Verify Permissions On /etc/sudoers.d Directory
An XCCDF Rule
Description
To properly set the permissions of /etc/sudoers.d
, run the command:
$ sudo chmod 0750 /etc/sudoers.d
Rationale
Setting correct permissions on the /etc/sudoers.d directory is important because this directory hosts sudo configuration. Protection of this directory is critical for system security. Restricting the permissions ensures exclusive control of the sudo configuration.
- ID
- xccdf_org.ssgproject.content_rule_directory_permissions_etc_sudoersd
- Severity
- Medium
- References
- Updated
Remediation - Ansible
- name: Find /etc/sudoers.d/ file(s)
command: 'find -H /etc/sudoers.d/ -maxdepth 1 -perm /u+s,g+ws,o+xwrt -type d '
register: files_found
changed_when: false
failed_when: false
check_mode: false
Remediation - Shell Script
find -H /etc/sudoers.d/ -maxdepth 1 -perm /u+s,g+ws,o+xwrt -type d -exec chmod u-s,g-ws,o-xwrt {} \;