Linux distributions
TMA-RHEL10-5.2.2
Ensure sudo commands use pty
説明
sudo can be configured to run only from a pseudo terminal (pseudo-pty).
チェック方法
監査方法: シェルコマンド
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*' 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*' 2>/dev/null); [ -z "$o" ] || { echo "step2: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi- 期待される出力
compliant
修正方法
修正方法: ガイダンスまたは IaC パッチ
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 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 sorted lexical order. That is, /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second. • Be aware that because the sorting is lexical, not numeric, /etc/sudoers.d/1_whoops would be loaded…
プロパティ
- オペレーティングシステム
- rhel-10
- タグ
- cis-convertedlinux
- 参照
- CIS Red Hat Enterprise Linux 10 Benchmark v1.0.1 - 5.2.2
このホストをチェック
監査が許可されているマシンで実行してください。スキャンは読み取り専用です。
tmaegis scan --target linux