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=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no 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 30FADC4360C for ; Sun, 6 Oct 2019 10:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9F6D2087E for ; Sun, 6 Oct 2019 10:01:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ch6XvDJj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726185AbfJFKB3 (ORCPT ); Sun, 6 Oct 2019 06:01:29 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:45453 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726291AbfJFKB3 (ORCPT ); Sun, 6 Oct 2019 06:01:29 -0400 Received: by mail-ed1-f65.google.com with SMTP id h33so9719654edh.12 for ; Sun, 06 Oct 2019 03:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RGXFYVtqFR43YWRL1k5/pklUaXsPjplTj/C3KQyjhTU=; b=Ch6XvDJjRZ6rKk+kCsGRWQSd1kUQ+BmWBRquXX50wc2cai2IT4PV25HaiPls4U2P9u UeooVl8ftqhQspVW/4jBGIR2MviBj3ssG+JEjMUz6NNneUITJfku4DJlvI2lJ1f0wcpT OYB1rMCnx0o1qAwiWRsyNHLKsvfn9mqfF24io9j76hiPQQpyXVu+Z5vsw+F3iqoUB3LS KTlByG6xT2eXG//Dm07/cDIlrBymvdFEhvXui1eXAT40beMQOk5IznL8K2pKPbjO5pi0 XBamsffuiv6/P2pD/x/aoORDUOUKci55FBvHsZwzZqrrHMpzMkqcoEAmU/+O5E0hJaWf umdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=RGXFYVtqFR43YWRL1k5/pklUaXsPjplTj/C3KQyjhTU=; b=WN0dbZrcYsiG0uu74Ig73gmkZVvvxWuTso8NTCLtk7vL6Oy0z7ejQewSVgxPo2gHso tMtj8i2KNqzSr273H7d+hbU9a10xjUqKsobfQ6jmhyCKjDSWMRkHVgHjuNZ/W1x4nhSg Q+MtfQm81KiKKREWddQb0QabkQUPvJYL3Ayp8IMYsBX2yFF/txWvB7UBR95UlkjoPQH8 Hl/yc8dc7ooA8F6ZBH4sCBhspDsQ1Jc+IPjXccjfe7pwgYPJ7065Xz17VwpkZklxal4G gVkMlHDiG33wjS8r83gEa8wi1W4rZ7TtpDVCfZwAo4c0kI/8TStgVkeoHsJHUIzxd2EZ EP3Q== X-Gm-Message-State: APjAAAX1QkHFAVjA6DmsCEAOPpCl4n/mxz2HGbS3twcpb8xhrkPp+HZY HGFUwl+vx4KfQk54UQiRNTM= X-Google-Smtp-Source: APXvYqxtUS5gdcca/WUmWKmNqK/1HuFusJw7Lpnfe5ANHIxiCbNzQh96G/4vuoEaxJTR32/JEvwgIQ== X-Received: by 2002:a17:906:7d8:: with SMTP id m24mr19610825ejc.196.1570356087565; Sun, 06 Oct 2019 03:01:27 -0700 (PDT) Received: from brutus.lan (brutus.defensec.nl. [2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id v6sm1436435eja.90.2019.10.06.03.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 03:01:26 -0700 (PDT) Date: Sun, 6 Oct 2019 12:01:25 +0200 From: Dominick Grift To: Laurent Bigonville , selinux-refpolicy@vger.kernel.org Subject: Re: systemd --user for GDM started as unconfined_t instead of xdm_t Message-ID: <20191006100125.GC469820@brutus.lan> Mail-Followup-To: Laurent Bigonville , selinux-refpolicy@vger.kernel.org References: <20191006094156.GB469820@brutus.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="w7PDEPdKQumQfZlR" Content-Disposition: inline In-Reply-To: <20191006094156.GB469820@brutus.lan> User-Agent: Every email client sucks, this one just sucks less. X-PGP-Key: https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org --w7PDEPdKQumQfZlR Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 06, 2019 at 11:41:56AM +0200, Dominick Grift wrote: > On Sun, Oct 06, 2019 at 11:22:00AM +0200, Laurent Bigonville wrote: > > Hello, > >=20 > > I discovered today that the GDM own processes are started as unconfined= _t > > instead of xdm_t because systemd --user process itself is started in th= at > > context. > >=20 > > This is probably related to: > >=20 > > commit da156aea1e89a6ff6025be7e50c9c8173e5a6dcf > > Author: Chris PeBenito > > Date:=A0=A0 Fri Apr 19 11:50:59 2019 -0400 > >=20 > > =A0=A0=A0 systemd: Add initial policy for systemd --user. > >=20 > > =A0=A0=A0 This is just a start; it does not cover all uses. > >=20 > > =A0=A0=A0 Signed-off-by: Chris PeBenito > >=20 > > Was that expected and/or wanted? >=20 > It just means that gdm hooks into pam, and since 1. your __default__ id i= s set to unconfined_u and 2. you do not have a private id for gdm (and gnom= e-initial-setup) systemd will start gdm's systemd --user instance with unco= nfined_u:unconfined_r:unconfined_t. >=20 > One (ugly but arguable less ugly than the alternative) solution is to cre= ate a "xdm_u" and allow systemd to run a systemd --user instance on behalf = of gdm with "xdm_u:system_r:xdm_t" >=20 > That way you can tell selinux that gdm's systemd --user instance should n= ever transition out of xdm_u:system_r:xdm_t >=20 > echo "system_r:init_t:s0 system_r:xdm_t:s0" > /etc/selinux/TYPE/contexts/= users/xdm_u >=20 > Then all processes in the gdm session should stay in xdm_t (but some proc= esses will be associate with xdm_u and other with system_u). >=20 > You would probably also want to add to semanage.conf: >=20 > ignoredirs =3D /var/lib/gdm;/run/gnome-initial-setup >=20 > and make sure that selinux does not relabel /run/user/$(id -u gdm) Just to clarify. The patch you reference is not responsible for the uglynes= s that is GDM/Gnome Without this patch, the systemd --user instance of GDM (and any other users= ) would run in "init_t". This is obviously also not desirable. >=20 > >=20 > > Kind regards, > >=20 > > Laurent Bigonville > >=20 >=20 > --=20 > Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 > https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6B02 > Dominick Grift --=20 Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6B02 Dominick Grift --w7PDEPdKQumQfZlR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAEBCAAdFiEEujmXliIBLFTc2Y4AJXSOVTf5R2kFAl2Zu3AACgkQJXSOVTf5 R2muTwv/cgAFLRALx+wLqrNiQ8GG0vcxJfVNkdnSprQIG4PBGQlF3iVSBTO7e/pk mNaajb98pkuvtBr7lK004mDjxdaNRB8xyaXWUVv1G5YtuDfm53d7i8MrCLqz/gn5 2Wd99zEAMDx2o/eG7Rec8E1GIUMdrjjfkpRd29CaKB3s1Uh1Hc0rtmt6/2WKYkrz DDiuY4h5i3hJqNLH/hWhPF/ubiBpBa/FjHPWM5zCEhw3BArtvu+eVbFiUcoeZDNI loo2ySV5sy/dBaOmZ9rnmA4GFXYb8W710TZHmoqEbrMpHQiAPwau7uggE56OrqB4 iGr7mU9ponjhCGzOUbXQz0FHN6y/8i/BAq7KxQT+fgUEk23+qRJK5lpQHm5CRhdH 8ISFKgW03DAoeIxMp5ns98j7+lDJhD+Rf6+iqTCFFp+pcR5PEKRm+Ejj/MOFNQgf u4wNn9XBX5CieObooAXY1yO4/Bki30TFd+4YYc3AcRJlPfPwog4vrhZ1t6LQ9HqY FcPhBPTy =kh3k -----END PGP SIGNATURE----- --w7PDEPdKQumQfZlR--