Verify User Who Owns /etc/selinux Directory
An XCCDF Rule
Description
To properly set the owner of /etc/selinux
, run the command:
$ sudo chown root /etc/selinux
Rationale
The ownership of the /etc/selinux directory by the root user is important because this directory hosts SELinux configuration. Protection of this directory is critical for system security. Assigning the ownership to root ensures exclusive control of the SELinux configuration.
- ID
- xccdf_org.ssgproject.content_rule_directory_owner_etc_selinux
- Severity
- Medium
- References
- Updated
Remediation - Ansible
- name: Ensure owner on directory /etc/selinux/
file:
path: /etc/selinux/
state: directory
owner: '0'
when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
find -H /etc/selinux/ -maxdepth 1 -L -type d -exec chown -L 0 {} \;
else