From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1433198-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C1C82158094 for <garchives@archives.gentoo.org>; Sat, 3 Sep 2022 19:10:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BE854E0825; Sat, 3 Sep 2022 19:10:22 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1FBD4E0844 for <gentoo-commits@lists.gentoo.org>; Sat, 3 Sep 2022 19:10:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A1284340FD6 for <gentoo-commits@lists.gentoo.org>; Sat, 3 Sep 2022 19:10:20 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F16075DA for <gentoo-commits@lists.gentoo.org>; Sat, 3 Sep 2022 19:10:16 +0000 (UTC) From: "Jason Zaman" <perfinion@gentoo.org> 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" <perfinion@gentoo.org> Message-ID: <1662230515.b8f614bfbcc1fe34a9664de1b1937a6e6cfbcf40.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/podman.if policy/modules/services/podman.te X-VCS-Directories: policy/modules/services/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: b8f614bfbcc1fe34a9664de1b1937a6e6cfbcf40 X-VCS-Branch: master Date: Sat, 3 Sep 2022 19:10:16 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ea8450d5-f8ff-4e25-a7ef-f577282a86c7 X-Archives-Hash: 28cea9ab242a1f1647b335d2f7cd6a1b commit: b8f614bfbcc1fe34a9664de1b1937a6e6cfbcf40 Author: Kenton Groombridge <me <AT> concord <DOT> sh> AuthorDate: Mon May 16 13:56:29 2022 +0000 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> CommitDate: Sat Sep 3 18:41:55 2022 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=b8f614bf podman: add interface to rangetrans when executing conmon Signed-off-by: Kenton Groombridge <me <AT> concord.sh> Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> policy/modules/services/podman.if | 29 +++++++++++++++++++++++++++++ policy/modules/services/podman.te | 20 ++++---------------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/policy/modules/services/podman.if b/policy/modules/services/podman.if index 7523e33d..626af3af 100644 --- a/policy/modules/services/podman.if +++ b/policy/modules/services/podman.if @@ -188,6 +188,35 @@ interface(`podman_run_conmon_user',` podman_domtrans_conmon_user($1) ') +######################################## +## <summary> +## Make the specified domain perform a +## range transition when executing conmon. +## </summary> +## <param name="domain"> +## <summary> +## Domain to transition ranges. +## </summary> +## </param> +## <param name="range"> +## <summary> +## MLS range to transition to. +## </summary> +## </param> +# +interface(`podman_spec_rangetrans_conmon',` + gen_require(` + type podman_conmon_exec_t; + ') + + ifdef(`enable_mcs',` + range_transition $1 podman_conmon_exec_t:process $2; + ') + ifdef(`enable_mls',` + range_transition $1 podman_conmon_exec_t:process $2; + ') +') + ######################################## ## <summary> ## Read and write conmon unnamed pipes. diff --git a/policy/modules/services/podman.te b/policy/modules/services/podman.te index 12c67145..bb0f67bd 100644 --- a/policy/modules/services/podman.te +++ b/policy/modules/services/podman.te @@ -61,6 +61,8 @@ container_manage_home_config(podman_t) container_manage_sock_files(podman_t) +podman_spec_rangetrans_conmon(podman_t, s0) + ifdef(`init_systemd',` init_dbus_chat(podman_t) init_setsched(podman_t) @@ -129,6 +131,8 @@ storage_rw_fuse(podman_user_t) userdom_relabel_generic_user_home_dirs(podman_user_t) userdom_relabel_generic_user_home_files(podman_user_t) +podman_spec_rangetrans_conmon(podman_user_t, s0) + ifdef(`init_systemd',` # podman queries the cgroup manager (systemd) over the session bus socket dbus_getattr_session_runtime_socket(podman_user_t) @@ -208,14 +212,6 @@ container_engine_tmp_filetrans(podman_conmon_t, { file sock_file }) container_manage_engine_tmp_files(podman_conmon_t) container_manage_engine_tmp_sock_files(podman_conmon_t) -# Ensure conmon runs in s0 so that it can talk to the container -ifdef(`enable_mcs',` - range_transition podman_t podman_conmon_exec_t:process s0; -') -ifdef(`enable_mls',` - range_transition podman_t podman_conmon_exec_t:process s0; -') - ifdef(`init_systemd',` init_get_transient_units_status(podman_conmon_t) init_start_transient_units(podman_conmon_t) @@ -287,14 +283,6 @@ container_engine_tmp_filetrans(podman_conmon_user_t, { file sock_file }) container_manage_engine_tmp_files(podman_conmon_user_t) container_manage_engine_tmp_sock_files(podman_conmon_user_t) -# Ensure conmon runs in s0 so that it can talk to the container -ifdef(`enable_mcs',` - range_transition podman_user_t podman_conmon_exec_t:process s0; -') -ifdef(`enable_mls',` - range_transition podman_user_t podman_conmon_exec_t:process s0; -') - ifdef(`init_systemd',` # conmon can read logs from containers which are # sent to the system journal