(Dwight, I took the liberty of adding your Ack but the code did change a bit to continue passing the char *label from attach. Tested that "lxc-start -n u1 -s lxc.aa_profile=p2; lxc-attach -n u1" does attach you to the p2 profile) Apparmor policies require mount restrictions to fullfill many of their promises - for instance if proc can be mounted anywhere, then 'deny /proc/sysrq-trigger w' prevents only accidents, not malice. The mount restrictions are not available in the upstream kernel. We can detect their presence through /sys. In the past, when we detected it missing, we would not enable apparmor. But that prevents apparmor from helping to prevent accidents. At the same time, if the user accidentaly boots a kernel which has regressed, we do not want them starting the container thinking they are more protected than they are. This patch: 1. adds a lxc.aa_allow_incomplete = 1 container config flag. If not set, then any container which is not set to run unconfined will refuse to run. If set, then the container will run with apparmor protection. 2. to pass this flag to the apparmor driver, we pass the container configuration (lxc_conf) to the lsm_label_set hook. 3. add a testcase. To test the case were a kernel does not provide mount restrictions, we mount an empty directory over the /sys/kernel/security/apparmor/features/mount directory. In order to have that not be unmounted in a new namespace, we must test using unprivileged containers (who cannot remove bind mounts which hide existing mount contents). Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Dwight Engen <dwight.engen@oracle.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com>
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| Makefile.am | Loading commit data... | |
| aa.c | Loading commit data... | |
| attach.c | Loading commit data... | |
| cgpath.c | Loading commit data... | |
| clonetest.c | Loading commit data... | |
| concurrent.c | Loading commit data... | |
| console.c | Loading commit data... | |
| containertests.c | Loading commit data... | |
| createtest.c | Loading commit data... | |
| destroytest.c | Loading commit data... | |
| device_add_remove.c | Loading commit data... | |
| get_item.c | Loading commit data... | |
| getkeys.c | Loading commit data... | |
| list.c | Loading commit data... | |
| locktests.c | Loading commit data... | |
| lxc-test-apparmor-mount | Loading commit data... | |
| lxc-test-autostart | Loading commit data... | |
| lxc-test-checkpoint-restore | Loading commit data... | |
| lxc-test-cloneconfig | Loading commit data... | |
| lxc-test-ubuntu | Loading commit data... | |
| lxc-test-unpriv | Loading commit data... | |
| lxc-test-usernic.in | Loading commit data... | |
| lxcpath.c | Loading commit data... | |
| may_control.c | Loading commit data... | |
| reboot.c | Loading commit data... | |
| saveconfig.c | Loading commit data... | |
| shutdowntest.c | Loading commit data... | |
| snapshot.c | Loading commit data... | |
| startone.c | Loading commit data... |