# Ensure sudo is installed

Necessity: The 'sudo' utility is a fundamental component for enforcing the principle of least privilege on Linux systems. It allows administrators to grant specific users or groups the ability to run some or all commands as root or another user, providing a granular and auditable method for privilege escalation. Without sudo, users may be forced to use the root account for administrative tasks, which dramatically increases the risk of accidental damage and makes it difficult to trace actions back to an individual. Auditing and Remediation: The audit script verifies that the sudo package is present on the system, which is the prerequisite for its use. The remediation script installs the sudo package using the native package manager, making the utility available for configuration. Recommended State Rationale: Basic: ['Installed'] - The presence of sudo is a baseline requirement for modern, secure system administration. Moderate: ['Installed'] - As with the basic level, sudo is considered essential. Security hardening at the moderate level would focus on the proper configuration of the '/etc/sudoers' file, not on the presence of the package itself. Strict: ['Installed'] - For a strictly hardened system, sudo is non-negotiable. Its absence would represent a major failure in security posture. All levels require sudo to be installed; the differentiation in security levels applies to its configuration, not its existence.

## Recommended State Configuration

| Security Level | Value |
|----------------|-------|
| **Basic** | `['Installed']` |
| **Moderate** | `['Installed']` |
| **Strict** | `['Installed']` |
| **Type** | `ENUM` |

## Audit Script Working

Bash script that uses the 'rpm -q sudo' command to check if the sudo package is installed. If the command succeeds (exit code 0), the script must output the string 'Installed'. If the command fails, it must output 'Not Installed'. The script must not output any other text or labels.

## Remediation Script Working

Bash script that accepts one positional argument representing the desired state ('Installed'). If the argument is 'Installed', the script must use the 'yum install -y sudo' command to install the package. The script must return 'true' if the installation is successful or if the package is already installed, and 'false' if the installation fails or if the input argument is not 'Installed'.

