aa-logprof

from denials to rules for application developers for administrators

aa-logprof reads the log and turns each record that no profile rule covers into a question. Which log it reads and which records it drops. The parts of a question and what each key writes. The owner qualifier and merged modes. Glob and Glob with Extension. How the profile file is rewritten and reloaded. logprof.conf. And where the suggestions go wrong - shown on one recorded session.

On the map: tools

▶ Watch this deck — 9 scenes, ~7 min

Worth seeing first

Part of journeys

01 From log records to rules

aa-logprof $ demo extra /etc/demo/extra.conf: Permission denied a profile in enforce mode, and something new apparmor="DENIED" operation="open" profile="/usr/bin/demo" name="/etc/demo/extra.conf" requested_mask="r" denied_mask="r" the log # aa-logprof Reading log entries from /var/log/audit/audit.log. Enforce-mode changes: Profile: /usr/bin/demo Path: /etc/demo/extra.conf New Mode: owner r [1 - owner /etc/demo/extra.conf r,] one question per uncovered record answer · save · reloaded any time, all profiles at once this deck: one question taken apart, the keys, the files, and the wrong suggestions
demo runs under an enforced profile and is denied a file. The kernel logs the denial. aa-logprof reads the log, asks one question for each record no rule covers, writes the answers into the profile and reloads it.

aa-logprof reads the system log, asks one question for each AppArmor record that no rule of the profile covers, writes the answers into the profile file and reloads it. It works on every profile in the profile directory at once.

Demo has a profile, in enforce mode, and today it failed: permission denied on a file it didn't touch during profiling. The kernel logged that denial. aa-logprof reads the log, finds the records your profiles don't cover yet, and turns each into a question, the same questions aa-genprof asks. Answer, save, and the profile is reloaded. You can run it any time, for all profiles at once: after an upgrade, or when a user reports a failure. This deck takes one question apart, shows what each key writes, where the tool reads from and writes to, and where its suggestions go wrong.

Details and sources

Details

  • aa-logprof [-d DIR] [-f LOGFILE] [-m MARK] [-j] [-a] [--no-abstraction] [-o OUTDIR]. Run it as root.
  • It handles both kinds of record: apparmor="ALLOWED" from profiles in complain mode (printed under Complain-mode changes:) and apparmor="DENIED" from profiles in enforce mode (under Enforce-mode changes:). Both headers are printed even when a section is empty.
  • The session on the slide: demo extra under the enforced profile printed /etc/demo/extra.conf: Permission denied; the log had apparmor="DENIED" operation="open" class="file" profile="/usr/bin/demo" name="/etc/demo/extra.conf" comm="demo" requested_mask="r" denied_mask="r" fsuid=0 ouid=0; aa-logprof asked one question, A wrote owner /etc/demo/extra.conf r,, and after S the next demo extra worked.
  • The questions are the ones aa-genprof asks during a scan; aa-genprof adds the starter profile, complain mode and the loop around them. See Generating a profile.
  • A deny rule in a profile produces no log record, so aa-logprof never asks about what it blocks.
  • Observed on 2026-11-16: the tree's utils/ (aa-genprof, aa-logprof and their Python package) and the tree's profiles/apparmor.d were run in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64; apparmor_parser and the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts are findings/tools/observed/session1.txt and session2.txt.

for AppArmor developers

Code

02 Which log, and which records

WHICH LOG, WHICH RECORDS the first of these that exists /var/log/audit/audit.log /var/log/syslog /var/log/messages or: aa-logprof -f FILE # aa-logprof ERROR: Can't find system log "/var/log/syslog". Please check permissions. no auditd, no syslog file: the journal alone is not read read from the top, every time; skipped without a message: records a rule already covers records of profiles with no file in the profile directory audit, status and error records # aa-logprof -m "upgrade done" start at the first line containing the mark mark not found: nothing is read, nothing is said
aa-logprof reads the first existing file of audit.log, syslog and messages, or the file given with -f. Without any of them it stops with an error. It reads from the top, or after a mark given with -m, and silently skips records that are covered, that belong to profiles without a file, or that are not allow or deny events.

The log is the first existing file of /var/log/audit/audit.log, /var/log/syslog, /var/log/messages, or -f FILE. It is read from the top, or after the mark given with -m. Covered records and records of profiles without a file are skipped silently.

Where do the records come from? aa-logprof takes the first of three files that exists: the audit log, then syslog, then messages. With neither auditd nor a syslog file it stops with this error, and you point it at a file with -f. It reads from the top every time. That's fine, because anything a profile already allows is skipped. Also skipped, without a word: records for profiles that have no file in the profile directory, and records that aren't allow or deny events. You can start later with -m and a marker string. If the marker isn't found, nothing is scanned, and nothing tells you.

Details and sources

Details

  • The list of log files is the logfiles setting of logprof.conf: /var/log/audit/audit.log /var/log/syslog /var/log/messages. The first that exists is used.
  • With none of them (a system that keeps kernel messages only in the journal, without auditd): ERROR: Can't find system log "/var/log/syslog". Please check permissions., exit status 1. Observed after moving audit.log aside in the guest. Install auditd, or write the kernel log to a file (for example journalctl -k > FILE) and pass it with -f; whether every field survives that route was not checked.
  • With -f and a missing file: The logfile FILE does not exist. Please check the path.
  • Only lines containing apparmor=, operation= or type=AVC are parsed. Records of kind AUDIT, STATUS (profile loads) and ERROR are dropped.
  • A record is dropped when its profile has no file in the profile directory. Observed: the same audit.log held denials for four other loaded profiles, and no question was asked about them.
  • A record that an existing rule or an included abstraction covers is dropped. So the whole log can be read on every run; the second aa-logprof run of the session asked nothing.
  • -m MARK skips every line before the first one that contains MARK; that line and the ones after it are read. aa-genprof uses this with its own mark. Observed: aa-logprof -m no-such-mark printed the two section headers and exited with status 0.
  • Known discrepancy: records for a child profile or hat that is defined in an included file are dropped as well.
  • Observed on 2026-11-16: the tree's utils/ (aa-genprof, aa-logprof and their Python package) and the tree's profiles/apparmor.d were run in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64; apparmor_parser and the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts are findings/tools/observed/session1.txt and session2.txt.

for AppArmor developers

Code

03 One question, taken apart

ONE QUESTION Profile: /usr/bin/demo Path: /var/lib/demo/state.db Old Mode: owner w New Mode: w Severity: unknown [1 - /var/lib/demo/state.db w,] (A)llow / [(D)eny] / (I)gnore / (G)lob / Glob with (E)xtension / (N)ew / Audi(t) / Abo(r)t / (F)inish headers: which profile, what it did Old Mode: what the profile already grants on this path Severity: 0 to 10, a hint offers, one selected keys; the default is Deny A add the selected offer D add it as a deny rule I skip it; it comes back next time 1-9 select another offer T toggle audit R abort, after a confirmation F stop asking, go to the save prompt Return the bracketed default: Deny
A file question from the session with its parts labelled: the headers Profile, Path, Old Mode, New Mode and Severity; the numbered offers with one in brackets; the key row with the default in brackets, which is Deny.

A question has headers (profile, what was requested, severity), numbered offers with one selected, and a row of keys. A adds the selected offer, D adds it as a deny rule, I skips it. The bracketed default was (D)eny throughout the session.

Here's a question from the session. On top, the headers: which profile, which path, and the mode, meaning the permissions the record asked for. Old mode appears when the profile already grants something on that path. Severity is a number from the tools' own table, ten being worst. It's only a hint. Then the numbered offers, one in brackets. And the row of keys, with the default in brackets. That default is deny, whatever the section header says, so return doesn't mean yes. The key A allows the selected offer. D writes it as a deny rule. The key I skips it for now, and it comes back next time.

Details and sources

Details

Keys of a rule question:

KeyEffect
A, (A)llowadd the selected offer; an include offer also removes rules it makes redundant ("Deleted N previous matching profile entries.")
D, (D)enyadd the selected rule with deny; on an include offer: "Denying via an include file isn't supported by the AppArmor tools"
I, (I)gnorewrite nothing; the record is asked about again on the next run
G, (G)lobfile questions: add a wider path to the offers
E, Glob with (E)xtensionfile questions: the same, keeping the file extension
N, (N)ewfile questions: type a path
T, Audi(t)toggle the audit qualifier on the offers
O, (O)wner permissions on / offfile questions: toggle owner on the offers
R, Abo(r)t"Are you sure you want to abandon this set of profile changes and exit?"
F, (F)inishstop asking and go to the save prompt
1 to 9, arrow keysselect another offer
Returnthe bracketed default
  • Headers depend on the kind of record: Path and New Mode for files; Capability; Accesses, Network Family, Socket Type, Local, Peer for network; and so on for signals, ptrace, mounts and D-Bus.
  • Old Mode appears when rules of the profile already give some permission on the path; the offer then holds the merged permissions.
  • Severity comes from severity.db: for example CAP_SYS_ADMIN 10, CAP_NET_RAW 8; paths have a number per access letter; unknown when nothing matches. It changes no default.
  • The default: the tool's code intends Allow for complain-mode records and Deny for enforce-mode records. In the sessions every question showed [(D)eny]. Known discrepancy: the test that should select Allow never matches.
  • The key row is one line in the terminal; the slide wraps it. The session's question followed a denial for an ordinary user on a file the profile allowed only for its owner.
  • Observed on 2026-11-16: the tree's utils/ (aa-genprof, aa-logprof and their Python package) and the tree's profiles/apparmor.d were run in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64; apparmor_parser and the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts are findings/tools/observed/session1.txt and session2.txt.

for AppArmor developers

Code

04 owner, and the merged mode

owner ... name="/etc/demo/demo.conf" requested_mask="r" fsuid=0 ouid=0 same number twice New Mode: owner r [1 - owner /etc/demo/demo.conf r,] a guess from one run # runuser -u tester -- demo /etc/demo/demo.conf: Permission denied ... fsuid=1000 ouid=0 another user is not the owner Old Mode: owner r New Mode: r [1 - /etc/demo/demo.conf r,] Adding /etc/demo/demo.conf r, to profile. Deleted 1 previous matching profile entries. O (O)wner permissions off / on decide at the first question keep owner for files under the user's home; drop it for system files everyone reads
The tool writes an owner rule when the log record shows the same user as the file owner. demo was profiled as root on root-owned files. Run by another user it is denied its configuration file; aa-logprof then shows Old Mode owner r, New Mode r and replaces the rule. The O key toggles owner.

The tool proposes an owner rule when the record's fsuid equals its ouid. A profile made as root on root's files then fails for other users. Observed: the later question shows Old Mode: owner r, New Mode: r and replaces the rule. O toggles owner.

Why does this say owner? When the user running the program owns the file, the log record shows the same ID twice, and the tool turns that into an owner rule. That's a guess from one run. Here demo was profiled as root. Later a normal user runs it, and demo can't read its own config: the file is root's, and the user isn't the owner. aa-logprof then shows Old Mode: owner r, New Mode: r, and accepting replaces the rule. You can decide up front with the O key, which toggles owner on the offers. Keep owner for files under home. Drop it for system files everyone reads.

Details and sources

Details

  • A file record carries fsuid (the user the program ran as) and ouid (the file's owner). When they are equal the tool sets owner on the proposed rule and shows New Mode: owner r.
  • (O)wner permissions off removes owner from every offer of the question; the key then reads (O)wner permissions on. Session: O then A on /var/log/demo.log wrote /var/log/demo.log w,.
  • The run: the profile from the root session had owner /etc/demo/demo.conf r,. demo started by the user tester: /etc/demo/demo.conf: Permission denied, /usr/share/demo/words-1.txt: Permission denied, /var/lib/demo/state.db: Permission denied, with records such as apparmor="DENIED" operation="open" class="file" profile="/usr/bin/demo" name="/etc/demo/demo.conf" comm="demo" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0.
  • The next aa-logprof run asked with Old Mode: owner r and New Mode: r; A printed Adding /etc/demo/demo.conf r, to profile. and Deleted 1 previous matching profile entries.
  • The replaced rule is deleted only when the new rule covers it exactly. With a wider new rule both stay: the session's profile ended with owner /usr/share/demo/* r, next to /usr/share/** r,.
  • The other direction also happens: profiling as an ordinary user on root's files gives rules without owner, which then also allow that user's program to read other users' files matched by the same path.
  • The default_owner_prompt setting of logprof.conf describes ways to change this behaviour. Known discrepancy: the setting is cleared when the file is read and has no effect.
  • Observed on 2026-11-16: the tree's utils/ (aa-genprof, aa-logprof and their Python package) and the tree's profiles/apparmor.d were run in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64; apparmor_parser and the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts are findings/tools/observed/session1.txt and session2.txt.

Read more

for AppArmor developers

Code

05 Glob: one key, a wider rule

GLOB [1 - owner /usr/share/demo/words-1.txt r,] the exact path comes first G 1 - owner /usr/share/demo/words-1.txt r, [2 - owner /usr/share/demo/* r,] the last part becomes a star G 1 - /usr/share/demo/* r, 2 - /usr/share/demo/words-1.txt r, [3 - /usr/share/** r,] G on that rule, in a later run: a directory dropped, two stars, everything under /usr/share E 1 - /var/lib/demo/state.db w, [2 - /var/lib/demo/*.db w,] the extension is kept narrower offers stay in the list: a digit steps back N type the path yourself stop at the directory your program owns
Pressing G on /usr/share/demo/words-1.txt adds /usr/share/demo/* to the offers; pressing G again adds /usr/share/**. Pressing E on /var/lib/demo/state.db adds /var/lib/demo/*.db. N lets you type a path.

(G)lob replaces the last path component with *; pressed again it removes a directory and ends in /**. Glob with (E)xtension keeps the extension. Each press adds an offer and selects it. Observed: one press gave /usr/share/demo/*; a press on that offer in a later run gave /usr/share/**.

The offers start with the exact path. Two keys widen it. G, for glob, replaces the last part of the path with a star. Press it again and it drops a directory and ends in two stars: here the word list became everything under /usr/share in two presses. E keeps the extension: the state file became *.db in its directory. Each press adds an offer and selects it. The narrower ones stay in the list, so you can step back with a number key. N lets you type a path. The tool doesn't rank wide against narrow. Stop at the directory your program owns.

Details and sources

Details

  • (G)lob, step by step: /usr/share/demo/words-1.txt → /usr/share/demo/* → /usr/share/** → /usr/** → /**. A path that already ends in /* or /** loses one more directory and ends in /**. Directory paths keep their trailing slash (/*/, /**/).
  • Glob with (E)xtension: /var/lib/demo/state.db → /var/lib/demo/*.db → /var/lib/**.db → /var/**.db. A file without an extension is left as it is.
  • (N)ew prompts Enter new path: with the current path to edit. When the typed path does not match the logged one the tool asks: "The specified path does not match this log entry ... Do you really want to use this path?" (default no). A path that does not start with / or a variable: "The path you entered is invalid (not starting with / or a variable)!"
  • Other offers that can appear without pressing a key: paths of rules already in the profile that match the logged path (in the session /usr/share/demo/* r, was listed first for words-1.txt), and substitutions from the [globs] section of logprof.conf, for example /home/NAME to /home/*, /proc/PID/ to /proc/*/, and library names with their version replaced.
  • The session: at the question for words-1.txt (after the denial for another user) G was pressed once on the selected offer /usr/share/demo/* r, and A wrote /usr/share/** r,. That rule lets demo read every file under /usr/share.
  • Widening is how a tool-made profile becomes broad. See Profiles for general-purpose apps for when that is acceptable.
  • Observed on 2026-11-16: the tree's utils/ (aa-genprof, aa-logprof and their Python package) and the tree's profiles/apparmor.d were run in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64; apparmor_parser and the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts are findings/tools/observed/session1.txt and session2.txt.

for AppArmor developers

Code

06 Saving: the file is rewritten

SAVING = Changed Local Profiles = The following local profiles were changed. Would you like to save them? [1 - /usr/bin/demo] 2 - /usr/bin/demo-helper (S)ave Changes / Save Selec(t)ed Profile / [(V)iew Changes] / View Changes b/w (C)lean profiles / Abo(r)t V: a diff against the file on disk S: save all the tool's model temporary file ...~ /etc/apparmor.d/usr.bin.demo the whole file is written again: sorted, with a "# Last Modified" line Writing updated profile for /usr/bin/demo. then: apparmor_parser -r, the profile is live your layout is not kept; redundant rules can stay behind: owner /usr/share/demo/* r, next to /usr/share/** r,
The save prompt lists changed profiles with the keys Save Changes, Save Selected Profile, View Changes and Abort. Saving writes the whole profile again from the tool's model into a temporary file, renames it over the profile and reloads it with apparmor_parser.

(S)ave Changes writes each changed profile completely from the tool's model (sorted, with a # Last Modified line) to a temporary file, renames it over the profile and reloads it with apparmor_parser -r. (V)iew Changes shows a diff first.

When the questions end, the tool lists the changed profiles. V shows a diff against the file on disk. S saves. Saving doesn't patch your file. The tool writes the whole profile again from its own model: includes first, then rules grouped by kind and sorted, with a last modified line on top. It writes a temporary file next to the profile, renames it into place, and runs the parser to reload it. So your layout is gone. And redundant rules can stay behind: here an owner rule for the word list sits next to the wider rule that replaced it. aa-cleanprof is the tool for that.

Details and sources

Details

  • The save prompt appears when at least one profile changed. Keys: (S)ave Changes (all), Save Selec(t)ed Profile, (V)iew Changes (the default; diff -u of the file on disk against the new text, shown with less), View Changes b/w (C)lean profiles (both sides as the tool would write them, so that only rule changes show), Abo(r)t.
  • Writing: the complete profile text is produced from the tool's in-memory model, written to a temporary file with a name ending in ~ in the profile directory (or the directory given with -o), given the permissions of the old file, and renamed over it. A new file is created with mode 0600.
  • Reloading: apparmor_parser -I DIR --base DIR -r FILE. If the parser reports an error, the error is printed and the tool continues; the file on disk is the new one and the kernel keeps the old profile.
  • Layout of the written file: # Last Modified: DATE, the abi line, preamble includes, then the profile with its includes, capability rules, network rules and file rules, each group sorted, separated by blank lines. Hand formatting and rule order of the previous file are not kept.
  • Session, profile after the second save (excerpt): /etc/demo/demo.conf r,, /usr/share/** r,, /var/lib/demo/*.db w,, /var/log/demo.log w,, owner /etc/demo/extra.conf r,, owner /usr/share/demo/* r,. The last one is covered by /usr/share/** r, and was not removed.
  • aa-cleanprof removes rules that other rules or includes cover. See Cleaning and merging profiles.
  • Known discrepancy: the tools read a child profile nested inside another child as a sibling and write it back that way.
  • Observed on 2026-11-16: the tree's utils/ (aa-genprof, aa-logprof and their Python package) and the tree's profiles/apparmor.d were run in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64; apparmor_parser and the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts are findings/tools/observed/session1.txt and session2.txt.

for AppArmor developers

Code

07 logprof.conf

logprof.conf # /etc/apparmor/logprof.conf [settings] profiledir = /etc/apparmor.d /etc/subdomain.d logfiles = /var/log/audit/audit.log /var/log/syslog /var/log/messages parser = /sbin/apparmor_parser /sbin/subdomain_parser where things are [qualifiers] /bin/bash = icnu /usr/bin/cat = icn /usr/bin/mount = u i c n u p: the exec answers offered when something runs this program anything but p: aa-genprof refuses it [globs] ^/home/[^\/]+ = /home/* ^/proc/\d+/ = /proc/*/ ready-made offers severity.db the number behind "Severity:" default_owner_prompt is described in the file and has no effect
The file /etc/apparmor/logprof.conf with its sections: settings for the profile directory, log files and parser; qualifiers with letters per program; globs with ready-made substitutions. severity.db sits beside it.

/etc/apparmor/logprof.conf: [settings] names the profile directory, the log files and the parser; [qualifiers] lists per program the exec answers offered and whether it may be profiled; [globs] adds ready-made path offers. severity.db holds the severity numbers.

The tool's behaviour is set in one file, logprof.conf, in /etc/apparmor. The settings section says where profiles live, which log files to try, and where the parser is. The qualifiers section is a list of programs with letters: which exec answers to offer when something runs them, and whether aa-genprof may profile them at all. The globs section adds ready-made offers, like a star in place of a user's name under /home. Next to the file sits the severity table. One setting, default_owner_prompt, is described in the file but has no effect in this version.

Details and sources

Details

[settings]:

SettingShipped valueMeaning
profiledir/etc/apparmor.d /etc/subdomain.dfirst existing directory is used; -d overrides
inactive_profiledir/usr/share/apparmor/extra-profilesprofiles offered instead of a starter profile
logfiles/var/log/audit/audit.log /var/log/syslog /var/log/messagesfirst existing file is read; -f overrides
parser/sbin/apparmor_parser /sbin/subdomain_parserused to reload profiles
logger/bin/logger /usr/bin/loggerused by aa-genprof to write its mark
default_owner_prompt1described with four values; cleared when the file is read (known discrepancy)
custom_includesemptyextra directories under the profile directory searched for include offers
json_log0with --json, log the dialog to a temporary file

[qualifiers]: PROGRAM = LETTERS. The letters are the exec answers offered when another program runs this one: i inherit, c child, n named, u unconfined, p its own profile. Programs not listed get all five. Shipped: shells icnu; mount and a few others u; utilities such as awk, cat, chmod, cp, grep, ls, sed and the perl and python interpreters icn. aa-genprof and aa-autodep refuse a listed program unless its value is exactly p.

[globs]: REGEX = REPLACEMENT. When the regular expression matches a logged path, the replaced path is added to the offers. Shipped entries cover library names, kernel module directories, /proc/PID/, /home/NAME, perl module trees, locale and timezone data, fonts and PAM files.

[required_hats] and [defaulthat]: hats that new profiles for Apache get.

  • severity.db lists a number from 0 to 10 for each capability (CAP_SYS_ADMIN 10, CAP_DAC_OVERRIDE 9, CAP_NET_RAW 8) and for path patterns with their access letters. It is shown as Severity: and has no other effect.
  • --configdir DIR (not shown in --help) makes the tools read logprof.conf and severity.db from another directory.
  • This scene is read from the shipped file and the tool's code; the sessions used the shipped file unchanged.

Read more

for AppArmor developers

Code

08 Where the suggestions go wrong

WHERE THE SUGGESTIONS GO WRONG 1 Return means Deny (A)llow / [(D)eny], also for complain-mode records 2 the first offer is first by alphabet, not by fit [1 - include <abstractions/apache2-common>] for any TCP socket 3 variables are not expanded /etc/ld.so.cache offered although base covers it; nameservice not offered 4 owner is a guess from one run fsuid=0 ouid=0 -> owner /etc/passwd r, 5 the log only holds what ran no record, no rule; a deny rule never logs # aa-logprof --allow-all every one of these, answered for you read the diff before you save
Five things to watch: Return means Deny; the first offer is first by alphabet; variables are not expanded, so covered files are offered again; owner is a guess from one run; only what ran is in the log. The --allow-all option answers all of them for you.

Seen in the recorded sessions: the default answer is Deny; offers are sorted by name with the first selected; rules written with variables are not recognised as covering a path; owner is derived from one record; only what ran is logged. --allow-all accepts the selected offer every time.

Five things to watch, all seen in this session. Return means deny. The first offer is first by alphabet, not by fit: an Apache abstraction for any program that opens a TCP socket. The tool doesn't expand variables, so it misses that the base abstraction already covers a file and offers it again, and it doesn't offer the nameservice abstraction for files that one covers. Owner is a guess from one run. And the log only holds what ran: no record, no rule, and a deny rule never logs. Add the --allow-all option, and every one of these is answered for you. Read the diff before you save.

Details and sources

Details

  • Return means Deny. Every rule question of both sessions showed (A)llow / [(D)eny], under Complain-mode changes: as well. Pressing Return writes a deny rule; the program then fails at that point and, because deny rules are not logged, later runs of the tool show nothing. Known discrepancy.
  • The first offer. Abstractions that cover the record are listed in name order above the exact rule, and the first is selected. For demo's TCP socket: [1 - include <abstractions/apache2-common>], 2 - include <abstractions/nameservice>, 3 - network (connect) inet stream peer=(ip=127.0.0.1 port=9),. Accepting the selected offer gave demo Apache's ptrace and signal rules. --no-abstraction turns the include offers off.
  • Variables. Known discrepancy: the tools match paths against abstraction rules without expanding variables such as @{etc_ro} or @{PROC}. Seen: owner /etc/ld.so.cache r, proposed for a profile that includes abstractions/base; /etc/nsswitch.conf and /etc/passwd proposed as single rules with no offer of abstractions/nameservice.
  • owner from one record: see the scene "owner, and the merged mode".
  • Only what ran: a code path that was not exercised has no record. An operation that AppArmor does not mediate has none either and needs no rule (What is not mediated). Explicit deny rules and denials silenced with deny never reach the log.
  • aa-logprof -a / --allow-all answers every rule question with Allow on the selected offer, every exec question with (P)rofile when the target has a profile and In(h)erit otherwise, and every yes/no question with no. Read from the tool's code, not run in these sessions. Known discrepancy: because the secure-execution question is answered no, it writes lowercase px.
  • Other known discrepancies of the tools: a network rule with port= is not seen as covering a logged event, so the same question returns on every run; events of children and hats defined in included files are dropped.
  • The tool does not check what an answer adds up to. (V)iew Changes before (S)ave Changes is the review step.
  • Observed on 2026-11-16: the tree's utils/ (aa-genprof, aa-logprof and their Python package) and the tree's profiles/apparmor.d were run in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64; apparmor_parser and the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts are findings/tools/observed/session1.txt and session2.txt.

for AppArmor developers

Code

09 Where to go from here

ROADS aa-logprof: it writes what you answer log · question · key · rule · save · reload ut-genprof the loop that starts a profile prac-abstractions what an include brings prac-general-purpose how broad is fine syn-owner the owner qualifier syn-globbing one star, two stars also: adm-denials (the records) · ut-cleanprof (redundant rules) · ut-modes · ut-notify syn-exec-modes · sec-unmediated
aa-logprof in the centre, with roads to ut-genprof, prac-abstractions, prac-general-purpose, syn-owner and syn-globbing, and a row naming adm-denials, ut-cleanprof, ut-modes, ut-notify, syn-exec-modes and sec-unmediated.

Next: ut-genprof, prac-abstractions, prac-general-purpose, syn-owner, syn-globbing, adm-denials, ut-cleanprof.

So aa-logprof is a patient clerk: it reads the log, asks, and writes down exactly what you say. The judgement stays with you. For that judgement, the abstractions deck shows what each include brings, and the deck on general-purpose apps says how broad an answer may be. The owner and globbing decks explain the two things the tool most often gets wrong for you. If you haven't seen the loop that creates a profile in the first place, that's the aa-genprof deck. And the denials deck reads the log records themselves, field by field.

Details and sources

Details

  • aa-logprof reads the log, asks about records no rule covers, writes the whole profile again with the answers and reloads it.
  • Watch the default answer, the order of the offers, owner, and how far Glob goes; view the changes before saving.

What each deck answers:

Read more

Basis of the statements on this page: "observed" means the utilities of the AppArmor tree at 836052d21 (6.0.0~alpha2) were run on 2026-11-16 in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64, apparmor_parser and the libapparmor Python binding 5.0.2 from Debian, auditd), as root, with keys sent by a script; transcripts are in findings/tools/observed/. "Code" means read from the tree and not run.

Command line

aa-logprof [-d DIR] [-f LOGFILE] [-m MARK] [-j] [-a] [--no-abstraction] [-o OUTDIR]

OptionMeaning
-d DIR, --dirprofile directory instead of the one from logprof.conf
-f FILE, --filelog file to read
-m MARK, --markstart after the first log line containing MARK
-j, --jsondialogs as JSON on standard output, answers on standard input
-a, --allow-allaccept the selected offer for every question without asking
--no-abstractiondo not offer abstractions
-o DIR, --output-dirwrite changed profiles into DIR

Order of one run

StepWhat happensBasis
1Updating AppArmor profiles in DIR.: every profile in the directory is readobserved
2Reading log entries from FILE.observed
3exec questionsobserved
4hat and child profile requestscode
5Complain-mode changes: then Enforce-mode changes:, per profile, rule questionsobserved
6= Changed Local Profiles =: view, saveobserved
7Writing updated profile for NAME., reloadobserved

Keys of a rule question

KeyMenu textEffect
A(A)llowadd the selected offer
D(D)enyadd it as a deny rule
I(I)gnoreskip for now
G(G)lobadd a wider path (files)
EGlob with (E)xtensionadd a wider path keeping the extension (files)
N(N)ewtype a path (files)
TAudi(t) / Audi(t) offtoggle audit
O(O)wner permissions on / offtoggle owner (files)
RAbo(r)tleave without saving, after a confirmation
F(F)inishgo to the save prompt
digits, arrowsselect an offer
Returnthe bracketed default; observed to be (D)eny for every rule question

Where the offers come from

OfferSource
include <abstractions/...>every abstraction with a rule covering the record, in name order; not those already included; not those marked # LOGPROF-SUGGEST: no; none with --no-abstraction
the exact rulethe log record, with owner when fsuid equals ouid, and with the permissions the profile already grants on the path merged in
paths of existing rulesrules of the profile whose path matches the logged path
[globs] substitutionslogprof.conf
Glob, Glob with Extension, Newadded by key

Glob steps

Start(G)lobagain
/usr/share/demo/words-1.txt/usr/share/demo/*/usr/share/**
/var/lib/demo//var/lib/*//var/**/
StartGlob with (E)xtensionagain
/var/lib/demo/state.db/var/lib/demo/*.db/var/lib/**.db

The first row of each table was observed; the others follow the tool's code.

Messages

MessageWhen
ERROR: Can't find system log "/var/log/syslog". Please check permissions.none of the configured log files exists (observed)
The logfile FILE does not exist. Please check the path.-f names a missing file
It seems AppArmor was not started. Please enable AppArmor and try again.AppArmor's interface is not mounted
Adding RULE to profile.after Allow or Deny (observed)
Deleted N previous matching profile entries.the new rule replaced exact duplicates (observed)
Denying via an include file isn't supported by the AppArmor toolsDeny pressed on an include offer
The specified path does not match this log entry ...(N)ew with a path that does not match
Writing updated profile for NAME.on save (observed)

Known discrepancies

Named by the titles used in the project's bug list where one exists:

  • The default answer of a rule question is always Deny (seen in both sessions; reported with this deck).
  • abstractions/apache2-common is offered first for any inet stream socket (seen; reported with this deck).
  • "The utilities' path matching ignores variables, so aa-logprof does not see that a rule with @{...} covers a logged path" (seen).
  • "aa-logprof --allow-all writes lowercase px, without environment scrubbing".
  • "aa-logprof never sees a network rule with port= as covering a logged event".
  • "Children and hats defined in an included file are unknown to the utilities: aa-logprof drops their events, aa-notify calls them unknown".
  • "The utilities flatten a nested child profile into a sibling and write it back that way".
  • default_owner_prompt in logprof.conf has no effect (read from the code; reported with this deck).

Roads from here

FILE ACCESS

QUALIFIERS

IN PRACTICE · general-purpose apps

SECURITY · threat model and limits

RUNNING THE PARSER

TOOLS · utils/