2007-04-11 08:12:51 +00:00
|
|
|
# ----------------------------------------------------------------------
|
2010-12-20 13:47:09 -06:00
|
|
|
# Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
|
|
|
# 2008, 2009
|
2007-04-11 08:12:51 +00:00
|
|
|
# NOVELL (All rights reserved)
|
|
|
|
#
|
2010-12-20 13:47:09 -06:00
|
|
|
# Copyright (c) 2010
|
|
|
|
# Canonical Ltd. (All rights reserved)
|
|
|
|
#
|
2007-04-11 08:12:51 +00:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, contact Novell, Inc.
|
|
|
|
# ----------------------------------------------------------------------
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2007-03-27 03:50:21 +00:00
|
|
|
AppArmor - kernel enhancement to confine programs to a limited set of resources.
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
AppArmor is a kernel enhancement to confine programs to a limited set
|
|
|
|
of resources. AppArmor's unique security model is to bind access control
|
|
|
|
attributes to programs rather than to users.
|
|
|
|
|
|
|
|
AppArmor confinement is provided via I<profiles> loaded into the kernel
|
2009-11-11 10:51:05 -08:00
|
|
|
via apparmor_parser(8), typically through the F</etc/init.d/apparmor>
|
2006-04-11 21:52:54 +00:00
|
|
|
SysV initscript, which is used like this:
|
|
|
|
|
2009-11-11 10:51:05 -08:00
|
|
|
# /etc/init.d/apparmor start
|
|
|
|
# /etc/init.d/apparmor stop
|
|
|
|
# /etc/init.d/apparmor restart
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
AppArmor can operate in two modes: I<enforcement>, and I<complain or learning>:
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item *
|
|
|
|
|
|
|
|
I<enforcement> - Profiles loaded in enforcement mode will result
|
|
|
|
in enforcement of the policy defined in the profile as well as reporting
|
|
|
|
policy violation attempts to syslogd.
|
|
|
|
|
|
|
|
=item *
|
|
|
|
|
|
|
|
I<complain> - Profiles loaded in C<complain> mode will not enforce policy.
|
|
|
|
Instead, it will report policy violation attempts. This mode is convenient for
|
|
|
|
developing profiles. To manage complain mode for individual profiles the
|
2006-11-03 09:47:55 +00:00
|
|
|
utilities aa-complain(8) and aa-enforce(8) can be used.
|
2006-04-11 21:52:54 +00:00
|
|
|
These utilities take a program name as an argument.
|
|
|
|
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
Profiles are traditionally stored in files in F</etc/apparmor.d/>
|
|
|
|
under filenames with the convention of replacing the B</> in pathnames
|
|
|
|
with B<.> (except for the root B</>) so profiles are easier to manage
|
2006-11-03 09:47:55 +00:00
|
|
|
(e.g. the F</usr/sbin/nscd> profile would be named F<usr.sbin.nscd>).
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
Profiles are applied to a process at exec(3) time (as seen through the
|
|
|
|
execve(2) system call); an already running process cannot be confined.
|
|
|
|
However, once a profile is loaded for a program, that program will be
|
|
|
|
confined on the next exec(3).
|
|
|
|
|
|
|
|
AppArmor supports the Linux kernel's securityfs filesystem, and makes
|
|
|
|
available the list of the profiles currently loaded; to mount the
|
|
|
|
filesystem:
|
|
|
|
|
|
|
|
# mount -tsecurityfs securityfs /sys/kernel/security
|
|
|
|
$ cat /sys/kernel/security/apparmor/profiles
|
|
|
|
/usr/bin/mutt
|
|
|
|
/usr/bin/gpg
|
|
|
|
...
|
|
|
|
|
|
|
|
Normally, the initscript will mount securityfs if it has not already
|
|
|
|
been done.
|
|
|
|
|
|
|
|
AppArmor also restricts what privileged operations a confined process
|
|
|
|
may execute, even if the process is running as root. A confined process
|
|
|
|
cannot call the following system calls:
|
|
|
|
|
|
|
|
create_module(2) delete_module(2) init_module(2) ioperm(2)
|
|
|
|
iopl(2) mount(2) umount(2) ptrace(2) reboot(2) setdomainname(2)
|
|
|
|
sethostname(2) swapoff(2) swapon(2) sysctl(2)
|
|
|
|
|
|
|
|
A confined process can not call mknod(2) to create character or block devices.
|
|
|
|
|
|
|
|
=head1 ERRORS
|
|
|
|
|
|
|
|
When a confined process tries to access a file it does not have permission
|
2006-11-03 09:47:55 +00:00
|
|
|
to access, the kernel will report a message through audit, similar to:
|
|
|
|
|
|
|
|
audit(1148420912.879:96): REJECTING x access to /bin/uname
|
|
|
|
(sh(6646) profile /tmp/sh active /tmp/sh)
|
|
|
|
|
|
|
|
audit(1148420912.879:97): REJECTING r access to /bin/uname
|
|
|
|
(sh(6646) profile /tmp/sh active /tmp/sh)
|
|
|
|
|
|
|
|
audit(1148420944.837:98): REJECTING access to capability
|
|
|
|
'dac_override' (sh(6641) profile /tmp/sh active /tmp/sh)
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
The permissions requested by the process are immediately after
|
|
|
|
REJECTING. The "name" and process id of the running program are reported,
|
|
|
|
as well as the profile name and any "hat" that may be active. ("Name"
|
|
|
|
is in quotes, because the process name is limited to 15 bytes; it is the
|
|
|
|
same as reported through the Berkeley process accounting.) If no hat is
|
2010-12-20 13:47:09 -06:00
|
|
|
active (see aa_change_hat(2)) then the profile name is printed for "active".
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
For confined processes running under a profile that has been loaded in
|
|
|
|
complain mode, enforcement will not take place and the log messages
|
2006-11-03 09:47:55 +00:00
|
|
|
reported to audit will be of the form:
|
|
|
|
|
|
|
|
audit(1146868287.904:237): PERMITTING r access to
|
|
|
|
/etc/apparmor.d/tunables (du(3811) profile /usr/bin/du active
|
|
|
|
/usr/bin/du)
|
|
|
|
|
|
|
|
audit(1146868287.904:238): PERMITTING r access to /etc/apparmor.d
|
|
|
|
(du(3811) profile /usr/bin/du active /usr/bin/du)
|
|
|
|
|
|
|
|
|
|
|
|
If the userland auditd is not running, the kernel will send audit events
|
|
|
|
to klogd; klogd will send the messages to syslog, which will log the
|
|
|
|
messages with the KERN facility. Thus, REJECTING and PERMITTING messages
|
|
|
|
may go to either F</var/log/audit/audit.log> or F</var/log/messages>,
|
|
|
|
depending upon local configuration.
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
=head1 FILES
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
2009-11-11 10:51:05 -08:00
|
|
|
=item F</etc/init.d/apparmor>
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
=item F</etc/apparmor.d/>
|
|
|
|
|
2009-11-11 10:51:05 -08:00
|
|
|
=item F</var/lib/apparmor/>
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2006-11-03 09:47:55 +00:00
|
|
|
=item F</var/log/audit/audit.log>
|
|
|
|
|
|
|
|
=item F</var/log/messages>
|
|
|
|
|
2006-04-11 21:52:54 +00:00
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2010-12-20 13:47:09 -06:00
|
|
|
apparmor_parser(8), aa_change_hat(2), apparmor.d(5),
|
|
|
|
subdomain.conf(5), aa-autodep(1), clean(1),
|
2006-11-03 09:47:55 +00:00
|
|
|
auditd(8),
|
2010-12-20 13:47:09 -06:00
|
|
|
aa-unconfined(8), aa-enforce(1), aa-complain(1), and
|
|
|
|
L<http://wiki.apparmor.net>.
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
=cut
|