Skip to content

SELinux

https://selinuxproject.org/

  • Mandatory Access Control system and policies for Linux operating systems, originally developed by the NSA and Red Hat and released in 2000.
  • For every current user or process, SELinux assigns a three string context consisting of a username, role, and domain (or “type”).

  • The command runcon allows for the launching of a process into an explicitly specified context (user, role, and domain), but SELinux may deny the transition if it is not approved by the policy.

  • After running in permissive mode for a while, the audit2allow tool can be used to produce additional rules that extend the policy to allow all legitimate activities of the application being confined.

  • The default policy on RHEL is “targeted”, meaning it only confines certain applications (e.g. daemons) and leaves others (e.g. the shell) running unrestricted.

Show the security context of processes or files

Section titled “Show the security context of processes or files”
Terminal window
ls -Z
ps -Z

Set to permissive mode to allow (but log) policy violations

Section titled “Set to permissive mode to allow (but log) policy violations”

Edit /etc/selinux/config:

SELINUX=permissive
Terminal window
sudo reboot
Terminal window
sestatus