5.1.8 Ensure cron is restricted to authorized users

Information

If cron is installed in the system, configure /etc/cron.allow to allow specific users to use these services. If /etc/cron.allow does not exist, then /etc/cron.deny is checked. Any user not specifically defined in those files is allowed to use cron. By removing the file, only users in /etc/cron.allow are allowed to use cron.

Note: 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.

On many systems, only the system administrator is authorized to schedule cron jobs. Using the cron.allow file to control who can run cron jobs enforces this policy. It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user ID to the system and forget to add it to the deny files.

Solution

Run the following script to remove /etc/cron.deny create /etc/cron.allow, and set the file mode on /etc/cron.allow`:

#!/usr/bin/env bash

cron_fix()
{
if rpm -q cronie >/dev/null; then
[ -e /etc/cron.deny ] && rm -f /etc/cron.deny
[ ! -e /etc/cron.allow ] && touch /etc/cron.allow
chown root:root /etc/cron.allow
chmod u-x,go-rwx /etc/cron.allow
else
echo "cron is not installed on the system"
fi
}
cron_fix

OR Run the following command to remove cron :

# dnf remove cronie

See Also

https://workbench.cisecurity.org/files/3796

Item Details

Category: ACCESS CONTROL, MEDIA PROTECTION

References: 800-53|AC-3, 800-53|AC-5, 800-53|AC-6, 800-53|MP-2, CSCv7|14.6

Plugin: Unix

Control ID: d7a839c08a24ec520788e31679a7a146be7a336fcb73d44a17eaa119a532a9fc