Gentoo Archives: gentoo-commits

From: Jason Zaman <perfinion@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/services/
Date: Sat, 09 Apr 2022 19:28:54
Message-Id: 1649532510.01b153cb47331dc2ba354100c74acb4e37393fc1.perfinion@gentoo
1 commit: 01b153cb47331dc2ba354100c74acb4e37393fc1
2 Author: Kenton Groombridge <me <AT> concord <DOT> sh>
3 AuthorDate: Thu Mar 31 18:44:24 2022 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 9 19:28:30 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=01b153cb
7
8 container, podman: allow containers to interact with conmon
9
10 Allow containers to use inherited conmon file descriptors and read and
11 write unnamed conmon pipes.
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 | 5 +++++
17 policy/modules/services/podman.if | 41 ++++++++++++++++++++++++++++++++++++
18 2 files changed, 46 insertions(+)
19
20 diff --git a/policy/modules/services/container.te b/policy/modules/services/container.te
21 index d5f79b15..3d623229 100644
22 --- a/policy/modules/services/container.te
23 +++ b/policy/modules/services/container.te
24 @@ -248,6 +248,11 @@ tunable_policy(`container_use_samba',`
25 fs_exec_cifs_files(container_domain)
26 ')
27
28 +optional_policy(`
29 + podman_rw_conmon_pipes(container_domain)
30 + podman_use_conmon_fds(container_domain)
31 +')
32 +
33 optional_policy(`
34 udev_read_runtime_files(container_domain)
35 ')
36
37 diff --git a/policy/modules/services/podman.if b/policy/modules/services/podman.if
38 index 3d03884e..7523e33d 100644
39 --- a/policy/modules/services/podman.if
40 +++ b/policy/modules/services/podman.if
41 @@ -188,6 +188,47 @@ interface(`podman_run_conmon_user',`
42 podman_domtrans_conmon_user($1)
43 ')
44
45 +########################################
46 +## <summary>
47 +## Read and write conmon unnamed pipes.
48 +## </summary>
49 +## <param name="domain">
50 +## <summary>
51 +## Domain allowed access.
52 +## </summary>
53 +## </param>
54 +#
55 +interface(`podman_rw_conmon_pipes',`
56 + gen_require(`
57 + type podman_conmon_t;
58 + type podman_conmon_user_t;
59 + ')
60 +
61 + allow $1 podman_conmon_t:fifo_file rw_fifo_file_perms;
62 + allow $1 podman_conmon_user_t:fifo_file rw_fifo_file_perms;
63 +')
64 +
65 +########################################
66 +## <summary>
67 +## Allow the specified domain to inherit
68 +## file descriptors from conmon.
69 +## </summary>
70 +## <param name="domain">
71 +## <summary>
72 +## Domain allowed access.
73 +## </summary>
74 +## </param>
75 +#
76 +interface(`podman_use_conmon_fds',`
77 + gen_require(`
78 + type podman_conmon_t;
79 + type podman_conmon_user_t;
80 + ')
81 +
82 + allow $1 podman_conmon_t:fd use;
83 + allow $1 podman_conmon_user_t:fd use;
84 +')
85 +
86 ########################################
87 ## <summary>
88 ## Role access for rootless podman.