selinux-refpolicy.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* systemd --user for GDM started as unconfined_t instead of xdm_t
@ 2019-10-06  9:22 Laurent Bigonville
  2019-10-06  9:41 ` Dominick Grift
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Bigonville @ 2019-10-06  9:22 UTC (permalink / raw)
  To: selinux-refpolicy

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 <Christopher.PeBenito@microsoft.com>
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 <Christopher.PeBenito@microsoft.com>

Was that expected and/or wanted?

Kind regards,

Laurent Bigonville


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: systemd --user for GDM started as unconfined_t instead of xdm_t
  2019-10-06  9:22 systemd --user for GDM started as unconfined_t instead of xdm_t Laurent Bigonville
@ 2019-10-06  9:41 ` Dominick Grift
  2019-10-06 10:01   ` Dominick Grift
  0 siblings, 1 reply; 4+ messages in thread
From: Dominick Grift @ 2019-10-06  9:41 UTC (permalink / raw)
  To: Laurent Bigonville; +Cc: selinux-refpolicy

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

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 <Christopher.PeBenito@microsoft.com>
> 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 <Christopher.PeBenito@microsoft.com>
> 
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: systemd --user for GDM started as unconfined_t instead of xdm_t
  2019-10-06  9:41 ` Dominick Grift
@ 2019-10-06 10:01   ` Dominick Grift
  2019-10-06 10:13     ` Dominick Grift
  0 siblings, 1 reply; 4+ messages in thread
From: Dominick Grift @ 2019-10-06 10:01 UTC (permalink / raw)
  To: Laurent Bigonville, selinux-refpolicy

[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]

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,
> > 
> > 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 <Christopher.PeBenito@microsoft.com>
> > 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 <Christopher.PeBenito@microsoft.com>
> > 
> > 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)

Just to clarify. The patch you reference is not responsible for the uglyness 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.

> 
> > 
> > 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



-- 
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: systemd --user for GDM started as unconfined_t instead of xdm_t
  2019-10-06 10:01   ` Dominick Grift
@ 2019-10-06 10:13     ` Dominick Grift
  0 siblings, 0 replies; 4+ messages in thread
From: Dominick Grift @ 2019-10-06 10:13 UTC (permalink / raw)
  To: Laurent Bigonville, selinux-refpolicy

[-- Attachment #1: Type: text/plain, Size: 2948 bytes --]

On Sun, Oct 06, 2019 at 12:01:25PM +0200, Dominick Grift wrote:
> 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,
> > > 
> > > 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 <Christopher.PeBenito@microsoft.com>
> > > 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 <Christopher.PeBenito@microsoft.com>
> > > 
> > > 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)
> 
> Just to clarify. The patch you reference is not responsible for the uglyness 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.


I wonder what you happen if you would (would gdm still work?):

sudo systemctl mask user@$(id -u gdm).service user-runtime-dir@$(id -u gdm).service

> 
> > 
> > > 
> > > 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
> 
> 
> 
> -- 
> Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
> https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
> Dominick Grift



-- 
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-06 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-06  9:22 systemd --user for GDM started as unconfined_t instead of xdm_t Laurent Bigonville
2019-10-06  9:41 ` Dominick Grift
2019-10-06 10:01   ` Dominick Grift
2019-10-06 10:13     ` Dominick Grift

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).