apparmor_parser [options] <command> [profiles]...
apparmor_parser [options] <command>
apparmor_parser [-hv] [--help] [--version]
apparmor_parser is used as a general tool to compile, and manage
AppArmor policy, including loading new apparmor.d(5) profiles into the
AppArmor profiles restrict the operations available to processes.
The profiles are loaded into the Linux kernel by the apparmor_parser
program. The profiles may be specified by file name or a directory name
containing a set of profiles. If a directory is specified then the
apparmor_parser will try to do a profile load for each file in the
directory that is not a dot file, or explicitly black listed
(*.dpkg-new, *.dpkg-old, *.dpkg-dist, *-dpkg-bak, *.repnew, *.rpmsave,
*orig, *.rej, *~). The apparmor_parser will fall back to taking input
from standard input if a profile or directory is not supplied.
The input supplied to apparmor_parser should be in the format described
The command set is broken into four subcategories.
Commands that don't require any privilege and don't operate on
unprivileged profile commands
Commands that operate on a profile either specified on the command
line or read from stdin if no profile was specified.
Commands that require the MAC_ADMIN capability within the affected
AppArmor namespace to load policy into the kernel or filesystem
write permissions to update the affected privileged files (cache
privileged profile commands
Commands that require privilege and operate on profiles.
Print the version number and exit.
Give a quick reference guide.
-o file, --ofile file
Writes a binary (cached) profile to the specified file (implies -K
Unconditionally clear out cached profiles.
Privileged profile commands
Insert the AppArmor definitions given into the kernel. This is the
default action. This gives an error message if a AppArmor
definition by the same name already exists in the kernel, or if the
parser doesn't understand its input. It reports when an addition
This flag is required if an AppArmor definition by the same name
already exists in the kernel; used to replace the definition
already in the kernel with the definition given on standard input.
This flag is used to remove an AppArmor definition already in the
kernel. Note that it still requires a complete AppArmor definition
as described in apparmor.d(5) even though the contents of the
definition aren't used.
Treat the profile files specified on the command line (or stdin if
none specified) as binary cache files, produced with the -S or -o
options, and load to the kernel as specified by -a, -r, and -R
(implies -K and -T).
Force the profile to load in complain mode.
-b n, --base n
Set the base directory for resolving #include directives defined as
-I n, --Include n
Add element n to the search path when resolving #include directives
defined as an absolute paths.
-f n, --subdomainfs n
Set the location of the apparmor security filesystem (default is
-M n, --features-file n
Use the features file located at path "n" (default is
/etc/apparmor.d/cache/.features). If the --cache-loc option is
present, the ".features" file in the specified cache directory is
Report the cache processing (hit/miss details) when loading or
saving cached profiles.
Perform no caching at all: disables -W, implies -T.
By default, if a profile's cache is found in the location specified
by --cache-loc and the timestamp is newer than the profile, it will
be loaded from the cache. This option disables this cache loading
Write out cached profiles to the location specified in --cache-loc.
Off by default. In cases where abstractions have been changed, and
the parser is running with "--replace", it may make sense to also
use "--skip-read-cache" with the "--write-cache" option.
Skip updating the cache if it contains cached profiles in a bad or
Set the location of the cache directory. If not specified the
cache location defaults to /etc/apparmor.d/cache
Perform all actions except the actual loading of a profile into the
kernel. This is useful for testing profile generation, caching,
etc, without making changes to the running kernel profiles.
This also removes the need for privilege to execute the commands
that manage policy in the kernel
Do not report on the profiles as they are loaded, and not show
Report on the profiles as they are loaded, and show warnings.
Enable various warnings during policy compilation. A single dump
flag can be specified per --warn option, but the --warn flag can be
passed multiple times.
apparmor_parser --warn=rules-not-enforced ...
Use --help=warn to see a full list of which warn flags are
Given once, only checks the profiles to ensure syntactic
-j n, --jobs=n
Set the number of jobs used to compile the specified policy. Where
n can be
# - a specific number of jobs
auto - the # of cpus in the in the system
x# - # * number of cpus
-j8 OR --jobs=8 allows for 8 parallel jobs
-jauto OR --jobs=auto sets the jobs to the # of
-jx4 OR --jobs=x4 sets the jobs to # of cpus
-jx1 is equivalent to -jauto
The default value is the number of cpus in the system.
Set a hard cap on the value that can be specified by the --jobs
flag. It takes the same set of options available to the --jobs
option, and defaults to 8*cpus
-O n, --optimize=n
Set the optimization flags used by policy compilation. A single
optimization flag can be toggled per -O option, but the optimize
flag can be passed multiple times. Turning off some phases of the
optimization can make it so that policy can't complete compilation
due to size constraints (it is entirely possible to create a dfa
with millions of states that will take days or longer to compile).
Note: The parser is set to use a balanced default set of flags,
that will result in resonable compression but not take excessive
amounts of time to complete.
Use --help=optimize to see a full list of which optimization flags
--abort-on-error Abort processing of profiles on the first error
encountered, otherwise the parser will continue to try to compile other
profiles if specified.
Note: If an error is encountered while processing profiles the last
error encountered will be used to set the exit code.
--skip-bad-cache-rebuild The default behavior of the parser is to check
if a cached version of a profile exists and if it does it attempt to
load it into the kernel. If that load is rejected, then the parser will
attempt to rebuild the cache file, and load again.
This option tells the parser to not attempt to rebuild the cache on
failure, instead the parser continues on with processing the
As with the command line some options accumulate and others override,
ie. when there are conflicting versions of switch the last option is
the one chosen.
would result in Optimize=minimize being set.
The Include, Dump, and Optimize options accululate except for the
inversion option (no-X vs. X), and a couple options that work by
setting/clearing multiple options (compress-small). In that case the
option will override the flags it sets but will may accumulate with
All other options override previously set values.
If you find any bugs, please report them at
apparmor(7), apparmor.d(5), subdomain.conf(5), aa_change_hat(2), and
AppArmor 2.10.95 2016-01-14 APPARMOR_PARSER(8)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2018
All Rights Reserved.