# Ensure sudo is installed

The 'sudo' (superuser do) command is a critical security component that allows authorized users to execute commands with the security privileges of another user, typically the root user. Its necessity stems from the principle of least privilege; it eliminates the need for administrators to share the root password or log in directly as the root user, which significantly reduces the risk of accidental system damage and creates a clear audit trail of all privileged operations. Not having sudo installed forces reliance on direct root access, a major security anti-pattern that expands the system's attack surface. The audit script verifies the installation status of the 'sudo' package using the system's package manager (dpkg). The remediation script uses 'apt-get' to install the package if it is determined to be missing. All recommended states (Basic, Moderate, and Strict) mandate that 'sudo' be 'Installed'. This is because sudo is a foundational utility for secure system administration on Ubuntu. There is no acceptable configuration for a managed system where sudo is absent. A Basic configuration requires it for fundamental manageability, while a Strict configuration considers its presence absolutely non-negotiable, often in conjunction with policies that disable direct root login entirely.

## Recommended State Configuration

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

## Audit Script Working

Bash script that checks if the 'sudo' package is installed using `dpkg`. If it is installed, the script must return the string 'Installed'. If it is not installed, it must return 'Not Installed'. The output should contain only one of these two strings, with no additional text or formatting.

## Remediation Script Working

Bash script that accepts a single positional argument. If the argument is the string 'Installed', the script must run 'apt-get update' and then 'apt-get install -y sudo' to install the sudo package. The script must return 'true' if the installation is successful and 'false' if it fails or if the input argument is not 'Installed'.

