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:10:21
Message-Id: 1662230515.888c1aed22a0f67d4e4bdac540f249c392f27cec.perfinion@gentoo
1 commit: 888c1aed22a0f67d4e4bdac540f249c392f27cec
2 Author: Kenton Groombridge <me <AT> concord <DOT> sh>
3 AuthorDate: Sat Apr 2 19:40:07 2022 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 3 18:41:55 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=888c1aed
7
8 init, systemd: allow unpriv users to read the catalog
9
10 Label /var/lib/systemd/catalog the journal type, and allow unpriv users
11 to search /var/lib/systemd. This is to fix this warning when an
12 unprivileged user uses journalctl:
13
14 Failed to find catalog entry: Permission denied
15
16 Signed-off-by: Kenton Groombridge <me <AT> concord.sh>
17 Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org>
18
19 policy/modules/system/init.if | 19 +++++++++++++++++++
20 policy/modules/system/systemd.fc | 2 ++
21 policy/modules/system/systemd.if | 1 +
22 3 files changed, 22 insertions(+)
23
24 diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if
25 index 8d3eab4a..1ce483da 100644
26 --- a/policy/modules/system/init.if
27 +++ b/policy/modules/system/init.if
28 @@ -1375,6 +1375,25 @@ interface(`init_read_var_lib_links',`
29 allow $1 init_var_lib_t:lnk_file read_lnk_file_perms;
30 ')
31
32 +########################################
33 +## <summary>
34 +## Search /var/lib/systemd/ dirs
35 +## </summary>
36 +## <param name="domain">
37 +## <summary>
38 +## Domain allowed access.
39 +## </summary>
40 +## </param>
41 +#
42 +interface(`init_search_var_lib_dirs',`
43 + gen_require(`
44 + type init_var_lib_t;
45 + ')
46 +
47 + files_search_var_lib($1)
48 + allow $1 init_var_lib_t:dir search_dir_perms;
49 +')
50 +
51 ########################################
52 ## <summary>
53 ## List /var/lib/systemd/ dir
54
55 diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/systemd.fc
56 index 2cbc2e19..cf7ce0c4 100644
57 --- a/policy/modules/system/systemd.fc
58 +++ b/policy/modules/system/systemd.fc
59 @@ -75,6 +75,8 @@ HOME_DIR/\.local/share/systemd(/.*)? gen_context(system_u:object_r:systemd_data
60
61 /var/\.updated -- gen_context(system_u:object_r:systemd_update_run_t,s0)
62
63 +/var/lib/systemd/catalog(/.*)? gen_context(system_u:object_r:systemd_journal_t,s0)
64 +
65 /var/lib/systemd/backlight(/.*)? gen_context(system_u:object_r:systemd_backlight_var_lib_t,s0)
66 /var/lib/systemd/coredump(/.*)? gen_context(system_u:object_r:systemd_coredump_var_lib_t,s0)
67 /var/lib/systemd/home(/.*)? gen_context(system_u:object_r:systemd_homed_var_lib_t,s0)
68
69 diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if
70 index c2b6824b..1da951f0 100644
71 --- a/policy/modules/system/systemd.if
72 +++ b/policy/modules/system/systemd.if
73 @@ -160,6 +160,7 @@ template(`systemd_role_template',`
74 can_exec($3, { systemd_run_exec_t systemd_analyze_exec_t })
75
76 init_dbus_chat($3)
77 + init_search_var_lib_dirs($3)
78
79 systemd_list_journal_dirs($3)
80 systemd_read_journal_files($3)