Applying SELinux policies

We've learned how to create SELinux policies in the previous recipe. This recipe will show you how to apply your newly created SELinux policies.

Getting ready

In order to apply a policy, we need a policy package file (pp). This can be obtained by parsing AVC denials to audit2allow or compiling your own policy package file, as explained in the Create SELinux policies recipe.

How to do it...

Follow these steps:

  1. Activate the policy (this can take quite a while, depending on the number of policies applied to your system) by running the following command:
    ~# semodule -i example_policy.pp
    ~#
    
  2. Next, verify that the policy is actually activated via these commands:
    ~# semodule -l |grep example_policy
    example_policy  1.0
    ~#
    

How it works… ...

Get Red Hat Enterprise Linux Server Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.