From 720da111e2f2403d6e6790343db93d7031b7a2c7 Mon Sep 17 00:00:00 2001 From: Roberto Ricci Date: Sat, 21 Nov 2026 17:59:18 +0100 Subject: [PATCH] config/security/apparmor: improve apparmor documentation - Link to AppArmor's website - Use lsm= kernel commandline flag instead of the deprecated security= - Mention extra profiles - Explain how to override system-provided profiles --- src/config/security/apparmor.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/config/security/apparmor.md b/src/config/security/apparmor.md index 884b4509..6095ed0f 100644 --- a/src/config/security/apparmor.md +++ b/src/config/security/apparmor.md @@ -1,19 +1,34 @@ # AppArmor -AppArmor is a mandatory access control mechanism (like SELinux). It can -constrain programs based on pre-defined or generated policy definitions. +[AppArmor](https://apparmor.net/) is a mandatory access control mechanism (like +SELinux). It can constrain programs based on pre-defined or generated policy +definitions. Void ships with some default profiles for several services, such as `dhcpcd` and `wpa_supplicant`. Container runtimes such as LXC and podman integrate with AppArmor for better security for container payloads. -To use AppArmor install the `apparmor` package and add `apparmor=1 -security=apparmor` to the [kernel cmdline](./../kernel.md#cmdline). +To use AppArmor install the `apparmor` package and add `apparmor=1 lsm=apparmor` +to the [kernel cmdline](./../kernel.md#cmdline). By default AppArmor will boot in `enforce` mode and disallow all policy violations. To boot in `complain` mode, add `apparmor.mode=complain` to the kernel cmdline. +A few extra profiles, not enabled by default, are shipped in +`/usr/share/apparmor/extra-profiles/`. Enable the desired ones by copying them +into `/etc/apparmor.d/`. Some programs (e.g. `firefox`) have a default profile +file in `unconfined` mode. Changes to these files will be overwritten by `xbps` +when updating the `apparmor` package. In this case, to use a custom profile in +`enforce` or `complain` mode, disable the system-provided file by symlinking it +in `/etc/apparmor.d/disable/` and copy the custom profile into +`/etc/apparmor.d/` with a different name. E.g.: + +``` +# ln -s ../ /etc/apparmor.d/disable/ +# cp /etc/apparmor.d/_local +``` + AppArmor tools [aa-genprof(8)](https://man.voidlinux.org/aa-genprof.8) and [aa-logprof(8)](https://man.voidlinux.org/aa-logprof.8) require either configured [syslog](../services/logging.md) or a running