brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: aa-status shows which processes AppArmor confines

Linux
~/tips/tip-security-aa-status-apparmor

sudo aa-status

Lists the loaded AppArmor profiles, their modes and how many running processes are confined.

AppArmor sits quietly in the background on many Linux systems, and one command shows what it is doing.

aa-status reports the loaded AppArmor policy: how many profiles are loaded, which modes they are in and how many processes they confine. It must run as root, because it reads the policy state from the AppArmor module.

sudo aa-status

Without privileges you get exit status 4. In enforcement mode a profile applies its policy and reports violations to syslog. In complain mode it enforces nothing and only reports. A profile in complain mode therefore protects nothing yet, which is worth remembering when an app can still read a file it should not.

For scripts there are single-purpose options, and the man page says to use one per run:

sudo aa-status --enforced
sudo aa-status --complaining
sudo aa-status --enabled
sudo aa-status --pretty-json

--enforced and --complaining print the number of profiles in that mode. --enabled returns an error code when AppArmor is not enabled, so it fits in an if. --json and --pretty-json give the full data, the second one formatted for people.

If your distribution uses SELinux, this command does nothing for you. A long list of profiles also says little by itself. What I check is whether the service I care about, a web server or a database for example, is on the list and enforcing.

Further reading: aa-status(8), apparmor(7)

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link