Use it when a confined program is denied access, or to confine a service.
AppArmor · Security
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 Security → 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.
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
executed path → profile attachment/transition → DAC/capability checks → AppArmor rule decision → allow/log/deny → workload result
Healthy evidence: the intended profile is loaded, attached and enforcing where required, and allowed/denied workload behavior matches policy
Step 2 Verification and output interpretation Verify boundary
For SELinux/AppArmor, correlate denial records with current mode/profile/labels and confirm the access vector/path actually matches the failing operation.
Verification chain. executed path → profile attachment/transition → DAC/capability checks → AppArmor rule decision → allow/log/deny → workload result
Step 3 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 4 Failure modes and next checks Narrow the fault
Suspicious evidence: profile is absent/unattached, complain mode is mistaken for enforcement, path changes bypass rules, abstractions are overly broad or disabling AppArmor merely hides another defect
Step 5 Common mistakes Narrow the fault
- Unconfined services on Ubuntu.
Step 6 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.
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.
sestatus / aa-status— SELinux or AppArmor statess -tulpn— listening servicesjournalctl -u sshd -g 'Failed'— failed loginsausearch -m avc,user_login -ts today— audit events (auditd)
ReferenceWhat it is1 section · depth on demand
Overview
AppArmor confines programs with path-based profiles (/etc/apparmor.d/), default on Ubuntu, Debian and SUSE.
aa-status
aa-enforce /etc/apparmor.d/usr.sbin.nginx
aa-complain /etc/apparmor.d/usr.sbin.nginx
aa-logprof # suggest rules from logged denials
journalctl -k | grep -i apparmor="DENIED"
apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx # reload
Unlike SELinux, AppArmor rules follow file paths, so moving data to a new directory (e.g. /srv/www) needs profile updates. Snap packages and containers (Docker's docker-default profile) also use AppArmor.
ReferenceWhy it matters1 section · depth on demand
Quality lift: concrete internals
Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
This subtopic shows AppArmor’s place in Linux security; use the dedicated AppArmor branch for profile lifecycle, modes and troubleshooting.
Security → AppArmor is the architecture bridge to the dedicated AppArmor operational root.
Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.
In depth
AppArmor in a security programme
AppArmor confines programs with per-program profiles that list the files, capabilities and network access each may use. The apparmor(7) manual page describes the model:
- Access control is bound to programs, not to users.
- Profiles in
/etc/apparmor.d/are loaded into the kernel withapparmor_parser. - In enforce mode, violations are blocked and reported. Complain mode only logs them.
- Denials appear in the audit log as
apparmor="DENIED". - Profiles apply at exec time, so a process that's already running unconfined can't be confined afterwards.
Coverage review
| Check | Command |
|---|---|
| Is AppArmor enabled? | aa-enabled, cat /sys/module/apparmor/parameters/enabled |
| Loaded profiles and their modes | aa-status |
| Processes with a profile defined but running unconfined | aa-status ("processes are unconfined but have a profile defined") |
| Profiles in complain mode | aa-status | sed -n '/complain mode/,/^[0-9]/p' |
| Network-facing services without a profile | ss -tlnp, compared with ps -eZ / aa-status |
| Recent denials | journalctl -k -g 'apparmor="DENIED"' |
What to look for
| Finding | Meaning |
|---|---|
| A service shown as unconfined although a profile exists | It was started before the profile was loaded; restart the service |
| Profiles left in complain mode | Learning was never finished; no protection |
| Internet-facing services with no profile at all | No MAC containment |
Very broad rules (/** rwk,) | The profile protects little |
Ubuntu specifics
Ubuntu ships profiles for many packaged services, and snaps are always confined by AppArmor. Third-party software installed from tarballs or vendor packages is normally unconfined, unless you write a profile for it.
host$ sudo aa-status | head -12
apparmor module is loaded.
42 profiles are loaded.
38 profiles are in enforce mode.
/usr/sbin/nginx
/usr/sbin/named
4 profiles are in complain mode.
/usr/sbin/mysqld
1 processes are unconfined but have a profile defined.
/usr/sbin/named (1204)
host$ sudo systemctl restart named
host$ sudo journalctl -k -g 'apparmor="DENIED"' --since today | tail -2
apparmor="DENIED" operation="open" profile="/usr/sbin/nginx" name="/srv/www/intranet/index.html" requested_mask="r" denied_mask="r"
host$ sudo aa-enforce /usr/sbin/mysqld
Reading the status
named is running unconfined even though a profile exists, because it was started before the profile was loaded. A restart applies the profile. mysqld's profile is in complain mode, so it only logs. Once the logs show no unexpected denials, aa-enforce turns protection on.
Documented example, not captured output.
How it works at runtime
AppArmor is part of Security → AppArmor. Security → AppArmor explains AppArmor as a path-oriented Linux Security Module and how attached profiles, execution transitions and enforcement mode participate in a layered access decision.
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. 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. Security → AppArmor explains AppArmor as a path-oriented Linux Security Module and how attached profiles, execution transitions and enforcement mode participate in a layered access decision.
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 loaded ≠ the target process is attached to an enforcing profile.
- Complain mode logs policy violations but normally does not block them.
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. This subtopic shows AppArmor’s place in Linux security; use the dedicated AppArmor branch for profile lifecycle, modes and troubleshooting.
Disabling SELinux/AppArmor to make an error disappear only localizes a policy boundary and can hide the real label/profile defect.
ReferenceConfiguration & state2 sections · depth on demand
Configuration, persistence and lifecycle
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.
Distribution/platform context. Security → AppArmor is the architecture bridge to the dedicated AppArmor operational root.
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 Security → AppArmor. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/security/index.html · 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 | Security → AppArmor explains AppArmor as a path-oriented Linux Security Module and how attached profiles, execution transitions and enforcement mode participate in a layered access decision. | 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 | executed path → profile attachment/transition → DAC/capability checks → AppArmor rule decision → allow/log/deny → workload result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | This subtopic proves AppArmor’s place in Linux security; use the dedicated AppArmor branch for profile lifecycle, modes and troubleshooting. | 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: executed path → profile attachment/transition → DAC/capability checks → AppArmor rule decision → allow/log/deny → workload result | 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. This subtopic proves AppArmor’s place in Linux security; use the dedicated AppArmor branch for profile lifecycle, modes and troubleshooting. | 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 | Security → AppArmor |
| Runtime state | Security → AppArmor explains AppArmor as a path-oriented Linux Security Module and how attached profiles, execution transitions and enforcement mode participate in a layered access decision. |
| 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 | executed path → profile attachment/transition → DAC/capability checks → AppArmor rule decision → allow/log/deny → workload result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | This subtopic proves AppArmor’s place in Linux security; use the dedicated AppArmor branch for profile lifecycle, modes and troubleshooting. 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. |
Deep reference
Healthy vs suspicious evidence
Commands
aa-status