]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
ubuntu containers: use a seccomp filter by default (v2)
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 20 Jun 2014 20:40:42 +0000 (15:40 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 20 Jun 2014 21:37:06 +0000 (17:37 -0400)
Blacklist module loading, kexec, and open_by_handle_at (the cause of the
not-docker-specific dockerinit mounts namespace escape).

This should be applied to all arches, but iiuc stgraber will be doing
some reworking of the commonizations which will simplify that, so I'm
not doing it here.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
config/templates/Makefile.am
config/templates/ubuntu.common.conf.in
config/templates/ubuntu.priv.seccomp [new file with mode: 0644]
config/templates/ubuntu.userns.conf.in

index d0b1c8763d9e32c0d7b913bd13aa1fca3ad12efd..dec62d98e9bb5a8259fb926dd0bc811c11d5410c 100644 (file)
@@ -21,4 +21,5 @@ templatesconfig_DATA = \
        ubuntu-cloud.userns.conf \
        ubuntu.common.conf \
        ubuntu.lucid.conf \
-       ubuntu.userns.conf
+       ubuntu.userns.conf \
+       ubuntu.priv.seccomp
index 1ec323fe420c6c0912e1e57a49f796b845108b03..a61ed79c977982879e982638d8a5fb8a4b813009 100644 (file)
@@ -68,3 +68,7 @@ lxc.cgroup.devices.allow = c 10:232 rwm
 ## To use loop devices, copy the following line to the container's
 ## configuration file (uncommented).
 #lxc.cgroup.devices.allow = b 7:* rwm
+
+# Blacklist some syscalls which are not safe in privileged
+# containers
+lxc.seccomp = @LXCTEMPLATECONFIG@/ubuntu.priv.seccomp
diff --git a/config/templates/ubuntu.priv.seccomp b/config/templates/ubuntu.priv.seccomp
new file mode 100644 (file)
index 0000000..e6650ef
--- /dev/null
@@ -0,0 +1,8 @@
+2
+blacklist
+[all]
+kexec_load errno 1
+open_by_handle_at errno 1
+init_module errno 1
+finit_module errno 1
+delete_module errno 1
index 5643744df8d502988c3f9152a33d29d30076cbec..c744b1d66ad5446a59feb821b48de9844329a020 100644 (file)
@@ -17,3 +17,7 @@ lxc.mount.entry = /dev/zero dev/zero none bind,create=file 0 0
 # Extra fstab entries as mountall can't mount those by itself
 lxc.mount.entry = /sys/firmware/efi/efivars sys/firmware/efi/efivars none bind,optional 0 0
 lxc.mount.entry = /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc none bind,optional 0 0
+
+# Default seccomp policy is not needed for unprivileged containers, and
+# non-root users cannot use seccmp without NNP anyway.
+lxc.seccomp =