.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "APPARMOR_PARSER 8" .TH APPARMOR_PARSER 8 "2019-03-30" "AppArmor 2.13.2" "AppArmor" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" apparmor_parser \- loads AppArmor profiles into the kernel .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBapparmor_parser [options] [profiles]...\fR .PP \&\fBapparmor_parser [options] \fR .PP \&\fBapparmor_parser [\-hv] [\-\-help] [\-\-version]\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBapparmor_parser\fR is used as a general tool to compile, and manage AppArmor policy, including loading new \fBapparmor.d\fR\|(5) profiles into the Linux kernel. .PP AppArmor profiles restrict the operations available to processes. .PP The \fBprofiles\fR are loaded into the Linux kernel by the \fBapparmor_parser\fR program. The \fBprofiles\fR may be specified by file name or a directory name containing a set of profiles. If a directory is specified then the \&\fBapparmor_parser\fR 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, *.dpkg\-remove, *.pacsave, *.pacnew, *.rpmnew, *.rpmsave, *.orig, *.rej, *~). The \fBapparmor_parser\fR will fall back to taking input from standard input if a profile or directory is not supplied. .PP The input supplied to \fBapparmor_parser\fR should be in the format described in \&\fBapparmor.d\fR\|(5). .SH "COMMANDS" .IX Header "COMMANDS" The command set is broken into four subcategories. .IP "unprivileged commands" 4 .IX Item "unprivileged commands" Commands that don't require any privilege and don't operate on profiles. .IP "unprivileged profile commands" 4 .IX Item "unprivileged profile commands" Commands that operate on a profile either specified on the command line or read from stdin if no profile was specified. .IP "privileged commands" 4 .IX Item "privileged commands" Commands that require the \s-1MAC_ADMIN\s0 capability within the affected AppArmor namespace to load policy into the kernel or filesystem write permissions to update the affected privileged files (cache etc). .IP "privileged profile commands" 4 .IX Item "privileged profile commands" Commands that require privilege and operate on profiles. .SH "Unprivileged commands" .IX Header "Unprivileged commands" .IP "\-V, \-\-version" 4 .IX Item "-V, --version" Print the version number and exit. .IP "\-h, \-\-help" 4 .IX Item "-h, --help" Give a quick reference guide. .SH "Unprivileged profile commands" .IX Header "Unprivileged profile commands" .IP "\-N, \-\-names" 4 .IX Item "-N, --names" Produce a list of policies from a given set of profiles (implies \-K). .IP "\-p, \-\-preprocess" 4 .IX Item "-p, --preprocess" Apply preprocessing to the input profile(s) by flattening includes into the output profile and dump to stdout. .IP "\-S, \-\-stdout" 4 .IX Item "-S, --stdout" Writes a binary (cached) profile to stdout (implies \-K and \-T). .IP "\-o file, \-\-ofile file" 4 .IX Item "-o file, --ofile file" Writes a binary (cached) profile to the specified file (implies \-K and \-T) .SH "Privileged commands" .IX Header "Privileged commands" .IP "\-\-purge\-cache" 4 .IX Item "--purge-cache" Unconditionally clear out cached profiles. .SH "Privileged profile commands" .IX Header "Privileged profile commands" .IP "\-a, \-\-add" 4 .IX Item "-a, --add" 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 succeeded. .IP "\-r, \-\-replace" 4 .IX Item "-r, --replace" 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. .IP "\-R, \-\-remove" 4 .IX Item "-R, --remove" 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 \fBapparmor.d\fR\|(5) even though the contents of the definition aren't used. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\-B, \-\-binary" 4 .IX Item "-B, --binary" 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). .IP "\-C, \-\-Complain" 4 .IX Item "-C, --Complain" Force the profile to load in complain mode. .IP "\-b n, \-\-base n" 4 .IX Item "-b n, --base n" Set the base directory for resolving #include directives defined as relative paths. .IP "\-I n, \-\-Include n" 4 .IX Item "-I n, --Include n" Add element n to the search path when resolving #include directives defined as an absolute paths. .IP "\-f n, \-\-apparmorfs n" 4 .IX Item "-f n, --apparmorfs n" Set the location of the apparmor security filesystem (default is \&\*(L"/sys/kernel/security/apparmor\*(R"). .IP "\-M n, \-\-features\-file n" 4 .IX Item "-M n, --features-file n" Use the features file located at path \*(L"n\*(R" (default is /etc/apparmor.d/cache/.features). If the \-\-cache\-loc option is present, the \&\*(L".features\*(R" file in the specified cache directory is used. .IP "\-m n, \-\-match\-string n" 4 .IX Item "-m n, --match-string n" Only use match features \*(L"n\*(R". .IP "\-n n, \-\-namespace\-string n" 4 .IX Item "-n n, --namespace-string n" Force a profile to load in the namespace \*(L"n\*(R". .IP "\-X, \-\-readimpliesX" 4 .IX Item "-X, --readimpliesX" In the case of profiles that are loading on systems were \s-1READ_IMPLIES_EXEC\s0 is set in the kernel for a given process, load the profile so that any \*(L"r\*(R" flags are processed as \*(L"mr\*(R". .IP "\-k, \-\-show\-cache" 4 .IX Item "-k, --show-cache" Report the cache processing (hit/miss details) when loading or saving cached profiles. .IP "\-K, \-\-skip\-cache" 4 .IX Item "-K, --skip-cache" Perform no caching at all: disables \-W, implies \-T. .IP "\-T, \-\-skip\-read\-cache" 4 .IX Item "-T, --skip-read-cache" 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 behavior. .IP "\-W, \-\-write\-cache" 4 .IX Item "-W, --write-cache" 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 \*(L"\-\-replace\*(R", it may make sense to also use \&\*(L"\-\-skip\-read\-cache\*(R" with the \*(L"\-\-write\-cache\*(R" option. .IP "\-\-skip\-bad\-cache" 4 .IX Item "--skip-bad-cache" Skip updating the cache if it contains cached profiles in a bad or inconsistent state .IP "\-L, \-\-cache\-loc" 4 .IX Item "-L, --cache-loc" Set the location(s) of the cache directory. This option can accept a comma separated list of directories, which will be searched in order to find a matching cache. The first matching cache file found is used even if a directory later in the search order may contain a newer cache file. .Sp If multiple directories are specified and \-\-write\-cache has been specified then cache writes will be made to the first directory in the list, all other directories will be treated as read only. .Sp If a cache directory name needs to have a comma as part of the name, it can be specified by using a backslash to escape the comma character in the directory name. .Sp If not specified the cache location defaults to /var/cache/apparmor .IP "\-\-print\-cache\-dir" 4 .IX Item "--print-cache-dir" Print the cache directory location. This path will be a subdirectory of the directory specified by \-\-cache\-loc. The subdirectory used will be influenced by the features available in the currently running kernel or by the features specified with the \-\-match\-string or \-\-features\-file options. .IP "\-Q, \-\-skip\-kernel\-load" 4 .IX Item "-Q, --skip-kernel-load" 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. .Sp This also removes the need for privilege to execute the commands that manage policy in the kernel .IP "\-q, \-\-quiet" 4 .IX Item "-q, --quiet" Do not report on the profiles as they are loaded, and not show warnings. .IP "\-v, \-\-verbose" 4 .IX Item "-v, --verbose" Report on the profiles as they are loaded, and show warnings. .IP "\-\-warn=n" 4 .IX Item "--warn=n" 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. .Sp .Vb 1 \& apparmor_parser \-\-warn=rules\-not\-enforced ... .Ve .Sp Use \-\-help=warn to see a full list of which warn flags are supported. .IP "\-d, \-\-debug" 4 .IX Item "-d, --debug" Given once, only checks the profiles to ensure syntactic correctness. Given twice, dumps its interpretation of the profile for checking. .IP "\-D n, \-\-dump=n" 4 .IX Item "-D n, --dump=n" Debug flag for dumping various structures and passes of policy compilation. A single dump flag can be specified per \-\-dump option, but the dump flag can be passed multiple times. Note progress flags tend to also imply the matching stats flag. .Sp .Vb 1 \& apparmor_parser \-\-dump=dfa\-stats \-\-dump=trans\-stats .Ve .Sp Use \-\-help=dump to see a full list of which dump flags are supported .IP "\-j n, \-\-jobs=n" 4 .IX Item "-j n, --jobs=n" Set the number of jobs used to compile the specified policy. Where n can be .Sp .Vb 3 \& # \- a specific number of jobs \& auto \- the # of cpus in the in the system \& x# \- # * number of cpus .Ve .Sp Eg. \-j8 \s-1OR\s0 \-\-jobs=8 allows for 8 parallel jobs \-jauto \s-1OR\s0 \-\-jobs=auto sets the jobs to the # of cpus \-jx4 \s-1OR\s0 \-\-jobs=x4 sets the jobs to # of cpus * 4 \-jx1 is equivalent to \-jauto .Sp The default value is the number of cpus in the system. .IP "\-\-max\-jobs n" 4 .IX Item "--max-jobs n" 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 .IP "\-O n, \-\-optimize=n" 4 .IX Item "-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). .Sp Note: The parser is set to use a balanced default set of flags, that will result in reasonable compression but not take excessive amounts of time to complete. .Sp Use \-\-help=optimize to see a full list of which optimization flags are supported. .IP "\-\-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." 4 .IX Item "--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. .IP "\-\-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." 4 .IX Item "--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 remaining profiles. .IP "\-\-config\-file" 4 .IX Item "--config-file" Specify the config file to use instead of /etc/apparmor/parser.conf. This option will be processed early before regular options regardless of the order it is specified in. .IP "\-\-print\-config\-file" 4 .IX Item "--print-config-file" Print the config file location that will be used. .SH "CONFIG FILE" .IX Header "CONFIG FILE" An optional config file /etc/apparmor/parser.conf can be used to specify the default options for the parser, which then can be overridden using the command line options. .PP The config file ignores leading whitespace and treats lines that begin with # as comments. Config options are specified one per line using the same format as the longform command line options (without the preceding \-\-). .PP Eg. #comment .PP .Vb 2 \& optimize=no\-expr\-tree \& optimize=compress\-fast .Ve .PP 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. .PP Eg. Optimize=no\-minimize Optimize=minimize .PP would result in Optimize=minimize being set. .PP 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 others. .PP All other options override previously set values. .SH "BUGS" .IX Header "BUGS" If you find any bugs, please report them at . .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBapparmor\fR\|(7), \fBapparmor.d\fR\|(5), \fBaa_change_hat\fR\|(2), and .