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 64969158086 for ; Sun, 21 Nov 2021 03:00:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 31B5FE07C9; Sun, 21 Nov 2021 03:00:09 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 0AA29E07C9 for ; Sun, 21 Nov 2021 03:00: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 C4D90342F3C for ; Sun, 21 Nov 2021 03:00:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5E69C1DD for ; Sun, 21 Nov 2021 03:00:03 +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: <1637449104.a9b9720b82e797983be0c4af4a7fbfdfa9c7f8f1.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/admin/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/admin/shutdown.if policy/modules/admin/shutdown.te X-VCS-Directories: policy/modules/admin/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: a9b9720b82e797983be0c4af4a7fbfdfa9c7f8f1 X-VCS-Branch: master Date: Sun, 21 Nov 2021 03:00:03 +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: a93a96aa-dd5a-4c36-a84b-7be9be6c413d X-Archives-Hash: a152bbbda80f81a6f4610539782a47fb commit: a9b9720b82e797983be0c4af4a7fbfdfa9c7f8f1 Author: Kenton Groombridge concord sh> AuthorDate: Fri Oct 8 20:02:50 2021 +0000 Commit: Jason Zaman gentoo org> CommitDate: Sat Nov 20 22:58:24 2021 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=a9b9720b shutdown: add tunable to control user exec domain access Signed-off-by: Kenton Groombridge concord.sh> Signed-off-by: Jason Zaman gentoo.org> policy/modules/admin/shutdown.if | 16 +++++++++++++--- policy/modules/admin/shutdown.te | 10 ++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/policy/modules/admin/shutdown.if b/policy/modules/admin/shutdown.if index 2a428398..3a86edeb 100644 --- a/policy/modules/admin/shutdown.if +++ b/policy/modules/admin/shutdown.if @@ -28,13 +28,23 @@ # template(`shutdown_role',` gen_require(` + attribute_role shutdown_roles; type shutdown_t; ') - shutdown_run($3, $4) + roleattribute $4 shutdown_roles; + + tunable_policy(`shutdown_allow_user_exec_domains',` + shutdown_domtrans($3) - allow $3 shutdown_t:process { ptrace signal_perms }; - ps_process_pattern($3, shutdown_t) + allow $3 shutdown_t:process { ptrace signal_perms }; + ps_process_pattern($3, shutdown_t) + ',` + shutdown_domtrans($2) + + allow $2 shutdown_t:process { ptrace signal_perms }; + ps_process_pattern($2, shutdown_t) + ') optional_policy(` systemd_user_app_status($1, shutdown_t) diff --git a/policy/modules/admin/shutdown.te b/policy/modules/admin/shutdown.te index cb8a6c6b..d3302a76 100644 --- a/policy/modules/admin/shutdown.te +++ b/policy/modules/admin/shutdown.te @@ -1,5 +1,15 @@ policy_module(shutdown, 1.7.0) +## +##

+## Determine whether the user application exec +## domain attribute should be respected for +## shutdown access. If not enabled, only user +## domains themselves may use shutdown. +##

+##
+gen_tunable(shutdown_allow_user_exec_domains, false) + ######################################## # # Declarations