-## Support X userspace object manager -##
++##++## Allow the graphical login program to create files in HOME dirs as xdm_home_t. ++##
++##+## Support X userspace object manager +##
@@ -23932,7 +23939,7 @@ index 2696452..d6f03e7 100644 attribute x_domain; # X Events -@@ -107,44 +130,54 @@ xserver_object_types_template(remote) +@@ -107,44 +137,54 @@ xserver_object_types_template(remote) xserver_common_x_domain_template(remote, remote_t) type user_fonts_t; @@ -23988,7 +23995,7 @@ index 2696452..d6f03e7 100644 typealias xauth_tmp_t alias { auditadm_xauth_tmp_t secadm_xauth_tmp_t }; userdom_user_tmp_file(xauth_tmp_t) -@@ -154,19 +187,28 @@ files_type(xconsole_device_t) +@@ -154,19 +194,28 @@ files_type(xconsole_device_t) fs_associate_tmpfs(xconsole_device_t) files_associate_tmp(xconsole_device_t) @@ -24019,7 +24026,7 @@ index 2696452..d6f03e7 100644 type xdm_var_lib_t; files_type(xdm_var_lib_t) -@@ -174,13 +216,27 @@ files_type(xdm_var_lib_t) +@@ -174,13 +223,27 @@ files_type(xdm_var_lib_t) type xdm_var_run_t; files_pid_file(xdm_var_run_t) @@ -24048,7 +24055,7 @@ index 2696452..d6f03e7 100644 # type for /var/lib/xkb type xkb_var_lib_t; files_type(xkb_var_lib_t) -@@ -193,14 +249,12 @@ typealias xserver_t alias { auditadm_xserver_t secadm_xserver_t xdm_xserver_t }; +@@ -193,14 +256,12 @@ typealias xserver_t alias { auditadm_xserver_t secadm_xserver_t xdm_xserver_t }; init_system_domain(xserver_t, xserver_exec_t) ubac_constrained(xserver_t) @@ -24067,7 +24074,7 @@ index 2696452..d6f03e7 100644 userdom_user_tmpfs_file(xserver_tmpfs_t) type xsession_exec_t; -@@ -225,21 +279,33 @@ optional_policy(` +@@ -225,21 +286,33 @@ optional_policy(` # allow iceauth_t iceauth_home_t:file manage_file_perms; @@ -24110,7 +24117,7 @@ index 2696452..d6f03e7 100644 ') ######################################## -@@ -247,48 +313,83 @@ tunable_policy(`use_samba_home_dirs',` +@@ -247,48 +320,83 @@ tunable_policy(`use_samba_home_dirs',` # Xauth local policy # @@ -24194,18 +24201,18 @@ index 2696452..d6f03e7 100644 +ifdef(`hide_broken_symptoms',` + term_dontaudit_use_unallocated_ttys(xauth_t) + dev_dontaudit_rw_dri(xauth_t) - ') - - optional_policy(` -+ nx_var_lib_filetrans(xauth_t, xauth_home_t, file) +') + +optional_policy(` ++ nx_var_lib_filetrans(xauth_t, xauth_home_t, file) + ') + + optional_policy(` + ssh_use_ptys(xauth_t) ssh_sigchld(xauth_t) ssh_read_pipes(xauth_t) ssh_dontaudit_rw_tcp_sockets(xauth_t) -@@ -299,64 +400,106 @@ optional_policy(` +@@ -299,64 +407,106 @@ optional_policy(` # XDM Local policy # @@ -24322,7 +24329,7 @@ index 2696452..d6f03e7 100644 # connect to xdm xserver over stream socket stream_connect_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t, xserver_t) -@@ -365,20 +508,27 @@ stream_connect_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t, xserver_t) +@@ -365,20 +515,27 @@ stream_connect_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t, xserver_t) delete_files_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t) delete_sock_files_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t) @@ -24352,7 +24359,7 @@ index 2696452..d6f03e7 100644 corenet_all_recvfrom_netlabel(xdm_t) corenet_tcp_sendrecv_generic_if(xdm_t) corenet_udp_sendrecv_generic_if(xdm_t) -@@ -388,38 +538,48 @@ corenet_tcp_sendrecv_all_ports(xdm_t) +@@ -388,38 +545,48 @@ corenet_tcp_sendrecv_all_ports(xdm_t) corenet_udp_sendrecv_all_ports(xdm_t) corenet_tcp_bind_generic_node(xdm_t) corenet_udp_bind_generic_node(xdm_t) @@ -24405,7 +24412,7 @@ index 2696452..d6f03e7 100644 files_read_etc_files(xdm_t) files_read_var_files(xdm_t) -@@ -430,9 +590,28 @@ files_list_mnt(xdm_t) +@@ -430,9 +597,28 @@ files_list_mnt(xdm_t) files_read_usr_files(xdm_t) # Poweroff wants to create the /poweroff file when run from xdm files_create_boot_flag(xdm_t) @@ -24434,7 +24441,7 @@ index 2696452..d6f03e7 100644 storage_dontaudit_read_fixed_disk(xdm_t) storage_dontaudit_write_fixed_disk(xdm_t) -@@ -441,28 +620,43 @@ storage_dontaudit_raw_read_removable_device(xdm_t) +@@ -441,28 +627,43 @@ storage_dontaudit_raw_read_removable_device(xdm_t) storage_dontaudit_raw_write_removable_device(xdm_t) storage_dontaudit_setattr_removable_dev(xdm_t) storage_dontaudit_rw_scsi_generic(xdm_t) @@ -24481,7 +24488,7 @@ index 2696452..d6f03e7 100644 userdom_dontaudit_use_unpriv_user_fds(xdm_t) userdom_create_all_users_keys(xdm_t) -@@ -471,24 +665,43 @@ userdom_read_user_home_content_files(xdm_t) +@@ -471,24 +672,144 @@ userdom_read_user_home_content_files(xdm_t) # Search /proc for any user domain processes. userdom_read_all_users_state(xdm_t) userdom_signal_all_users(xdm_t) @@ -24490,7 +24497,108 @@ index 2696452..d6f03e7 100644 +userdom_manage_user_tmp_files(xdm_t) +userdom_manage_user_tmp_sockets(xdm_t) +userdom_manage_tmpfs_role(system_r, xdm_t) -+userdom_home_manager(xdm_t) ++ ++#userdom_home_manager(xdm_t) ++tunable_policy(`xdm_write_home',` ++ userdom_user_home_dir_filetrans(xdm_t, xdm_home_t, file) ++',` ++ userdom_user_home_dir_filetrans_user_home_content(xdm_t, { dir file lnk_file fifo_file sock_file }) ++') ++ ++tunable_policy(`use_nfs_home_dirs',` ++ fs_list_auto_mountpoints(xdm_t) ++ fs_manage_nfs_dirs(xdm_t) ++ fs_manage_nfs_files(xdm_t) ++ fs_manage_nfs_symlinks(xdm_t) ++') ++ ++tunable_policy(`use_samba_home_dirs',` ++ fs_manage_cifs_dirs(xdm_t) ++ fs_manage_cifs_files(xdm_t) ++ fs_manage_cifs_symlinks(xdm_t) ++') ++ ++tunable_policy(`use_fusefs_home_dirs',` ++ fs_manage_fusefs_dirs(xdm_t) ++ fs_manage_fusefs_files(xdm_t) ++ fs_manage_fusefs_symlinks(xdm_t) ++') ++ ++tunable_policy(`use_ecryptfs_home_dirs',` ++ fs_manage_ecryptfs_dirs(xdm_t) ++ fs_manage_ecryptfs_files(xdm_t) ++') ++ ++### filename transitions ### ++userdom_filetrans_generic_home_content(xdm_t) ++ ++optional_policy(` ++ gnome_config_filetrans(xdm_t, home_cert_t, dir, "certificates") ++') ++ ++optional_policy(` ++ apache_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ auth_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ gnome_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ gpg_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ irc_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ kerberos_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ mozilla_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ mta_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ pulseaudio_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ spamassassin_filetrans_home_content(xdm_t) ++ spamassassin_filetrans_admin_home_content(xdm_t) ++') ++ ++optional_policy(` ++ ssh_filetrans_admin_home_content(xdm_t) ++ ssh_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ telepathy_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ thumb_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ tvtime_filetrans_home_content(xdm_t) ++') ++ ++optional_policy(` ++ virt_filetrans_home_content(xdm_t) ++') ++ ++### end of filename transitions ### + +application_signal(xdm_t) @@ -24531,7 +24639,7 @@ index 2696452..d6f03e7 100644 tunable_policy(`xdm_sysadm_login',` userdom_xsession_spec_domtrans_all_users(xdm_t) # FIXME: -@@ -502,11 +715,26 @@ tunable_policy(`xdm_sysadm_login',` +@@ -502,11 +823,26 @@ tunable_policy(`xdm_sysadm_login',` ') optional_policy(` @@ -24558,7 +24666,7 @@ index 2696452..d6f03e7 100644 ') optional_policy(` -@@ -514,12 +742,72 @@ optional_policy(` +@@ -514,12 +850,72 @@ optional_policy(` ') optional_policy(` @@ -24619,7 +24727,7 @@ index 2696452..d6f03e7 100644 + gnome_exec_keyringd(xdm_t) + gnome_manage_config(xdm_t) + gnome_manage_gconf_home_files(xdm_t) -+ gnome_filetrans_home_content(xdm_t) ++ #gnome_filetrans_home_content(xdm_t) + gnome_read_config(xdm_t) + gnome_read_usr_config(xdm_t) + gnome_read_gconf_config(xdm_t) @@ -24631,7 +24739,7 @@ index 2696452..d6f03e7 100644 hostname_exec(xdm_t) ') -@@ -537,28 +825,78 @@ optional_policy(` +@@ -537,28 +933,78 @@ optional_policy(` ') optional_policy(` @@ -24719,7 +24827,7 @@ index 2696452..d6f03e7 100644 ') optional_policy(` -@@ -570,6 +908,14 @@ optional_policy(` +@@ -570,6 +1016,14 @@ optional_policy(` ') optional_policy(` @@ -24734,7 +24842,7 @@ index 2696452..d6f03e7 100644 xfs_stream_connect(xdm_t) ') -@@ -594,8 +940,11 @@ allow xserver_t input_xevent_t:x_event send; +@@ -594,8 +1048,11 @@ allow xserver_t input_xevent_t:x_event send; # execheap needed until the X module loader is fixed. # NVIDIA Needs execstack @@ -24747,7 +24855,7 @@ index 2696452..d6f03e7 100644 allow xserver_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow xserver_t self:fd use; allow xserver_t self:fifo_file rw_fifo_file_perms; -@@ -608,8 +957,15 @@ allow xserver_t self:unix_dgram_socket { create_socket_perms sendto }; +@@ -608,8 +1065,15 @@ allow xserver_t self:unix_dgram_socket { create_socket_perms sendto }; allow xserver_t self:unix_stream_socket { create_stream_socket_perms connectto }; allow xserver_t self:tcp_socket create_stream_socket_perms; allow xserver_t self:udp_socket create_socket_perms; @@ -24763,7 +24871,7 @@ index 2696452..d6f03e7 100644 manage_dirs_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t) manage_files_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t) manage_sock_files_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t) -@@ -617,6 +973,10 @@ files_tmp_filetrans(xserver_t, xserver_tmp_t, { file dir sock_file }) +@@ -617,6 +1081,10 @@ files_tmp_filetrans(xserver_t, xserver_tmp_t, { file dir sock_file }) filetrans_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t, sock_file) @@ -24774,7 +24882,7 @@ index 2696452..d6f03e7 100644 manage_dirs_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) manage_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) manage_lnk_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) -@@ -628,12 +988,19 @@ manage_files_pattern(xserver_t, xkb_var_lib_t, xkb_var_lib_t) +@@ -628,12 +1096,19 @@ manage_files_pattern(xserver_t, xkb_var_lib_t, xkb_var_lib_t) manage_lnk_files_pattern(xserver_t, xkb_var_lib_t, xkb_var_lib_t) files_search_var_lib(xserver_t) @@ -24796,7 +24904,7 @@ index 2696452..d6f03e7 100644 kernel_read_system_state(xserver_t) kernel_read_device_sysctls(xserver_t) -@@ -641,12 +1008,12 @@ kernel_read_modprobe_sysctls(xserver_t) +@@ -641,12 +1116,12 @@ kernel_read_modprobe_sysctls(xserver_t) # Xorg wants to check if kernel is tainted kernel_read_kernel_sysctls(xserver_t) kernel_write_proc_files(xserver_t) @@ -24810,7 +24918,7 @@ index 2696452..d6f03e7 100644 corenet_all_recvfrom_netlabel(xserver_t) corenet_tcp_sendrecv_generic_if(xserver_t) corenet_udp_sendrecv_generic_if(xserver_t) -@@ -667,23 +1034,27 @@ dev_rw_apm_bios(xserver_t) +@@ -667,23 +1142,27 @@ dev_rw_apm_bios(xserver_t) dev_rw_agp(xserver_t) dev_rw_framebuffer(xserver_t) dev_manage_dri_dev(xserver_t) @@ -24841,7 +24949,7 @@ index 2696452..d6f03e7 100644 # brought on by rhgb files_search_mnt(xserver_t) -@@ -694,7 +1065,16 @@ fs_getattr_xattr_fs(xserver_t) +@@ -694,7 +1173,16 @@ fs_getattr_xattr_fs(xserver_t) fs_search_nfs(xserver_t) fs_search_auto_mountpoints(xserver_t) fs_search_ramfs(xserver_t) @@ -24859,7 +24967,7 @@ index 2696452..d6f03e7 100644 mls_xwin_read_to_clearance(xserver_t) selinux_validate_context(xserver_t) -@@ -708,20 +1088,18 @@ init_getpgid(xserver_t) +@@ -708,20 +1196,18 @@ init_getpgid(xserver_t) term_setattr_unallocated_ttys(xserver_t) term_use_unallocated_ttys(xserver_t) @@ -24883,7 +24991,7 @@ index 2696452..d6f03e7 100644 userdom_search_user_home_dirs(xserver_t) userdom_use_user_ttys(xserver_t) -@@ -729,8 +1107,6 @@ userdom_setattr_user_ttys(xserver_t) +@@ -729,8 +1215,6 @@ userdom_setattr_user_ttys(xserver_t) userdom_read_user_tmp_files(xserver_t) userdom_rw_user_tmpfs_files(xserver_t) @@ -24892,7 +25000,7 @@ index 2696452..d6f03e7 100644 ifndef(`distro_redhat',` allow xserver_t self:process { execmem execheap execstack }; domain_mmap_low_uncond(xserver_t) -@@ -775,16 +1151,44 @@ optional_policy(` +@@ -775,16 +1259,44 @@ optional_policy(` ') optional_policy(` @@ -24938,7 +25046,7 @@ index 2696452..d6f03e7 100644 unconfined_domtrans(xserver_t) ') -@@ -793,6 +1197,10 @@ optional_policy(` +@@ -793,6 +1305,10 @@ optional_policy(` ') optional_policy(` @@ -24949,7 +25057,7 @@ index 2696452..d6f03e7 100644 xfs_stream_connect(xserver_t) ') -@@ -808,10 +1216,10 @@ allow xserver_t xdm_t:shm rw_shm_perms; +@@ -808,10 +1324,10 @@ allow xserver_t xdm_t:shm rw_shm_perms; # NB we do NOT allow xserver_t xdm_var_lib_t:dir, only access to an open # handle of a file inside the dir!!! @@ -24963,7 +25071,7 @@ index 2696452..d6f03e7 100644 # Label pid and temporary files with derived types. manage_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t) -@@ -819,7 +1227,7 @@ manage_lnk_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t) +@@ -819,7 +1335,7 @@ manage_lnk_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t) manage_sock_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t) # Run xkbcomp. @@ -24972,7 +25080,7 @@ index 2696452..d6f03e7 100644 can_exec(xserver_t, xkb_var_lib_t) # VNC v4 module in X server -@@ -832,26 +1240,21 @@ init_use_fds(xserver_t) +@@ -832,26 +1348,21 @@ init_use_fds(xserver_t) # to read ROLE_home_t - examine this in more detail # (xauth?) userdom_read_user_home_content_files(xserver_t) @@ -25007,7 +25115,7 @@ index 2696452..d6f03e7 100644 ') optional_policy(` -@@ -902,7 +1305,7 @@ allow x_domain xproperty_t:x_property { getattr create read write append destroy +@@ -902,7 +1413,7 @@ allow x_domain xproperty_t:x_property { getattr create read write append destroy allow x_domain root_xdrawable_t:x_drawable { getattr setattr list_child add_child remove_child send receive hide show }; # operations allowed on my windows allow x_domain self:x_drawable { create destroy getattr setattr read write show hide list_child add_child remove_child manage send receive }; @@ -25016,7 +25124,7 @@ index 2696452..d6f03e7 100644 # operations allowed on all windows allow x_domain x_domain:x_drawable { getattr get_property set_property remove_child }; -@@ -956,11 +1359,31 @@ allow x_domain self:x_resource { read write }; +@@ -956,11 +1467,31 @@ allow x_domain self:x_resource { read write }; # can mess with the screensaver allow x_domain xserver_t:x_screen { getattr saver_getattr }; @@ -25048,7 +25156,7 @@ index 2696452..d6f03e7 100644 tunable_policy(`! xserver_object_manager',` # should be xserver_unconfined(x_domain), # but typeattribute doesnt work in conditionals -@@ -982,18 +1405,40 @@ tunable_policy(`! xserver_object_manager',` +@@ -982,18 +1513,41 @@ tunable_policy(`! xserver_object_manager',` allow x_domain xevent_type:{ x_event x_synthetic_event } *; ') @@ -25104,6 +25212,7 @@ index 2696452..d6f03e7 100644 + domtrans_pattern(xdm_t, xdm_unconfined_exec_t, xdm_unconfined_t) + unconfined_domain(xdm_unconfined_t) +') ++ diff --git a/policy/modules/system/application.if b/policy/modules/system/application.if index 1b6619e..be02b96 100644 --- a/policy/modules/system/application.if @@ -39212,7 +39321,7 @@ index db75976..65191bd 100644 + +/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0) diff --git a/policy/modules/system/userdomain.if b/policy/modules/system/userdomain.if -index 3c5dba7..df7407b 100644 +index 3c5dba7..e27d755 100644 --- a/policy/modules/system/userdomain.if +++ b/policy/modules/system/userdomain.if @@ -30,9 +30,11 @@ template(`userdom_base_user_template',` @@ -41879,7 +41988,7 @@ index 3c5dba7..df7407b 100644 ## Create keys for all user domains. ## ## -@@ -3438,4 +4197,1390 @@ interface(`userdom_dbus_send_all_users',` +@@ -3438,4 +4197,1415 @@ interface(`userdom_dbus_send_all_users',` ') allow $1 userdomain:dbus send_msg; @@ -43269,6 +43378,31 @@ index 3c5dba7..df7407b 100644 + ') + + filetrans_pattern($1, user_tmpfs_t, $2, $3, $4) ++') ++ ++###################################### ++##