Pcornel
Linux

AppArmor

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

Back to the Topic

Answer

AppArmor is mandatory access control on Ubuntu, Debian and SUSE: path-based profiles in /etc/apparmor.d restrict what each confined program may read, write, execute and access on the network.

Remember

Denials are logged as apparmor="DENIED" in the kernel log. Add local rules in /etc/apparmor.d/local/<profile> and reload — do not edit the shipped profile. Use complain mode only to learn rules.

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

aa-status
Summarize AppArmor kernel support, loaded profiles and enforce/complain state.

Verify in this order

program starts → profile attached → each access checked against the profile → allowed or DENIED 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=2861

Confirmation

Confirm action

Continue?