commit: dec4d917db0fc74b940f6e21dc10d41f99920f7a Author: Kenton Groombridge <me <AT> concord <DOT> sh> AuthorDate: Sat Nov 13 01:33:52 2021 +0000 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> CommitDate: Sun Jan 30 01:12:42 2022 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=dec4d917
container: add tunable for containers to manage cgroups systemd running inside containers needs to be able to manage cgroups. Add this feature behind a tunable. Signed-off-by: Kenton Groombridge <me <AT> concord.sh> Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> policy/modules/services/container.te | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/policy/modules/services/container.te b/policy/modules/services/container.te index 87ceaeda..015d9f2d 100644 --- a/policy/modules/services/container.te +++ b/policy/modules/services/container.te @@ -1,5 +1,14 @@ policy_module(container) +## <desc> +## <p> +## Allow containers to manage cgroups. +## This is required for systemd to run inside +## containers. +## </p> +## </desc> +gen_tunable(container_manage_cgroup, false) + ######################################## # # Declarations @@ -202,6 +211,11 @@ mta_dontaudit_read_spool_symlinks(container_domain) container_use_container_ptys(container_domain) +tunable_policy(`container_manage_cgroup',` + fs_manage_cgroup_dirs(container_domain) + fs_manage_cgroup_files(container_domain) +') + optional_policy(` udev_read_runtime_files(container_domain) ') @@ -280,7 +294,6 @@ dev_read_urand(container_t) files_read_kernel_modules(container_t) fs_mount_cgroup(container_t) -fs_manage_cgroup_dirs(container_t) fs_rw_cgroup_files(container_t) auth_use_nsswitch(container_t)