2.4.1.8 Ensure cron is restricted to authorized users
Audit#
- IF - cron is installed on the system: Run the following command to verify /etc/cron.allow: - Exists - Is mode 0640 or more restrictive - Is owned by the user root - Is group owned by the group root - OR - the group crontab
Verify the returned value is:Access: (640/-rw-r-----) Owner: (root) Group: (root)
- OR -
Access: (640/-rw-r-----) Owner: (root) Group: (crontab)
Run the following command to verify either cron.deny doesn't exist or is: - Mode 0640 or more restrictive - Owned by the user root - Is group owned by the group root - OR - the group crontab
Verify either nothing is returned - OR - returned value is one of the following:
Access: (640/-rw-r-----) Owner: (root) Group: (root)
- OR -
Access: (640/-rw-r-----) Owner: (root) Group: (crontab)
Note: On systems where cron is configured to use the group crontab, if the group crontab is not set as the owner of cron.allow, then cron will deny access to all users and you will see an error similar to:
Remediation#
- IF - cron is installed on the system: - Run the following script to: - Create /etc/cron.allow if it doesn't exist - Change owner to user root - Change group owner to group root - OR - group crontab if it exists - Change mode to 640 or more restrictive
- IF - /etc/cron.deny exists, run the following script to: - Change owner to user root - Change group owner to group root - OR - group crontab if it exists - Change mode to 640 or more restrictive Run the following command to create /etc/cron.allow
Note: On systems where cron is configured to use the group crontab, if the group crontab is not set as the owner of cron.allow, then cron will deny access to all users and you will see an error similar to: