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.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 C9C44158094 for ; Sat, 3 Sep 2022 19:54:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0689FE0831; Sat, 3 Sep 2022 19:54:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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 E3A04E0831 for ; Sat, 3 Sep 2022 19:54:08 +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 2D647340F5A for ; Sat, 3 Sep 2022 19:54:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AFDDC5C6 for ; Sat, 3 Sep 2022 19:54:05 +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: <1662232069.9f360ceda6290fc51e9f537d59574810e5a876b6.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/system/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/system/systemd.if X-VCS-Directories: policy/modules/system/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: 9f360ceda6290fc51e9f537d59574810e5a876b6 X-VCS-Branch: master Date: Sat, 3 Sep 2022 19:54:05 +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: fdb32ba1-8819-4273-b6f1-7ad36afb2c4f X-Archives-Hash: 59b3f359742d0da6493b5dc2f4046598 commit: 9f360ceda6290fc51e9f537d59574810e5a876b6 Author: Chris PeBenito linux microsoft com> AuthorDate: Wed Aug 17 17:53:26 2022 +0000 Commit: Jason Zaman gentoo org> CommitDate: Sat Sep 3 19:07:49 2022 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=9f360ced systemd: Add interface for systemctl exec. Adds necessary baseline permissions for the command. Signed-off-by: Chris PeBenito linux.microsoft.com> Signed-off-by: Jason Zaman gentoo.org> policy/modules/system/systemd.if | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if index 62545021..f48cc541 100644 --- a/policy/modules/system/systemd.if +++ b/policy/modules/system/systemd.if @@ -2388,6 +2388,37 @@ interface(`systemd_read_resolved_runtime',` read_files_pattern($1, systemd_resolved_runtime_t, systemd_resolved_runtime_t) ') +######################################## +## +## Execute the systemctl program. +## +## +## +## Domain allowed access. +## +## +# +interface(`systemd_exec_systemctl',` + gen_require(` + type systemd_passwd_agent_t, systemd_passwd_agent_exec_t; + ') + + dontaudit $1 self:capability { net_admin sys_resource }; + allow $1 self:process signal; + allow $1 self:unix_stream_socket create_socket_perms; + + # the command is a regular bin + corecmd_exec_bin($1) + + domtrans_pattern($1, systemd_passwd_agent_exec_t, systemd_passwd_agent_t) + allow $1 systemd_passwd_agent_t:process signal; + + init_read_state($1) + init_stream_connect($1) + init_telinit($1) + init_dbus_chat($1) +') + ####################################### ## ## Allow domain to getattr on .updated file (generated by systemd-update-done