Linux distributions
TMA-ALINUX2-5.1.8
Ensure at/cron is restricted to authorized users
Deskripsi
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.
Cara pemeriksaan
Metode audit: Perintah 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- Output yang diharapkan
compliant
Cara perbaikan
Metode perbaikan: Panduan atau patch infrastruktur
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
Properti
- Sistem operasi
- alinux-2
- Tag
- cis-convertedlinux
- Referensi
- CIS Aliyun Linux 2 Benchmark v1.0.0 ARCHIVE - 5.1.8
Periksa host ini
Jalankan ini pada mesin yang diizinkan untuk Anda audit. Pemindaian bersifat hanya baca.
tmaegis scan --target linux