Pcornel
Linux · Security

AppArmor

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

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

  • sestatus / aa-status — SELinux or AppArmor state
  • ss -tulpn — listening services
  • journalctl -u sshd -g 'Failed' — failed logins
  • ausearch -m avc,user_login -ts today — audit events (auditd)

Commands

ss -tlnp
journalctl -k -g 'apparmor="DENIED"'

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=2850

Confirmation

Confirm action

Continue?