TMAegisBeta
Aturan lainnya untuk linux

Linux distributions

TMA-ALMA9-5.2.4

Ensure sudo commands use pty

SedangLevel 1Otomatislinux

Deskripsi

sudo can be configured to run only from a pseudo terminal (pseudo-pty).

Cara pemeriksaan

Metode audit: Perintah shell

shell
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
Output yang diharapkan
compliant

Cara perbaikan

Metode perbaikan: Panduan atau patch infrastruktur

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 …

Properti

Sistem operasi
almalinux-9
Tag
cis-convertedlinux
Referensi
CIS AlmaLinux OS 9 Benchmark v3.0.0 - 5.2.4

Periksa host ini

Jalankan ini pada mesin yang diizinkan untuk Anda audit. Pemindaian bersifat hanya baca.

shell
tmaegis scan --target linux