Enhancing SELinux policies
Not all situations can be perfectly defined by policy writers. At times, we will need to make modifications to the SELinux policy. As long as the changes involve adding rules, we can create additional SELinux modules to enhance the policy. If the change is more intrusive, we might need to remove an existing SELinux module and replace it with an updated one.
Let's start with SELinux policy modules.
Handling SELinux policy modules
SELinux policy modules are, as mentioned at the beginning of this book, sets of SELinux rules that can be loaded and unloaded. They are packaged as files with the .pp
suffix and can be loaded and unloaded using the semodule
command as follows:
# cd /usr/share/selinux/mcs # semodule -i screen.pp
To list the current set of installed (loaded) modules, use semodule -l
:
# semodule -l aide 1.6.1 apache 2.7.0 Disabled application 1.2.0 authlogin 2.4.2 …
The output shows each SELinux module with its version (as provided by the policy...