Use it to read or adjust what a confined program may access.
Profiles
AppArmor profiles in /etc/apparmor.d/ list what a program may do: file paths with permissions (r, w, x variants), capabilities, network access, signals and mounts, often using abstractions.
1. Profile for the program: aa-status | grep <prog>.
2. Read it: /etc/apparmor.d/<profile>.
3. Add local rules in /etc/apparmor.d/local/<profile>.
4. apparmor_parser -r /etc/apparmor.d/<profile>.
5. Test; check for new denials.
profile loaded → attached to the program path → rules checked on each access
For AppArmor → Profiles, 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 Profiles. 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
profile source/includes → parser/load → process attachment → rule/transition match → audit/deny → workload
Healthy evidence: profile parses/loads, attachment matches the target executable, rules cover required accesses narrowly and enforcement tests pass
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. profile source/includes → parser/load → process attachment → rule/transition match → audit/deny → workload
Step 3 Specialized verification Verify boundary
Confirm the profile is loaded and the target process is attached to the expected profile. Reproduce the denied operation and correlate kernel/audit logs with profile and resource path. Determine whether the failure is AppArmor or ordinary DAC/other policy. After a scoped rule change, reload the profile, verify enforce mode and repeat the original operation. Also test a negative case when the rule is security-sensitive so the profile has not become overly permissive.
Step 4 Commands Verify boundary
aa-status
ls /etc/apparmor.d/
apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx
Step 5 Failure modes and next checks Narrow the fault
Suspicious evidence: syntax/load error, wrong profile name/path, abstraction grants too much, local override drifts, child transition becomes unconfined or edited source is not the loaded profile
Step 6 Special cases and limits Narrow the fault
Profile-file syntax success does not show attachment, and complain mode success does not show the enforced profile is correct. Path aliases, mounts and namespace views can change which pathname AppArmor evaluates. A denial can coexist with DAC denial or application restrictions. Keep profile source, loaded policy, process attachment and workload behavior separate.
Step 7 Common mistakes Narrow the fault
- Editing profiles without reloading.
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.
Keep local changes in /etc/apparmor.d/local/ so updates do not overwrite them. Reload after editing. aa-logprof proposes rules from logged denials.
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 & boundaries6 sections · depth on demand
What this shows and what it does not
Profile changes are confirmed only when the loaded profile reflects the intended source, the correct process is attached and allowed/denied workload tests match expectations.
In depth
Writing and reading AppArmor profiles
An AppArmor profile lists what a program may do. The apparmor.d(5) manual page defines the syntax:
- A profile has a name or path, optional flags in parentheses, such as
flags=(complain), and rules in braces. #include <abstractions/base>pulls in rules that nearly every program needs.- File rules are a path followed by permissions:
r(read),w(write),a(append),l(link),k(lock) andm(memory map executable). - Execute rules control transitions:
ix(inherit this profile),px(switch to that program's own profile),cx(a child profile) andux(unconfined). capability net_bind_service,allows a capability, andnetwork inet tcp,allows IPv4 TCP sockets.denyblocks without logging, andownerrequires the file to belong to the process's user.*matches within one directory level, and**matches across levels.
A small profile for a custom service
host$ cat /etc/apparmor.d/opt.reportapi.bin.reportapi
#include <tunables/global>
/opt/reportapi/bin/reportapi {
#include <abstractions/base>
#include <abstractions/nameservice>
capability net_bind_service,
network inet tcp,
network inet6 tcp,
/opt/reportapi/bin/reportapi mr,
/opt/reportapi/lib/** mr,
/etc/reportapi/*.yml r,
/var/lib/reportapi/** rwk,
owner /var/log/reportapi/*.log a,
/usr/bin/gzip ix,
deny /etc/shadow r,
deny /home/** rw,
#include <local/opt.reportapi.bin.reportapi>
}
host$ sudo apparmor_parser -r /etc/apparmor.d/opt.reportapi.bin.reportapi
host$ sudo systemctl restart reportapi
host$ ps -eo label,comm | grep reportapi
/opt/reportapi/bin/reportapi (enforce) reportapi
Reading the profile
| Rule | Meaning |
|---|---|
abstractions/nameservice | DNS, NSS and hosts lookups |
capability net_bind_service | Bind ports below 1024 without root |
/opt/reportapi/lib/** mr | Read and map libraries anywhere below lib |
/var/lib/reportapi/** rwk | Read, write and lock its own data |
owner ... a | Only append to logs it owns |
/usr/bin/gzip ix | gzip runs under this same profile |
deny lines | Explicitly forbidden, and not logged |
Capabilities weaken confinement
The manual warns that some capabilities, such as sys_admin or dac_override, make the confinement largely advisory. Grant only what the program needs. Prefer file rules over capabilities that bypass file permissions.
Documented example, not captured output.
How it works at runtime
Profiles is part of AppArmor → Profiles. AppArmor Profiles define path, capability, network, mount, signal and execution permissions for named applications using abstractions, local overrides and transition rules.
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. AppArmor Profiles define path, capability, network, mount, signal and execution permissions for named applications using abstractions, local overrides and transition rules.
Interpretation rule. - Profile file present ≠ profile loaded or attached.
- A broad abstraction include ≠ least-privilege policy for the specific application.
Specialized mechanics
AppArmor confines programs using pathname-oriented profiles loaded into the kernel. Profiles define executable attachment and permissions for files, capabilities, network, signals and other resources. Hat/subprofile transitions and abstractions can compose policy. Enforcement applies to a task only when the intended profile is loaded and attached; the mere presence of a profile file under /etc does not show the running process is confined by it. Complain mode records policy violations without enforcing denials, whereas enforce mode blocks operations that violate the loaded profile.
Quick reference
AppArmor profiles list allowed paths, capabilities and network access for a program.
#include <tunables/global>
profile myapp /opt/myapp/bin/myapp flags=(attach_disconnected) {
#include <abstractions/base>
#include <abstractions/nameservice>
network inet stream,
capability net_bind_service,
/opt/myapp/** r,
/opt/myapp/bin/myapp ix,
/var/lib/myapp/** rw,
/var/log/myapp/*.log w,
}
Documented example, not captured output. Generate a starting profile with aa-genprof /opt/myapp/bin/myapp, exercise the program, then refine with aa-logprof. Local tweaks to distribution profiles go in /etc/apparmor.d/local/<profile> so package updates keep them.
Limits and how it fails
Primary failure point. Profile changes are confirmed only when the loaded profile reflects the intended source, the correct process is attached and allowed/denied workload tests match expectations.
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.
Specialized lifecycle
Keep profiles in the distribution-supported location and use abstractions/tunables where they express shared policy. Validate and reload the profile after edits, then confirm its enforce/complain state. Complain mode is useful for observation but is not equivalent to enforced security. When paths are dynamic, account for real resolved paths and application behavior rather than broad wildcard rules. Avoid auto-generating and accepting large permission sets without reviewing what the workload should actually access.
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 → Profiles. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://gitlab.com/apparmor/apparmor/-/wikis/Documentation · confidence 94%Authoritative Linux project/vendor documentation reviewed for bounded reference claims: profile syntax, attachment, enforce/complain modes and policy scope. Documentation-based technical verification only; not lab or production-runtime proof. The schema vendor_doc method is used for authoritative project/vendor documentation; deployment applicability remains separate evidence.
Basis: https://apparmor.net/ · confidence 93%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
Profiles operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Profiles.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | AppArmor Profiles define path, capability, network, mount, signal and execution permissions for named applications using abstractions, local overrides and transition rules. | 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 | profile source/includes → parser/load → process attachment → rule/transition match → audit/deny → workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Profile changes are proven only when the loaded profile reflects the intended source, the correct process is attached and allowed/denied workload tests match expectations. | 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: profile source/includes → parser/load → process attachment → rule/transition match → audit/deny → workload | 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. Profile changes are proven only when the loaded profile reflects the intended source, the correct process is attached and allowed/denied workload tests match expectations. | 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. |
Profiles · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Profiles |
|---|---|
| Topic path | AppArmor → Profiles |
| Runtime state | AppArmor Profiles define path, capability, network, mount, signal and execution permissions for named applications using abstractions, local overrides and transition rules. |
| Fast checks | - Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for Profiles. - 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 | profile source/includes → parser/load → process attachment → rule/transition match → audit/deny → workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | Profile changes are proven only when the loaded profile reflects the intended source, the correct process is attached and allowed/denied workload tests match expectations. 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. |
Profiles · specialized operational reference
Topic-specific Linux mechanics, lifecycle, proof path and failure-boundary lookup.
| Operational boundary | Topic-specific reference |
|---|---|
| State | Profile source → loaded kernel policy → process attachment |
| Modes | enforce vs complain |
| Evidence | AppArmor denial matched to process/path |
| Proof | Scoped rule works in enforce mode without broad bypass |