1 |
commit: fc0dd40ee53f5a1d45ee160db2d3d1e6727bff90 |
2 |
Author: Kenton Groombridge <me <AT> concord <DOT> sh> |
3 |
AuthorDate: Wed Nov 10 17:58:42 2021 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 31 02:40:53 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=fc0dd40e |
7 |
|
8 |
files, init: allow init to remount filesystems mounted on /boot |
9 |
|
10 |
The context= mount option can be used to label, for example, a DOS |
11 |
filesystem mounted on boot to be boot_t instead of dosfs_t. Explicitly |
12 |
allow init (systemd) to remount boot_t filesystems so that options like |
13 |
ProtectSystem=full work properly. |
14 |
|
15 |
Signed-off-by: Kenton Groombridge <me <AT> concord.sh> |
16 |
Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> |
17 |
|
18 |
policy/modules/kernel/files.if | 18 ++++++++++++++++++ |
19 |
policy/modules/system/init.te | 1 + |
20 |
2 files changed, 19 insertions(+) |
21 |
|
22 |
diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if |
23 |
index ea29fef3..baedb52e 100644 |
24 |
--- a/policy/modules/kernel/files.if |
25 |
+++ b/policy/modules/kernel/files.if |
26 |
@@ -2238,6 +2238,24 @@ interface(`files_mounton_root',` |
27 |
allow $1 root_t:dir mounton; |
28 |
') |
29 |
|
30 |
+######################################## |
31 |
+## <summary> |
32 |
+## Remount a filesystem mounted on /boot. |
33 |
+## </summary> |
34 |
+## <param name="domain"> |
35 |
+## <summary> |
36 |
+## Domain allowed access. |
37 |
+## </summary> |
38 |
+## </param> |
39 |
+# |
40 |
+interface(`files_remount_boot',` |
41 |
+ gen_require(` |
42 |
+ type boot_t; |
43 |
+ ') |
44 |
+ |
45 |
+ allow $1 boot_t:filesystem remount; |
46 |
+') |
47 |
+ |
48 |
######################################## |
49 |
## <summary> |
50 |
## Get attributes of the /boot directory. |
51 |
|
52 |
diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te |
53 |
index 3f1c7d20..6e1baef9 100644 |
54 |
--- a/policy/modules/system/init.te |
55 |
+++ b/policy/modules/system/init.te |
56 |
@@ -417,6 +417,7 @@ ifdef(`init_systemd',` |
57 |
files_mounton_tmp(init_t) |
58 |
files_manage_urandom_seed(init_t) |
59 |
files_read_boot_files(initrc_t) |
60 |
+ files_remount_boot(init_t) |
61 |
files_relabel_all_lock_dirs(init_t) |
62 |
files_search_all(init_t) |
63 |
files_unmount_all_file_type_fs(init_t) |