Blame SOURCES/tigervnc-selinux-policy-improvements.patch

acbd46
From 386542e6d50eeaa68aa91f821c0725ddd0ab9b2a Mon Sep 17 00:00:00 2001
acbd46
From: Vit Mojzis <vmojzis@redhat.com>
acbd46
Date: Tue, 18 May 2021 12:23:15 +0200
acbd46
Subject: [PATCH] selinux: Fix issues reported by SELint
acbd46
acbd46
Style guide [1] issues only. No impact on policy functionality.
acbd46
acbd46
[1] - https://github.com/TresysTechnology/refpolicy/wiki/StyleGuide
acbd46
---
acbd46
 unix/vncserver/selinux/vncsession.te | 7 +++----
acbd46
 1 file changed, 3 insertions(+), 4 deletions(-)
acbd46
acbd46
diff --git a/unix/vncserver/selinux/vncsession.te b/unix/vncserver/selinux/vncsession.te
acbd46
index a773fed39..63ad8a85f 100644
acbd46
--- a/unix/vncserver/selinux/vncsession.te
acbd46
+++ b/unix/vncserver/selinux/vncsession.te
acbd46
@@ -17,7 +17,7 @@
acbd46
 #  USA.
acbd46
 #
acbd46
acbd46
-policy_module(vncsession, 1.0.0);
acbd46
+policy_module(vncsession, 1.0.0)
acbd46
acbd46
 gen_require(`
acbd46
     attribute userdomain;
acbd46
@@ -42,8 +42,8 @@ can_exec(vnc_session_t, vnc_session_exec_t)
acbd46
 userdom_spec_domtrans_all_users(vnc_session_t)
acbd46
 userdom_signal_all_users(vnc_session_t)
acbd46
acbd46
-allow vnc_session_t self:capability { kill chown dac_override dac_read_search fowner setgid setuid sys_resource };
acbd46
-allow vnc_session_t self:process { getcap setsched setexec setrlimit };
acbd46
+allow vnc_session_t self:capability { chown dac_override dac_read_search fowner kill setgid setuid sys_resource };
acbd46
+allow vnc_session_t self:process { getcap setexec setrlimit setsched };
acbd46
 allow vnc_session_t self:fifo_file rw_fifo_file_perms;
acbd46
acbd46
 manage_files_pattern(vnc_session_t, xdm_home_t, xdm_home_t)
acbd46
@@ -65,4 +65,3 @@ logging_append_all_logs(vnc_session_t)
acbd46
acbd46
 mcs_process_set_categories(vnc_session_t)
acbd46
 mcs_killall(vnc_session_t)
acbd46
-
acbd46
From 23cf514ac265a02dc666e8651dcc579022f0da77 Mon Sep 17 00:00:00 2001
acbd46
From: Zdenek Pytela <zpytela@redhat.com>
acbd46
Date: Tue, 18 May 2021 13:31:53 +0200
acbd46
Subject: [PATCH] selinux: further style and comprehensibility improvements
acbd46
acbd46
Sections and rules blocks reordered according to the Style guide.
acbd46
acbd46
https://github.com/TresysTechnology/refpolicy/wiki/StyleGuide
acbd46
---
acbd46
 unix/vncserver/selinux/vncsession.te | 59 +++++++++++++++++-----------
acbd46
 1 file changed, 36 insertions(+), 23 deletions(-)
acbd46
acbd46
diff --git a/unix/vncserver/selinux/vncsession.te b/unix/vncserver/selinux/vncsession.te
acbd46
index 63ad8a85f..86fd6e5ef 100644
acbd46
--- a/unix/vncserver/selinux/vncsession.te
acbd46
+++ b/unix/vncserver/selinux/vncsession.te
acbd46
@@ -20,48 +20,61 @@
acbd46
 policy_module(vncsession, 1.0.0)
acbd46
acbd46
 gen_require(`
acbd46
-    attribute userdomain;
acbd46
-    type xdm_home_t;
acbd46
+	attribute userdomain;
acbd46
+	type xdm_home_t;
acbd46
 ')
acbd46
acbd46
-type vnc_session_exec_t;
acbd46
-corecmd_executable_file(vnc_session_exec_t)
acbd46
 type vnc_session_t;
acbd46
+type vnc_session_exec_t;
acbd46
 init_daemon_domain(vnc_session_t, vnc_session_exec_t)
acbd46
-auth_login_pgm_domain(vnc_session_t)
acbd46
+can_exec(vnc_session_t, vnc_session_exec_t)
acbd46
acbd46
 type vnc_session_var_run_t;
acbd46
 files_pid_file(vnc_session_var_run_t)
acbd46
-allow vnc_session_t vnc_session_var_run_t:file manage_file_perms;
acbd46
-files_pid_filetrans(vnc_session_t, vnc_session_var_run_t, file)
acbd46
-
acbd46
-auth_write_login_records(vnc_session_t)
acbd46
-
acbd46
-can_exec(vnc_session_t, vnc_session_exec_t)
acbd46
-
acbd46
-userdom_spec_domtrans_all_users(vnc_session_t)
acbd46
-userdom_signal_all_users(vnc_session_t)
acbd46
acbd46
 allow vnc_session_t self:capability { chown dac_override dac_read_search fowner kill setgid setuid sys_resource };
acbd46
 allow vnc_session_t self:process { getcap setexec setrlimit setsched };
acbd46
 allow vnc_session_t self:fifo_file rw_fifo_file_perms;
acbd46
acbd46
+allow vnc_session_t vnc_session_var_run_t:file manage_file_perms;
acbd46
+files_pid_filetrans(vnc_session_t, vnc_session_var_run_t, file)
acbd46
+
acbd46
 manage_files_pattern(vnc_session_t, xdm_home_t, xdm_home_t)
acbd46
 manage_fifo_files_pattern(vnc_session_t, xdm_home_t, xdm_home_t)
acbd46
 manage_sock_files_pattern(vnc_session_t, xdm_home_t, xdm_home_t)
acbd46
 manage_lnk_files_pattern(vnc_session_t, xdm_home_t, xdm_home_t)
acbd46
-userdom_user_home_dir_filetrans(vnc_session_t, xdm_home_t, dir, ".vnc")
acbd46
-userdom_admin_home_dir_filetrans(vnc_session_t, xdm_home_t, dir, ".vnc")
acbd46
-
acbd46
-# This also affects other tools, e.g. vncpasswd
acbd46
-userdom_admin_home_dir_filetrans(userdomain, xdm_home_t, dir, ".vnc")
acbd46
-userdom_user_home_dir_filetrans(userdomain, xdm_home_t, dir, ".vnc")
acbd46
-
acbd46
-miscfiles_read_localization(vnc_session_t)
acbd46
acbd46
 kernel_read_kernel_sysctls(vnc_session_t)
acbd46
acbd46
-logging_append_all_logs(vnc_session_t)
acbd46
+corecmd_executable_file(vnc_session_exec_t)
acbd46
acbd46
 mcs_process_set_categories(vnc_session_t)
acbd46
 mcs_killall(vnc_session_t)
acbd46
+
acbd46
+optional_policy(`
acbd46
+	auth_login_pgm_domain(vnc_session_t)
acbd46
+	auth_write_login_records(vnc_session_t)
acbd46
+')
acbd46
+
acbd46
+optional_policy(`
acbd46
+	logging_append_all_logs(vnc_session_t)
acbd46
+')
acbd46
+
acbd46
+optional_policy(`
acbd46
+	miscfiles_read_localization(vnc_session_t)
acbd46
+')
acbd46
+
acbd46
+optional_policy(`
acbd46
+	userdom_spec_domtrans_all_users(vnc_session_t)
acbd46
+	userdom_signal_all_users(vnc_session_t)
acbd46
+
acbd46
+	userdom_user_home_dir_filetrans(vnc_session_t, xdm_home_t, dir, ".vnc")
acbd46
+	userdom_admin_home_dir_filetrans(vnc_session_t, xdm_home_t, dir, ".vnc")
acbd46
+
acbd46
+	# This also affects other tools, e.g. vncpasswd
acbd46
+	gen_require(`
acbd46
+		attribute userdomain;
acbd46
+	')
acbd46
+	userdom_admin_home_dir_filetrans(userdomain, xdm_home_t, dir, ".vnc")
acbd46
+	userdom_user_home_dir_filetrans(userdomain, xdm_home_t, dir, ".vnc")
acbd46
+')
acbd46
From 3c8622691abfb377b48bf3749dd629c5a7120cf4 Mon Sep 17 00:00:00 2001
acbd46
From: Zdenek Pytela <zpytela@redhat.com>
acbd46
Date: Tue, 18 May 2021 13:39:11 +0200
acbd46
Subject: [PATCH] Allow vnc_session_t manage nfs dirs and files conditionally
acbd46
acbd46
The permissions set to manage directories and files with the nfs_t type
acbd46
is allowed when the use_nfs_home_dirs boolean is turned on.
acbd46
acbd46
Resolves: https://github.com/TigerVNC/tigervnc/issues/1189
acbd46
---
acbd46
 unix/vncserver/selinux/vncsession.te | 5 +++++
acbd46
 1 file changed, 5 insertions(+)
acbd46
acbd46
diff --git a/unix/vncserver/selinux/vncsession.te b/unix/vncserver/selinux/vncsession.te
acbd46
index 86fd6e5ef..46e699117 100644
acbd46
--- a/unix/vncserver/selinux/vncsession.te
acbd46
+++ b/unix/vncserver/selinux/vncsession.te
acbd46
@@ -51,6 +51,11 @@ corecmd_executable_file(vnc_session_exec_t)
acbd46
 mcs_process_set_categories(vnc_session_t)
acbd46
 mcs_killall(vnc_session_t)
acbd46
acbd46
+tunable_policy(`use_nfs_home_dirs',`
acbd46
+	fs_manage_nfs_dirs(vnc_session_t)
acbd46
+	fs_manage_nfs_files(vnc_session_t)
acbd46
+')
acbd46
+
acbd46
 optional_policy(`
acbd46
 	auth_login_pgm_domain(vnc_session_t)
acbd46
 	auth_write_login_records(vnc_session_t)
acbd46
diff --git a/unix/vncserver/selinux/vncsession.te b/unix/vncserver/selinux/vncsession.te
acbd46
index 46e69911..f1108ec8 100644
acbd46
--- a/unix/vncserver/selinux/vncsession.te
acbd46
+++ b/unix/vncserver/selinux/vncsession.te
acbd46
@@ -20,7 +20,6 @@
acbd46
 policy_module(vncsession, 1.0.0)
acbd46
acbd46
 gen_require(`
acbd46
-	attribute userdomain;
acbd46
 	type xdm_home_t;
acbd46
 ')
acbd46