1 |
commit: fb88733bbd3f7017f4baf778b9f147eb769b53e9 |
2 |
Author: Dave Sugar <dsugar <AT> tresys <DOT> com> |
3 |
AuthorDate: Sat Sep 26 18:55:35 2020 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 16 09:03:43 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=fb88733b |
7 |
|
8 |
Updates for corosync to work in enforcing |
9 |
|
10 |
Allow corosync to map its own shared memory |
11 |
|
12 |
Sep 26 18:45:02 localhost audispd: node=virtual type=AVC msg=audit(1601145902.400:2972): avc: denied { map } for pid=6903 comm="corosync" path="/dev/shm/qb-6903-7028-31-FGGoGv/qb-request-cmap-header" dev="tmpfs" ino=40759 scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:corosync_tmpfs_t:s0 tclass=file permissive=1 |
13 |
|
14 |
Setup corosync lock file type |
15 |
|
16 |
Sep 27 17:20:07 localhost audispd: node=virtual type=PATH msg=audit(1601227207.522:3421): item=1 name="/var/lock/subsys/corosync" inode=35029 dev=00:14 mode=0100640 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:var_lock_t:s0 objtype=DELETE cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 |
17 |
Sep 27 17:34:49 localhost audispd: node=virtual type=AVC msg=audit(1601228085.093:2862): avc: denied { read } for pid=6748 comm="corosync" name="lock" dev="dm-0" ino=13082 scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:var_lock_t:s0 tclass=lnk_file permissive=1 |
18 |
Sep 27 17:34:49 localhost audispd: node=virtual type=AVC msg=audit(1601228085.093:2862): avc: denied { search } for pid=6748 comm="corosync" name="lock" dev="tmpfs" ino=10248 scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:var_lock_t:s0 tclass=dir permissive=1 |
19 |
Sep 27 17:34:49 localhost audispd: node=virtual type=AVC msg=audit(1601228085.797:2882): avc: denied { add_name } for pid=7066 comm="touch" name="corosync" scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:var_lock_t:s0 tclass=dir permissive=1 |
20 |
Sep 27 17:34:49 localhost audispd: node=virtual type=AVC msg=audit(1601228085.797:2882): avc: denied { create } for pid=7066 comm="touch" name="corosync" scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:var_lock_t:s0 tclass=file permissive=1 |
21 |
Sep 27 17:34:49 localhost audispd: node=virtual type=AVC msg=audit(1601228085.797:2882): avc: denied { write open } for pid=7066 comm="touch" path="/run/lock/subsys/corosync" dev="tmpfs" ino=35048 scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:var_lock_t:s0 tclass=file permissive=1 |
22 |
|
23 |
On RHEL7 systemd executes '/usr/share/corosync/corosync start' to start, label these files. |
24 |
|
25 |
Signed-off-by: Dave Sugar <dsugar <AT> tresys.com> |
26 |
Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> |
27 |
|
28 |
policy/modules/services/corosync.fc | 7 +++++++ |
29 |
policy/modules/services/corosync.te | 7 +++++++ |
30 |
2 files changed, 14 insertions(+) |
31 |
|
32 |
diff --git a/policy/modules/services/corosync.fc b/policy/modules/services/corosync.fc |
33 |
index 51a558c8..1c4787d7 100644 |
34 |
--- a/policy/modules/services/corosync.fc |
35 |
+++ b/policy/modules/services/corosync.fc |
36 |
@@ -6,8 +6,15 @@ |
37 |
/usr/sbin/corosync -- gen_context(system_u:object_r:corosync_exec_t,s0) |
38 |
/usr/sbin/corosync-notifyd -- gen_context(system_u:object_r:corosync_exec_t,s0) |
39 |
|
40 |
+ifdef(`distro_redhat',` |
41 |
+/usr/share/corosync/corosync -- gen_context(system_u:object_r:corosync_exec_t,s0) |
42 |
+/usr/share/corosync/corosync-notifyd -- gen_context(system_u:object_r:corosync_exec_t,s0) |
43 |
+') |
44 |
+ |
45 |
/var/lib/corosync(/.*)? gen_context(system_u:object_r:corosync_var_lib_t,s0) |
46 |
|
47 |
+/var/lock/subsys/corosync -- gen_context(system_u:object_r:corosync_lock_t,s0) |
48 |
+ |
49 |
/var/log/cluster/corosync\.log.* -- gen_context(system_u:object_r:corosync_var_log_t,s0) |
50 |
|
51 |
/run/cman_.* -s gen_context(system_u:object_r:corosync_runtime_t,s0) |
52 |
|
53 |
diff --git a/policy/modules/services/corosync.te b/policy/modules/services/corosync.te |
54 |
index 36a6ffab..b85b1c9a 100644 |
55 |
--- a/policy/modules/services/corosync.te |
56 |
+++ b/policy/modules/services/corosync.te |
57 |
@@ -13,6 +13,9 @@ domain_obj_id_change_exemption(corosync_t) |
58 |
type corosync_initrc_exec_t; |
59 |
init_script_file(corosync_initrc_exec_t) |
60 |
|
61 |
+type corosync_lock_t; |
62 |
+files_lock_file(corosync_lock_t) |
63 |
+ |
64 |
type corosync_runtime_t alias corosync_var_run_t; |
65 |
files_runtime_file(corosync_runtime_t) |
66 |
|
67 |
@@ -43,6 +46,9 @@ allow corosync_t self:shm create_shm_perms; |
68 |
allow corosync_t self:unix_dgram_socket sendto; |
69 |
allow corosync_t self:unix_stream_socket { accept connectto listen }; |
70 |
|
71 |
+manage_files_pattern(corosync_t, corosync_lock_t, corosync_lock_t) |
72 |
+files_lock_filetrans(corosync_t, corosync_lock_t, file) |
73 |
+ |
74 |
manage_dirs_pattern(corosync_t, corosync_tmp_t, corosync_tmp_t) |
75 |
manage_files_pattern(corosync_t, corosync_tmp_t, corosync_tmp_t) |
76 |
relabel_files_pattern(corosync_t, corosync_tmp_t, corosync_tmp_t) |
77 |
@@ -50,6 +56,7 @@ files_tmp_filetrans(corosync_t, corosync_tmp_t, { dir file }) |
78 |
|
79 |
manage_dirs_pattern(corosync_t, corosync_tmpfs_t, corosync_tmpfs_t) |
80 |
manage_files_pattern(corosync_t, corosync_tmpfs_t, corosync_tmpfs_t) |
81 |
+mmap_read_files_pattern(corosync_t, corosync_tmpfs_t, corosync_tmpfs_t) |
82 |
fs_tmpfs_filetrans(corosync_t, corosync_tmpfs_t, { dir file }) |
83 |
|
84 |
manage_files_pattern(corosync_t, corosync_var_lib_t, corosync_var_lib_t) |