SELinux Permissive and Enforcing Modes
SELinux has three major modes of operation:
- Enforcing - SELinux is enforcing the loaded policy.
- Permissive - SELinux has loaded the policy, however it is not enforcing the policy rules. This is generally used for testing as the audit log will contain the AVC denied messages as defined in the Auditing SELinux Events section. The SELinux utilities such as audit2allow(1) and audit2why(8) can then be used to determine the cause and possible resolution by generating the appropriate allow rules.
- Disabled - The SELinux infrastructure is not enabled, therefore no policy can be loaded.
These flags are set in the /etc/selinux/config file as described in the Global Configuration Files section.
There is another method for running specific domains in permissive mode using the permissive statement. This can be used directly in a user written module or semanage(8) will generate the appropriate module and load it using the following example command:
# This example will add a new module in # /etc/selinux/<SELINUXTYPE>/modules/active/modules/permissive_unconfined_t.pp # and then reload the policy: semanage permissive -a unconfined_t
It is also possible to set permissive mode on a userspace object manager using the libselinux function avc_open(3), for example the X-Windows object manager uses avc_open to set whether it will always run permissive, enforcing or follow the current SELinux enforcement mode.
The sestatus(8) command will show the current SELinux enforcement mode in its output, however it does not display individual domain or object manager enforcement modes.