Confine a Linux service with AppArmor profiles

8 steps · about 1 h 56 min · Intermediate

  1. Understand AppArmor as a Linux security module (reference, Linux kernel documentation, 8 min)

    The kernel's own page on what AppArmor is and how it is enabled at boot.

  2. Check AppArmor status and profile modes on Ubuntu (article, Ubuntu Server documentation, 15 min)

    Shows aa-status, profile locations and switching between complain and enforce.

  3. Enable AppArmor and load profiles on Debian (article, Debian Wiki, 12 min)

    Covers installing the utilities, kernel parameters and loading extra profiles.

  4. Read the AppArmor profile language quickly (reference, AppArmor project wiki, 20 min)

    A compact tour of file rules, permissions, capabilities and abstractions.

  5. Build a profile with the AppArmor tools (tutorial, AppArmor project wiki, 25 min)

    The upstream walkthrough of generating a profile from observed behaviour.

  6. Generate a starting profile with aa-genprof (reference, Arch Linux manual pages, 8 min)

    Explains the interactive loop of running the program and answering prompts.

  7. Refine a profile from denial logs with aa-logprof (reference, Arch Linux manual pages, 8 min)

    Turns logged denials into rules so the profile can move to enforce mode.

  8. Look up profile syntax in apparmor.d (reference, Arch Linux manual pages, 20 min)

    The full grammar reference for when a rule does not behave as expected.