ansible-lockdown / RHEL9-CIS

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

Search for SUID extends to NFS mount directories #217

Open tedunder237 opened 1 month ago

tedunder237 commented 1 month ago

Describe the Issue Our systems automount home directories which are listed to be searched for SUID exec. First, this is probably not the intent of the code since in 6.1.12 task the --local flag is used in df, and second the find command is taking a long time to run. Also suspect the CIS guidelines is to only perform checks on local filesystems.

Expected Behavior Task should only include local filesystems

Actual Behavior Task is including all found filesystems include NFS mounts

Control(s) Affected 6.1.13, 6.1.14

Environment (please complete the following information):

Possible Solution Add the local flag to df to prevent including external filesystems tasks/section_6/cis_6.1.x.yml

For 6.1.13, line 261, add flag: ansible.builtin.shell: df {{ item.mount }} --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -4000 For 6.1.14, line line 304, add flag: ansible.builtin.shell: df {{ item.mount }} --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -2000

Tested on Rocky 9