Pcornel
Linux · AppArmor

Enforce Mode

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

Back to the Topic

Answer

In enforce mode an AppArmor profile blocks and logs any access its rules do not allow.

Remember

Profiles in complain mode give no protection. After tuning, set enforce (aa-enforce) and watch for denials.

First checks

  • aa-status — loaded profiles and modes
  • journalctl -k | grep -i apparmor — denials
  • aa-complain / aa-enforce <profile> — change a profile's mode
  • apparmor_parser -r <profile> — reload a profile

Commands

journalctl -k -g 'apparmor="ALLOWED"'
systemctl restart myapp
journalctl -k -g 'apparmor="DENIED"' -f

Verify in this order

profile in enforce → disallowed access 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=2863

Confirmation

Confirm action

Continue?