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 76DB0158041 for ; Sun, 5 Sep 2021 16:00:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3D1B1E0855; Sun, 5 Sep 2021 16:00:20 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.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 10D7CE0855 for ; Sun, 5 Sep 2021 16:00:20 +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 02D81340BB4 for ; Sun, 5 Sep 2021 16:00:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 133CECB for ; Sun, 5 Sep 2021 16:00:16 +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: <1630852004.f04ea627a99d4b6650f22da3ac0a4e4a97b34b63.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/virt.fc policy/modules/services/virt.te X-VCS-Directories: policy/modules/services/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: f04ea627a99d4b6650f22da3ac0a4e4a97b34b63 X-VCS-Branch: master Date: Sun, 5 Sep 2021 16:00:16 +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: 6766e998-865d-4594-b0c5-ca55149db971 X-Archives-Hash: c213ed54f902f751c38bfa87b5d5c5f9 commit: f04ea627a99d4b6650f22da3ac0a4e4a97b34b63 Author: Jonathan Davies protonmail com> AuthorDate: Wed Jul 14 21:30:37 2021 +0000 Commit: Jason Zaman gentoo org> CommitDate: Sun Sep 5 14:26:44 2021 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=f04ea627 virt: Defined a virt_common_runtime_t type for the new common/system.token file and added permissions to virtd_t and virtlogd_t. Modelled on: https://github.com/fedora-selinux/selinux-policy/commit/1f761d0bbdc08d21a91cdcbd1909ddb53858e354 libvirt change introducing this: https://gitlab.com/libvirt/libvirt/-/commit/cbfebfc74741a00bddf67b7fa10892b757fffd6a Signed-off-by: Jonathan Davies protonmail.com> Signed-off-by: Jason Zaman gentoo.org> policy/modules/services/virt.fc | 1 + policy/modules/services/virt.te | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/policy/modules/services/virt.fc b/policy/modules/services/virt.fc index 5266b68c..ab5d0885 100644 --- a/policy/modules/services/virt.fc +++ b/policy/modules/services/virt.fc @@ -58,6 +58,7 @@ HOME_DIR/VirtualMachines/isos(/.*)? gen_context(system_u:object_r:virt_content_t /run/libguestfs(/.*)? gen_context(system_u:object_r:virt_runtime_t,s0) /run/libvirtd\.pid -- gen_context(system_u:object_r:virt_runtime_t,s0) /run/libvirt(/.*)? gen_context(system_u:object_r:virt_runtime_t,s0) +/run/libvirt/common(/.*)? gen_context(system_u:object_r:virt_common_runtime_t,s0) /run/libvirt/lxc(/.*)? gen_context(system_u:object_r:virtd_lxc_runtime_t,s0) /run/libvirt-sandbox(/.*)? gen_context(system_u:object_r:virtd_lxc_runtime_t,s0) /run/libvirt/qemu(/.*)? gen_context(system_u:object_r:svirt_runtime_t,s0-mls_systemhigh) diff --git a/policy/modules/services/virt.te b/policy/modules/services/virt.te index da88b2cb..47c6042c 100644 --- a/policy/modules/services/virt.te +++ b/policy/modules/services/virt.te @@ -129,6 +129,9 @@ type virt_image_t; # customizable virt_image(virt_image_t) files_mountpoint(virt_image_t) +type virt_common_runtime_t; +files_runtime_file(virt_common_runtime_t) + type virt_content_t; # customizable virt_image(virt_content_t) userdom_user_home_content(virt_content_t) @@ -581,6 +584,11 @@ manage_files_pattern(virtd_t, virt_runtime_t, virt_runtime_t) manage_sock_files_pattern(virtd_t, virt_runtime_t, virt_runtime_t) files_runtime_filetrans(virtd_t, virt_runtime_t, { file dir }) +allow virtd_t virt_common_runtime_t:file append_file_perms; +manage_dirs_pattern(virtd_t, virt_common_runtime_t, virt_common_runtime_t) +manage_files_pattern(virtd_t, virt_common_runtime_t, virt_common_runtime_t) +filetrans_pattern(virtd_t, virt_runtime_t, virt_common_runtime_t, dir, "common") + manage_dirs_pattern(virtd_t, virtd_lxc_runtime_t, virtd_lxc_runtime_t) manage_files_pattern(virtd_t, virtd_lxc_runtime_t, virtd_lxc_runtime_t) filetrans_pattern(virtd_t, virt_runtime_t, virtd_lxc_runtime_t, dir, "lxc") @@ -1371,6 +1379,9 @@ manage_sock_files_pattern(virtlogd_t, virt_runtime_t, virtlogd_run_t) filetrans_pattern(virtlogd_t, virt_runtime_t, virtlogd_run_t, sock_file) files_runtime_filetrans(virtlogd_t, virtlogd_run_t, file) +allow virtlogd_t virt_common_runtime_t:file append_file_perms; +manage_files_pattern(virtlogd_t, virt_runtime_t, virt_common_runtime_t) + kernel_read_system_state(virtlogd_t) files_read_etc_files(virtlogd_t)