selinux-refpolicy.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] patch for sddm with PAM
@ 2021-10-09  9:52 Russell Coker
  2021-10-27 13:11 ` Chris PeBenito
  0 siblings, 1 reply; 2+ messages in thread
From: Russell Coker @ 2021-10-09  9:52 UTC (permalink / raw)
  To: selinux-refpolicy

This patch makes the recent versions of sddm work for X logins.  Sddm uses
PAM to start the actual XDM under a different UID so we have to work with
this.

Signed-off-by: Russell Coker <russell@coker.com.au>

Index: refpolicy-2.20210908/policy/modules/services/xserver.te
===================================================================
--- refpolicy-2.20210908.orig/policy/modules/services/xserver.te
+++ refpolicy-2.20210908/policy/modules/services/xserver.te
@@ -18,6 +18,7 @@ gen_require(`
 	class x_resource all_x_resource_perms;
 	class x_event all_x_event_perms;
 	class x_synthetic_event all_x_synthetic_event_perms;
+	role xdm_r;
 ')
 
 ########################################
@@ -152,6 +153,10 @@ init_daemon_domain(xdm_t, xdm_exec_t)
 xserver_object_types_template(xdm)
 xserver_common_x_domain_template(xdm, xdm_t)
 
+# for sddm to use pam for greeter
+role xdm_r types xdm_t;
+allow system_r xdm_r;
+
 type xdm_lock_t;
 files_lock_file(xdm_lock_t)
 
@@ -848,6 +853,9 @@ manage_files_pattern(xserver_t, xdm_tmp_
 manage_lnk_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t)
 manage_sock_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t)
 
+# for sddm to use pam for greeter, sddm greeter needs execmod
+allow xdm_t xdm_tmpfs_t:file execmod;
+
 # Run Xorg.wrap
 can_exec(xserver_t, xserver_exec_t)
 
Index: refpolicy-2.20210908/config/appconfig-mcs/seusers
===================================================================
--- refpolicy-2.20210908.orig/config/appconfig-mcs/seusers
+++ refpolicy-2.20210908/config/appconfig-mcs/seusers
@@ -1,2 +1,3 @@
 root:unconfined_u:s0-mcs_systemhigh
 __default__:unconfined_u:s0-mcs_systemhigh
+sddm:xdm:s0
Index: refpolicy-2.20210908/policy/users
===================================================================
--- refpolicy-2.20210908.orig/policy/users
+++ refpolicy-2.20210908/policy/users
@@ -27,6 +27,7 @@ gen_user(system_u,, system_r, s0, s0 - m
 gen_user(user_u, user, user_r, s0, s0)
 gen_user(staff_u, staff, staff_r sysadm_r ifdef(`enable_mls',`secadm_r auditadm_r'), s0, s0 - mls_systemhigh, mcs_allcats)
 gen_user(sysadm_u, sysadm, sysadm_r, s0, s0 - mls_systemhigh, mcs_allcats)
+gen_user(xdm, user, xdm_r, s0, s0)
 
 # Until order dependence is fixed for users:
 ifdef(`direct_sysadm_daemon',`
Index: refpolicy-2.20210908/config/appconfig-mcs/xdm_default_contexts
===================================================================
--- /dev/null
+++ refpolicy-2.20210908/config/appconfig-mcs/xdm_default_contexts
@@ -0,0 +1 @@
+system_r:xdm_t:s0		xdm_r:xdm_t:s0
Index: refpolicy-2.20210908/policy/modules/kernel/kernel.te
===================================================================
--- refpolicy-2.20210908.orig/policy/modules/kernel/kernel.te
+++ refpolicy-2.20210908/policy/modules/kernel/kernel.te
@@ -32,6 +32,7 @@ role system_r;
 role sysadm_r;
 role staff_r;
 role user_r;
+role xdm_r;
 
 # here until order dependence is fixed:
 role unconfined_r;

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

* Re: [PATCH] patch for sddm with PAM
  2021-10-09  9:52 [PATCH] patch for sddm with PAM Russell Coker
@ 2021-10-27 13:11 ` Chris PeBenito
  0 siblings, 0 replies; 2+ messages in thread
From: Chris PeBenito @ 2021-10-27 13:11 UTC (permalink / raw)
  To: Russell Coker, selinux-refpolicy

On 10/9/21 05:52, Russell Coker wrote:
> This patch makes the recent versions of sddm work for X logins.  Sddm uses
> PAM to start the actual XDM under a different UID so we have to work with
> this.
> 
> Signed-off-by: Russell Coker <russell@coker.com.au>
> 
> Index: refpolicy-2.20210908/policy/modules/services/xserver.te
> ===================================================================
> --- refpolicy-2.20210908.orig/policy/modules/services/xserver.te
> +++ refpolicy-2.20210908/policy/modules/services/xserver.te
> @@ -18,6 +18,7 @@ gen_require(`
>   	class x_resource all_x_resource_perms;
>   	class x_event all_x_event_perms;
>   	class x_synthetic_event all_x_synthetic_event_perms;
> +	role xdm_r;
>   ')
>   
>   ########################################
> @@ -152,6 +153,10 @@ init_daemon_domain(xdm_t, xdm_exec_t)
>   xserver_object_types_template(xdm)
>   xserver_common_x_domain_template(xdm, xdm_t)
>   
> +# for sddm to use pam for greeter
> +role xdm_r types xdm_t;
> +allow system_r xdm_r;
> +
>   type xdm_lock_t;
>   files_lock_file(xdm_lock_t)
>   
> @@ -848,6 +853,9 @@ manage_files_pattern(xserver_t, xdm_tmp_
>   manage_lnk_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t)
>   manage_sock_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t)
>   
> +# for sddm to use pam for greeter, sddm greeter needs execmod
> +allow xdm_t xdm_tmpfs_t:file execmod;
> +
>   # Run Xorg.wrap
>   can_exec(xserver_t, xserver_exec_t)
>   
> Index: refpolicy-2.20210908/config/appconfig-mcs/seusers
> ===================================================================
> --- refpolicy-2.20210908.orig/config/appconfig-mcs/seusers
> +++ refpolicy-2.20210908/config/appconfig-mcs/seusers
> @@ -1,2 +1,3 @@
>   root:unconfined_u:s0-mcs_systemhigh
>   __default__:unconfined_u:s0-mcs_systemhigh
> +sddm:xdm:s0
> Index: refpolicy-2.20210908/policy/users
> ===================================================================
> --- refpolicy-2.20210908.orig/policy/users
> +++ refpolicy-2.20210908/policy/users
> @@ -27,6 +27,7 @@ gen_user(system_u,, system_r, s0, s0 - m
>   gen_user(user_u, user, user_r, s0, s0)
>   gen_user(staff_u, staff, staff_r sysadm_r ifdef(`enable_mls',`secadm_r auditadm_r'), s0, s0 - mls_systemhigh, mcs_allcats)
>   gen_user(sysadm_u, sysadm, sysadm_r, s0, s0 - mls_systemhigh, mcs_allcats)
> +gen_user(xdm, user, xdm_r, s0, s0)
>   
>   # Until order dependence is fixed for users:
>   ifdef(`direct_sysadm_daemon',`
> Index: refpolicy-2.20210908/config/appconfig-mcs/xdm_default_contexts
> ===================================================================
> --- /dev/null
> +++ refpolicy-2.20210908/config/appconfig-mcs/xdm_default_contexts
> @@ -0,0 +1 @@
> +system_r:xdm_t:s0		xdm_r:xdm_t:s0
> Index: refpolicy-2.20210908/policy/modules/kernel/kernel.te
> ===================================================================
> --- refpolicy-2.20210908.orig/policy/modules/kernel/kernel.te
> +++ refpolicy-2.20210908/policy/modules/kernel/kernel.te
> @@ -32,6 +32,7 @@ role system_r;
>   role sysadm_r;
>   role staff_r;
>   role user_r;
> +role xdm_r;
>   
>   # here until order dependence is fixed:
>   role unconfined_r;

I'm confused by this.  There is a login that happens prior to SDDM starting? 
There also is no role change allowed from xdm_r to the user role.


-- 
Chris PeBenito

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

end of thread, other threads:[~2021-10-27 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-09  9:52 [PATCH] patch for sddm with PAM Russell Coker
2021-10-27 13:11 ` Chris PeBenito

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