Skip to contentSkip to conversation

wm: interactive start

PATCH New Guido Trentalancia 2 participants 4 messages Apr 13, 2017 – Apr 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 2/10 wm: interactive start

Update the window manager (wm) module (support starting gnome-shell from an X terminal).

---
 policy/modules/contrib/wm.if |   27 +++++++++++++++++++++++++++
 policy/modules/contrib/wm.te |    7 ++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)
policy/modules/contrib/wm.if +27 -0
diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.if refpolicy-2.20170204/policy/modules/contrib/wm.if
@@ -73,6 +73,8 @@ template(`wm_role_template',`
 	xserver_role($2, $1_wm_t)
 	xserver_manage_core_devices($1_wm_t)
 
+	wm_write_pipes($1, $3)
+
 	optional_policy(`
 		dbus_connect_spec_session_bus($1, $1_wm_t)
 		dbus_spec_session_bus_client($1, $1_wm_t)
@@ -219,3 +221,28 @@ interface(`wm_application_domain',`
 	userdom_user_application_domain($1, $2)
 	domtrans_pattern(wm_domain, $2, $1)
 ')
+
+########################################
+### <summary>
+###	Write wm unnamed pipes.
+### </summary>
+## <param name="role_prefix">
+###	<summary>
+###	The prefix of the user domain (e.g., user
+###	is the prefix for user_t).
+###	</summary>
+### </param>
+### <param name="domain">
+###	<summary>
+###	Domain allowed access.
+###	</summary>
+### </param>
+### </param>
+##
+interface(`wm_write_pipes',`
+	gen_require(`
+		type $1_t;
+	')
+
+	allow $2 $1_wm_t:fifo_file write;
+')
policy/modules/contrib/wm.te +6 -1
diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.te refpolicy-2.20170204/policy/modules/contrib/wm.te
@@ -64,19 +64,24 @@ kernel_read_fs_sysctls(wm_domain)
 kernel_read_proc_symlinks(wm_domain)
 kernel_read_sysctl(wm_domain)
 
+locallogin_dontaudit_use_fds(wm_domain)
+
 miscfiles_read_fonts(wm_domain)
 miscfiles_read_generic_certs(wm_domain)
 miscfiles_read_localization(wm_domain)
 
 udev_read_pid_files(wm_domain)
 
-# this is needed by gnome-shell
+# the following is needed by gnome-shell
 userdom_exec_user_home_content_files(wm_domain)
 
 userdom_manage_user_tmp_sockets(wm_domain)
 userdom_tmp_filetrans_user_tmp(wm_domain, sock_file)
 userdom_user_runtime_filetrans_user_tmp(wm_domain, sock_file)
 
+# to print error messages
+userdom_use_user_terminals(wm_domain)
+
 userdom_manage_user_home_content_dirs(wm_domain)
 userdom_manage_user_home_content_files(wm_domain)
 
#1 lore raw

PATCH 2/10 wm: interactive start

2017-04-14 1:24 GMT+02:00 Guido Trentalancia via refpolicy <[email protected]>:

Quoted 65 lines

Update the window manager (wm) module (support starting gnome-shell from an X terminal).

---
 policy/modules/contrib/wm.if |   27 +++++++++++++++++++++++++++
 policy/modules/contrib/wm.te |    7 ++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.if refpolicy-2.20170204/policy/modules/contrib/wm.if

policy/modules/contrib/wm.if 2017-04-13 14:05:06.957330403 +0200 renamed from policy/modules/contrib/wm.if 2016-12-22 22:03:34.000000000 +0100 +27 -0
@@ -73,6 +73,8 @@ template(`wm_role_template',`
        xserver_role($2, $1_wm_t)
        xserver_manage_core_devices($1_wm_t)
 
+       wm_write_pipes($1, $3)
+
        optional_policy(`
                dbus_connect_spec_session_bus($1, $1_wm_t)
                dbus_spec_session_bus_client($1, $1_wm_t)
@@ -219,3 +221,28 @@ interface(`wm_application_domain',`
        userdom_user_application_domain($1, $2)
        domtrans_pattern(wm_domain, $2, $1)
 ')
+
+########################################
+### <summary>
+###    Write wm unnamed pipes.
+### </summary>
+## <param name="role_prefix">
+###    <summary>
+###    The prefix of the user domain (e.g., user
+###    is the prefix for user_t).
+###    </summary>
+### </param>
+### <param name="domain">
+###    <summary>
+###    Domain allowed access.
+###    </summary>
+### </param>
+### </param>
+##
+interface(`wm_write_pipes',`
+       gen_require(`
+               type $1_t;
+       ')
+
+       allow $2 $1_wm_t:fifo_file write;
+')

diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.te refpolicy-2.20170204/policy/modules/contrib/wm.te

policy/modules/contrib/wm.te 2017-04-13 14:05:26.993330321 +0200 renamed from policy/modules/contrib/wm.te 2017-02-04 19:30:47.000000000 +0100 +2 -0
@@ -64,19 +64,24 @@ kernel_read_fs_sysctls(wm_domain)
 kernel_read_proc_symlinks(wm_domain)
 kernel_read_sysctl(wm_domain)
 
+locallogin_dontaudit_use_fds(wm_domain)
+
 miscfiles_read_fonts(wm_domain)
 miscfiles_read_generic_certs(wm_domain)
 miscfiles_read_localization(wm_domain)
 
 udev_read_pid_files(wm_domain)
 

policy/modules/contrib/wm.te 2017-04-13 14:05:26.993330321 +0200 kernel_read_fs_sysctls(wm_domain) · line 83

Quoted 10 lines
policy/modules/contrib/wm.te 2017-04-13 14:05:26.993330321 +0200 renamed from policy/modules/contrib/wm.te 2017-02-04 19:30:47.000000000 +0100 +3 -1
-# this is needed by gnome-shell
+# the following is needed by gnome-shell
 userdom_exec_user_home_content_files(wm_domain)
 
 userdom_manage_user_tmp_sockets(wm_domain)
 userdom_tmp_filetrans_user_tmp(wm_domain, sock_file)
 userdom_user_runtime_filetrans_user_tmp(wm_domain, sock_file)
 
+# to print error messages
+userdom_use_user_terminals(wm_domain)

maybe userdom_use_inherited_user_terminals()?

Quoted 8 lines
policy/modules/contrib/wm.te 2017-04-13 14:05:26.993330321 +0200 renamed from policy/modules/contrib/wm.te 2017-02-04 19:30:47.000000000 +0100 +1 -0
+
 userdom_manage_user_home_content_dirs(wm_domain)
 userdom_manage_user_home_content_files(wm_domain)
 

_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

#2 lore raw

PATCH 2/10 wm: interactive start

Hello.

Thanks for getting back on this and for your tip.

I think it should be possibile to curb on the "open" permission and use userdom_use_inherited_user_terminals() instead of userdom_use_user_terminals().

However, before submitting a revised patch, I would prefer to test it again and at the moment, I do not have access to the development system.

I will get back as soon as possible and hopefully improve this patch as you suggested.

Best regards,

Guido

Quoted 94 lines · Christian G?ttsche

2017-04-14 1:24 GMT+02:00 Guido Trentalancia via refpolicy <[email protected]>:

Quoted 10 lines

Update the window manager (wm) module (support starting gnome-shell from an X terminal).

---
 policy/modules/contrib/wm.if |   27 +++++++++++++++++++++++++++
 policy/modules/contrib/wm.te |    7 ++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.if

refpolicy-2.20170204/policy/modules/contrib/wm.if

Quoted 1 line

--- refpolicy-2.20170204-orig/policy/modules/contrib/wm.if

2016-12-22 22:03:34.000000000 +0100
Quoted 1 line

+++ refpolicy-2.20170204/policy/modules/contrib/wm.if 2017-04-13

14:05:06.957330403 +0200

Quoted 38 lines
policy/modules/contrib/wm.if +27 -0
@@ -73,6 +73,8 @@ template(`wm_role_template',`
        xserver_role($2, $1_wm_t)
        xserver_manage_core_devices($1_wm_t)
 
+       wm_write_pipes($1, $3)
+
        optional_policy(`
                dbus_connect_spec_session_bus($1, $1_wm_t)
                dbus_spec_session_bus_client($1, $1_wm_t)
@@ -219,3 +221,28 @@ interface(`wm_application_domain',`
        userdom_user_application_domain($1, $2)
        domtrans_pattern(wm_domain, $2, $1)
 ')
+
+########################################
+### <summary>
+###    Write wm unnamed pipes.
+### </summary>
+## <param name="role_prefix">
+###    <summary>
+###    The prefix of the user domain (e.g., user
+###    is the prefix for user_t).
+###    </summary>
+### </param>
+### <param name="domain">
+###    <summary>
+###    Domain allowed access.
+###    </summary>
+### </param>
+### </param>
+##
+interface(`wm_write_pipes',`
+       gen_require(`
+               type $1_t;
+       ')
+
+       allow $2 $1_wm_t:fifo_file write;
+')
Quoted 1 line

diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.te

refpolicy-2.20170204/policy/modules/contrib/wm.te

Quoted 1 line

--- refpolicy-2.20170204-orig/policy/modules/contrib/wm.te

2017-02-04 19:30:47.000000000 +0100
Quoted 1 line

+++ refpolicy-2.20170204/policy/modules/contrib/wm.te 2017-04-13

14:05:26.993330321 +0200

Quoted 12 lines
policy/modules/contrib/wm.te +2 -0
@@ -64,19 +64,24 @@ kernel_read_fs_sysctls(wm_domain)
 kernel_read_proc_symlinks(wm_domain)
 kernel_read_sysctl(wm_domain)
 
+locallogin_dontaudit_use_fds(wm_domain)
+
 miscfiles_read_fonts(wm_domain)
 miscfiles_read_generic_certs(wm_domain)
 miscfiles_read_localization(wm_domain)
 
 udev_read_pid_files(wm_domain)
 

policy/modules/contrib/wm.te kernel_read_fs_sysctls(wm_domain) · line 83

Quoted 10 lines
policy/modules/contrib/wm.te +3 -1
-# this is needed by gnome-shell
+# the following is needed by gnome-shell
 userdom_exec_user_home_content_files(wm_domain)
 
 userdom_manage_user_tmp_sockets(wm_domain)
 userdom_tmp_filetrans_user_tmp(wm_domain, sock_file)
 userdom_user_runtime_filetrans_user_tmp(wm_domain, sock_file)
 
+# to print error messages
+userdom_use_user_terminals(wm_domain)

maybe userdom_use_inherited_user_terminals()?

Quoted 8 lines
policy/modules/contrib/wm.te +1 -0
+
 userdom_manage_user_home_content_dirs(wm_domain)
 userdom_manage_user_home_content_files(wm_domain)
 

_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

#3 lore raw

PATCH v2 2/10 wm: interactive start

In reply to Guido Trentalancia

Update the window manager (wm) module (support starting gnome-shell from an X terminal).

This second version curbs on an open permission when dealing with the user terminal (terminal is already opened by the X terminal application, thanks to Christian G?ttsche for the tip).

---
policy/modules/contrib/wm.if | 27 +++++++++++++++++++++++++++ policy/modules/contrib/wm.te | 7 ++++++-

2 files changed, 33 insertions(+), 1 deletion(-)
policy/modules/contrib/wm.if +0 -0
diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.if refpolicy-2.20170204/policy/modules/contrib/wm.if
@@ -73,6 +73,8 @@ template(`wm_role_template',`
	xserver_role($2, $1_wm_t)
	xserver_manage_core_devices($1_wm_t)

+ wm_write_pipes($1, $3)
+

	optional_policy(`
		dbus_connect_spec_session_bus($1, $1_wm_t)
		dbus_spec_session_bus_client($1, $1_wm_t)
@@ -219,3 +221,28 @@ interface(`wm_application_domain',`
	userdom_user_application_domain($1, $2)
	domtrans_pattern(wm_domain, $2, $1)

')
+
+########################################
+### <summary>
+### Write wm unnamed pipes.
+### </summary>
+## <param name="role_prefix">
+### <summary>
+### The prefix of the user domain (e.g., user
+### is the prefix for user_t).
+### </summary>
+### </param>
+### <param name="domain">
+### <summary>
+### Domain allowed access.
+### </summary>
+### </param>
+### </param>
+##
+interface(wm_write_pipes',
+ gen_require(`
+ type $1_t;
+ ')
+
+ allow $2 $1_wm_t:fifo_file write;
+')

policy/modules/contrib/wm.te +0 -0
diff -pru refpolicy-2.20170204-orig/policy/modules/contrib/wm.te refpolicy-2.20170204/policy/modules/contrib/wm.te
@@ -64,19 +64,24 @@ kernel_read_fs_sysctls(wm_domain)

kernel_read_proc_symlinks(wm_domain)
kernel_read_sysctl(wm_domain)

+locallogin_dontaudit_use_fds(wm_domain)
+
miscfiles_read_fonts(wm_domain)
miscfiles_read_generic_certs(wm_domain)
miscfiles_read_localization(wm_domain)

udev_read_pid_files(wm_domain)

-# this is needed by gnome-shell
+# the following is needed by gnome-shell
userdom_exec_user_home_content_files(wm_domain)

userdom_manage_user_tmp_sockets(wm_domain) userdom_tmp_filetrans_user_tmp(wm_domain, sock_file) userdom_user_runtime_filetrans_user_tmp(wm_domain, sock_file)

+# to print error messages +userdom_use_inherited_user_terminals(wm_domain)
+
userdom_manage_user_home_content_dirs(wm_domain) userdom_manage_user_home_content_files(wm_domain)