LinuxCommandLibrary

aa-audit

Process AppArmor audit events

TLDR

Set a profile to audit mode

$ sudo aa-audit [profile_name]
copy

Set multiple profiles to audit mode
$ sudo aa-audit [profile1 profile2 ...]
copy

Set a profile to audit mode from a specific directory
$ sudo aa-audit [[-d|--dir]] /[path/to/profiles] [profile_name]
copy

Force audit mode even if already applied
$ sudo aa-audit --force [profile_name]
copy

Set a profile to audit mode without reloading it
$ sudo aa-audit --no-reload [profile_name]
copy

Remove audit mode for a profile
$ sudo aa-audit [[-r|--remove]] [profile_name]
copy

Display help
$ aa-audit [[-h|--help]]
copy

SYNOPSIS

aa-audit profile [profile …]

PARAMETERS

profile
    Name or absolute path to AppArmor profile(s) to set into audit mode

-h, --help
    Display usage information

--version
    Display version information

DESCRIPTION

aa-audit is a utility from the AppArmor toolkit for Linux systems using the AppArmor Mandatory Access Control (MAC) framework. It changes the enforcement mode of specified AppArmor profiles to audit mode.

In audit mode, the kernel does not enforce the profile's restrictions but logs all access attempts that match profile rules—both permitted and denied. This generates comprehensive AUDIT log entries in addition to standard violation logs, ideal for profiling application behavior, tuning rules, and debugging without interrupting operations.

Logs appear in kernel logs (e.g., via dmesg, journalctl, or auditd). It's commonly used during profile development before switching to complain (log violations only, no enforcement) or enforce (block violations) modes. Requires root privileges and loaded profiles; use aa-status to verify.

CAVEATS

Must run as root (sudo). Profiles must be already loaded (aa-status to check). Does not load unloaded profiles. Audit mode generates high log volume.

EXAMPLE

sudo aa-audit /usr/bin/bash
Sets bash profile to audit mode.

sudo aa-audit usr.sbin.nginx
Sets nginx profile (by name).

VIEWING LOGS

journalctl -k | grep APPARMOR or aa-logprof to analyze audit data.

HISTORY

Part of AppArmor utilities since ~2009 (AppArmor v2), developed originally by Novell (SUSE) and Canonical (Ubuntu). Audit mode added for advanced tuning; maintained in libapparmor-utils package.

SEE ALSO

aa-enforce(8), aa-complain(8), aa-status(8), aa-logprof(1), apparmor(7), apparmor.d(5)

Copied to clipboard