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

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