The audit qualifier
log what is allowed for application developers for administrators for security researchers
audit in front of an allow rule logs every access the rule permits. audit in front of a deny rule logs the refusals that a plain deny keeps quiet. It changes what is logged and not what is allowed.
On the map: qualifiers
▶ Watch this deck — 8 scenes, ~6 min
Worth seeing first
- allow and deny — why a plain deny is silent, which audit changes
Part of journeys
- Hardening a privileged program, step 7 of 11 · previous: Capability rules · next: Profile mode flags
- How a rule becomes a permission, step 7 of 12 · previous: allow and deny · next: Rule priority
01 Allowed, but you want to know
audit RULE, logs each access the rule permits, as an apparmor="AUDIT" record. It does not change the decision. (The kernel, read from the source.)
When demo reads a file its profile allows, nothing is written anywhere. Most of the time that's what you want: a log full of permitted opens is no use to anyone. But a few files are different. Take demo's TLS private key. The open is allowed, and still you'd like a record each time it happens. That's what audit is for. Put the word audit in front of a rule for that file, and every access the rule covers leaves a record marked AUDIT in the log. The open itself goes ahead exactly as before. Audit changes what you're told, not what's permitted.
Details and sources
Details
- Syntax: the keyword
auditin front of a rule, as inaudit /etc/demo/tls/key.pem r,. - Without
audit, an allowed access produces no record: the kernel keeps only the requested permissions that are in the profile's audit set, and returns without logging when none are left (file.c:119-130 for files, lib.c:432-438 for the other rule classes). - The record type is the string
AUDIT, written asapparmor="AUDIT"(audit.c:29-30, audit.c:143-146). - The record on the slide is adapted from a real one in the libapparmor test suite (testcase36.in):
apparmor="AUDIT" operation="getattr" class="file" profile="/usr/sbin/mosquitto" name="/etc/mosquitto/pwfile" pid=8119 comm="mosquitto" requested_mask="r" fsuid=122 ouid=122. An AUDIT record hasrequested_maskand nodenied_mask. - The program
demo, its key file and its profile are invented for the map. Nothing on this slide was observed on a running kernel; the kernel behaviour is stated from the kernel source.
Read more
- apparmor.d(5), audit.
- apparmor.net: Audit the system: how AppArmor uses the kernel audit subsystem, with and without auditd.
- Reading denials: where the records arrive and what each field means.
- How the kernel builds the record.
for AppArmor developers for security researchers
In the code
- In the grammar the audit seat is either empty or the word
audit(parser_yacc.y:693-694); the keyword table maps the word at parser_misc.c:99.
02 The second seat
[priority=N] audit [allow|deny|prompt] [owner|other] RULE,. audit works on file, capability, signal, network and most other rules, and on blocks. The order of the qualifiers is fixed.
There are four seats in front of a rule, and audit has the second one: after a priority, before allow or deny, before owner. Here it is on three file rules. It isn't limited to files, though. Capabilities, signals, network rules: nearly every kind of rule takes it. You can combine it with deny, and that's the combination you'll use most, as you'll see in a moment. The order is fixed. It's audit deny, not deny audit, and a priority comes first. And you can put audit in front of a block in braces, to audit every rule inside.
Details and sources
Details
- Order of the qualifiers:
[priority=N] [audit] [allow|deny|prompt] [owner|other] RULE,. The order is fixed. - Block form:
audit { RULES }applies the qualifier to every rule inside. Example from the parser's tests: entry_mods_audit_ok1.sd. - Run with the parser built from the AppArmor tree at 836052d21 (
-Q -K --skip-kernel-load --warn=all, nothing loaded into a kernel): deny audit /foo r,is rejected:syntax error, unexpected TOK_AUDIT, expecting TOK_ID or TOK_MODE or TOK_SET_VAR.audit priority=1 /foo r,is rejected:syntax error, unexpected TOK_PRIORITY, expecting TOK_ID or TOK_MODE or TOK_SET_VAR.- The full form of the message is
AppArmor parser error for FILE in profile FILE at line N: MESSAGE. - "Nearly every kind of rule":
set rlimitrules take no qualifier at all, also not through a block; the message isprefix not allowed on rlimit rules(parser.h:171-178, bad_rlimit_block_audit.sd). This is from the parser source and its test file. @{HOME}is defined intunables/home, whichtunables/globalincludes.
Read more
- apparmor.d(5), Rule Qualifiers and apparmor.d(5), audit.
- allow and deny, priority, owner: the other three seats.
- Qualifier blocks.
for AppArmor developers for security researchers
In the code
- The order comes from the
opt_prefixproduction (parser_yacc.y:705-711); the audit seat isopt_audit_flag(parser_yacc.y:693-694).
03 audit on an allow rule
An audit allow rule logs uses of the permissions it names, in enforce and in complain mode. Permissions granted by other rules are not logged. This is read from the kernel source of the kernel, not observed on a running kernel.
Audit is precise. Here demo may read and write its state, but only the write rule carries audit. Demo opens the state file for reading: allowed, and nothing in the log. Demo opens it for writing: allowed again, and this time there's an AUDIT record with requested mask w. You get one for every such open, whatever mode the profile is in. So think before you audit a pattern that matches thousands of opens a second, because the log will show every one. Going by the code of the kernel, repeats of the same capability within a second are dropped, but file records aren't thinned out like that.
Details and sources
Details
- Only the permissions named by the
auditrule are logged. The parser built from the AppArmor tree at 836052d21 compilesaudit /a r,to a state with allow0x10004and audit0x10004; a rule withoutauditleaves the audit set empty. - Kernel side, read from the kernel source and not observed on a running kernel:
- For an allowed file request the kernel keeps the requested permissions that are in the audit set and logs a record of type AUDIT if any are left (file.c:119-130). The profile mode is not consulted on this path, so it is the same in enforce and in complain mode.
- File rules are consulted when a file is opened. Later reads and writes on the open file descriptor are normally not checked again while the task's confinement is unchanged (file.c:626-660), so expect a record per open and not per
read()orwrite(). - Capabilities: an audited capability is logged, but a repeat of the same capability by the same credentials within one second is dropped (capability.c:67-110). Nothing comparable exists for file records.
- Record fields:
requested_maskholds the audited permissions only. Opening the file read-write with the rules on the slide givesrequested_mask="w". - No log volume was measured for the map.
Read more
- apparmor.d(5), audit.
- apparmor.net: Audit the system: where the records go.
- Access modes: what
randwcover. - Reading denials.
for AppArmor developers for security researchers
In the code
- The file rule emitter passes the permissions as the audit mask when the rule has
audit:entry->audit == audit_t::FORCE ? entry->perms : 0(parser_regex.c:685-688). - Capabilities are kept as bit sets; the audited ones are packed as
allowed_caps & caps.audit(block_rules.cc:143-152, parser_interface.c:551).
04 audit deny: a refusal you can see
deny RULE, refuses silently. audit deny RULE, refuses and logs apparmor="DENIED". The program sees EACCES in both cases. (The kernel, read from the source.)
This is the combination to remember. A plain deny refuses and says nothing. That's right for known noise. But some things a healthy demo should not be attempting at all, like reading your SSH keys, and there silence is the wrong choice: an attempt is exactly what you want to hear about. So write audit deny. The refusal stays, and the DENIED record comes back into the log, with the path and the permission that was asked for. Demo gets the same error either way, EACCES. The only difference is whether you find out.
Details and sources
Details
- Run with the parser built from the AppArmor tree at 836052d21:
deny /c r,compiles to a state whose quiet set equals the denied permissions;audit deny /b r,compiles to the same denial with an empty quiet set. - Kernel side, read from the kernel source and not observed on a running kernel: for a refused file request the kernel removes the quieted permissions from the request, and when nothing is left it returns the error without a record (file.c:132-149). With an empty quiet set the record is written with type DENIED in enforce mode (audit.c:206-213).
- The error the program sees is
EACCESwith or withoutaudit. - DENIED records carry both
requested_maskanddenied_mask, thenfsuid=andouid=. - The rule is line 27 of the map's example profile:
audit deny @{HOME}/.ssh/** rw,. The example profile carriesflags=(complain, ...). In complain mode this rule is logged as ALLOWED and not refused (next scene); the slide shows it as it behaves in an enforce-mode profile. - An administrator can see quieted denials without editing profiles by setting the kernel's audit mode to
noquiet(/sys/module/apparmor/parameters/audit); the quiet sets are then ignored (file.c:143-146, lib.c:374-380).
Read more
- apparmor.d(5), deny and apparmor.d(5), audit.
- apparmor(7), Debugging: "Turn off deny audit quieting", the system-wide switch.
- allow and deny: why a plain deny is silent.
- Reading denials.
for security researchers
For a security review
- A plain
denyleaves no record: a confined program that probes a denied path is not visible in the log unless the rule isaudit denyor the kernel's audit mode isnoquietorall. Shipped profiles use plaindenyto silence noise, so the absence of DENIED records is not evidence that nothing was attempted. - Changing the kernel's audit mode needs policy administration rights (lsm.c:2201-2218). The mode
quietsuppresses all records, including those asked for byauditrules (audit.c:216-219).
05 audit and complain mode
In complain mode: audit allow logs AUDIT; plain deny still refuses without a record; audit deny is logged as ALLOWED and permitted. The last two are derived from the kernel source of the kernel and were not tested on a running kernel.
Complain mode turns refusals into log records, so you can learn what a program needs. With no rule, the access is allowed and logged as ALLOWED. An audited allow logs AUDIT, as usual. A plain deny keeps refusing, silently, even here. And now the odd one. Going by the kernel source of the kernel, audit deny in complain mode is logged as ALLOWED and the access goes through. What kept the plain deny in force was its quiet marking, and audit takes that away. These last two come from reading the code, not from a test. So don't count on audit deny to protect anything while a profile is in complain mode.
Details and sources
Details
All statements here are read from the kernel source of the kernel. Rows 3 and 4 of the slide are derived from that code and were not tested on a running kernel.
- No rule (row 1): the request is not allowed; nothing is quieted; in complain mode the record type becomes ALLOWED (audit.c:206-213) and the error is turned into success (audit.c:233-234, audit.h:206-211).
auditallow (row 2): the request is allowed, so the audited permissions are logged as AUDIT; the profile mode plays no part (file.c:119-130).- Plain
deny(row 3): the denied permissions are in the quiet set. The kernel removes them from the request, nothing is left, and it returns the error before the complain-mode conversion is reached (file.c:143-149). Result:EACCES, no record. audit deny(row 4): the denied permissions are not allowed and not quieted. The request is handled like row 1: logged as ALLOWED and permitted.- The parser does not send a separate "denied" set to the kernel: a deny rule reaches it as "not allowed" plus "quiet". That is why removing the quiet marking also removes what kept the denial in force in complain mode.
- The manual page describes this differently: it says complain mode converts only implicit denials when the kernel carries explicit denial information (apparmor.d.pod:608-616). This is a known discrepancy between the documentation and the code read here; the map does not say which one is intended.
Read more
- apparmor(7), Complain mode.
- apparmor.d(5), Profile Mode.
- Profile modes: complain mode itself.
- allow and deny: what a deny rule becomes.
for security researchers
For a security review
- A profile in complain mode with
audit denyrules gives a log that says ALLOWED for the accesses its author meant to forbid. Treataudit denyin a complain-mode profile as detection only. - A request that mixes a quieted denied permission with a permission that is merely not granted is judged on the remaining permissions after the quiet ones are removed (file.c:143-153): by the code, in complain mode the whole request is then permitted. Derived, not tested.
for AppArmor developers for security researchers
In the code
aa_audit_file(file.c:95-154),aa_audit(audit.c:200-236),complain_error(audit.h:206-211).- For rule classes checked through
aa_check_permsthe same order applies: quiet bits are removed first and the function returns when none are left (lib.c:440-447); otherwiseaa_select_audit_typepicks ALLOWED when all denied bits are incomplain(audit.c:143-151).
06 The audit and quiet masks for AppArmor developers for security researchers
audit → audit mask; plain deny → quiet mask; audit deny → neither (parser/rule.h:426-440). aa_audit_file (linux:security/apparmor/file.c:95-154, the kernel) applies them.
In the parser, audit is a field with three values: unspecified, force and implied. A plain deny gets implied, which compares equal to force. So both pass their permissions as the fourth argument, and on a deny node that argument means quiet. Audit deny is set back to unspecified, so nothing is quieted. Inside a state, audit is resolved per bit together with allow, so a higher priority rule can take it away. In the kernel the other end is aa_audit_file. For an allowed request it reports only the audited bits. For a denied one it removes the quiet bits first, and with nothing left it returns the error without a record.
Details and sources
for AppArmor developers for security researchers
Details
audit_thas the values UNSPECIFIED, FORCE and IMPLIED;internal_audit_t::operator==makes IMPLIED compare equal to FORCE (rule.h:195-232).- Applying a prefix: deny together with audit gives DENY with UNSPECIFIED; deny alone gives DENY with IMPLIED; audit alone gives FORCE. Rule objects: rule.h:426-440; file rules: parser_misc.c:1132-1142. The grammar sets FORCE for the keyword at parser_yacc.y:693-694.
- File rule emitter: for a deny entry the fourth argument of
add_ruleis the quiet mask, for the others the audit mask (parser_regex.c:675-688). - State dumps on the slide were produced with the parser built from the AppArmor tree at 836052d21 (
-D rule-exprs -D dfa-states-initial). Format(allow/deny//prompt/audit/quiet);rfor the owner and other halves together is0x10004. - Per-bit resolution in
pri_update_perm: a deny node sets deny and quiet and clears allow and audit for its bits (hfa.cc:1589-1593); allow and prompt nodes add their audit bits (hfa.cc:1639, hfa.cc:1650). - Packing:
PACK_AUDIT_CTL(audit, quiet)(immunix.h:126-127); in a permission table entry the audit and quiet words are written at parser_interface.c:356-357. - Kernel, read and not run:
aa_audit_file(file.c:95-154);aa_check_permsfor the other classes (lib.c:425-464);aa_select_audit_type(audit.c:143-151);aa_audit(audit.c:200-236). - The kernel's audit mode rewrites the masks per check:
allsets audit to every permission,noquietclears quiet (lib.c:374-380).
Read more
- apparmor(7), Force audit mode: the audit mode that rewrites the masks.
- AppArmor wiki: TechnicalDoc_HFA_permissions: how permissions are encoded on accept states.
- Permissions in the compiled policy.
- How the kernel builds the record.
07 When audit does not do what you expect
audit deny and priority=N audit are the valid orders. A higher-priority rule without audit removes the audit of lower rules for the permissions it grants. The rule qualifier, the profile flag audit and the kernel's audit mode are three separate switches.
Two mistakes are about order. Audit comes before deny, and after a priority. Get either wrong and you get a plain syntax error. A quieter one involves priority. The rule that wins a permission also decides whether that permission is audited. Here a priority one rule without audit grants read, so the audit on the lower rule is lost for read and kept for write. And don't mix up three switches that share a name: the qualifier on one rule, the audit flag on a whole profile, and the kernel's audit mode for every profile. This deck is about the first. If no audit records show up at all, check where your audit log goes.
Details and sources
Details
- Order errors, run with the parser built from the AppArmor tree at 836052d21:
deny audit /foo r,:syntax error, unexpected TOK_AUDIT, expecting TOK_ID or TOK_MODE or TOK_SET_VAR.audit priority=1 /foo r,:syntax error, unexpected TOK_PRIORITY, expecting TOK_ID or TOK_MODE or TOK_SET_VAR.- Audit lost to priority: with the parser built from the tree,
priority=1 /a r, audit /a rw,compiles to a state where read and write are allowed and only write and append are audited. Audit is decided per permission together with allow, and the priority 1 rule wins the read permission. - A deny rule removes the audit of an allow rule of the same priority for the same permission (parser source).
- Three switches, read from the source:
- the rule qualifier
audit(this deck); - the profile flag
flags=(audit)(profile.h:221-222), covered in other profile flags; - the kernel's audit mode,
/sys/module/apparmor/parameters/audit, with the valuesnormal,quiet_denied,quiet,noquiet,alland one more for quieting allowed accesses (audit.c:20-27, the kernel). When it is notnormalit replaces the profile's own setting (policy.h:459-465). conflicting audit prefixis a message in the parser source.audit { audit /a r, }andaudit { audit deny /a r, }are accepted by the tree's parser, and no input that produces the message was found.- Known discrepancy: a
deny { }block around anaudit denyrule loses the audit. Observed with the parser built from the tree for file, signal and ptrace rules; see the reference below.
Read more
- apparmor.d(5), audit.
- apparmor(7), Force audit mode: auditing everything, per profile or globally.
- apparmor.net: Troubleshooting.
- Priority.
- Reading denials: where the audit log goes.
08 Where to go from here
Next: syn-allow-deny, syn-priority, syn-qualifier-blocks, adm-denials (reading the records), k-audit (how they are produced), syn-flags-modes (complain mode).
So: audit on an allow rule for the few accesses you want a trail of, and audit deny for the things that shouldn't happen. Next door, the allow and deny deck explains why a plain deny is silent, priority explains how an audit can be overridden, and qualifier blocks covers audit for a group of rules. If you look after machines, the reading denials deck shows where these records arrive and how to read each field, and the kernel audit deck shows how they're built. Complain mode has a deck of its own too.
Details and sources
Details
auditon an allow rule: an AUDIT record for each use of the permissions the rule names.audit deny: the refusal of a deny rule with its DENIED record restored.- Neither changes which accesses are allowed in enforce mode. For complain mode see the scene "audit and complain mode".
- Commits read for this deck: AppArmor 836052d21 (6.0.0~alpha2), the kernel-rc2 (97d73c825).
Read more
Read more
Basis of the statements on this page: "tree" means the parser built from the AppArmor commit above was run on the fragment (-Q -K --skip-kernel-load --warn=all), with nothing loaded into a kernel; "code" means the parser source or the kernel source of mainline Linux 7.4 was read, not run; "derived" means the result was reasoned from that code. Nothing here was observed on a running kernel.
Grammar
RULE: [priority=N] audit [allow|deny|prompt] [owner|other] RULE ,
BLOCK: audit [allow|deny|prompt] [owner|other] { RULES }
auditis the second qualifier: afterpriority=N, before the access type (code).- It is accepted on file, link, capability, network, signal, ptrace, mount, dbus, unix and the other rule classes, and on blocks.
set rlimitrules take no qualifier:prefix not allowed on rlimit rules(code). audit denyis the only way to combine the two words;deny auditis a syntax error (tree).- Examples in the parser's tests:
audit /foo rw,,audit rw /bar,,audit { /one rw, }(parser/tst/simple_tests/profile/entry_mods_audit_ok1.sd),audit other /tmp/** rw,(parser/tst/simple_tests/file/ok_other_3.sd).
What is logged
| Rule for the request | Enforce mode | Complain mode |
|---|---|---|
audit allow rule | allowed, apparmor="AUDIT" | allowed, apparmor="AUDIT" |
allow rule without audit | allowed, no record | allowed, no record |
| no rule | refused, apparmor="DENIED" | allowed, apparmor="ALLOWED" |
deny rule | refused, no record | refused, no record (derived) |
audit deny rule | refused, apparmor="DENIED" | allowed, apparmor="ALLOWED" (derived) |
- The whole table is from the kernel source of mainline Linux 7.4 (code). The two complain-mode rows marked "derived" follow from that code and were not tested on a running kernel.
- Only the permissions named by the
auditrule are logged. Permissions that other rules grant on the same path are not. - File rules are consulted at open; reads and writes on an open file descriptor are normally not checked again, so there is a record per open (code).
Record fields
An AUDIT record (from libraries/libapparmor/testsuite/test_multi/testcase36.in):
apparmor="AUDIT" operation="getattr" class="file" profile="/usr/sbin/mosquitto" name="/etc/mosquitto/pwfile" pid=8119 comm="mosquitto" requested_mask="r" fsuid=122 ouid=122
A DENIED record, as produced for an audit deny rule (shape of the kernel's file records, values invented):
apparmor="DENIED" operation="open" class="file" profile="demo" name="/home/user/.ssh/id_rsa" pid=4242 comm="demo" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
- An AUDIT record has
requested_maskand nodenied_mask.requested_maskholds the audited permissions only. fsuid=is the task's filesystem uid,ouid=the owner of the object.- Reading the records: adm-denials. How they are built: k-audit.
Interactions
- Priority. Audit is decided per permission together with allow: the rule that wins a permission also decides whether it is audited.
priority=1 /a r, audit /a rw,allows read and write and audits only write and append (tree). See syn-priority. - Deny. A deny rule removes the audit of an allow rule of the same priority for the same permission (code).
- Capabilities. Audited capabilities are kept as a capability set. In the kernel a repeat of the same capability by the same credentials within one second is not logged again (code).
- change_profile.
auditon achange_profilerule is accepted and has no effect at this commit: the rule is compiled without an audit mask (code: parser/parser_regex.c:765-773). With--warn=rule-downgradedor--warn=allthe parser printsWarning kernel does not support audit modifier for change_profile rule.; by default it prints nothing (tree). - The profile flag.
flags=(audit)is a switch for a whole profile: syn-flags-other. - The kernel's audit mode.
/sys/module/apparmor/parameters/auditapplies to every profile and, when it is notnormal, replaces the profile's own setting.allaudits every access,noquietshows the denials that deny rules quiet,quietsuppresses all records (code, mainline Linux 7.4). Changing it needs policy administration rights.
What audit does not tell you
- An
auditrule reports only the accesses that rule covers. Everything else that is allowed stays unlogged. - A plain
denyleaves no record in either mode. A missing DENIED record does not show that nothing was attempted. - In complain mode an
audit denyrule does not refuse (derived). - With the kernel's audit mode set to
quiet, rules withauditproduce no records (code).
Errors and warnings
The full form of a parser error is AppArmor parser error for FILE in profile FILE at line N: MESSAGE (tree). The table gives MESSAGE.
| Message | Example | When |
|---|---|---|
| syntax error, unexpected TOK_AUDIT, expecting TOK_ID or TOK_MODE or TOK_SET_VAR | deny audit /foo r, | audit after the access type (tree) |
| syntax error, unexpected TOK_PRIORITY, expecting TOK_ID or TOK_MODE or TOK_SET_VAR | audit priority=1 /foo r, | priority=N after audit (tree) |
| prefix not allowed on rlimit rules | audit { set rlimit nofile <= 1024, } | any qualifier on an rlimit rule (tree, and the parser's test rlimits/bad_rlimit_block_audit.sd) |
| conflicting audit prefix | none found | present in the parser source; audit { audit /a r, } and audit { audit deny /a r, } are accepted (tree) and no input producing the message was found |
| Warning kernel does not support audit modifier for change_profile rule. | audit change_profile -> x, | a warning of the class rule-downgraded, printed whatever the kernel supports; off by default (tree) |
Known discrepancies
These are differences between the documentation and the behaviour, listed as such. They are not taught as intended behaviour.
deny { audit deny RULE, }anddeny { deny { audit RULE, } }compile as a quiet deny: the audit is lost. Observed with the tree's parser for file, signal and ptrace rules. The manual page says a deny applied to a rule that carries audit results in an audited denial. Capability rules keep the audited denial (tree).- The manual page's text on complain mode and explicit denials (
parser/apparmor.d.pod, lines 608-616) does not match the kernel code read for the table above: by that code a plaindenyis kept in force by its quiet marking, and anaudit denyis not kept in force.
for AppArmor developers for security researchers
Code map and dumps
| What | Where |
|---|---|
opt_audit_flag, opt_prefix | parser_yacc.y:693-694, parser_yacc.y:705-711 |
keyword audit | parser_misc.c:99 |
internal_audit_t, audit_t values (IMPLIED equals FORCE) | rule.h:195-232 |
prefix_rule_t::add_prefix (rule objects) | rule.h:397-440 |
generic_add_prefix (file rules) | parser_misc.c:1121-1142 |
| file rule emitter, audit or quiet as fourth argument | parser_regex.c:675-688 |
audit change_profile warning | parser_regex.c:725-730 |
| capability sets | block_rules.cc:143-152, parser_interface.c:549-552 |
pri_update_perm | hfa.cc:1589-1593, hfa.cc:1639, hfa.cc:1650 |
PACK_AUDIT_CTL | immunix.h:126-127 |
| audit and quiet words of a permission entry | parser_interface.c:356-357 |
aa_audit_file | file.c:95-154 |
aa_file_perm (cached checks on open files) | file.c:626-660 |
aa_check_perms | lib.c:425-464 |
| audit mode applied to the masks | lib.c:374-390 |
aa_select_audit_type, aa_audit | audit.c:143-151, audit.c:200-236 |
complain_error | audit.h:206-211 |
audit mode names, AUDIT_MODE() | audit.c:20-27, policy.h:459-465 |
| capability audit cache | capability.c:67-110 |
State dumps (-D rule-exprs -D dfa-states-initial), format (allow/deny//prompt/audit/quiet). Per half x 0x1, w 0x2, r 0x4, a 0x8; the other half is shifted left by 14, so r for both halves is 0x10004, w with its implied append is 0x2800a and rw is 0x3800e.
| Rules | State | Basis |
|---|---|---|
audit /a r, | (0x 10004/0//0/10004/0) | tree |
audit deny /b r, | (0x 0/10004//0/0/0) | tree |
deny /c r, | (0x 0/10004//0/0/10004) | tree |
priority=1 /a r, audit /a rw, | (0x 3800e/0//0/2800a/0) | tree |
priority=-1 /a r, deny /a r, priority=5 audit /a r, | (0x 10004/0//0/10004/0) | tree |
Roads from here
START HERE
- The profile language at a glance — every kind of line on one page
PROFILE HEAD
- Profile mode flags — complain mode
- The other profile flags — the audit flag of a whole profile
QUALIFIERS
- allow and deny — why a plain deny is silent
- Rule priority — a higher priority rule can take the audit away
- Qualifier blocks — audit for a group of rules
RUNNING THE PARSER
- Reading a denial — reading AUDIT ALLOWED and DENIED records
IN THE KERNEL
- How a denial is logged (no slides yet) — how the kernel builds the record
THE DFA ENGINE · libapparmor_re
- Permissions in the DFA — the audit and quiet masks in the compiled policy