TMAegisBêta
Plus de règles pour linux

Linux distributions

TMA-ALINUX2-5.1.8

Ensure at/cron is restricted to authorized users

MoyenneNiveau 1Automatiséelinux

Description

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.

Méthode de vérification

Méthode d'audit: Commande 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
Sortie attendue
compliant

Méthode de correction

Méthode de correction: Recommandation ou correctif d'infrastructure

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

Propriétés

Systèmes d'exploitation
alinux-2
Étiquettes
cis-convertedlinux
Référence
CIS Aliyun Linux 2 Benchmark v1.0.0 ARCHIVE - 5.1.8

Vérifier cet hôte

Exécutez cette commande sur une machine que vous êtes autorisé à auditer. L'analyse est en lecture seule.

shell
tmaegis scan --target linux