Information
Monitor SELinux, an implementation of mandatory access controls. The parameters below monitor any write access (potential additional, deletion or modification of files in the directory) or attribute changes to the /etc/selinux/ and /usr/share/selinux/ directories.
Note: If a different Mandatory Access Control method is used, changes to the corresponding directories should be audited.
Changes to files in the /etc/selinux/ and /usr/share/selinux/ directories could indicate that an unauthorized user is attempting to modify access controls and change security contexts, leading to a compromise of the system.
Solution
Note:
- The -w option is deprecated and the rule should be updated in accordance with the Remediation Procedure.
- For best performance, the arch field should be supplied in the rule. The individual permissions will cause the selection of specific system calls that use that kind of access. Not supplying the arch will cause the selection of all system calls which will affect performance as all system calls will be evaluated.
- Edit or create a file in the /etc/audit/rules.d/ directory, ending inrules extension, with the relevant rules to monitor events that modify the system's Mandatory Access Controls.
Example:
# printf "
-a always,exit -F arch=b64 -S all -F path=/etc/selinux -F perm=wa -F key=MAC-policy
-a always,exit -F arch=b64 -S all -F path=/usr/share/selinux -F perm=wa -F key=MAC-policy
" >> /etc/audit/rules.d/50-MAC-policy.rules <xhtml:ol start="2"> - Merge and load the rules into active configuration:
# augenrules --load <xhtml:ol start="3"> - Check if reboot is required:
# if [[ $(auditctl -s | grep "enabled") =~ "2" ]]; then printf "Reboot required to load rules\n"; fi