Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Enforce Mode

Direct answer

In enforce mode an AppArmor profile blocks and logs any access its rules do not allow.

When to use this

Use it to confirm a program is actually confined.

First 30 seconds

1. aa-status — profile under "enforce mode"?

2. aa-enforce /etc/apparmor.d/<profile>.

3. Restart the program.

4. Watch denials.

5. Fix with local rules if needed.

Operational verification

profile in enforce → disallowed access blocked and logged

Evidence · next step

For AppArmor → Enforce 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 Enforce 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
Scope / prerequisiteUse it to confirm a program is actually confined.
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

loaded enforcing profile → process attachment → rule match → deny/allow → audit record → workload

Healthy evidence: target process is attached to an enforcing profile, expected denies block, expected allows work and audit records match the exact tests

Step 2 Verification and output interpretation Verify boundary

Verification chain. loaded enforcing profile → process attachment → rule match → deny/allow → audit record → workload

Step 3 Commands Verify boundary
aa-enforce /etc/apparmor.d/usr.sbin.nginx
aa-status | grep -A5 enforce
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: profile is complain/unconfined, wrong process path attaches elsewhere, denials are misattributed, or enforcement is disabled to restore service without fixing policy

Step 5 Common mistakes Narrow the fault
  • Enforcing a new profile without a complain-mode trial.
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

Profiles in complain mode give no protection. After tuning, set enforce (aa-enforce) and watch for denials.

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

Enforce mode is confirmed for the specific attached profile/process and operation, but it does not show coverage of unconfined processes or correctness of all allowed rules.

In depth

Enforce mode

In enforce mode, AppArmor applies a profile's rules: anything not allowed is denied and reported. The apparmor(7) manual page explains how profiles are loaded and switched:

  • apparmor_parser loads profiles into the kernel, and aa-enforce sets a profile to enforce mode.
  • A denial is logged with apparmor="DENIED" and the operation, profile, file and requested permissions.
  • Profiles apply at execution, so a program must be restarted after its profile is first loaded.

Putting a profile into enforce mode

StepCommand
1. Run in complain mode first, and exercise the programaa-complain /usr/sbin/myapp
2. Review the log entriesjournalctl -k -g 'apparmor="ALLOWED"'
3. Update the profile from the logsaa-logprof
4. Switch to enforceaa-enforce /usr/sbin/myapp
5. Restart the servicesystemctl restart myapp
6. Watch for denialsjournalctl -k -g 'apparmor="DENIED"' -f

Reading a denial

FieldExampleMeaning
operationopen, exec, connectWhat the program tried
profile/usr/sbin/nginxThe profile that denied it
name/srv/www/intranet/index.htmlThe object
requested_mask / denied_maskrThe permission requested and denied
commnginxThe process name

Fixing a denial

CauseFix
A new legitimate pathA rule in /etc/apparmor.d/local/<profile>, then reload
A program that needs broad changesUpdate the profile with aa-logprof
A sign of compromiseInvestigate: the denial is the protection working
host$ sudo aa-enforce /usr/sbin/nginx
Setting /usr/sbin/nginx to enforce mode.
host$ sudo journalctl -k -g 'apparmor="DENIED"' -n 1
apparmor="DENIED" operation="open" class="file" profile="/usr/sbin/nginx" name="/srv/www/intranet/index.html" pid=1203 comm="nginx" requested_mask="r" denied_mask="r" fsuid=33 ouid=0
host$ echo '/srv/www/** r,' | sudo tee -a /etc/apparmor.d/local/usr.sbin.nginx
host$ sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx
host$ curl -s -o /dev/null -w "%{http_code}\n" http://localhost/intranet/
200
host$ sudo aa-status | grep -A1 "enforce mode" | head -2

Reading the fix

nginx was denied reading web content under /srv/www, a path its packaged profile doesn't cover. One line in the local override allows reading that tree. Reloading the profile applies it without a service restart, and the page loads.

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

Enforce Mode is part of AppArmor → Enforce Mode. AppArmor 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.

Topic-specific state model. AppArmor 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.

Interpretation rule. - Enforce mode globally available ≠ every profile/process is enforcing.

  • A logged DENIED event ≠ the denied operation is necessarily the application root cause.

Quick reference

Enforce mode blocks and logs anything outside the profile.

aa-enforce /etc/apparmor.d/usr.sbin.named
aa-status | sed -n '/enforce mode/,/complain mode/p'
journalctl -k --since -1h | grep 'apparmor="DENIED"'

A denial line contains operation, profile, name (path) and requested_mask — enough to add the missing rule. Reload after edits with apparmor_parser -r.

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. Enforce mode is confirmed for the specific attached profile/process and operation, but it does not show coverage of unconfined processes or correctness of all allowed rules.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. Enforce Mode owns blocking policy behavior.

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 → Enforce 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 enforce modeaa enforce conceptapparmor enforcing
Embedded reference data

Quick lookup tables

Enforce Mode operational reference

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

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateAppArmor 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.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 chainloaded enforcing profile → process attachment → rule match → deny/allow → audit record → workloadTrace requested/configured state through effective state to the observed workload result.
Failure boundaryEnforce mode is proven for the specific attached profile/process and operation; it does not prove coverage of unconfined processes or correctness of all allowed rules.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux security/trust evidence can establish this proof path: loaded enforcing profile → process attachment → rule match → deny/allow → audit record → workloadUse 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. Enforce mode is proven for the specific attached profile/process and operation; it does not prove coverage of unconfined processes or correctness of all allowed rules.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.

Enforce Mode · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryEnforce Mode
Topic pathAppArmor → Enforce Mode
Runtime stateAppArmor 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.
Fast checks- Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for Enforce 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 chainloaded enforcing profile → process attachment → rule match → deny/allow → audit record → workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary.
Failure boundaryEnforce mode is proven for the specific attached profile/process and operation; it does not prove coverage of unconfined processes or correctness of all allowed rules. 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?