ansible-lockdown / RHEL9-CIS

Ansible role for Red Hat 9 CIS Baseline
https://ansible-lockdown.readthedocs.io
MIT License
124 stars 94 forks source link

5.1.8 and 5.1.9 permissions error #218

Closed Wykx-Sama closed 2 months ago

Wykx-Sama commented 4 months ago

Describe the Issue Hi, i noticed that the step 5.1.8 and 5.1.9 set the permissions to 600 but the CIS recommendations is to set it to 640. That is making the rule to be failed in the CIS Benchmark. Expected Behavior The expected behavior should be to set permissions to 640 insted of 600. Actual Behavior At the moment rules go to failed because of the permissions not being 640.

Possible Solution

I tested to set the permissions to 640 and it's not failed anymore

uk-bolly commented 4 months ago

hi @Wykx-Sama

Thank you for taking the time in raising the issue and the associated PR. Going through the associated CIS documentation for these controls it provides a remediation script. Admittedly we all get things wrong occasionally, but we have been seeing an increase in issues with scanners not following documented control baselines. Out of interest which scanner are you using?

The component for both cron.allow 5.1.8 and at.allow 5.1.9 have the line (excert - larger output below)

chmod u-x,go-rwx /etc/cron.allow

which give the value 600

So it appears the scanner is not as expected.

I hope that this makes sense.

many thanks

uk-bolly

Remediation Procedure
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

{
   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
}
uk-bolly commented 2 months ago

hi @Wykx-Sama

This issue has been open for a while with no feedback. I will therefore close this. Please reopen if you feel this is still an issue with the role.

many thanks

uk-bolly