Manually activating enforce mode (using the command
line) removes mode ags from the top of the prole
/bin/foo flags=(complain) becomes /bin/foo.
genprof
Generate or update a prole. When running, you must
specify a program to prole. If the specied program is
not an absolute path, genprof searches the $PATH variable. If a prole does not exist, genprof creates one using
autodep.
logprof
Manage AppArmor proles. logprof is an interactive tool
used to review the learning or complain mode output
found in the AppArmor syslog entries and to generate
new entries in AppArmor proles.
unconned
Output a list of processes with open tcp or udp ports
that do not have AppArmor proles loaded.
Methods of Proling
Stand-Alone Proling
Using genprof. Suitable for proling small applications.
Systemic Proling
Suitable for proling large numbers of programs all at
once and for proling applications that may run “forever.”
To apply systemic proling, proceed as follows:
1. Create proles for the individual programs that make
up your application (autodep).
2. Put relevant proles into learning or complain mode.
3. Exercise your application.
4. Analyze the log (logprof).
5. Repeat Steps 3-4.
6. Edit the proles.
7. Return to enforce mode.
8.
Reload all proles (rcapparmor restart).
Learning Mode
When using genprof, logprof, or YaST in learning mode,
you get several options for how to proceed:
Allow
Grant access.
Deny
Prevent access.
Glob
Modify the directory path to include all les in the suggested directory.
Glob w/Ext
Modify the original directory path while retaining the
lename extension. This allows the program to access
all les in the suggested directories that end with the
specied extension.
Edit
Enable editing of the highlighted line. The new (edited)
line appears at the bottom of the list. This option is called
New in the logprof and genprof command line tools.
Abort
Abort logprof or YaST, losing all rule changes entered
so far and leaving all proles unmodied.
Finish
Close logprof or YaST, saving all rule changes entered
so far and modifying all proles.
Example Prole
#include<tunables/global>
@{HOME} = /home/*/ /root/ # variable
/usr/bin/foo {
#include <abstractions/base>
network inet tcp,
capability setgid,
/bin/mount ux,
/dev/{,u}random r,
/etc/ld.so.cache r,
/etc/foo/* r,
/lib/ld-*.so* mr,
/lib/lib*.so* mr,
/proc/[0-9]** r,
/usr/lib/** mr,
/tmp/ r,
/tmp/foo.pid wr,
/tmp/foo.* lrw,
/@{HOME}/.foo_file rw,
/@{HOME}/.foo_lock kw,
link /etc/sysconfig/foo -> /etc/foo.conf,
deny /etc/shadow w,
owner /home/*/** rw,
/usr/bin/foobar cx,
/bin/** px -> bin_generic
# comment on foo's local profile, foobar.
foobar {
/bin/bash rmix,
/bin/cat rmix,
/bin/more rmix,
/var/log/foobar* rwl,
/etc/foobar r,
}
}
2