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/system/
Date: Sat, 03 Sep 2022 19:54:12
Message-Id: 1662232070.d63d91588adf55e6867440af9b9f6a4fe6c166f6.perfinion@gentoo
1 commit: d63d91588adf55e6867440af9b9f6a4fe6c166f6
2 Author: Dave Sugar <dsugar100 <AT> gmail <DOT> com>
3 AuthorDate: Fri Aug 26 02:45:24 2022 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 3 19:07:50 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=d63d9158
7
8 systemd: init_t creates systemd-logind 'linger' directory
9
10 node=localhost type=AVC msg=audit(1661480051.880:321): avc: denied { create } for pid=1027 comm="(d-logind)" name="linger" scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:systemd_logind_var_lib_t:s0 tclass=dir permissive=0
11
12 Signed-off-by: Dave Sugar <dsugar100 <AT> gmail.com>
13 Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org>
14
15 policy/modules/system/init.te | 1 +
16 policy/modules/system/systemd.if | 21 +++++++++++++++++++++
17 2 files changed, 22 insertions(+)
18
19 diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
20 index 285ee5b4..9ecaae54 100644
21 --- a/policy/modules/system/init.te
22 +++ b/policy/modules/system/init.te
23 @@ -551,6 +551,7 @@ ifdef(`init_systemd',`
24
25 optional_policy(`
26 systemd_dbus_chat_logind(init_t)
27 + systemd_create_logind_linger_dir(init_t)
28 systemd_search_all_user_keys(init_t)
29 systemd_create_all_user_keys(init_t)
30 systemd_write_all_user_keys(init_t)
31
32 diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if
33 index f48cc541..2370c729 100644
34 --- a/policy/modules/system/systemd.if
35 +++ b/policy/modules/system/systemd.if
36 @@ -2031,6 +2031,27 @@ interface(`systemd_read_logind_state',`
37 allow systemd_logind_t $1:file read_file_perms;
38 ')
39
40 +########################################
41 +## <summary>
42 +## Allow the specified domain to create
43 +## the systemd-logind linger directory with
44 +## the correct context.
45 +## </summary>
46 +## <param name="domain">
47 +## <summary>
48 +## Domain allowed access.
49 +## </summary>
50 +## </param>
51 +#
52 +interface(`systemd_create_logind_linger_dir',`
53 + gen_require(`
54 + type systemd_logind_var_lib_t;
55 + ')
56 +
57 + init_var_lib_filetrans($1, systemd_logind_var_lib_t, dir, "linger")
58 + allow $1 systemd_logind_var_lib_t:dir create;
59 +')
60 +
61 ########################################
62 ## <summary>
63 ## Allow the specified domain to start systemd