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 5724D1581D3 for ; Tue, 14 May 2024 19:43:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A84C3E2A1B; Tue, 14 May 2024 19:42:58 +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 934B6E2A18 for ; Tue, 14 May 2024 19:42:58 +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 D88FE3408DD for ; Tue, 14 May 2024 19:42:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3B4651ACF for ; Tue, 14 May 2024 19:42:55 +0000 (UTC) From: "Kenton Groombridge" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Kenton Groombridge" Message-ID: <1715708491.b2ceb53d4b7b1df545f740ae9b4ed2e77f640dca.concord@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/system/, policy/modules/services/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/services/ssh.if policy/modules/system/init.te X-VCS-Directories: policy/modules/system/ policy/modules/services/ X-VCS-Committer: concord X-VCS-Committer-Name: Kenton Groombridge X-VCS-Revision: b2ceb53d4b7b1df545f740ae9b4ed2e77f640dca X-VCS-Branch: master Date: Tue, 14 May 2024 19:42:55 +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: f5668072-7a90-48ea-9813-37e81a7922e4 X-Archives-Hash: 4b4dd38c3b9f009f0400fec7e67accb8 commit: b2ceb53d4b7b1df545f740ae9b4ed2e77f640dca Author: Kenton Groombridge gentoo org> AuthorDate: Mon May 6 19:53:46 2024 +0000 Commit: Kenton Groombridge gentoo org> CommitDate: Tue May 14 17:41:31 2024 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=b2ceb53d init: allow systemd to use sshd pidfds Without this, a lengthy 2 minute delay can be observed SSHing into a system while pam_systemd tries to create a login session. May 06 14:22:08 megumin.fuwafuwatime.moe sshd[29384]: pam_systemd(sshd:session): Failed to create session: Connection timed out type=AVC msg=audit(1715019897.540:13855): avc: denied { use } for pid=1 comm="systemd" path="anon_inode:[pidfd]" dev="anon_inodefs" ino=10 scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:sshd_t:s0 tclass=fd permissive=1 Signed-off-by: Kenton Groombridge gentoo.org> policy/modules/services/ssh.if | 19 +++++++++++++++++++ policy/modules/system/init.te | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/policy/modules/services/ssh.if b/policy/modules/services/ssh.if index dcbabf6b0..4b5fd5d33 100644 --- a/policy/modules/services/ssh.if +++ b/policy/modules/services/ssh.if @@ -535,6 +535,25 @@ interface(`ssh_signull',` allow $1 sshd_t:process signull; ') +######################################## +## +## Use PIDFD file descriptors from the +## ssh server. +## +## +## +## Domain allowed access. +## +## +# +interface(`ssh_use_sshd_pidfds',` + gen_require(` + type sshd_t; + ') + + allow $1 sshd_t:fd use; +') + ######################################## ## ## Read a ssh server unnamed pipe. diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te index 8f3772dcb..03d0de8ed 100644 --- a/policy/modules/system/init.te +++ b/policy/modules/system/init.te @@ -630,6 +630,10 @@ ifdef(`init_systemd',` fs_rw_rpc_named_pipes(initrc_t) ') + optional_policy(` + ssh_use_sshd_pidfds(init_t) + ') + optional_policy(` # for systemd --user: unconfined_search_keys(init_t)