Use it when an AppArmor-confined program fails, or when confining a service on Ubuntu/Debian.
AppArmor
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.
1. aa-status — profile loaded and enforce?
2. journalctl -k | grep DENIED — operation, profile, name?
3. Add a rule in /etc/apparmor.d/local/<profile>.
4. apparmor_parser -r /etc/apparmor.d/<profile>.
5. Retest; no new denials.
program starts → profile attached → each access checked against the profile → allowed or DENIED logged
For AppArmor, continue with the first unproven Topic check: Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for AppArmor. If that boundary is healthy, advance to the adjacent check: Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
aa-statusPrimary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle
Healthy evidence: expected profiles are loaded, target processes are attached, enforcing behavior matches intended access and logs explain denies without breaking the workload
Step 2 Commands Verify boundary
aa-status
aa-complain /etc/apparmor.d/usr.sbin.nginx
journalctl -k | grep -i apparmor
Step 3 Verification and output interpretation Verify boundary
Verification path. Reproduce using the exact identity, service, path/object label and execution context. Separate authentication success from subsequent authorization. For SELinux/AppArmor, correlate denial records with current mode/profile/labels and confirm the access vector/path actually matches the failing operation. For hardening, verify both the intended denial and one required allowed workflow. Audit presence supports reconstruction but is not equivalent to evidence that policy blocked the action.
Verification chain. program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle
Step 4 Verification path Verify boundary
Exercise one safe negative or boundary case implied by UID/GID mismatch, stale group membership, ACL/mode conflict, missing capability, noexec/readonly mount, SELinux denial, AppArmor denial, expired/untrusted certificate or secret exposure.
Step 5 Failure modes and next checks Narrow the fault
Suspicious evidence: profile is missing/unloaded, process is unconfined, complain mode is mistaken for enforcement, path aliases/transitions bypass intent or broad abstractions allow excess access
Step 6 Common mistakes Narrow the fault
- Disabling the profile instead of fixing it.
Step 7 Where it fails Narrow the fault
Walk identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation and stop where observed state diverges.
Common failure classes are UID/GID mismatch, stale group membership, ACL/mode conflict, missing capability, noexec/readonly mount, SELinux denial, AppArmor denial, expired/untrusted certificate or secret exposure.
Also consider stale generated config, wrong environment, wrong namespace/chroot/container, package/provider mismatch, dependency ordering, immutable/read-only mounts, exhausted inode/block resources, capabilities, SELinux/AppArmor denial, systemd sandboxing, cgroup limits and boot-time state that differs from the interactive shell.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
AppArmor Profiles define path, capability, network, mount, signal and execution permissions for named applications using abstractions, local overrides and transition rules.
Subtopic Enforce ModeAppArmor Enforce Mode actively blocks operations denied by an attached profile while logging policy violations, so process attachment and the exact denial record must be correlated with workload behavior.
Subtopic Complain ModeAppArmor Complain Mode permits most operations while logging rule violations as policy-learning evidence, useful for controlled profile development but not equivalent to active confinement.
Subtopic AppArmor TroubleshootingAppArmor Troubleshooting determines whether a failure comes from profile attachment, mode, path resolution, abstraction/include, execution transition or a specific denied rule by correlating logs with the real operation.
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.
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
ReferenceWhy it matters1 section · depth on demand
How it works in operation
Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.
ReferenceHow it works2 sections · depth on demand
How it works
Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.
Quick reference
AppArmor is the mandatory access control system used by default on Ubuntu, Debian and SUSE. Instead of labelling files, it confines programs with path-based profiles that list which files, capabilities and network access each program may use. Programs without a profile run unconfined.
| Concept | Meaning |
|---|---|
| Profile | Rules for one executable, in /etc/apparmor.d/ |
| Enforce mode | Violations blocked and logged |
| Complain mode | Violations only logged — used to build profiles |
| Abstractions | Reusable rule sets (#include <abstractions/base>) |
| Local overrides | /etc/apparmor.d/local/ for site additions that survive upgrades |
aa-status
journalctl -k | grep -i apparmor # DENIED messages
aa-complain /etc/apparmor.d/usr.sbin.nginx
aa-enforce /etc/apparmor.d/usr.sbin.nginx
aa-logprof # suggest rules from logs
apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx
When a confined service suddenly cannot read a new directory or bind a socket, check for DENIED entries first. Add the minimal rule in the local/ include file, reload the profile and keep enforce mode rather than disabling AppArmor for the service.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
AppArmor is resolved when the target process/profile/mode are confirmed, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement.
Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.
In depth
AppArmor: profiles, modes and tools
AppArmor is the mandatory access control system used by default on Ubuntu, Debian and SUSE. The apparmor(7) manual page describes its design:
- Access rules are bound to programs, not users.
- Profiles are stored in
/etc/apparmor.d/, named after the program path with dots, for exampleusr.sbin.nscdfor/usr/sbin/nscd. They're loaded into the kernel withapparmor_parser. - In enforce mode, rules are enforced and violations are reported. In complain mode, violations are only logged.
- Denials appear in the audit log, or in syslog without auditd, as
apparmor="DENIED". - A profile applies when the program is executed, so a process already running unconfined stays unconfined.
AppArmor and SELinux compared
| AppArmor | SELinux | |
|---|---|---|
| Model | Path-based profiles per program | Type labels on all files and processes |
| Default on | Ubuntu, Debian, SUSE | RHEL family, Fedora |
| Labels stored in file systems | No | Yes (extended attributes) |
| Writing a new policy | Relatively simple (profile files) | More complex (policy modules) |
| Granularity | Per program | System-wide types and domains |
Tools
| Task | Command |
|---|---|
| Is it enabled? | aa-enabled |
| Loaded profiles and their modes | aa-status |
| Switch modes | aa-enforce <profile>, aa-complain <profile> |
| Load or reload a profile | apparmor_parser -r /etc/apparmor.d/<file> |
| Unload a profile | apparmor_parser -R /etc/apparmor.d/<file> |
| Disable one profile | ln -s /etc/apparmor.d/<file> /etc/apparmor.d/disable/ + apparmor_parser -R |
| Create a profile interactively | aa-genprof <program> |
| Update a profile from logs | aa-logprof |
host$ aa-enabled
Yes
host$ sudo aa-status --summary 2>/dev/null || sudo aa-status | head -4
apparmor module is loaded.
42 profiles are loaded.
38 profiles are in enforce mode.
4 profiles are in complain mode.
host$ ls /etc/apparmor.d/ | head -6
abstractions
disable
local
usr.sbin.named
usr.sbin.nginx
usr.sbin.tcpdump
host$ ps -eo pid,label,comm | grep -E "nginx|named" | head -3
1203 /usr/sbin/nginx (enforce) nginx
1240 /usr/sbin/named (enforce) named
host$ sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx
host$ sudo journalctl -k -g apparmor --since today | tail -2
Local additions
Packaged profiles usually include a file from /etc/apparmor.d/local/, so administrators can add rules without editing the packaged profile. Updates then keep the local changes. The label column in ps shows each process's profile and mode directly.
Documented example, not captured output.
How it works at runtime
AppArmor is part of AppArmor. AppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions.
Runtime state ownership and mechanics. Linux security composes authentication (PAM and service mechanisms), identity/credentials, DAC permissions/ACLs, capabilities, LSM policy such as SELinux/AppArmor, audit and service/network policy. These controls are cumulative: passing one layer does not bypass another. SELinux labels/types and AppArmor path/profile rules differ in policy model, while auditd records selected security-relevant events rather than making authorization decisions.
Topic-specific state model. AppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions.
Technical metadata. Linux distribution/kernel + boot/time + user/group/process/service identity + PAM/SSH/DAC/ACL + SELinux/AppArmor mode/context/profile + audit/log correlation + key/certificate/SAN/EKU/chain/trust store/SNI + original workload result.
Interpretation rule. - AppArmor enabled/loaded ≠ the target process is actually confined by the intended profile.
- A profile path rule ≠ protection if execution path, namespace or transition attaches a different/no profile.
Mechanics
Follow the path in order: identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation.
Important negative cases include UID/GID mismatch, stale group membership, ACL/mode conflict, missing capability, noexec/readonly mount, SELinux denial, AppArmor denial, expired/untrusted certificate or secret exposure.
Limits and how it fails
Primary failure point. AppArmor is resolved when the target process/profile/mode are confirmed, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement.
Model. chmod 777 cannot override LSM or read-only mount policy. Disabling SELinux/AppArmor to make an error disappear only localizes a policy boundary and can hide the real label/profile defect. PAM success does not show sudo, filesystem or application authorization. Fail2ban acts on observed authentication patterns and network banning; it does not fix authentication policy. Security controls should remain explicit layers rather than a single “permission denied” bucket.
ReferenceConfiguration & state2 sections · depth on demand
Configuration, persistence and lifecycle
Configuration intent and lifecycle. Harden one control with a known access/recovery path and preserve the policy source of truth. PAM stack order/control flags matter; sudo/SSH hardening can lock out administration; SELinux policy should normally be fixed through correct labels/booleans/policy rather than permanent disablement; AppArmor profiles should move from complain to enforce only after reviewing legitimate workload behavior. Audit rules need bounded scope to avoid volume/resource problems.
Distribution/platform context. AppArmor root owns operational profile/mode diagnosis; Security → AppArmor is the architecture bridge.
Lifecycle
systemd generators and drop-ins, package scripts, udev, mount helpers, netlink, resolver caches, namespaces, SELinux/AppArmor policy and kernel drivers can make runtime state differ from the file or command that appears to own it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in AppArmor. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://gitlab.com/apparmor/apparmor/-/wikis/Documentation · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
AppArmor operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for AppArmor.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | AppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin host + boot/time + real identity/workload → identify authoritative policy/key/trust source → read back loaded/effective runtime state → reproduce one safe allow/deny/handshake test → correlate audit/service/kernel evidence → locate first failed boundary → make the smallest persistent change → repeat original workload + regression/recovery check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | AppArmor closes when the target process/profile/mode are proven, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux security/trust evidence can establish this proof path: program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove unobserved identities, objects, policies, namespaces, endpoints or time periods. AppArmor closes when the target process/profile/mode are proven, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven security/trust boundary, capture the adjacent effective state and audit/handshake evidence, make only the demonstrated persistent change, then repeat the original workload plus recovery/regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
AppArmor · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | AppArmor |
|---|---|
| Topic path | AppArmor |
| Runtime state | AppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions. |
| Fast checks | - Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for AppArmor. - Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. - Reproduce one safe allowed/denied or handshake/access test and correlate kernel/service/audit evidence at the first relevant boundary. - Apply the smallest persistent cause-specific change, then repeat the original test plus an adjacent regression/recovery check. |
| Verification chain | program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | AppArmor closes when the target process/profile/mode are proven, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |