1 |
commit: dec4d917db0fc74b940f6e21dc10d41f99920f7a |
2 |
Author: Kenton Groombridge <me <AT> concord <DOT> sh> |
3 |
AuthorDate: Sat Nov 13 01:33:52 2021 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 30 01:12:42 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=dec4d917 |
7 |
|
8 |
container: add tunable for containers to manage cgroups |
9 |
|
10 |
systemd running inside containers needs to be able to manage cgroups. |
11 |
Add this feature behind a tunable. |
12 |
|
13 |
Signed-off-by: Kenton Groombridge <me <AT> concord.sh> |
14 |
Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> |
15 |
|
16 |
policy/modules/services/container.te | 15 ++++++++++++++- |
17 |
1 file changed, 14 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/policy/modules/services/container.te b/policy/modules/services/container.te |
20 |
index 87ceaeda..015d9f2d 100644 |
21 |
--- a/policy/modules/services/container.te |
22 |
+++ b/policy/modules/services/container.te |
23 |
@@ -1,5 +1,14 @@ |
24 |
policy_module(container) |
25 |
|
26 |
+## <desc> |
27 |
+## <p> |
28 |
+## Allow containers to manage cgroups. |
29 |
+## This is required for systemd to run inside |
30 |
+## containers. |
31 |
+## </p> |
32 |
+## </desc> |
33 |
+gen_tunable(container_manage_cgroup, false) |
34 |
+ |
35 |
######################################## |
36 |
# |
37 |
# Declarations |
38 |
@@ -202,6 +211,11 @@ mta_dontaudit_read_spool_symlinks(container_domain) |
39 |
|
40 |
container_use_container_ptys(container_domain) |
41 |
|
42 |
+tunable_policy(`container_manage_cgroup',` |
43 |
+ fs_manage_cgroup_dirs(container_domain) |
44 |
+ fs_manage_cgroup_files(container_domain) |
45 |
+') |
46 |
+ |
47 |
optional_policy(` |
48 |
udev_read_runtime_files(container_domain) |
49 |
') |
50 |
@@ -280,7 +294,6 @@ dev_read_urand(container_t) |
51 |
files_read_kernel_modules(container_t) |
52 |
|
53 |
fs_mount_cgroup(container_t) |
54 |
-fs_manage_cgroup_dirs(container_t) |
55 |
fs_rw_cgroup_files(container_t) |
56 |
|
57 |
auth_use_nsswitch(container_t) |