TMAegisБета
Другие правила для linux

Linux distributions

TMA-ALMA9-5.2.4

Ensure sudo commands use pty

СреднийУровень 1Автоматическаяlinux

Описание

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

Как проверяется

Метод проверки: Команда оболочки

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
Ожидаемый вывод
compliant

Как исправляется

Метод исправления: Рекомендация или патч инфраструктуры

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 …

Свойства

Операционные системы
almalinux-9
Теги
cis-convertedlinux
Источник
CIS AlmaLinux OS 9 Benchmark v3.0.0 - 5.2.4

Проверить этот хост

Выполните команду на компьютере, аудит которого вам разрешён. Сканирование работает только на чтение.

shell
tmaegis scan --target linux