Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3018928ybp; Sun, 6 Oct 2019 03:01:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGFwapeC0z0EUWBC6z8GQrNmSVTtiz0JtP9jVlZAHtjNUArcwTy6h4ajYKzsO4k456+30f X-Received: by 2002:a17:906:4a11:: with SMTP id w17mr18994675eju.21.1570356102409; Sun, 06 Oct 2019 03:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570356102; cv=none; d=google.com; s=arc-20160816; b=a11jqc6D0DOTEM5L+mIh0n9OUqCh+/wX0MnvLiAfTIjMSDl/+cekdy9mp+EtZWiKVj ZzPwnV1MntRHO2iwOCEYoXGcKBLrRMoSJvebqXD+zJNSLvOT9Hp9A45JuHeugyTg9HL4 OTh9nedDhS2Mkz0rN8BYxnKq4Vewp/RmZD97e1FkZMHo8sSV3twrHFZHoCE/Yv8nw9iO B+NOleclgS6lsbRKvZf6V1KUtonwaxZG8Rxoh7msXnWKFy9HrHkqYe0k6x8U1fZZ+tbj tCd2yjkLd5tSl1kEIvdyNwUafydMCfffTgati9iRgNqDL4ubYUecpX0MNiMVLlLMnYK6 I8rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:to:from:date:dkim-signature; bh=RGXFYVtqFR43YWRL1k5/pklUaXsPjplTj/C3KQyjhTU=; b=b6vNZ8FiIt/1nRTamjvDMNBFsc4Kx6GEjVdttCPAO1uJU4LORXHqTcKPdR1CoNS1zn WR+U+5lUYubw2h+GmycgU8WOZl+EqoVLL1bKyNGC7QCe4T3w/rTtlv5E88HqKz7APEzP 52/RxdPzaYYRx1VCWYssJ5MEC8HkPR2iEgr6ut1WcEnXRHDnE3Y/J39TDmtT5gykAnGA 5WDRpoTwiZA2pSZ3kGNFmx6WJXKS6mOnLDYt6/oVzDg1w0h5WbQ8biuWWzi/LIvYqoKn hQj+0aJ/Pt0/Yyqmui84lCtkG6ONDqP/5CUwohU6S/VHYxDjOMKic2vQwk0WrVCuR1ZX 1qMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ch6XvDJj; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id op4si5389634ejb.77.2019.10.06.03.01.38; Sun, 06 Oct 2019 03:01:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ch6XvDJj; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726185AbfJFKB3 (ORCPT + 11 others); 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-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--