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
- Generating a profile — the profiling loop and the exec question
- File rules — paths and permission letters in a file rule
- Profile mode flags — complain and enforce mode
Part of journeys
- Write your first profile, step 12 of 12 · previous: Generating a profile
01 From log records to rules
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 underComplain-mode changes:) andapparmor="DENIED"from profiles in enforce mode (underEnforce-mode changes:). Both headers are printed even when a section is empty. - The session on the slide:
demo extraunder the enforced profile printed/etc/demo/extra.conf: Permission denied; the log hadapparmor="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-logprofasked one question,Awroteowner /etc/demo/extra.conf r,, and afterSthe nextdemo extraworked. - The questions are the ones
aa-genprofasks during a scan;aa-genprofadds the starter profile, complain mode and the loop around them. See Generating a profile. - A
denyrule in a profile produces no log record, soaa-logprofnever 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'sprofiles/apparmor.dwere run in a disposable Debian forky/sid guest (kernel7.3.4+deb14-cloud-amd64;apparmor_parserand the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts arefindings/tools/observed/session1.txtandsession2.txt.
Read more
02 Which log, and which records
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
logfilessetting oflogprof.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 movingaudit.logaside in the guest. Install auditd, or write the kernel log to a file (for examplejournalctl -k > FILE) and pass it with-f; whether every field survives that route was not checked. - With
-fand a missing file:The logfile FILE does not exist. Please check the path. - Only lines containing
apparmor=,operation=ortype=AVCare 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.logheld 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-logprofrun of the session asked nothing. -m MARKskips every line before the first one that contains MARK; that line and the ones after it are read.aa-genprofuses this with its own mark. Observed:aa-logprof -m no-such-markprinted 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'sprofiles/apparmor.dwere run in a disposable Debian forky/sid guest (kernel7.3.4+deb14-cloud-amd64;apparmor_parserand the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts arefindings/tools/observed/session1.txtandsession2.txt.
Read more
for AppArmor developers
Code
set_logfile: aa.py:1478-1498; the line filter: logparser.py:59; dropped records: logparser.py:297-320; the mark: logparser.py:397-430.
03 One question, taken apart
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:
| Key | Effect |
|---|---|
| A, (A)llow | add the selected offer; an include offer also removes rules it makes redundant ("Deleted N previous matching profile entries.") |
| D, (D)eny | add the selected rule with deny; on an include offer: "Denying via an include file isn't supported by the AppArmor tools" |
| I, (I)gnore | write nothing; the record is asked about again on the next run |
| G, (G)lob | file questions: add a wider path to the offers |
| E, Glob with (E)xtension | file questions: the same, keeping the file extension |
| N, (N)ew | file questions: type a path |
| T, Audi(t) | toggle the audit qualifier on the offers |
| O, (O)wner permissions on / off | file 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)inish | stop asking and go to the save prompt |
| 1 to 9, arrow keys | select another offer |
| Return | the bracketed default |
- Headers depend on the kind of record:
PathandNew Modefor files;Capability;Accesses,Network Family,Socket Type,Local,Peerfor network; and so on for signals, ptrace, mounts and D-Bus. Old Modeappears when rules of the profile already give some permission on the path; the offer then holds the merged permissions.Severitycomes fromseverity.db: for exampleCAP_SYS_ADMIN 10,CAP_NET_RAW 8; paths have a number per access letter;unknownwhen 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'sprofiles/apparmor.dwere run in a disposable Debian forky/sid guest (kernel7.3.4+deb14-cloud-amd64;apparmor_parserand the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts arefindings/tools/observed/session1.txtandsession2.txt.
for AppArmor developers
Code
ask_rule_questions: aa.py:1128-1292;available_buttons: aa.py:1331-1361; the prompt loop: ui.py:407-564; the default: aa.py:1177-1182.
04 owner, and the merged mode
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) andouid(the file's owner). When they are equal the tool setsowneron the proposed rule and showsNew Mode: owner r. (O)wner permissions offremovesownerfrom every offer of the question; the key then reads(O)wner permissions on. Session:OthenAon/var/log/demo.logwrote/var/log/demo.log w,.- The run: the profile from the root session had
owner /etc/demo/demo.conf r,.demostarted by the usertester:/etc/demo/demo.conf: Permission denied,/usr/share/demo/words-1.txt: Permission denied,/var/lib/demo/state.db: Permission denied, with records such asapparmor="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-logprofrun asked withOld Mode: owner randNew Mode: r;AprintedAdding /etc/demo/demo.conf r, to profile.andDeleted 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_promptsetting oflogprof.confdescribes 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'sprofiles/apparmor.dwere run in a disposable Debian forky/sid guest (kernel7.3.4+deb14-cloud-amd64;apparmor_parserand the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts arefindings/tools/observed/session1.txtandsession2.txt.
Read more
- The owner qualifier, Reading a denial (the
fsuidandouidfields) - logprof.conf(5)
for AppArmor developers
Code
ownerfromfsuid == ouid: file.py:477-479; merging with existing permissions,propose_file_rules: aa.py:2378-2417; the toggle: aa.py:1204-1212.
05 Glob: one key, a wider rule
(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 forwords-1.txt), and substitutions from the[globs]section oflogprof.conf, for example/home/NAMEto/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)Gwas pressed once on the selected offer/usr/share/demo/* r,andAwrote/usr/share/** r,. That rule letsdemoread 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'sprofiles/apparmor.dwere run in a disposable Debian forky/sid guest (kernel7.3.4+deb14-cloud-amd64;apparmor_parserand the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts arefindings/tools/observed/session1.txtandsession2.txt.
for AppArmor developers
Code
glob_pathandglob_path_withext: aare.py:97-146; the keys inask_rule_questions: aa.py:1248-1287;[globs]: logprof.conf:140-179.
06 Saving: the file is rewritten
(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 -uof the file on disk against the new text, shown withless),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, theabiline, 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-cleanprofremoves 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'sprofiles/apparmor.dwere run in a disposable Debian forky/sid guest (kernel7.3.4+deb14-cloud-amd64;apparmor_parserand the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts arefindings/tools/observed/session1.txtandsession2.txt.
for AppArmor developers
Code
save_profiles: aa.py:1519-1580;serialize_profileandwrite_profile: aa.py:2210-2303;reload_profile: aa.py:2420-2438; the diff: ui.py:276-319.
07 logprof.conf
/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]:
| Setting | Shipped value | Meaning |
|---|---|---|
profiledir | /etc/apparmor.d /etc/subdomain.d | first existing directory is used; -d overrides |
inactive_profiledir | /usr/share/apparmor/extra-profiles | profiles offered instead of a starter profile |
logfiles | /var/log/audit/audit.log /var/log/syslog /var/log/messages | first existing file is read; -f overrides |
parser | /sbin/apparmor_parser /sbin/subdomain_parser | used to reload profiles |
logger | /bin/logger /usr/bin/logger | used by aa-genprof to write its mark |
default_owner_prompt | 1 | described with four values; cleared when the file is read (known discrepancy) |
custom_includes | empty | extra directories under the profile directory searched for include offers |
json_log | 0 | with --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.dblists 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 asSeverity:and has no other effect.--configdir DIR(not shown in--help) makes the tools readlogprof.confandseverity.dbfrom another directory.- This scene is read from the shipped file and the tool's code; the sessions used the shipped file unchanged.
Read more
- logprof.conf(5)
- Generating a profile (the scene "aa-autodep, scripts and programs the tools refuse"), Exec modes
for AppArmor developers
Code
- The shipped file: logprof.conf:12-179; reading it,
init_aa: aa.py:2573-2611; qualifiers in the exec question: aa.py:771;glob_common: aa.py:2537-2554.
08 Where the suggestions go wrong
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], underComplain-mode changes:as well. Pressing Return writes adenyrule; the program then fails at that point and, becausedenyrules 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 gavedemoApache's ptrace and signal rules.--no-abstractionturns 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 includesabstractions/base;/etc/nsswitch.confand/etc/passwdproposed as single rules with no offer ofabstractions/nameservice. ownerfrom 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
denyrules and denials silenced withdenynever reach the log. aa-logprof -a/--allow-allanswers 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 lowercasepx.- 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 Changesbefore(S)ave Changesis the review step. - Observed on 2026-11-16: the tree's
utils/(aa-genprof, aa-logprof and their Python package) and the tree'sprofiles/apparmor.dwere run in a disposable Debian forky/sid guest (kernel7.3.4+deb14-cloud-amd64;apparmor_parserand the Python binding of libapparmor 5.0.2 from Debian; auditd), as root. Keys were sent by a script on a terminal; the transcripts arefindings/tools/observed/session1.txtandsession2.txt.
Read more
- Choosing abstractions (the scene "How aa-logprof suggests an abstraction"), Profiles for general-purpose apps, Profiles for security-sensitive programs, Known bugs
- aa-logprof(8)
for AppArmor developers
Code
- The default: aa.py:1177-1182; offer order: aa.py:1150-1161; no variable table in the path matcher: aare.py:49;
allow_allmode: ui.py:78-80, ui.py:518-526.
09 Where to go from here
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-logprofreads 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:
- Generating a profile: the starter profile, the loop and the exec question.
- Choosing abstractions: what each include offer brings.
- Profiles for general-purpose apps: how broad an answer may be.
- The owner qualifier, Globbing, Exec modes.
- Reading a denial: the records the tool reads.
- Cleaning and merging profiles, Changing a profile's mode, aa-notify.
- What is not mediated: operations that never reach the log.
Read more
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]
| Option | Meaning |
|---|---|
-d DIR, --dir | profile directory instead of the one from logprof.conf |
-f FILE, --file | log file to read |
-m MARK, --mark | start after the first log line containing MARK |
-j, --json | dialogs as JSON on standard output, answers on standard input |
-a, --allow-all | accept the selected offer for every question without asking |
--no-abstraction | do not offer abstractions |
-o DIR, --output-dir | write changed profiles into DIR |
Order of one run
| Step | What happens | Basis |
|---|---|---|
| 1 | Updating AppArmor profiles in DIR.: every profile in the directory is read | observed |
| 2 | Reading log entries from FILE. | observed |
| 3 | exec questions | observed |
| 4 | hat and child profile requests | code |
| 5 | Complain-mode changes: then Enforce-mode changes:, per profile, rule questions | observed |
| 6 | = Changed Local Profiles =: view, save | observed |
| 7 | Writing updated profile for NAME., reload | observed |
Keys of a rule question
| Key | Menu text | Effect |
|---|---|---|
| A | (A)llow | add the selected offer |
| D | (D)eny | add it as a deny rule |
| I | (I)gnore | skip for now |
| G | (G)lob | add a wider path (files) |
| E | Glob with (E)xtension | add a wider path keeping the extension (files) |
| N | (N)ew | type a path (files) |
| T | Audi(t) / Audi(t) off | toggle audit |
| O | (O)wner permissions on / off | toggle owner (files) |
| R | Abo(r)t | leave without saving, after a confirmation |
| F | (F)inish | go to the save prompt |
| digits, arrows | select an offer | |
| Return | the bracketed default; observed to be (D)eny for every rule question |
Where the offers come from
| Offer | Source |
|---|---|
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 rule | the log record, with owner when fsuid equals ouid, and with the permissions the profile already grants on the path merged in |
| paths of existing rules | rules of the profile whose path matches the logged path |
[globs] substitutions | logprof.conf |
| Glob, Glob with Extension, New | added by key |
Glob steps
| Start | (G)lob | again |
|---|---|---|
/usr/share/demo/words-1.txt | /usr/share/demo/* | /usr/share/** |
/var/lib/demo/ | /var/lib/*/ | /var/**/ |
| Start | Glob with (E)xtension | again |
|---|---|---|
/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
| Message | When |
|---|---|
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 tools | Deny 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-commonis 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-allwrites lowercasepx, 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_promptinlogprof.confhas no effect (read from the code; reported with this deck).
Roads from here
FILE ACCESS
- Globbing (AARE) — one star and two stars
- Exec modes — the modes behind the exec question
QUALIFIERS
- The owner qualifier — what owner means on a rule
IN PRACTICE · general-purpose apps
- Choosing abstractions — where include offers come from and which to accept
- Profiles for general-purpose apps — how broad an answer may be
SECURITY · threat model and limits
- What is not mediated — operations that never reach the log
RUNNING THE PARSER
- Reading a denial — every field of the records the tool reads
TOOLS · utils/
- Generating a profile — the same questions inside the profiling loop
- Switching profile modes (no slides yet) — aa-complain and aa-enforce
- Keeping profiles tidy (no slides yet) — removing the redundant rules that are left behind
- aa-notify (no slides yet) — being told about denials as they happen