From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id F27B01382C5 for ; Sat, 28 Nov 2020 23:09:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C1464E0817; Sat, 28 Nov 2020 23:09:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 974FDE0817 for ; Sat, 28 Nov 2020 23:09:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5790534165D for ; Sat, 28 Nov 2020 23:09:31 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9B1A32CA for ; Sat, 28 Nov 2020 23:09:29 +0000 (UTC) From: "Jason Zaman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jason Zaman" Message-ID: <1605517423.fb88733bbd3f7017f4baf778b9f147eb769b53e9.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/services/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/services/corosync.fc policy/modules/services/corosync.te X-VCS-Directories: policy/modules/services/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: fb88733bbd3f7017f4baf778b9f147eb769b53e9 X-VCS-Branch: master Date: Sat, 28 Nov 2020 23:09:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e1eb575e-8aa5-4357-9f14-16ab21c49b29 X-Archives-Hash: 38cc27ebc569d74be8dd2f5179a9b4c5 commit: fb88733bbd3f7017f4baf778b9f147eb769b53e9 Author: Dave Sugar tresys com> AuthorDate: Sat Sep 26 18:55:35 2020 +0000 Commit: Jason Zaman gentoo org> CommitDate: Mon Nov 16 09:03:43 2020 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=fb88733b Updates for corosync to work in enforcing Allow corosync to map its own shared memory 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 Setup corosync lock file type 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 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 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 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 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 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 On RHEL7 systemd executes '/usr/share/corosync/corosync start' to start, label these files. Signed-off-by: Dave Sugar tresys.com> Signed-off-by: Jason Zaman gentoo.org> policy/modules/services/corosync.fc | 7 +++++++ policy/modules/services/corosync.te | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/policy/modules/services/corosync.fc b/policy/modules/services/corosync.fc index 51a558c8..1c4787d7 100644 --- a/policy/modules/services/corosync.fc +++ b/policy/modules/services/corosync.fc @@ -6,8 +6,15 @@ /usr/sbin/corosync -- gen_context(system_u:object_r:corosync_exec_t,s0) /usr/sbin/corosync-notifyd -- gen_context(system_u:object_r:corosync_exec_t,s0) +ifdef(`distro_redhat',` +/usr/share/corosync/corosync -- gen_context(system_u:object_r:corosync_exec_t,s0) +/usr/share/corosync/corosync-notifyd -- gen_context(system_u:object_r:corosync_exec_t,s0) +') + /var/lib/corosync(/.*)? gen_context(system_u:object_r:corosync_var_lib_t,s0) +/var/lock/subsys/corosync -- gen_context(system_u:object_r:corosync_lock_t,s0) + /var/log/cluster/corosync\.log.* -- gen_context(system_u:object_r:corosync_var_log_t,s0) /run/cman_.* -s gen_context(system_u:object_r:corosync_runtime_t,s0) diff --git a/policy/modules/services/corosync.te b/policy/modules/services/corosync.te index 36a6ffab..b85b1c9a 100644 --- a/policy/modules/services/corosync.te +++ b/policy/modules/services/corosync.te @@ -13,6 +13,9 @@ domain_obj_id_change_exemption(corosync_t) type corosync_initrc_exec_t; init_script_file(corosync_initrc_exec_t) +type corosync_lock_t; +files_lock_file(corosync_lock_t) + type corosync_runtime_t alias corosync_var_run_t; files_runtime_file(corosync_runtime_t) @@ -43,6 +46,9 @@ allow corosync_t self:shm create_shm_perms; allow corosync_t self:unix_dgram_socket sendto; allow corosync_t self:unix_stream_socket { accept connectto listen }; +manage_files_pattern(corosync_t, corosync_lock_t, corosync_lock_t) +files_lock_filetrans(corosync_t, corosync_lock_t, file) + manage_dirs_pattern(corosync_t, corosync_tmp_t, corosync_tmp_t) manage_files_pattern(corosync_t, corosync_tmp_t, corosync_tmp_t) relabel_files_pattern(corosync_t, corosync_tmp_t, corosync_tmp_t) @@ -50,6 +56,7 @@ files_tmp_filetrans(corosync_t, corosync_tmp_t, { dir file }) manage_dirs_pattern(corosync_t, corosync_tmpfs_t, corosync_tmpfs_t) manage_files_pattern(corosync_t, corosync_tmpfs_t, corosync_tmpfs_t) +mmap_read_files_pattern(corosync_t, corosync_tmpfs_t, corosync_tmpfs_t) fs_tmpfs_filetrans(corosync_t, corosync_tmpfs_t, { dir file }) manage_files_pattern(corosync_t, corosync_var_lib_t, corosync_var_lib_t)