TMAegisBeta
Thêm quy tắc cho linux

Linux distributions

TMA-ALINUX2-5.1.8

Ensure at/cron is restricted to authorized users

Trung bìnhCấp 1Tự độnglinux

Mô tả

Configure /etc/cron.allow and /etc/at.allow to allow specific users to use these services. If /etc/cron.allow or /etc/at.allow do not exist, then /etc/at.deny and /etc/cron.deny are checked. Any user not specifically defined in those files is allowed to use at and cron. By removing the files, only users in /etc/cron.allow and /etc/at.allow are allowed to use at and cron. Note that even though a given user is not listed in cron.allow , cron jobs can still be run as that user. The cron.allow file only controls administrative access to the crontab command for scheduling and modifying cron jobs.

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

shell
alt0() { command -v stat >/dev/null 2>&1 || { echo "step1: stat not installed"; return 1; }; o=$(bash -c 'stat /etc/cron.deny' 2>&1); printf '%s\n' "$o" | tr -s ' \t' '  ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'stat: cannot stat `/etc/cron.deny'"'"': No such file or directory' || { echo step1: missing 'stat: cannot stat `/etc/cron.deny'"'"': No such file or director'; return 1; }; command -v stat >/dev/null 2>&1 || { echo "step2: stat not installed"; return 1; }; o=$(bash -c 'stat /etc/at.deny' 2>&1); printf '%s\n' "$o" | tr -s ' \t' '  ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'stat: cannot stat` /etc/at.deny'"'"': No such file or directory' || { echo step2: missing 'stat: cannot stat` /etc/at.deny'"'"': No such file or directory'; return 1; }; command -v stat >/dev/null 2>&1 || { echo "step3: stat not installed"; return 1; }; o=$(bash -c 'stat /etc/cron.allow' 2>&1); printf '%s\n' "$o" | tr -s ' \t' '  ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)' || { echo step3: missing 'Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)'; return 1; }; command -v stat >/dev/null 2>&1 || { echo "step4: stat not installed"; return 1; }; o=$(bash -c 'stat /etc/at.allow' 2>&1); printf '%s\n' "$o" | tr -s ' \t' '  ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)' || { echo step4: missing 'Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)'; 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

Run the following commands to remove /etc/cron.deny and /etc/at.deny and create and set permissions and ownership for /etc/cron.allow and /etc/at.allow : # rm /etc/cron.deny # rm /etc/at.deny # touch /etc/cron.allow # touch /etc/at.allow # chmod 600 /etc/cron.allow # chmod 600 /etc/at.allow # chown root:root /etc/cron.allow # chown root:root /etc/at.allow

Thuộc tính

Hệ điều hành
alinux-2
Thẻ
cis-convertedlinux
Tham chiếu
CIS Aliyun Linux 2 Benchmark v1.0.0 ARCHIVE - 5.1.8

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.

shell
tmaegis scan --target linux