![Lead Image © Agustin Paz, 123RF.com Lead Image © Agustin Paz, 123RF.com](/var/ezflow_site/storage/images/archive/2013/16/setting-up-selinux-policies/aa_adminstory-04_123rf-11846598_katze-und-hund-spielen-zusammen_agustin-paz_resized.png/97869-1-eng-US/AA_AdminStory-04_123rf-11846598_katze-und-hund-spielen-zusammen_Agustin-Paz_resized.png_medium.png)
Lead Image © Agustin Paz, 123RF.com
Setting up SELinux policies
Save the Kittens
Following a public appeal [1], you should not resolve problems with SELinux by simply disabling the security mechanism. A better approach is to analyze the problem and write an appropriate ruleset. This approach is also recommended if you want to place your own program under the SELinux shield. Again, some analysis of the application is necessary before you set about developing an appropriate policy.
For the first of these cases, it makes sense to run ausearch
and audit2allow
to analyze the SELinux-related problems that occur in an application and then to bundle the necessary rulesets into your own policy module. Depending on the nature of the problem, the existing policy for the application might contain a bug. In this case, you should file a bug report with the appropriate policy distributor. In the short term, of course, you can fix the problem using your own policy module, but that would be like advocating reinvention of the wheel.
My Policies
The second case, in which no policy yet exists for the application, requires some extra work. To begin, you need to design a suitable framework for the new policy. You can do this manually or with the aid of a tool, such as sepolgen
. In an iterative process, the policy then needs to be optimized. The topic of policy development is well beyond the scope of this article, however, especially considering that plenty of literature exists on the subject [2]. Instead, I will be looking at the options for distributing a new policy.
In both of the cases I've mentioned, the development process results in a new policy package. The package uses a binary format and must be loaded into the kernel security server on the target systems using semodule
. A global policy file is composed from all the