Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Complain Mode

Direct answer

In complain mode an AppArmor profile logs accesses its rules would deny, but allows them. It is used to learn and tune profiles.

When to use this

Use it to develop a profile or confirm AppArmor causes a failure.

First 30 seconds

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.

Operational verification

complain → accesses allowed and logged → rules learned → enforce

Evidence · next step

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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commandjournalctl -k | grep 'apparmor="ALLOWED"'
Scope / prerequisiteUse it to develop a profile or confirm AppArmor causes a failure.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points

Run the program through its normal tasks, then aa-logprof to turn logged events into rules. Return to enforce afterwards.

Key checks
  • aa-status — loaded profiles and modes
  • journalctl -k | grep -i apparmor — denials
  • aa-complain / aa-enforce <profile> — change a profile's mode
  • apparmor_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

SituationApproach
A new profile for an existing programStart in complain, exercise every function, then enforce
A packaged profile breaks a custom setupComplain 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 behaviourComplain briefly, then update the profile

Building a profile from complain logs

StepCommand
Generate a skeleton and start learningaa-genprof /opt/app/bin/app (sets complain mode)
Exercise the programNormal use, tests, all features
Review and accept suggested rulesaa-logprof (asks for each logged access)
Repeat until no new events appear—
Enforceaa-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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

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%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
apparmor complain modeaa complain conceptapparmor learning mode
Embedded reference data

Quick lookup tables

Complain Mode operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Complain Mode.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateAppArmor 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 verificationPin 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 chaincomplain profile attachment → rule evaluation → violation log → operation allowed → profile refinement → enforce retestTrace requested/configured state through effective state to the observed workload result.
Failure boundaryComplain-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 evidenceCorrelated Linux security/trust evidence can establish this proof path: complain profile attachment → rule evaluation → violation log → operation allowed → profile refinement → enforce retestUse this observation only for the specific claim it actually supports.
Evidence limitIt 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 checkContinue 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 boundaryComplain Mode
Topic pathAppArmor → Complain Mode
Runtime stateAppArmor 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 chaincomplain 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 boundaryComplain-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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?