On live mode apparmor breaks completely 0 profile loaded:
apparmor module is loaded.
0 profiles are loaded.
0 profiles are in enforce mode.
0 profiles are in complain mode.
0 processes have profiles defined.
0 processes are in enforce mode.
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.
On persistent mode doesn’t load all profiles, only 3 if I recall correctly.
Tested on KVM.
Any advice is welcomed if a solution is not ready.
[Unit]
Description=Load AppArmor profiles
DefaultDependencies=no
Before=sysinit.target
After=local-fs.target
After=systemd-journald-audit.socket
RequiresMountsFor=/var/cache/apparmor
AssertPathIsReadWrite=/sys/kernel/security/apparmor/.load
ConditionSecurity=apparmor
Documentation=man:apparmor(7)
Documentation=https://gitlab.com/apparmor/apparmor/wikis/home/
# Don't start this unit on the Ubuntu Live CD
ConditionPathExists=!/rofs/etc/apparmor.d
# Don't start this unit on the Debian Live CD when using overlayfs
ConditionPathExists=!/run/live/overlay/work
[Service]
Type=oneshot
ExecStart=/lib/apparmor/apparmor.systemd reload
ExecReload=/lib/apparmor/apparmor.systemd reload
# systemd maps 'restart' to 'stop; start' which means removing AppArmor confinement
# from running processes (and not being able to re-apply it later).
# Upstream systemd developers refused to implement an option that allows overriding
# this behaviour, therefore we have to make ExecStop a no-op to error out on the
# safe side.
#
# If you really want to unload all AppArmor profiles, run aa-teardown
ExecStop=/bin/true
RemainAfterExit=yes
[Install]
WantedBy=sysinit.target
Culprit being:
# Don't start this unit on the Debian Live CD when using overlayfs
ConditionPathExists=!/run/live/overlay/work
Next step, find out which component creates /run/live/overlay/work?
user@host:~$ sudo systemctl status apparmor
Warning: The unit file, source configuration file or drop-ins of apparmor.servic
● apparmor.service - Load AppArmor profiles
Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; vendor preset:
Drop-In: /lib/systemd/system/apparmor.service.d
└─30_live_mode.conf
Active: inactive (dead)
Condition: start condition failed at Thu 2019-06-20 12:31:10 UTC; 6min ago
└─ ConditionPathExists=!/run/live/overlay/work was not met
Docs: man:apparmor(7)
https://gitlab.com/apparmor/apparmor/wikis/home/
Jun 20 12:31:10 host systemd[1]: Condition check resulted in Load AppArmor profi