From: Christian Brauner Date: Sun, 3 May 2020 10:01:44 +0000 (+0200) Subject: common.conf: add cgroup2 default device limits X-Git-Tag: lxc-5.0.0~443^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dd7f9052fef12c4516fa7f62e267554a489fd9f;p=thirdparty%2Flxc.git common.conf: add cgroup2 default device limits Fixes: #3183 Cc: Thomas Moschny Signed-off-by: Christian Brauner --- diff --git a/config/templates/common.conf.in b/config/templates/common.conf.in index c4b3bdcce..286c5e4a3 100644 --- a/config/templates/common.conf.in +++ b/config/templates/common.conf.in @@ -15,6 +15,8 @@ lxc.cap.drop = mac_admin mac_override sys_time sys_module sys_rawio # Ensure hostname is changed on clone lxc.hook.clone = @LXCHOOKDIR@/clonehostname +# Default legacy cgroup configuration +# # CGroup whitelist lxc.cgroup.devices.deny = a ## Allow any mknod (but not reading/writing the node) @@ -42,6 +44,35 @@ lxc.cgroup.devices.allow = c 136:* rwm ### fuse lxc.cgroup.devices.allow = c 10:229 rwm +# Default unified cgroup configuration +# +# CGroup whitelist +lxc.cgroup2.devices.deny = a +## Allow any mknod (but not reading/writing the node) +lxc.cgroup2.devices.allow = c *:* m +lxc.cgroup2.devices.allow = b *:* m +## Allow specific devices +### /dev/null +lxc.cgroup2.devices.allow = c 1:3 rwm +### /dev/zero +lxc.cgroup2.devices.allow = c 1:5 rwm +### /dev/full +lxc.cgroup2.devices.allow = c 1:7 rwm +### /dev/tty +lxc.cgroup2.devices.allow = c 5:0 rwm +### /dev/console +lxc.cgroup2.devices.allow = c 5:1 rwm +### /dev/ptmx +lxc.cgroup2.devices.allow = c 5:2 rwm +### /dev/random +lxc.cgroup2.devices.allow = c 1:8 rwm +### /dev/urandom +lxc.cgroup2.devices.allow = c 1:9 rwm +### /dev/pts/* +lxc.cgroup2.devices.allow = c 136:* rwm +### fuse +lxc.cgroup2.devices.allow = c 10:229 rwm + # Setup the default mounts lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none bind,optional 0 0 diff --git a/config/templates/userns.conf.in b/config/templates/userns.conf.in index 19013da5b..69d992680 100644 --- a/config/templates/userns.conf.in +++ b/config/templates/userns.conf.in @@ -1,7 +1,15 @@ # CAP_SYS_ADMIN in init-user-ns is required for cgroup.devices +# +# Default legacy cgroup configuration +# lxc.cgroup.devices.deny = lxc.cgroup.devices.allow = +# Default unified cgroup configuration +# +lxc.cgroup2.devices.deny = +lxc.cgroup2.devices.allow = + # Start with a full set of capabilities in user namespaces. lxc.cap.drop = lxc.cap.keep =