The AppArmor user space development project.
Find a file
Steve Beattie 5a93959068 regression tests: have ptrace use PTRACE_GETREGSET by default
Bug: https://bugs.launchpad.net/apparmor/+bug/1470985

The ptrace regression test fails to compile on the arm64 platform,
because it uses PTRACE_GETREGS and not the newer PTRACE_GETREGSET
interface for getting access to arch-specific register information[0].
However, fixing it is complicated by the fact that the struct name
for for the general purpose registers is not named consistently
across architectures. This patch attempts to address those issues,
and compiles at least on i386, amd64, arm64, arm (armhf), ppc64,
and ppc64el. The test is verified to continue to function correctly
on i386 and amd64.

[0] https://sourceware.org/ml/archer/2010-q3/msg00193.html

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2015-07-02 23:24:54 -07:00
changehat Respect $CPPFLAGS 2015-06-10 12:36:15 -07:00
common rename _clean to pod_clean in Makefiles 2015-01-30 22:15:53 +01:00
deprecated rename _clean to pod_clean in Makefiles 2015-01-30 22:15:53 +01:00
documentation Minor updates and reorg to apparmor tech docs 2014-11-03 17:21:20 -08:00
kernel-patches Update kernel-patches directory with compatibility patches for v3.{7,8,9,10,11,12} 2013-10-29 11:59:11 -07:00
libraries/libapparmor libapparmor: Don't apply special SWIG %exception to some functions 2015-06-16 15:51:19 -05:00
parser Fix NETWORK RULE in apparmor.d manpage 2015-06-26 12:46:46 +02:00
profiles profiles: postfix/master also needs lock permissions for master.pid 2015-06-25 13:16:49 +02:00
tests regression tests: have ptrace use PTRACE_GETREGSET by default 2015-07-02 23:24:54 -07:00
utils Fix rttime default unit in RlimitRule 2015-06-27 21:52:09 +02:00
.bzrignore Add *.orig to .bzrignore 2015-06-08 22:23:51 +02:00
LICENSE Add a top-level "catch-all" GPLv2 license to cover any files that are 2007-03-30 15:47:14 +00:00
Makefile common: more Make.rules cruft removal 2015-01-23 16:01:14 -08:00
README Update the top-level README for the utils rewrite 2014-11-18 10:27:56 -06:00

------------
Introduction
------------
AppArmor protects systems from insecure or untrusted processes by
running them in restricted confinement, while still allowing processes
to share files, exercise privilege and communicate with other processes.
AppArmor is a Mandatory Access Control (MAC) mechanism which uses the
Linux Security Module (LSM) framework. The confinement's restrictions
are mandatory and are not bound to identity, group membership, or object
ownership. The protections provided are in addition to the kernel's
regular access control mechanisms (including DAC) and can be used to
restrict the superuser.

The AppArmor kernel module and accompanying user-space tools are
available under the GPL license (the exception is the libapparmor
library, available under the LGPL license, which allows change_hat(2)
and change_profile(2) to be used by non-GPL binaries).

For more information, you can read the techdoc.pdf (available after
building the parser) and by visiting the http://apparmor.net/ web
site.


-------------
Source Layout
-------------

AppArmor consists of several different parts:

changehat/	source for using changehat with Apache, PAM and Tomcat
common/		common makefile rules
desktop/	empty
kernel-patches/	compatibility patches for various kernel versions
libraries/	libapparmor source and language bindings
parser/		source for parser/loader and corresponding documentation
profiles/	configuration files, reference profiles and abstractions
tests/		regression and stress testsuites
utils/		high-level utilities for working with AppArmor

--------------------------------------
Important note on AppArmor kernel code
--------------------------------------

While most of the kernel AppArmor code has been accepted in the
upstream Linux kernel, a few important pieces were not included. These
missing pieces unfortunately are important bits for AppArmor userspace
and kernel interaction; therefore we have included compatibility
patches in the kernel-patches/ subdirectory, versioned by upstream
kernel (2.6.37 patches should apply cleanly to 2.6.38 source).

Without these patches applied to the kernel, the AppArmor userspace
will not function correctly.

------------------------------------------
Building and Installing AppArmor Userspace
------------------------------------------

To build and install AppArmor userspace on your system, build and install in
the following order.


libapparmor:
$ cd ./libraries/libapparmor
$ sh ./autogen.sh
$ sh ./configure --prefix=/usr --with-perl --with-python # see below
$ make
$ make check
$ make install

[an additional optional argument to libapparmor's configure is --with-ruby, to
generate Ruby bindings to libapparmor.]


Utilities:
$ cd utils
$ make
$ make check
$ make install


parser:
$ cd parser
$ make		# depends on libapparmor having been built first
$ make check
$ make install


Apache mod_apparmor:
$ cd changehat/mod_apparmor
$ make		# depends on libapparmor having been built first
$ make install


PAM AppArmor:
$ cd changehat/pam_apparmor
$ make		# depends on libapparmor having been built first
$ make install


Profiles:
$ cd profiles
$ make
$ make check	# depends on the parser having been built first
$ make install


[Note that for the parser and the utils, if you only with to build/use
 some of the locale languages, you can override the default by passing
 the LANGS arguments to make; e.g. make all install "LANGS=en_US fr".]

-------------------
AppArmor Testsuites
-------------------

A number of testsuites are in the AppArmor sources. Most have documentation on
usage and how to update and add tests. Below is a quick overview of their
location and how to run them.


Regression tests
----------------
For details on structure and adding tests, see
tests/regression/apparmor/README.

To run:
$ cd tests/regression/apparmor (requires root)
$ make
$ sudo make tests
$ sudo bash open.sh -r	 # runs and saves the last testcase from open.sh


Parser tests
------------
For details on structure and adding tests, see parser/tst/README.

To run:
$ cd parser/tst
$ make
$ make tests


Libapparmor
-----------
For details on structure and adding tests, see libraries/libapparmor/README.
$ cd libraries/libapparmor
$ make check

Utils
-----
Tests for the Python utilities exist in the test/ subdirectory.
$ cd utils
$ make check

The aa-decode utility to be tested can be overridden by
setting up environment variable APPARMOR_DECODE; e.g.:

$ APPARMOR_DECODE=/usr/bin/aa-decode make check

Profile checks
--------------
A basic consistency check to ensure that the parser and aa-logprof parse
successfully the current set of shipped profiles. The system or other
parser and logprof can be passed in by overriding the PARSER and LOGPROF
variables.
$ cd profiles
$ make && make check

Stress Tests
------------
To run AppArmor stress tests:
$ make all

Use these:
$ ./change_hat
$ ./child
$ ./kill.sh
$ ./open
$ ./s.sh

Or run all at once:
$ ./stress.sh

Please note that the above will stress the system so much it may end up
invoking the OOM killer.

To run parser stress tests (requires /usr/bin/ruby):
$ ./stress.sh

(see stress.sh -h for options)

-----------------------------------------------
Building and Installing AppArmor Kernel Patches
-----------------------------------------------

TODO


-----------------
Required versions
-----------------

The AppArmor userspace utilities are written with some assumptions about
installed and available versions of other tools. This is a (possibly
incomplete) list of known version dependencies:

The Python utilities require a minimum of Python 2.7 or Python 3.3.

Some utilities (aa-exec, aa-notify and aa-decode) require Perl 5.10.1 or newer.

Most shell scripts are written for POSIX-compatible sh. aa-decode expects
bash, probably version 3.2 and higher.