Table of Contents

Ubuntu - AppArmor - Create an AppArmor Profile

Design a test plan

Try to think about how the application should be exercised. The test plan should be divided into small test cases. Each test case should have a small description and list the steps to follow.

Some standard test cases are:


Generate the new profile

Use aa-genprof to generate a new profile.

sudo aa-genprof executable

For example:

sudo aa-genprof slapd

To get your new profile included in the apparmor-profiles package, file a bug in Launchpad against the AppArmor package:


Profiles

AppArmor profiles are simple text files located in /etc/apparmor.d/. The files are named after the full path to the executable they profile replacing the “/” with “.”. For example /etc/apparmor.d/bin.ping is the AppArmor profile for the /bin/ping command.

There are two main type of rules used in profiles:

As an example take a look at /etc/apparmor.d/bin.ping:

/etc/apparmor.d/bin.ping
#include <tunables/global>
/bin/ping flags=(complain) {
  #include <abstractions/base>
  #include <abstractions/consoles>
  #include <abstractions/nameservice>
 
  capability net_raw,
  capability setuid,
  network inet raw,
 
  /bin/ping mixr,
  /etc/modules.conf r,
}