Re: systemd --user for GDM started as unconfined_t instead of xdm_t

Dominick Grift <[email protected]>
Newsgroups org.kernel.vger.selinux-refpolicy
Message-ID <[email protected]>
On Sun, Oct 06, 2019 at 11:22:00AM +0200, Laurent Bigonville wrote:
> Hello,
> 
> 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 that
> context.
> 
> This is probably related to:
> 
> commit da156aea1e89a6ff6025be7e50c9c8173e5a6dcf
> Author: Chris PeBenito <[email protected]>
> Date:   Fri Apr 19 11:50:59 2019 -0400
> 
>     systemd: Add initial policy for systemd --user.
> 
>     This is just a start; it does not cover all uses.
> 
>     Signed-off-by: Chris PeBenito <[email protected]>
> 
> Was that expected and/or wanted?

It just means that gdm hooks into pam, and since 1. your __default__ id is set to unconfined_u and 2. you do not have a private id for gdm (and gnome-initial-setup) systemd will start gdm's systemd --user instance with unconfined_u:unconfined_r:unconfined_t.

One (ugly but arguable less ugly than the alternative) solution is to create a "xdm_u" and allow systemd to run a systemd --user instance on behalf of gdm with "xdm_u:system_r:xdm_t"

That way you can tell selinux that gdm's systemd --user instance should never transition out of xdm_u:system_r:xdm_t

echo "system_r:init_t:s0 system_r:xdm_t:s0" > /etc/selinux/TYPE/contexts/users/xdm_u

Then all processes in the gdm session should stay in xdm_t (but some processes will be associate with xdm_u and other with system_u).

You would probably also want to add to semanage.conf:

ignoredirs = /var/lib/gdm;/run/gnome-initial-setup

and make sure that selinux does not relabel /run/user/$(id -u gdm)

> 
> Kind regards,
> 
> Laurent Bigonville
> 

-- 
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
signature.asc (application/pgp-signature, 659 B)
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCAAdFiEEujmXliIBLFTc2Y4AJXSOVTf5R2kFAl2ZtuAACgkQJXSOVTf5
R2k2jAv/aPkBiziXSkE8b6NJvcAPBbKDN2R3pXHD9UVrDTp4NAAG4/f6+BAbFx04
Hx2xmAo9LpIcrGAZzplUf/pP2eTUvcrKbzqPoH/KwuhbDRYZq4QyszyQu6Rum/sf
F56r6WITMv5tQQdwYl34irU0uz9gs3j9soB9WkQmfJlWXy2+e19Z30OnGr6T1R+j
uoi0IyZ5fjkHfkn8eQ6XhX7J1qUlNiu3QfVM2E6x+mp+Bq2QiJs7ai1gz+ev50nZ
fGNiGYr8LRdVUl52/qoxesBBIv3K/v47ONlbC2Hi8ZI8+WBXDxaNam47D5Vqdo2S
HWEsbvoU+9WJ/VXLGIg4CS4JGto4aIPr3yXDczfHnlnP4fE+GeQt1PktuqqcEVpg
y1Xyv3VTWvGH6gms3wOeyHSvIGuhVZhLWEtx1IJVoP0g7y+efUse+S2WNnreXu8V
LxtkBhinWHIcpXbBLkejse5e/fih3ee7jESUx3ozv6L58BXn7vDng0lOd+A/zVeX
CVgxZjKu
=HLe2
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.