Linux distributions
TMA-ALMA9-5.2.4
Ensure sudo commands use pty
Beschreibung
sudo can be configured to run only from a pseudo terminal (pseudo-pty).
So wird geprüft
Prüfmethode: Shell-Befehl
alt0() { command -v grep >/dev/null 2>&1 || { echo "step1: grep not installed"; return 1; }; o=$(bash -c 'grep -rPi -- '"'"'^\h*Defaults\h+([^#\n\r]+,\h*)?use_pty\b'"'"' /etc/sudoers /etc/sudoers.d/' 2>&1); printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- '/etc/sudoers:Defaults use_pty' || { echo step1: missing '/etc/sudoers:Defaults use_pty'; return 1; }; command -v grep >/dev/null 2>&1 || { echo "step2: grep not installed"; return 1; }; o=$(bash -c 'grep -rPi -- '"'"'^\h*Defaults\h+([^#\n\r]+,\h*)?!use_pty\b'"'"' /etc/sudoers /etc/sudoers.d/' 2>/dev/null); [ -z "$o" ] || { echo "step2: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi- Erwartete Ausgabe
compliant
So wird behoben
Behebungsmethode: Anleitung oder Infrastruktur-Patch
Edit the file /etc/sudoers with visudo or a file in /etc/sudoers.d/ with visudo -f <PATH TO FILE> and add the following line: Defaults use_pty Edit the file /etc/sudoers with visudo and any files in /etc/sudoers.d/ with visudo -f <PATH TO FILE> and remove any occurrence of !use_pty Because sudo applies the last matching Defaults definition, place this setting so that no later-parsed file in /etc/sudoers.d overrides it; see this section's overview for how the sudoers files combine. Note: • sudo will read each file in /etc/sudoers.d, skipping file names that end in ~ or contain a . character to avoid causing problems with package manager or editor temporary/backup files. • Files are parsed in …
Eigenschaften
- Betriebssysteme
- almalinux-9
- Tags
- cis-convertedlinux
- Referenz
- CIS AlmaLinux OS 9 Benchmark v3.0.0 - 5.2.4
Diesen Host prüfen
Führen Sie dies auf einem Rechner aus, den Sie prüfen dürfen. Der Scan ist schreibgeschützt.
tmaegis scan --target linux