Replacing existing policies
When adding custom SELinux policies, all that users can do is to add more allow
rules. SELinux does not have a deny rule that can be used to remove currently allowed access rules from the active policy.
If the current policy is too permissive to the administrator's liking, then the administrator will need to update the policy rather than just enhance it. And that implies that the administrator has access to the current SELinux policy rules used.
Replacing existing policies depends on the SELinux user space utilities (the more recent one supports priority-based loading) and the source of the current policy. Let's look at two approaches: one for RHEL and another for Gentoo Linux.
Replacing RHEL policies
To replace an active Red Hat policy, we need to download the source RPM of the SELinux policy package and use the rpmbuild
application to extract the files. Once extracted, we update the policy files, rebuild them, and then install them on the system.
First, find out...