Enforce Mode
Cheat sheet · https://pcornel.dk/topic.php?topic=2863
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 modesjournalctl -k | grep -i apparmor— denialsaa-complain / aa-enforce <profile>— change a profile's modeapparmor_parser -r <profile>— reload a profile
Commands
journalctl -k -g 'apparmor="ALLOWED"'systemctl restart myappjournalctl -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