Use it to develop a profile or confirm AppArmor causes a failure.
Complain Mode
In complain mode an AppArmor profile logs accesses its rules would deny, but allows them. It is used to learn and tune profiles.
1. aa-complain /etc/apparmor.d/<profile>.
2. Exercise the program.
3. aa-logprof — review proposed rules.
4. aa-enforce the profile.
5. Confirm no denials.
complain → accesses allowed and logged → rules learned → enforce
For AppArmor → Complain Mode, 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 Complain Mode. 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.
journalctl -k | grep 'apparmor="ALLOWED"'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
complain profile attachment → rule evaluation → violation log → operation allowed → profile refinement → enforce retest
Healthy evidence: test workload produces understandable complain events, required rules are refined narrowly and the final enforcing profile passes acceptance tests
Step 2 Verification and output interpretation Verify boundary
Verification chain. complain profile attachment → rule evaluation → violation log → operation allowed → profile refinement → enforce retest
Step 3 Commands Verify boundary
aa-complain /etc/apparmor.d/usr.sbin.nginx
journalctl -k | grep 'apparmor="ALLOWED"'
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: complain remains enabled indefinitely, noisy logs are bulk-accepted, generated rules overpermit, target process is actually unconfined or enforcement later breaks untested paths
Step 5 Common mistakes Narrow the fault
- Leaving profiles in complain mode permanently.
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.
Run the program through its normal tasks, then aa-logprof to turn logged events into rules. Return to enforce afterwards.
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
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Complain-mode work is complete only when logs are reviewed, the profile is narrowed deliberately, enforce mode is restored and original workload plus deny tests pass.
In depth
Complain mode: learning a profile
In complain mode, AppArmor loads the profile but only logs violations, without blocking them. The apparmor.d(5) manual page shows that a profile can be put in complain mode with flags=(complain) in its header, where violations are logged and allowed. The apparmor(7) manual page adds that aa-complain switches a loaded profile to complain mode.
When to use complain mode
| Situation | Approach |
|---|---|
| A new profile for an existing program | Start in complain, exercise every function, then enforce |
| A packaged profile breaks a custom setup | Complain temporarily, find what's missing, add local rules |
| Diagnosing "is it AppArmor?" | Switch to complain; if the problem disappears, AppArmor was the cause |
| A program updated with new behaviour | Complain briefly, then update the profile |
Building a profile from complain logs
| Step | Command |
|---|---|
| Generate a skeleton and start learning | aa-genprof /opt/app/bin/app (sets complain mode) |
| Exercise the program | Normal use, tests, all features |
| Review and accept suggested rules | aa-logprof (asks for each logged access) |
| Repeat until no new events appear | — |
| Enforce | aa-enforce /opt/app/bin/app |
What the log shows in complain mode
Violations are logged as apparmor="ALLOWED" instead of "DENIED". They show exactly what an enforce-mode profile would have blocked.
Don't leave profiles in complain mode
A profile in complain mode gives no protection. aa-status lists profiles by mode. Make "profiles in complain mode" part of regular reviews, so learning phases don't become permanent.
host$ sudo aa-complain /usr/sbin/mysqld
Setting /usr/sbin/mysqld to complain mode.
host$ grep -m1 flags /etc/apparmor.d/usr.sbin.mysqld
/usr/sbin/mysqld flags=(complain) {
host$ sudo journalctl -k -g 'apparmor="ALLOWED"' --since "1 hour ago" | grep -o 'name="[^"]*"' | sort | uniq -c | sort -rn | head -3
42 name="/data/mysql/ibdata1"
17 name="/data/mysql/mysql.sock"
3 name="/data/mysql/"
host$ printf '/data/mysql/ r,\n/data/mysql/** rwk,\n' | sudo tee /etc/apparmor.d/local/usr.sbin.mysqld
host$ sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld && sudo aa-enforce /usr/sbin/mysqld
Reading the example
Every "allowed" access is under /data/mysql, the non-standard data directory this server uses. Two local rules cover it. After that, the profile goes back to enforce. The complain phase lasted exactly as long as needed to find what was missing.
Documented example, not captured output.
How it works at runtime
Complain Mode is part of AppArmor → Complain Mode. AppArmor Complain Mode permits most operations while logging rule violations as policy-learning evidence, useful for controlled profile development but not equivalent to active confinement.
Topic-specific state model. AppArmor Complain Mode permits most operations while logging rule violations as policy-learning evidence, useful for controlled profile development but not equivalent to active confinement.
Interpretation rule. - Complain mode ≠ enforcing mode.
- A workload succeeding in complain mode ≠ the profile is ready to enforce safely or securely.
Quick reference
Complain mode logs violations without blocking, used while building or debugging a profile.
aa-complain /etc/apparmor.d/usr.sbin.nginx
journalctl -k | grep 'apparmor="ALLOWED"'
aa-logprof
aa-enforce /etc/apparmor.d/usr.sbin.nginx
Do not leave production profiles in complain mode; it gives no protection, only logs.
Limits and how it fails
Primary failure point. Complain-mode work is complete only when logs are reviewed, the profile is narrowed deliberately, enforce mode is restored and original workload plus deny tests pass.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Complain Mode owns non-blocking AppArmor policy observation.
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 → Complain Mode. 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
Complain Mode operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Complain Mode.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | AppArmor Complain Mode permits most operations while logging rule violations as policy-learning evidence, useful for controlled profile development but not equivalent to active confinement. | 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 | complain profile attachment → rule evaluation → violation log → operation allowed → profile refinement → enforce retest | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Complain-mode work is complete only when logs are reviewed, the profile is narrowed deliberately, enforce mode is restored and original workload plus deny tests pass. | 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: complain profile attachment → rule evaluation → violation log → operation allowed → profile refinement → enforce retest | 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. Complain-mode work is complete only when logs are reviewed, the profile is narrowed deliberately, enforce mode is restored and original workload plus deny tests pass. | 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. |
Complain Mode · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Complain Mode |
|---|---|
| Topic path | AppArmor → Complain Mode |
| Runtime state | AppArmor Complain Mode permits most operations while logging rule violations as policy-learning evidence, useful for controlled profile development but not equivalent to active confinement. |
| Fast checks | - Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for Complain Mode. - 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 | complain profile attachment → rule evaluation → violation log → operation allowed → profile refinement → enforce retest Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | Complain-mode work is complete only when logs are reviewed, the profile is narrowed deliberately, enforce mode is restored and original workload plus deny tests pass. 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. |