1 |
commit: f1666469b87a81d52a5a15aec0a53771b2b7e486 |
2 |
Author: Kenton Groombridge <me <AT> concord <DOT> sh> |
3 |
AuthorDate: Mon Jan 17 21:09:10 2022 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 30 01:15:06 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=f1666469 |
7 |
|
8 |
systemd: add supporting interfaces for user daemons |
9 |
|
10 |
Add an interface to allow systemd user daemons to use systemd notify and |
11 |
an interface to write to the systemd user runtime named socket. |
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/system/systemd.if | 48 ++++++++++++++++++++++++++++++++++++++++ |
17 |
1 file changed, 48 insertions(+) |
18 |
|
19 |
diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if |
20 |
index db98053a..e5214124 100644 |
21 |
--- a/policy/modules/system/systemd.if |
22 |
+++ b/policy/modules/system/systemd.if |
23 |
@@ -257,6 +257,35 @@ interface(`systemd_user_unix_stream_activated_socket',` |
24 |
systemd_user_activated_sock_file($2) |
25 |
') |
26 |
|
27 |
+###################################### |
28 |
+## <summary> |
29 |
+## Allow the target domain the permissions necessary |
30 |
+## to use systemd notify when started by the specified |
31 |
+## systemd user instance. |
32 |
+## </summary> |
33 |
+## <param name="prefix"> |
34 |
+## <summary> |
35 |
+## Prefix for the user domain. |
36 |
+## </summary> |
37 |
+## </param> |
38 |
+## <param name="domain"> |
39 |
+## <summary> |
40 |
+## Domain to be allowed systemd notify permissions. |
41 |
+## </summary> |
42 |
+## </param> |
43 |
+# |
44 |
+template(`systemd_user_send_systemd_notify',` |
45 |
+ gen_require(` |
46 |
+ type $1_systemd_t; |
47 |
+ type systemd_user_runtime_notify_t; |
48 |
+ ') |
49 |
+ |
50 |
+ systemd_search_user_runtime($2) |
51 |
+ allow $2 systemd_user_runtime_notify_t:sock_file rw_sock_file_perms; |
52 |
+ |
53 |
+ allow $2 $1_systemd_t:unix_dgram_socket sendto; |
54 |
+') |
55 |
+ |
56 |
###################################### |
57 |
## <summary> |
58 |
## Allow the target domain to be monitored and have its output |
59 |
@@ -596,6 +625,25 @@ interface(`systemd_read_user_runtime_lnk_files',` |
60 |
read_lnk_files_pattern($1, systemd_user_runtime_t, systemd_user_runtime_t) |
61 |
') |
62 |
|
63 |
+###################################### |
64 |
+## <summary> |
65 |
+## Allow the specified domain to write to |
66 |
+## the systemd user runtime named socket. |
67 |
+## </summary> |
68 |
+## <param name="domain"> |
69 |
+## <summary> |
70 |
+## Domain allowed access. |
71 |
+## </summary> |
72 |
+## </param> |
73 |
+# |
74 |
+interface(`systemd_write_user_runtime_socket',` |
75 |
+ gen_require(` |
76 |
+ type systemd_user_runtime_t; |
77 |
+ ') |
78 |
+ |
79 |
+ allow $1 systemd_user_runtime_t:sock_file write; |
80 |
+') |
81 |
+ |
82 |
###################################### |
83 |
## <summary> |
84 |
## Allow the specified domain to read system-wide systemd |