Linux distributions
TMA-RHEL10-5.2.2
Ensure sudo commands use pty
Mô tả
sudo can be configured to run only from a pseudo terminal (pseudo-pty).
Cách kiểm tra
Phương pháp kiểm tra: Lệnh 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*' 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- Đầu ra mong đợi
compliant
Cách khắc phục
Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng
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…
Thuộc tính
- Hệ điều hành
- rhel-10
- Thẻ
- cis-convertedlinux
- Tham chiếu
- CIS Red Hat Enterprise Linux 10 Benchmark v1.0.1 - 5.2.2
Kiểm tra máy này
Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.
tmaegis scan --target linux