Pcornel
Linux · SELinux

Enforcing

Cheat sheet · https://pcornel.dk/topic.php?topic=2855

Back to the Topic

Answer

Enforcing mode applies the SELinux policy: denied operations are blocked and logged as AVC denials. It is the default and intended mode on RHEL.

Remember

Check both the running mode (getenforce) and the configured boot mode (/etc/selinux/config). Per-domain permissive (semanage permissive -a <domain>) is a narrower alternative to global permissive.

First checks

  • getenforce / sestatus — mode and policy
  • ls -Z <path> — file context
  • ps -eZ | grep <proc> — process context
  • ausearch -m AVC -ts recent — recent denials
  • semanage fcontext -l | grep <path> — context rules for a path

Verify in this order

policy loaded → enforcing → every access checked → denials blocked and logged

Where it usually breaks

First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2855

Confirmation

Confirm action

Continue?