From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 349DEC3A5A4 for ; Sun, 1 Sep 2019 11:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CBBA2190F for ; Sun, 1 Sep 2019 11:20:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726631AbfIALUN (ORCPT ); Sun, 1 Sep 2019 07:20:13 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:47882 "EHLO mx1.polytechnique.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726121AbfIALUN (ORCPT ); Sun, 1 Sep 2019 07:20:13 -0400 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 04A7C561237 for ; Sun, 1 Sep 2019 13:20:09 +0200 (CEST) Received: by mail-ot1-f46.google.com with SMTP id z17so11066101otk.13 for ; Sun, 01 Sep 2019 04:20:08 -0700 (PDT) X-Gm-Message-State: APjAAAVqOnjdnCt8gR++PWr4sAKwah3nCrXXvGTWzJ0W1d0ySrMZyPxe n/nLZSHRf5WQBjkPEVBLdOKN5WEE/CtJTTYNzJc= X-Google-Smtp-Source: APXvYqwbpbawPDc0j+0GZVw4TU1cJZuG3rr2ptU3+yu0ovsFrFayxgsOzx/UUv/IwUjy/z2T0kNIyiezw8QuMXmFfIs= X-Received: by 2002:a9d:6e93:: with SMTP id a19mr19876688otr.29.1567336808019; Sun, 01 Sep 2019 04:20:08 -0700 (PDT) MIME-Version: 1.0 References: <20190831172713.140005-1-dac.override@gmail.com> <21a95013-0147-63fa-77ab-471ef24b0eb8@ieee.org> In-Reply-To: <21a95013-0147-63fa-77ab-471ef24b0eb8@ieee.org> From: Nicolas Iooss Date: Sun, 1 Sep 2019 13:19:56 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] ssh: remove unconfined_shell_domtrans(sshd_t) To: Chris PeBenito , Dominick Grift Cc: selinux-refpolicy@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sun Sep 1 13:20:09 2019 +0200 (CEST)) X-Org-Mail: nicolas.iooss.2010@polytechnique.org Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On Sat, Aug 31, 2019 at 10:54 PM Chris PeBenito wrote: > > On 8/31/19 1:27 PM, Dominick Grift wrote: > > This call allows sshd_t associated processes with run shell with an automatic domain transition to unconfined_t. > > I was unable to make sense of the commit that added this: > > > > https://github.com/SELinuxProject/refpolicy/commit/708aab13932bb8830a2d37850cc0a5c72a5d4df4 > > > > Debian's motd dynamic pam module makes sshd run a shell, we want this shell to run with sshd_t instead of unconfined_t > > > > This patch will make the ssh_sysadm_login boolean apply to unconfined ssh logins. > > To me this makes sense, as unconfined_t is targeted equivalent to the strict sysadm_t. > > The boolean could however be renamed to the more generic ssh_priv_login name. > > > > Signed-off-by: Dominick Grift > > --- > > policy/modules/services/ssh.te | 4 ---- > > 1 file changed, 4 deletions(-) > > > > diff --git a/policy/modules/services/ssh.te b/policy/modules/services/ssh.te > > index 4e75b6e1..a99ad912 100644 > > --- a/policy/modules/services/ssh.te > > +++ b/policy/modules/services/ssh.te > > @@ -328,10 +328,6 @@ optional_policy(` > > systemd_dbus_chat_logind(sshd_t) > > ') > > > > -optional_policy(` > > - unconfined_shell_domtrans(sshd_t) > > -') > > - > > optional_policy(` > > xserver_domtrans_xauth(sshd_t) > > xserver_link_xdm_keys(sshd_t) > > I don't have any objections to this. Would it be possible to extend this patch to other callers of unconfined_shell_domtrans, like the patch below? It will help fix issues with Debian's PAM module that generates the MOTD (Message Of The Day) in a dynamic way, using shell commands (cf. https://wiki.debian.org/motd for more information: calling system() triggers a transition to system_u:system_r:unconfined_t because of unconfined_shell_domtrans). diff --git a/policy/modules/services/remotelogin.te b/policy/modules/services/remotelogin.te index bc2292e37892..c7c9c5646785 100644 --- a/policy/modules/services/remotelogin.te +++ b/policy/modules/services/remotelogin.te @@ -91,10 +91,6 @@ optional_policy(` telnet_use_ptys(remote_login_t) ') -optional_policy(` - unconfined_shell_domtrans(remote_login_t) -') - optional_policy(` usermanage_read_crack_db(remote_login_t) ') diff --git a/policy/modules/services/rshd.te b/policy/modules/services/rshd.te index 0f4caffc4f33..196ed2848e4b 100644 --- a/policy/modules/services/rshd.te +++ b/policy/modules/services/rshd.te @@ -74,6 +74,5 @@ optional_policy(` ') optional_policy(` - unconfined_shell_domtrans(rshd_t) unconfined_signal(rshd_t) ') diff --git a/policy/modules/system/locallogin.te b/policy/modules/system/locallogin.te index a56f3d1fbe16..632d2542972d 100644 --- a/policy/modules/system/locallogin.te +++ b/policy/modules/system/locallogin.te @@ -200,10 +200,6 @@ optional_policy(` systemd_write_inherited_logind_sessions_pipes(local_login_t) ') -optional_policy(` - unconfined_shell_domtrans(local_login_t) -') - optional_policy(` usermanage_read_crack_db(local_login_t) ')