logprof - utility program for managing AppArmor security profiles
#name
NAME
#synopsis
SYNOPSIS
#options
OPTIONS
#description
DESCRIPTION
#responding_to_security_events
Responding to Security Events
#new_process__execution__events
New Process (Execution) Events
#changehat_events
ChangeHat Events
#capability_events
Capability Events
#bugs
BUGS
#see_also
SEE ALSO
NAME
logprof - utility program for managing AppArmor security profiles
SYNOPSIS
logprof [
-d  /path/to/profiles
] [
-f /path/to/logfile
] [
-m <mark in logfile>
]
OPTIONS
-d --dir   /path/to/profiles
Use this option to specify the full path to the location of
the profiles if the profiles are not located in the
default directory, /etc/subdomain.d/.
-f --file   /path/to/logfile
Use this option to specify the full path to the location of the
logfile if the logfile is not located in the
default directory, /var/log/messages/.
-m --logmark    ``mark''
Use this option to mark the starting point for logprof to look in
the system log. logprof will ignore all events in the system log
before the specified mark is seen.  If the mark contains spaces,
it must be surrounded with quotes to work correctly. An example
of this would look like: logprof -m "Jan 19 13:09:51"
DESCRIPTION
Llogprof
is an interactive tool used to review the learning/complain mode output found in the AppArmor syslog entries, then generate new entries in AppArmor security profiles.
When you run logprof, it begins to scan the log files produced in learning/complain mode, and if there are new security events that are not covered by the existing profile set, the user is prompted with suggestions for modifying the profile. The learning/complain mode traces program behavior and enters it in syslog. Logprof uses this information to observe program behavior.
If a confined program forks and execs another program, logprof will see this and ask the user which execution mode should be used when launching the child process. The following execution modes are options for starting the child process: ix, px, or ux. If a separate profile exists for the child process, the default selection will be px. If one doesn.t exist, the profile will default to ix. Child processes with separate profiles will be autodep.d and loaded into AppArmor, if it's running.
When logprof exits, profiles are updated with the changes. If AppArmor is running, the updated profiles are reloaded and if any processes that generated security events are still running in the null-complain-profile, those processes are set to run under their proper profiles.
Responding to Security Events
logprof
will generate a list of ``suggested profile changes'' that the
user can choose from, or they can create their own, to modifiy the permission set
of the profile so that the generated access violation will not re-occur.
The user is then presented with info about the access including profile,
path, old mode if there was a previous entry in the profile for
this path, new mode, the suggestion list, and given these options:
(A)llow, (D)eny, (N)ew, (G)lob last piece, (Q)uit
If the Apparmor profile was in complain mode when the event was generated,
the default for this option is (A)llow, otherwise, it's (D)eny.
The suggestion list is presented as a numbered list with includes at
the top, the literal path in the middle, and the suggested globs at the
bottom.  If any globs are being suggested, the shortest glob is the
selected option, otherwise, the literal path is selected.  Picking includes
from the list must be done manually.
Hitting a numbered key will change the selected option to the corresponding
numbered entry in the list.
If the user selects (N)ew, they'll be prompted to enter their own globbed
entry to match the path.  If the user-entered glob does not match the path for this
event, they'll be informed and have the option to fix it.
If the user selects (G)lob last piece then, taking the currently selected
option, logprof will remove the last path element and replace it with /*.
If the last path element already was /*, logprof will go up a directory level and
replace it with /**.
This new globbed entry is then added to the suggestion list and marked as the
selected option.
So /usr/share/themes/foo/bar/baz.gif can be turned into /usr/share/themes/**
by hitting ``g'' three times.
If the user selects (A)llow, logprof will take the current selection and add it to
the profile, deleting other entries in the profile that are matched by the
new entry.
Adding r access to /usr/share/themes/** would delete an entry for r access
to /usr/share/themes/foo/*.gif if it exists in the profile.
If (Q)uit is selected at this point, logprof will ignore all new pending capability
and path accesses.
After all of the path accesses have been handled, logrof will write all updated
profiles to the disk and reload them if AppArmor is running.
New Process (Execution) Events
If there are unhandled x accesses generated by the forking of a new process,
logprof will display the parent profile
and the target program that's being executed and prompt the user to select
and execute modifier. These modifiers will allow a choice for the target to:
have it's own profile (px), inherit the parent's  profile (ix), run unconstrained (ux),
or deny access for the target.
If there is a corresponding entry for the target in the qualifiers section of
/etc/logprof.conf, the presented list will contain only the allowed modes.
The default option for this question is selected using this logic--
# if px mode is allowed and profile exists for the target
#   px is default.
# else if ix mode is allowed
#   ix is default
# else
#   deny is default
logprof will never suggest ``ux'' as the default.
ChangeHat Events
If  unknown changehat events are found, the user is prompted to add a new hat,
if the events should go into the default hat for this profile based on the
corresponding entry in the defaulthat section of logprof.conf, or if the
following events that run under that hat should be denied altogether.
Capability Events
If there are capability accesses, the user is shown each capability
access and asked if the capability should be allowed, denied, or if the
user wants to quit.
BUGS
None
SEE ALSO
subdomain(7), subdomain.d(5), change_hat(2), logprof.conf(5),
genprof(1), complain(1), and enforce(1).
logprof - utility program for managing AppArmor security profiles
