Docker: AppArmor is off, and kernel and userspace have to land together #70
Labels
No labels
blocked-physical
cleanup
hardware
infra
kernel
P1-critical
P2-high
P3-normal
P4-later
reliability
security
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tiagoagueda/a80#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Deliberately excluded from the Tier 0 kernel change. Recording why, so it does not get
"fixed" later without the other half.
Measured
apparmor_parseris not installed on the board/etc/apparmor.d/exists with two leftover profiles (local,usr.sbin.dhclient)CONFIG_SECURITYwasn, so no LSM at allCONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,ipe,bpf"- noapparmorin itWhy it was left out
Turning on
CONFIG_SECURITY_APPARMORalone is worse than leaving it off. If the kernelreports AppArmor as enabled and the userspace cannot load the
docker-defaultprofile,every container start fails with a confusing error. The kernel option and the
apparmorpackage have to arrive in the same change.To do it properly
CONFIG_SECURITY=y,CONFIG_SECURITY_APPARMOR=yapparmortoCONFIG_LSM- compiling it in is not enough, it must be in theordered list or it stays inactive
apt install apparmorinprovision.shdocker infono longer reports AppArmor as absentMeanwhile
Containers are unconfined by LSM. Seccomp still applies -
CONFIG_SECCOMPandCONFIG_SECCOMP_FILTERare both on, so the default seccomp profile works. This is adefence-in-depth gap, not an open door.
Done, and both halves landed together as this issue required.
What changed
patches/configs/apparmor.config, kept as its own fragment rather than folded intodocker.configso the reasoning stays attached to it:The
CONFIG_LSMline is the one that is easy to get wrong. Compiling AppArmor in is not enough -it is an ordered list, and a module missing from it is present, visible in
/sys/module, andenforces nothing.
The
apparmorpackage went onto the board before the kernel that carries the LSM, which isthe whole point of this issue: a kernel advertising AppArmor while
apparmor_parseris missingmakes every container start fail.
apparmor_parser 4.1.0, and it is inpackages.txtso aprovisioned rootfs gets it.
Verified, not assumed
and the check that actually matters - is a container confined, rather than merely running on a
kernel that has the module:
Containers still start (
container OK), 0 failed units, 4 GiB and all five cgroup controllersintact.
Guarded
provision.shgained five assertions covering both halves and the enforce state, because "themodule is loaded" and "containers are confined" are different claims and only the second one is
worth anything:
Still 0 failures on the board.
One note for #72's benefit
The kernel is now 8.58 MiB, up ~170 KiB. It would not have booted before
SYS_BOOTM_LENwas raised - it would have reset with no console output, looking exactly like an instant panic.
Nice to have that cost paid already rather than rediscovered here.