Chris PeBenito 488ec7
## <summary>X Windows Server</summary>
Chris PeBenito 488ec7
Chris PeBenito 24a637
#######################################
Chris PeBenito 24a637
## <summary>
Chris PeBenito 24a637
##	Template to create types and rules common to
Chris PeBenito 24a637
##	all X server domains.
Chris PeBenito 24a637
## </summary>
Chris PeBenito 24a637
## <param name="prefix">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	The prefix of the domain (e.g., user
Chris PeBenito 24a637
##	is the prefix for user_t).
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
#
Chris PeBenito 488ec7
template(`xserver_common_domain_template',`
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	##############################
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
	# Declarations
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	type $1_xserver_t;
Chris PeBenito 488ec7
	domain_type($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	type $1_xserver_tmp_t;
Chris PeBenito 488ec7
	files_tmp_file($1_xserver_tmp_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	type $1_xserver_tmpfs_t;
Chris PeBenito 488ec7
	files_tmpfs_file($1_xserver_tmpfs_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	##############################
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
	# $1_xserver_t local policy
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	# setuid/setgid for the wrapper program to change UID
Chris PeBenito 488ec7
	# sys_rawio is for iopl access - should not be needed for frame-buffer
Chris PeBenito 488ec7
	# sys_admin, locking shared mem?  chowning IPC message queues or semaphores?
Chris PeBenito 488ec7
	# admin of APM bios?
Chris PeBenito 488ec7
	# sys_nice is so that the X server can set a negative nice value
Chris PeBenito 488ec7
	# execheap needed until the X module loader is fixed.
Chris PeBenito 46c69c
	# NVIDIA Needs execstack
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	allow $1_xserver_t self:capability { dac_override fsetid setgid setuid ipc_owner sys_rawio sys_admin sys_nice sys_tty_config mknod net_bind_service };
Chris PeBenito 488ec7
	dontaudit $1_xserver_t self:capability chown;
Chris PeBenito 488ec7
	allow $1_xserver_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 46c69c
	allow $1_xserver_t self:process { execmem execheap execstack setsched };
Chris PeBenito 488ec7
	allow $1_xserver_t self:fd use;
Chris PeBenito 488ec7
	allow $1_xserver_t self:fifo_file rw_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t self:sock_file r_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t self:shm create_shm_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t self:sem create_sem_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t self:msgq create_msgq_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t self:msg { send receive };
Chris PeBenito 488ec7
	allow $1_xserver_t self:unix_dgram_socket { create_socket_perms sendto };
Chris PeBenito 488ec7
	allow $1_xserver_t self:unix_stream_socket { create_stream_socket_perms connectto };
Chris PeBenito 46c69c
	allow $1_xserver_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t self:udp_socket create_socket_perms;
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmp_t:dir manage_dir_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmp_t:file manage_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmp_t:sock_file manage_file_perms;
Chris PeBenito 103fe2
	files_tmp_filetrans($1_xserver_t, $1_xserver_tmp_t, { file dir sock_file })
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
	allow $1_xserver_t xdm_xserver_tmp_t:dir rw_dir_perms;
Chris PeBenito 0f5d13
	type_transition $1_xserver_t xdm_xserver_tmp_t:sock_file $1_xserver_tmp_t;
Chris PeBenito 0f5d13
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmpfs_t:dir manage_dir_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmpfs_t:file manage_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmpfs_t:lnk_file create_lnk_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmpfs_t:sock_file manage_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $1_xserver_tmpfs_t:fifo_file manage_file_perms;
Chris PeBenito 103fe2
	fs_tmpfs_filetrans($1_xserver_t,$1_xserver_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	allow $1_xserver_t xkb_var_lib_t:dir rw_dir_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t xkb_var_lib_t:file manage_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t xkb_var_lib_t:lnk_file create_lnk_perms;
Chris PeBenito 488ec7
	files_search_var_lib($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	# Create files in /var/log with the xserver_log_t type.
Chris PeBenito 488ec7
	allow $1_xserver_t xserver_log_t:file manage_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t xserver_log_t:dir r_dir_perms;
Chris PeBenito 103fe2
	logging_log_filetrans($1_xserver_t,xserver_log_t,file)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	kernel_read_system_state($1_xserver_t)
Chris PeBenito 445522
	kernel_read_device_sysctls($1_xserver_t)
Chris PeBenito 445522
	kernel_read_modprobe_sysctls($1_xserver_t)
Chris PeBenito 488ec7
	# Xorg wants to check if kernel is tainted
Chris PeBenito 445522
	kernel_read_kernel_sysctls($1_xserver_t)
Chris PeBenito 46c69c
	kernel_write_proc_files($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	# Run helper programs in $1_xserver_t.
Chris PeBenito 488ec7
	corecmd_search_sbin($1_xserver_t)
Chris PeBenito 488ec7
	corecmd_exec_bin($1_xserver_t)
Chris PeBenito 488ec7
	corecmd_exec_shell($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	corenet_non_ipsec_sendrecv($1_xserver_t)
Chris PeBenito 488ec7
	corenet_tcp_sendrecv_generic_if($1_xserver_t)
Chris PeBenito 488ec7
	corenet_udp_sendrecv_generic_if($1_xserver_t)
Chris PeBenito 488ec7
	corenet_raw_sendrecv_generic_if($1_xserver_t)
Chris PeBenito 488ec7
	corenet_tcp_sendrecv_all_nodes($1_xserver_t)
Chris PeBenito 488ec7
	corenet_udp_sendrecv_all_nodes($1_xserver_t)
Chris PeBenito 488ec7
	corenet_raw_sendrecv_all_nodes($1_xserver_t)
Chris PeBenito 488ec7
	corenet_tcp_sendrecv_all_ports($1_xserver_t)
Chris PeBenito 488ec7
	corenet_udp_sendrecv_all_ports($1_xserver_t)
Chris PeBenito 488ec7
	corenet_tcp_bind_all_nodes($1_xserver_t)
Chris PeBenito 488ec7
	corenet_udp_bind_all_nodes($1_xserver_t)
Chris PeBenito 488ec7
	corenet_tcp_bind_xserver_port($1_xserver_t)
Chris PeBenito 488ec7
	corenet_tcp_connect_all_ports($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	dev_read_sysfs($1_xserver_t)
Chris PeBenito 488ec7
	dev_rw_mouse($1_xserver_t)
Chris PeBenito 488ec7
	dev_rw_mtrr($1_xserver_t)
Chris PeBenito 488ec7
	dev_rw_apm_bios($1_xserver_t)
Chris PeBenito 207c47
	dev_rw_agp($1_xserver_t)
Chris PeBenito 488ec7
	dev_rw_framebuffer($1_xserver_t)
Chris PeBenito 488ec7
	dev_manage_dri_dev($1_xserver_t)
Chris PeBenito 207c47
	dev_create_generic_dirs($1_xserver_t)
Chris PeBenito 207c47
	dev_setattr_generic_dirs($1_xserver_t)
Chris PeBenito 488ec7
	# raw memory access is needed if not using the frame buffer
Chris PeBenito 488ec7
	dev_read_raw_memory($1_xserver_t)
Chris PeBenito 488ec7
	dev_write_raw_memory($1_xserver_t)
Chris PeBenito 488ec7
	# for other device nodes such as the NVidia binary-only driver
Chris PeBenito 207c47
	dev_rw_xserver_misc($1_xserver_t)
Chris PeBenito 488ec7
	# read events - the synaptics touchpad driver reads raw events
Chris PeBenito 488ec7
	dev_rw_input_dev($1_xserver_t)
Chris PeBenito 46c69c
	dev_rwx_zero($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	files_read_etc_files($1_xserver_t)
Chris PeBenito 488ec7
	files_read_etc_runtime_files($1_xserver_t)
Chris PeBenito 46c69c
	files_read_usr_files($1_xserver_t)
Chris PeBenito 46c69c
Chris PeBenito 488ec7
	# brought on by rhgb
Chris PeBenito 488ec7
	files_search_mnt($1_xserver_t)
Chris PeBenito 488ec7
	# for nscd
Chris PeBenito 488ec7
	files_dontaudit_search_pids($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	fs_getattr_xattr_fs($1_xserver_t)
Chris PeBenito 488ec7
	fs_search_nfs($1_xserver_t)
Chris PeBenito 488ec7
	fs_search_auto_mountpoints($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 46c69c
	init_getpgid($1_xserver_t)
Chris PeBenito 46c69c
Chris PeBenito 488ec7
	term_setattr_unallocated_ttys($1_xserver_t)
Chris PeBenito 1815ba
	term_use_unallocated_ttys($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	libs_use_ld_so($1_xserver_t)
Chris PeBenito 488ec7
	libs_use_shared_libs($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	logging_send_syslog_msg($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	miscfiles_read_localization($1_xserver_t)
Chris PeBenito 488ec7
	miscfiles_read_fonts($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 07620c
	modutils_domtrans_insmod($1_xserver_t)
Chris PeBenito 07620c
Chris PeBenito 488ec7
	seutil_dontaudit_search_config($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	sysnet_read_config($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 488ec7
		auth_search_pam_console_data($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 488ec7
		nis_use_ypbind($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 1815ba
		nscd_socket_use($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 0f5d13
		xfs_stream_connect($1_xserver_t)
Chris PeBenito 0f5d13
	')
Chris PeBenito 0f5d13
Chris PeBenito 488ec7
	ifdef(`TODO',`
Chris PeBenito 488ec7
	ifdef(`distro_redhat',`
Chris PeBenito 488ec7
		ifdef(`rpm.te', `
Chris PeBenito 488ec7
			allow $1_xserver_t rpm_t:shm { unix_read unix_write read write associate getattr };
Chris PeBenito 488ec7
			allow $1_xserver_t rpm_tmpfs_t:file { read write };
Chris PeBenito 1c1ac6
			rpm_use_fds($1_xserver_t)
Chris PeBenito 488ec7
		')
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
	') dnl end TODO
Chris PeBenito 488ec7
')
Chris PeBenito 488ec7
Chris PeBenito 488ec7
#######################################
Chris PeBenito 488ec7
## <summary>
Chris PeBenito 488ec7
##	The per user domain template for the xserver module.
Chris PeBenito 488ec7
## </summary>
Chris PeBenito 488ec7
## <desc>
Chris PeBenito 488ec7
##	

Chris PeBenito 488ec7
##	Define a derived domain for the X server when executed
Chris PeBenito 488ec7
##	by a user domain (e.g. via startx).  See the xdm module
Chris PeBenito 488ec7
##	if using an X Display Manager.
Chris PeBenito 488ec7
##	

Chris PeBenito 488ec7
##	

Chris PeBenito 488ec7
##	This is invoked automatically for each user and
Chris PeBenito 488ec7
##	generally does not need to be invoked directly
Chris PeBenito 488ec7
##	by policy writers.
Chris PeBenito 488ec7
##	

Chris PeBenito 488ec7
## </desc>
Chris PeBenito 488ec7
## <param name="prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 488ec7
##	The prefix of the user domain (e.g., user
Chris PeBenito 488ec7
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 488ec7
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 488ec7
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
#
Chris PeBenito 488ec7
template(`xserver_per_userdomain_template',`
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	##############################
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
	# Declarations
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	xserver_common_domain_template($1)
Chris PeBenito 488ec7
	role $3 types $1_xserver_t;
Chris PeBenito 488ec7
Chris PeBenito 178647
	type $1_fonts_t, fonts_type;
Chris PeBenito 178647
	userdom_user_home_content($1,$1_fonts_t)
Chris PeBenito 178647
Chris PeBenito 178647
	type $1_fonts_cache_t, fonts_cache_type;
Chris PeBenito 178647
	userdom_user_home_content($1,$1_fonts_cache_t)
Chris PeBenito 178647
Chris PeBenito 178647
	type $1_fonts_config_t, fonts_config_type;
Chris PeBenito 178647
	userdom_user_home_content($1,$1_fonts_cache_t)
Chris PeBenito 178647
Chris PeBenito acd87c
	type $1_iceauth_t;
Chris PeBenito acd87c
	domain_type($1_iceauth_t)
Chris PeBenito acd87c
	role $3 types $1_iceauth_t;
Chris PeBenito acd87c
Chris PeBenito acd87c
	type $1_iceauth_home_t alias $1_iceauth_rw_t;
Chris PeBenito acd87c
	files_poly_member($1_iceauth_home_t)
Chris PeBenito 103fe2
	userdom_user_home_content($1,$1_iceauth_home_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	type $1_xauth_t;
Chris PeBenito acd87c
	domain_type($1_xauth_t)
Chris PeBenito acd87c
	role $3 types $1_xauth_t;
Chris PeBenito acd87c
Chris PeBenito acd87c
	type $1_xauth_home_t alias $1_xauth_rw_t;
Chris PeBenito acd87c
	files_poly_member($1_xauth_home_t)
Chris PeBenito 103fe2
	userdom_user_home_content($1,$1_xauth_home_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	type $1_xauth_tmp_t;
Chris PeBenito acd87c
	files_tmp_file($1_xauth_tmp_t)
Chris PeBenito acd87c
Chris PeBenito 488ec7
	##############################
Chris PeBenito 488ec7
	#
Chris PeBenito acd87c
	# $1_xserver_t Local policy
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
Chris PeBenito acd87c
	domain_auto_trans($1_xserver_t, xauth_exec_t, $1_xauth_t)
Chris PeBenito acd87c
	allow $1_xserver_t $1_xauth_t:fd use;
Chris PeBenito acd87c
	allow $1_xauth_t $1_xserver_t:fd use;
Chris PeBenito acd87c
	allow $1_xauth_t $1_xserver_t:fifo_file rw_file_perms;
Chris PeBenito acd87c
	allow $1_xauth_t $1_xserver_t:process sigchld;
Chris PeBenito acd87c
Chris PeBenito acd87c
	allow $1_xserver_t $1_xauth_home_t:file { getattr read };
Chris PeBenito acd87c
Chris PeBenito 488ec7
	domain_auto_trans($2, xserver_exec_t, $1_xserver_t)
Chris PeBenito 488ec7
	allow $2 $1_xserver_t:fd use;
Chris PeBenito 488ec7
	allow $1_xserver_t $2:fd use;
Chris PeBenito 488ec7
	allow $1_xserver_t $2:fifo_file rw_file_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $2:process { signal sigchld };
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	allow $1_xserver_t $2:shm rw_shm_perms;
Chris PeBenito 488ec7
Chris PeBenito 178647
	allow $2 $1_fonts_t:dir manage_dir_perms;
Chris PeBenito 178647
	allow $2 $1_fonts_t:file manage_file_perms;
Chris PeBenito 178647
	allow $2 $1_fonts_t:{ dir file } { relabelto relabelfrom };
Chris PeBenito 178647
Chris PeBenito 178647
	allow $2 $1_fonts_config_t:dir manage_dir_perms;
Chris PeBenito 178647
	allow $2 $1_fonts_config_t:file manage_file_perms;
Chris PeBenito 178647
	allow $2 $1_fonts_config_t:file { relabelto relabelfrom };
Chris PeBenito 178647
Chris PeBenito 178647
	# For startup relabel
Chris PeBenito 178647
	allow $2 $1_fonts_cache_t:{ dir file } { relabelto relabelfrom };
Chris PeBenito 178647
Chris PeBenito 488ec7
	allow $2 $1_xserver_tmp_t:dir r_dir_perms;
Chris PeBenito 488ec7
	allow $2 $1_xserver_tmp_t:sock_file rw_file_perms;
Chris PeBenito 488ec7
	allow $2 $1_xserver_t:unix_stream_socket connectto;
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	allow $2 $1_xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	# Communicate via System V shared memory.
Chris PeBenito 488ec7
	allow $1_xserver_t $2:shm rw_shm_perms;
Chris PeBenito 488ec7
	allow $2 $1_xserver_t:shm rw_shm_perms;
Chris PeBenito 488ec7
Chris PeBenito 1c1ac6
	getty_use_fds($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 1c1ac6
	locallogin_use_fds($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 103fe2
	userdom_search_user_home_dirs($1,$1_xserver_t)
Chris PeBenito 15722e
	userdom_use_user_ttys($1,$1_xserver_t)
Chris PeBenito 15722e
	userdom_setattr_user_ttys($1,$1_xserver_t)
Chris PeBenito 488ec7
	userdom_rw_user_tmpfs_files($1,$1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 178647
	xserver_use_user_fonts($1,$1_xserver_t)
Chris PeBenito 178647
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 488ec7
		userhelper_search_config($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	ifdef(`TODO',`
Chris PeBenito 488ec7
	allow $1_t xdm_xserver_tmp_t:dir r_dir_perms;
Chris PeBenito 488ec7
	allow $1_t xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	ifdef(`xdm.te', `
Chris PeBenito 488ec7
		allow $1_t xdm_tmp_t:sock_file unlink;
Chris PeBenito 488ec7
		allow $1_xserver_t xdm_var_run_t:dir search;
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
	') dnl end TODO
Chris PeBenito acd87c
Chris PeBenito acd87c
	##############################
Chris PeBenito acd87c
	#
Chris PeBenito acd87c
	# $1_xauth_t Local policy
Chris PeBenito acd87c
	#
Chris PeBenito acd87c
Chris PeBenito acd87c
	allow $1_xauth_t self:process signal;
Chris PeBenito acd87c
	allow $1_xauth_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito acd87c
Chris PeBenito acd87c
	allow $1_xauth_t $1_xauth_home_t:file manage_file_perms;
Chris PeBenito 103fe2
	userdom_user_home_dir_filetrans($1,$1_xauth_t,$1_xauth_home_t,file)
Chris PeBenito acd87c
Chris PeBenito acd87c
	allow $1_xauth_t $1_xauth_tmp_t:dir create_dir_perms;
Chris PeBenito acd87c
	allow $1_xauth_t $1_xauth_tmp_t:file create_file_perms;
Chris PeBenito 103fe2
	files_tmp_filetrans($1_xauth_t, $1_xauth_tmp_t, { file dir })
Chris PeBenito acd87c
Chris PeBenito acd87c
	domain_auto_trans($2, xauth_exec_t, $1_xauth_t)
Chris PeBenito acd87c
	allow $2 $1_xauth_t:fd use;
Chris PeBenito acd87c
	allow $1_xauth_t $2:fd use;
Chris PeBenito acd87c
	allow $1_xauth_t $2:fifo_file rw_file_perms;
Chris PeBenito acd87c
	allow $1_xauth_t $2:process sigchld;
Chris PeBenito acd87c
Chris PeBenito acd87c
	allow $2 $1_xauth_t:process signal;
Chris PeBenito acd87c
Chris PeBenito 3b3113
	# allow ps to show xauth
Chris PeBenito 3b3113
	allow $2 $1_xauth_t:dir { search getattr read };
Chris PeBenito 3b3113
	allow $2 $1_xauth_t:{ file lnk_file } { read getattr };
Chris PeBenito 3b3113
	allow $2 $1_xauth_t:process getattr;
Chris PeBenito 3b3113
	# We need to suppress this denial because procps tries to access
Chris PeBenito 3b3113
	# /proc/pid/environ and this now triggers a ptrace check in recent kernels
Chris PeBenito 3b3113
	# (2.4 and 2.6).  Might want to change procps to not do this, or only if
Chris PeBenito 3b3113
	# running in a privileged domain.
Chris PeBenito 3b3113
	dontaudit $2 $1_xauth_t:process ptrace;
Chris PeBenito 3b3113
Chris PeBenito acd87c
	allow $2 $1_xauth_home_t:file manage_file_perms;
Chris PeBenito acd87c
	allow $2 $1_xauth_home_t:file { relabelfrom relabelto };
Chris PeBenito acd87c
Chris PeBenito 0f5d13
	allow xdm_t $1_xauth_home_t:file manage_file_perms;
Chris PeBenito 103fe2
	userdom_user_home_dir_filetrans($1,xdm_t,$1_xauth_home_t,file)
Chris PeBenito 0f5d13
Chris PeBenito 15722e
	domain_use_interactive_fds($1_xauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	files_read_etc_files($1_xauth_t)
Chris PeBenito acd87c
	files_search_pids($1_xauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	fs_getattr_xattr_fs($1_xauth_t)
Chris PeBenito acd87c
	fs_search_auto_mountpoints($1_xauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	# cjp: why?
Chris PeBenito acd87c
	term_use_ptmx($1_xauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	libs_use_ld_so($1_xauth_t)
Chris PeBenito acd87c
	libs_use_shared_libs($1_xauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	sysnet_dns_name_resolve($1_xauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	userdom_use_user_terminals($1,$1_xauth_t)
Chris PeBenito 3b3113
	userdom_read_user_tmp_files($1,$1_xauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito acd87c
		fs_manage_nfs_files($1_xauth_t)
Chris PeBenito acd87c
	')
Chris PeBenito acd87c
Chris PeBenito acd87c
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito acd87c
		fs_manage_cifs_files($1_xauth_t)
Chris PeBenito acd87c
	')
Chris PeBenito acd87c
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito acd87c
		nis_use_ypbind($1_xauth_t)
Chris PeBenito acd87c
	')
Chris PeBenito acd87c
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 3b3113
		ssh_sigchld($1_xauth_t)
Chris PeBenito 1815ba
		ssh_read_pipes($1_xauth_t)
Chris PeBenito 1815ba
		ssh_dontaudit_rw_tcp_sockets($1_xauth_t)
Chris PeBenito 3b3113
	')
Chris PeBenito acd87c
Chris PeBenito acd87c
	##############################
Chris PeBenito acd87c
	#
Chris PeBenito acd87c
	# $1_iceauth_t Local policy
Chris PeBenito acd87c
	#
Chris PeBenito acd87c
Chris PeBenito acd87c
	domain_auto_trans($2, iceauth_exec_t, $1_iceauth_t)
Chris PeBenito acd87c
	allow $2 $1_iceauth_t:fd use;
Chris PeBenito acd87c
	allow $1_iceauth_t $2:fd use;
Chris PeBenito acd87c
	allow $1_iceauth_t $2:fifo_file rw_file_perms;
Chris PeBenito acd87c
	allow $1_iceauth_t $2:process sigchld;
Chris PeBenito acd87c
Chris PeBenito acd87c
	allow $1_iceauth_t $1_iceauth_home_t:file manage_file_perms;
Chris PeBenito 103fe2
	userdom_user_home_dir_filetrans($1,$1_iceauth_t,$1_iceauth_home_t,file)
Chris PeBenito acd87c
Chris PeBenito 3b3113
	# allow ps to show iceauth
Chris PeBenito 3b3113
	allow $2 $1_iceauth_t:dir { search getattr read };
Chris PeBenito 3b3113
	allow $2 $1_iceauth_t:{ file lnk_file } { read getattr };
Chris PeBenito 3b3113
	allow $2 $1_iceauth_t:process getattr;
Chris PeBenito 3b3113
	# We need to suppress this denial because procps tries to access
Chris PeBenito 3b3113
	# /proc/pid/environ and this now triggers a ptrace check in recent kernels
Chris PeBenito 3b3113
	# (2.4 and 2.6).  Might want to change procps to not do this, or only if
Chris PeBenito 3b3113
	# running in a privileged domain.
Chris PeBenito 3b3113
	dontaudit $2 $1_iceauth_t:process ptrace;
Chris PeBenito 3b3113
Chris PeBenito acd87c
	allow $2 $1_iceauth_home_t:file manage_file_perms;
Chris PeBenito acd87c
	allow $2 $1_iceauth_home_t:file { relabelfrom relabelto };
Chris PeBenito acd87c
Chris PeBenito acd87c
	fs_search_auto_mountpoints($1_iceauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	libs_use_ld_so($1_iceauth_t)
Chris PeBenito acd87c
	libs_use_shared_libs($1_iceauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	userdom_use_user_terminals($1,$1_iceauth_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito acd87c
		fs_manage_nfs_files($1_iceauth_t)
Chris PeBenito acd87c
	')
Chris PeBenito acd87c
Chris PeBenito acd87c
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito acd87c
		fs_manage_cifs_files($1_iceauth_t)
Chris PeBenito acd87c
	')
Chris PeBenito 488ec7
')
Chris PeBenito 488ec7
Chris PeBenito 24a637
#######################################
Chris PeBenito 24a637
## <summary>
Chris PeBenito 24a637
##	Template for creating sessions on a
Chris PeBenito 24a637
##	prefix X server, with read-only
Chris PeBenito 24a637
##	access to the X server shared
Chris PeBenito 24a637
##	memory segments.
Chris PeBenito 24a637
## </summary>
Chris PeBenito 24a637
## <param name="prefix">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	The prefix of the domain (e.g., user
Chris PeBenito 24a637
##	is the prefix for user_t).
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
## <param name="domain">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	Domain allowed access.
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
## <param name="tmpfs_type">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	The type of the domain SYSV tmpfs files.
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
#
Chris PeBenito 24a637
template(`xserver_ro_session_template',`
Chris PeBenito 24a637
	gen_require(`
Chris PeBenito 24a637
		type $1_xserver_t, $1_xserver_tmp_t, $1_xserver_tmpfs_t;
Chris PeBenito 24a637
	')
Chris PeBenito 24a637
Chris PeBenito 24a637
	# Xserver read/write client shm
Chris PeBenito 24a637
	allow $1_xserver_t $2:fd use;
Chris PeBenito 24a637
	allow $1_xserver_t $2:shm rw_shm_perms;
Chris PeBenito 24a637
	allow $1_xserver_t $3:file rw_file_perms;
Chris PeBenito 24a637
Chris PeBenito 24a637
	# Connect to xserver
Chris PeBenito 24a637
	allow $2 $1_xserver_t:unix_stream_socket connectto;
Chris PeBenito 24a637
	allow $2 $1_xserver_t:process signal;
Chris PeBenito 24a637
Chris PeBenito 24a637
	# Read /tmp/.X0-lock
Chris PeBenito 24a637
	allow $2 $1_xserver_tmp_t:file { getattr read };
Chris PeBenito 24a637
Chris PeBenito 24a637
	# Client read xserver shm
Chris PeBenito 24a637
	allow $2 $1_xserver_t:fd use;
Chris PeBenito 24a637
	allow $2 $1_xserver_t:shm r_shm_perms;
Chris PeBenito 24a637
	allow $2 $1_xserver_tmpfs_t:file r_file_perms;
Chris PeBenito 24a637
')
Chris PeBenito 24a637
Chris PeBenito 24a637
#######################################
Chris PeBenito 24a637
## <summary>
Chris PeBenito 24a637
##	Template for creating sessions on a
Chris PeBenito 24a637
##	prefix X server, with read and write
Chris PeBenito 24a637
##	access to the X server shared
Chris PeBenito 24a637
##	memory segments.
Chris PeBenito 24a637
## </summary>
Chris PeBenito 24a637
## <param name="prefix">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	The prefix of the domain (e.g., user
Chris PeBenito 24a637
##	is the prefix for user_t).
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
## <param name="domain">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	Domain allowed access.
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
## <param name="tmpfs_type">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	The type of the domain SYSV tmpfs files.
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
#
Chris PeBenito 24a637
template(`xserver_rw_session_template',`
Chris PeBenito 24a637
	gen_require(`
Chris PeBenito 24a637
		type $1_xserver_t, $1_xserver_tmpfs_t;
Chris PeBenito 24a637
	')
Chris PeBenito 24a637
Chris PeBenito 24a637
	xserver_ro_session_template($1,$2,$3)
Chris PeBenito 24a637
	allow $2 $1_xserver_t:shm rw_shm_perms;
Chris PeBenito 24a637
	allow $2 $1_xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 24a637
')
Chris PeBenito 24a637
Chris PeBenito 24a637
#######################################
Chris PeBenito 24a637
## <summary>
Chris PeBenito 24a637
##	Template for creating full client sessions
Chris PeBenito 24a637
##	on a user X server.
Chris PeBenito 24a637
## </summary>
Chris PeBenito 24a637
## <param name="prefix">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	The prefix of the domain (e.g., user
Chris PeBenito 24a637
##	is the prefix for user_t).
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
## <param name="domain">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	Domain allowed access.
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
## <param name="tmpfs_type">
Chris PeBenito 24a637
##	<summary>
Chris PeBenito 24a637
##	The type of the domain SYSV tmpfs files.
Chris PeBenito 24a637
##	</summary>
Chris PeBenito 24a637
## </param>
Chris PeBenito 24a637
#
Chris PeBenito 24a637
template(`xserver_user_client_template',`
Chris PeBenito 24a637
Chris PeBenito 24a637
	gen_require(`
Chris PeBenito 24a637
		type xdm_t, xdm_tmp_t;
Chris PeBenito 24a637
		type $1_xauth_home_t, $1_xserver_t, $1_xserver_tmpfs_t;
Chris PeBenito 24a637
	')
Chris PeBenito 24a637
Chris PeBenito 24a637
	allow $2 self:shm create_shm_perms;
Chris PeBenito 24a637
	allow $2 self:unix_dgram_socket create_socket_perms;
Chris PeBenito 24a637
	allow $2 self:unix_stream_socket { connectto create_stream_socket_perms };
Chris PeBenito 24a637
Chris PeBenito 24a637
	# Read .Xauthority file
Chris PeBenito 24a637
	allow $2 $1_xauth_home_t:file { getattr read };
Chris PeBenito 24a637
Chris PeBenito 24a637
	# for when /tmp/.X11-unix is created by the system
Chris PeBenito 24a637
	allow $2 xdm_t:fd use;
Chris PeBenito 24a637
	allow $2 xdm_t:fifo_file { getattr read write ioctl };
Chris PeBenito 24a637
	allow $2 xdm_tmp_t:dir search;
Chris PeBenito 24a637
	allow $2 xdm_tmp_t:sock_file { read write };
Chris PeBenito 24a637
	dontaudit $2 xdm_t:tcp_socket { read write };
Chris PeBenito 24a637
Chris PeBenito 24a637
	# Allow connections to X server.
Chris PeBenito 24a637
	files_search_tmp($2)
Chris PeBenito 24a637
Chris PeBenito 24a637
	miscfiles_read_fonts($2)
Chris PeBenito 24a637
Chris PeBenito 103fe2
	userdom_search_user_home_dirs($1,$2)
Chris PeBenito 24a637
	# for .xsession-errors
Chris PeBenito 103fe2
	userdom_dontaudit_write_user_home_content_files($1,$2)
Chris PeBenito 24a637
Chris PeBenito 24a637
	xserver_ro_session_template(xdm,$2,$3)
Chris PeBenito 24a637
	xserver_rw_session_template($1,$2,$3)
Chris PeBenito 178647
	xserver_use_user_fonts($1,$2)
Chris PeBenito 24a637
Chris PeBenito 24a637
	# Client write xserver shm
Chris PeBenito 24a637
	tunable_policy(`allow_write_xshm',`
Chris PeBenito 24a637
		allow $2 $1_xserver_t:shm rw_shm_perms;
Chris PeBenito 24a637
		allow $2 $1_xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 24a637
	')
Chris PeBenito 24a637
Chris PeBenito 24a637
	# for X over a ssh tunnel
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 24a637
		kernel_tcp_recvfrom($2)
Chris PeBenito 24a637
		ssh_tcp_connect($2)
Chris PeBenito 24a637
	')
Chris PeBenito 178647
')
Chris PeBenito 24a637
Chris PeBenito 178647
########################################
Chris PeBenito 178647
## <summary>
Chris PeBenito 178647
##	Read user fonts, user font configuration,
Chris PeBenito 178647
##	and manage the user font cache.
Chris PeBenito 178647
## </summary>
Chris PeBenito 178647
## <desc>
Chris PeBenito 178647
##	

Chris PeBenito 178647
##	Read user fonts, user font configuration,
Chris PeBenito 178647
##	and manage the user font cache.
Chris PeBenito 178647
##	

Chris PeBenito 178647
##	

Chris PeBenito 178647
##	This is a templated interface, and should only
Chris PeBenito 178647
##	be called from a per-userdomain template.
Chris PeBenito 178647
##	

Chris PeBenito 178647
## </desc>
Chris PeBenito 178647
## <param name="userdomain_prefix">
Chris PeBenito 178647
##	<summary>
Chris PeBenito 178647
##	The prefix of the user domain (e.g., user
Chris PeBenito 178647
##	is the prefix for user_t).
Chris PeBenito 178647
##	</summary>
Chris PeBenito 178647
## </param>
Chris PeBenito 178647
## <param name="domain">
Chris PeBenito 178647
##	<summary>
Chris PeBenito 178647
##	Domain allowed access.
Chris PeBenito 178647
##	</summary>
Chris PeBenito 178647
## </param>
Chris PeBenito 178647
#
Chris PeBenito 178647
template(`xserver_use_user_fonts',`
Chris PeBenito 178647
	gen_require(`
Chris PeBenito 178647
		type $1_fonts_t, $1_fonts_cache_t, $1_fonts_config_t;
Chris PeBenito 178647
	')
Chris PeBenito 178647
Chris PeBenito 178647
	# Read per user fonts
Chris PeBenito 178647
	allow $2 $1_fonts_t:dir list_dir_perms;
Chris PeBenito 178647
	allow $2 $1_fonts_t:file read_file_perms;
Chris PeBenito 178647
Chris PeBenito 178647
	# Manipulate the global font cache
Chris PeBenito 178647
	allow $2 $1_fonts_cache_t:dir manage_dir_perms;
Chris PeBenito 178647
	allow $2 $1_fonts_cache_t:file manage_file_perms;
Chris PeBenito 178647
Chris PeBenito 178647
	# Read per user font config
Chris PeBenito 178647
	allow $2 $1_fonts_config_t:dir list_dir_perms;
Chris PeBenito 178647
	allow $2 $1_fonts_config_t:file read_file_perms;
Chris PeBenito 178647
Chris PeBenito 178647
	userdom_search_user_home_dirs($1,$2)
Chris PeBenito 24a637
')
Chris PeBenito 24a637
Chris PeBenito 0f5d13
########################################
Chris PeBenito 488ec7
## <summary>
Chris PeBenito 0f5d13
##	Transition to a user Xauthority domain.
Chris PeBenito 488ec7
## </summary>
Chris PeBenito 0f5d13
## <desc>
Chris PeBenito 0f5d13
##	

Chris PeBenito 0f5d13
##	Transition to a user Xauthority domain.
Chris PeBenito 0f5d13
##	

Chris PeBenito 0f5d13
##	

Chris PeBenito 0f5d13
##	This is a templated interface, and should only
Chris PeBenito 0f5d13
##	be called from a per-userdomain template.
Chris PeBenito 0f5d13
##	

Chris PeBenito 0f5d13
## </desc>
Chris PeBenito 0f5d13
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	The prefix of the user domain (e.g., user
Chris PeBenito 0f5d13
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 488ec7
## </param>
Chris PeBenito 0f5d13
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
#
Chris PeBenito 0f5d13
template(`xserver_domtrans_user_xauth',`
Chris PeBenito 0f5d13
	gen_require(`
Chris PeBenito 0f5d13
		type $1_xauth_t, xauth_exec_t;
Chris PeBenito 0f5d13
	')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
	domain_auto_trans($2, xauth_exec_t, $1_xauth_t)
Chris PeBenito 0f5d13
	allow $2 $1_xauth_t:fd use;
Chris PeBenito 0f5d13
	allow $1_xauth_t $2:fd use;
Chris PeBenito 0f5d13
	allow $1_xauth_t $2:fifo_file rw_file_perms;
Chris PeBenito 0f5d13
	allow $1_xauth_t $2:process sigchld;
Chris PeBenito 0f5d13
')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
########################################
Chris PeBenito 0f5d13
## <summary>
Chris PeBenito 178647
##	Read all users fonts, user font configurations,
Chris PeBenito 178647
##	and manage all users font caches.
Chris PeBenito 178647
## </summary>
Chris PeBenito 178647
## <param name="domain">
Chris PeBenito 178647
##	<summary>
Chris PeBenito 178647
##	Domain allowed access.
Chris PeBenito 178647
##	</summary>
Chris PeBenito 178647
## </param>
Chris PeBenito 178647
#
Chris PeBenito 178647
interface(`xserver_use_all_users_fonts',`
Chris PeBenito 178647
	gen_require(`
Chris PeBenito 178647
		attribute fonts_type, fonts_cache_type, fonts_config_type;
Chris PeBenito 178647
	')
Chris PeBenito 178647
Chris PeBenito 178647
	# Read per user fonts
Chris PeBenito 178647
	allow $1 fonts_type:dir list_dir_perms;
Chris PeBenito 178647
	allow $1 fonts_type:file read_file_perms;
Chris PeBenito 178647
Chris PeBenito 178647
	# Manipulate the global font cache
Chris PeBenito 178647
	allow $1 fonts_cache_type:dir manage_dir_perms;
Chris PeBenito 178647
	allow $1 fonts_cache_type:file manage_file_perms;
Chris PeBenito 178647
Chris PeBenito 178647
	# Read per user font config
Chris PeBenito 178647
	allow $1 fonts_config_type:dir list_dir_perms;
Chris PeBenito 178647
	allow $1 fonts_config_type:file read_file_perms;
Chris PeBenito 178647
Chris PeBenito 178647
	userdom_search_all_users_home_dirs($1)
Chris PeBenito 178647
')
Chris PeBenito 178647
Chris PeBenito 178647
########################################
Chris PeBenito 178647
## <summary>
Chris PeBenito 413982
##	Set the attributes of the X windows console named pipes.
Chris PeBenito 413982
## </summary>
Chris PeBenito 413982
## <param name="domain">
Chris PeBenito 413982
##	<summary>
Chris PeBenito 413982
##	Domain allowed access.
Chris PeBenito 413982
##	</summary>
Chris PeBenito 413982
## </param>
Chris PeBenito 413982
#
Chris PeBenito 413982
interface(`xserver_setattr_console_pipes',`
Chris PeBenito 413982
	gen_require(`
Chris PeBenito 413982
		type xconsole_device_t;
Chris PeBenito 413982
	')
Chris PeBenito 413982
Chris PeBenito 413982
	allow $1 xconsole_device_t:fifo_file setattr;
Chris PeBenito 413982
')
Chris PeBenito 413982
Chris PeBenito 413982
########################################
Chris PeBenito 413982
## <summary>
Chris PeBenito 413982
##	Read and write the X windows console named pipe.
Chris PeBenito 413982
## </summary>
Chris PeBenito 413982
## <param name="domain">
Chris PeBenito 413982
##	<summary>
Chris PeBenito 413982
##	Domain allowed access.
Chris PeBenito 413982
##	</summary>
Chris PeBenito 413982
## </param>
Chris PeBenito 413982
#
Chris PeBenito 413982
interface(`xserver_rw_console',`
Chris PeBenito 413982
	gen_require(`
Chris PeBenito 413982
		type xconsole_device_t;
Chris PeBenito 413982
	')
Chris PeBenito 413982
Chris PeBenito 413982
	allow $1 xconsole_device_t:fifo_file { getattr read write };
Chris PeBenito 413982
')
Chris PeBenito 413982
Chris PeBenito 413982
########################################
Chris PeBenito 413982
## <summary>
Chris PeBenito 0f5d13
##	Connect to XDM over a unix domain
Chris PeBenito 0f5d13
##	stream socket.
Chris PeBenito 0f5d13
## </summary>
Chris PeBenito 0f5d13
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0f5d13
## </param>
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
interface(`xserver_stream_connect_xdm',`
Chris PeBenito 0f5d13
	gen_require(`
Chris PeBenito 0f5d13
		type xdm_t;
Chris PeBenito 0f5d13
	')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
	allow $1 xdm_t:unix_stream_socket connectto;
Chris PeBenito 0f5d13
')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
########################################
Chris PeBenito 0f5d13
## <summary>
Chris PeBenito 5a975c
##	Read xdm-writable configuration files.
Chris PeBenito 5a975c
## </summary>
Chris PeBenito 5a975c
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 5a975c
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 5a975c
## </param>
Chris PeBenito 5a975c
#
Chris PeBenito 5a975c
interface(`xserver_read_xdm_rw_config',`
Chris PeBenito 5a975c
	gen_require(`
Chris PeBenito 5a975c
		type xdm_rw_etc_t;
Chris PeBenito 5a975c
	')
Chris PeBenito 5a975c
Chris PeBenito 5a975c
	files_search_etc($1)
Chris PeBenito 5a975c
	allow $1 xdm_rw_etc_t:dir { getattr read };
Chris PeBenito 5a975c
')
Chris PeBenito 5a975c
Chris PeBenito 5a975c
########################################
Chris PeBenito 5a975c
## <summary>
Chris PeBenito 5a975c
##	Set the attributes of XDM temporary directories.
Chris PeBenito 5a975c
## </summary>
Chris PeBenito 5a975c
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 5a975c
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 5a975c
## </param>
Chris PeBenito 5a975c
#
Chris PeBenito 5a975c
interface(`xserver_setattr_xdm_tmp_dirs',`
Chris PeBenito 5a975c
	gen_require(`
Chris PeBenito 5a975c
		type xdm_tmp_t;
Chris PeBenito 5a975c
	')
Chris PeBenito 5a975c
Chris PeBenito 5a975c
	allow $1 xdm_tmp_t:dir setattr;
Chris PeBenito 5a975c
')
Chris PeBenito 5a975c
Chris PeBenito 5a975c
########################################
Chris PeBenito 5a975c
## <summary>
Chris PeBenito 0f5d13
##	Create a named socket in a XDM
Chris PeBenito 0f5d13
##	temporary directory.
Chris PeBenito 0f5d13
## </summary>
Chris PeBenito 0f5d13
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0f5d13
## </param>
Chris PeBenito 0f5d13
#
Chris PeBenito 1815ba
interface(`xserver_create_xdm_tmp_sockets',`
Chris PeBenito 0f5d13
	gen_require(`
Chris PeBenito 0f5d13
		type xdm_tmp_t;
Chris PeBenito 0f5d13
	')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
	files_search_tmp($1)
Chris PeBenito 0f5d13
	allow $1 xdm_tmp_t:dir ra_dir_perms;
Chris PeBenito 0f5d13
	allow $1 xdm_tmp_t:sock_file create;
Chris PeBenito 0f5d13
')
Chris PeBenito 07620c
Chris PeBenito 0f5d13
########################################
Chris PeBenito 0f5d13
## <summary>
Chris PeBenito 0f5d13
##	Read XDM pid files.
Chris PeBenito 0f5d13
## </summary>
Chris PeBenito 0f5d13
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0f5d13
## </param>
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
interface(`xserver_read_xdm_pid',`
Chris PeBenito 0f5d13
	gen_require(`
Chris PeBenito 0f5d13
		type xdm_var_run_t;
Chris PeBenito 0f5d13
	')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
	files_search_pids($1)
Chris PeBenito 0f5d13
	allow $1 xdm_var_run_t:file r_file_perms;
Chris PeBenito 0f5d13
')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
########################################
Chris PeBenito 0f5d13
## <summary>
Chris PeBenito fbc0a2
##      Read XDM var lib files.
Chris PeBenito fbc0a2
## </summary>
Chris PeBenito fbc0a2
## <param name="domain">
Chris PeBenito fbc0a2
##      <summary>
Chris PeBenito fbc0a2
##      Domain allowed access.
Chris PeBenito fbc0a2
##      </summary>
Chris PeBenito fbc0a2
## </param>
Chris PeBenito fbc0a2
#
Chris PeBenito fbc0a2
interface(`xserver_read_xdm_lib_files',`
Chris PeBenito fbc0a2
	gen_require(`
Chris PeBenito fbc0a2
		type xdm_var_lib_t;
Chris PeBenito fbc0a2
	')
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	allow $1 xdm_var_lib_t:file { getattr read };
Chris PeBenito fbc0a2
')
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
########################################
Chris PeBenito fbc0a2
## <summary>
Chris PeBenito 955019
##	Execute the X server in the XDM X server domain.
Chris PeBenito 955019
## </summary>
Chris PeBenito 955019
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 955019
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 955019
## </param>
Chris PeBenito 955019
#
Chris PeBenito 955019
interface(`xserver_domtrans_xdm_xserver',`
Chris PeBenito 955019
	gen_require(`
Chris PeBenito 955019
		type xdm_xserver_t, xserver_exec_t;
Chris PeBenito 955019
	')
Chris PeBenito 955019
Chris PeBenito 955019
	domain_auto_trans($1,xserver_exec_t,xdm_xserver_t)
Chris PeBenito 955019
Chris PeBenito 955019
	allow $1 xdm_xserver_t:fd use;
Chris PeBenito 955019
	allow xdm_xserver_t $1:fd use;
Chris PeBenito 955019
	allow xdm_xserver_t $1:fifo_file rw_file_perms;
Chris PeBenito 955019
	allow xdm_xserver_t $1:process sigchld;
Chris PeBenito 955019
')
Chris PeBenito 955019
Chris PeBenito 955019
########################################
Chris PeBenito 955019
## <summary>
Chris PeBenito 0f5d13
##	Make an X session script an entrypoint for the specified domain.
Chris PeBenito 0f5d13
## </summary>
Chris PeBenito 0f5d13
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	The domain for which the shell is an entrypoint.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0f5d13
## </param>
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
interface(`xserver_xsession_entry_type',`
Chris PeBenito 0f5d13
	gen_require(`
Chris PeBenito 0f5d13
		type xsession_exec_t;
Chris PeBenito 0f5d13
	')
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
	domain_entry_file($1,xsession_exec_t)
Chris PeBenito 488ec7
')
Chris PeBenito 3b3113
Chris PeBenito 3b3113
########################################
Chris PeBenito 3b3113
## <summary>
Chris PeBenito 0f5d13
##	Execute an X session in the target domain.  This
Chris PeBenito 0f5d13
##	is an explicit transition, requiring the
Chris PeBenito 0f5d13
##	caller to use setexeccon().
Chris PeBenito 3b3113
## </summary>
Chris PeBenito 3b3113
## <desc>
Chris PeBenito 3b3113
##	

Chris PeBenito 0f5d13
##	Execute an Xsession in the target domain.  This
Chris PeBenito 0f5d13
##	is an explicit transition, requiring the
Chris PeBenito 0f5d13
##	caller to use setexeccon().
Chris PeBenito 3b3113
##	

Chris PeBenito 3b3113
##	

Chris PeBenito 0f5d13
##	No interprocess communication (signals, pipes,
Chris PeBenito 0f5d13
##	etc.) is provided by this interface since
Chris PeBenito 0f5d13
##	the domains are not owned by this module.
Chris PeBenito 3b3113
##	

Chris PeBenito 3b3113
## </desc>
Chris PeBenito 3b3113
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 3b3113
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 3b3113
## </param>
Chris PeBenito 0f5d13
## <param name="target_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	The type of the shell process.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0f5d13
## </param>
Chris PeBenito 3b3113
#
Chris PeBenito 0f5d13
interface(`xserver_xsession_spec_domtrans',`
Chris PeBenito 3b3113
	gen_require(`
Chris PeBenito 0f5d13
		type xsession_exec_t;
Chris PeBenito 3b3113
	')
Chris PeBenito 3b3113
Chris PeBenito 0f5d13
	domain_trans($1,xsession_exec_t,$2)
Chris PeBenito 3b3113
')
Chris PeBenito 3b3113
Chris PeBenito 3b3113
########################################
Chris PeBenito 3b3113
## <summary>
Chris PeBenito 3b9147
##	Get the attributes of X server logs.
Chris PeBenito 3b9147
## </summary>
Chris PeBenito 3b9147
## <param name="domain">
Chris PeBenito 3b9147
##	<summary>
Chris PeBenito 3b9147
##	Domain allowed access.
Chris PeBenito 3b9147
##	</summary>
Chris PeBenito 3b9147
## </param>
Chris PeBenito 3b9147
#
Chris PeBenito 3b9147
interface(`xserver_getattr_log',`
Chris PeBenito 3b9147
	gen_require(`
Chris PeBenito 3b9147
		type xserver_log_t;
Chris PeBenito 3b9147
	')
Chris PeBenito 3b9147
Chris PeBenito 3b9147
	logging_search_logs($1)
Chris PeBenito 3b9147
	allow $1 xserver_log_t:file getattr;
Chris PeBenito 3b9147
')
Chris PeBenito 3b9147
Chris PeBenito 3b9147
########################################
Chris PeBenito 3b9147
## <summary>
Chris PeBenito 0f5d13
##	Do not audit attempts to write the X server
Chris PeBenito 0f5d13
##	log files.
Chris PeBenito 3b3113
## </summary>
Chris PeBenito 3b3113
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0f5d13
##	Domain to not audit
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 3b3113
## </param>
Chris PeBenito 3b3113
#
Chris PeBenito 0f5d13
interface(`xserver_dontaudit_write_log',`
Chris PeBenito 3b3113
	gen_require(`
Chris PeBenito 0f5d13
		type xserver_log_t;
Chris PeBenito 3b3113
	')
Chris PeBenito 3b3113
Chris PeBenito 0f5d13
	dontaudit $1 xserver_log_t:file { append write };
Chris PeBenito 3b3113
')
Chris PeBenito 5a975c
Chris PeBenito 5a975c
########################################
Chris PeBenito 5a975c
## <summary>
Chris PeBenito 5a975c
##	Do not audit attempts to write the X server
Chris PeBenito 5a975c
##	log files.
Chris PeBenito 5a975c
## </summary>
Chris PeBenito 5a975c
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 5a975c
##	Domain to not audit
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 5a975c
## </param>
Chris PeBenito 5a975c
#
Chris PeBenito 5a975c
interface(`xserver_delete_log',`
Chris PeBenito 5a975c
	gen_require(`
Chris PeBenito 5a975c
		type xserver_log_t;
Chris PeBenito 5a975c
	')
Chris PeBenito 5a975c
Chris PeBenito 5a975c
	logging_search_logs($1)
Chris PeBenito 5a975c
	allow $1 xserver_log_t:dir rw_dir_perms;
Chris PeBenito 5a975c
	allow $1 xserver_log_t:file unlink;
Chris PeBenito 5a975c
')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
########################################
Chris PeBenito c8d5b3
## <summary>
Chris PeBenito c8d5b3
##	Read X keyboard extension libraries.
Chris PeBenito c8d5b3
## </summary>
Chris PeBenito c8d5b3
## <param name="domain">
Chris PeBenito c8d5b3
##	<summary>
Chris PeBenito c8d5b3
##	Domain to not audit
Chris PeBenito c8d5b3
##	</summary>
Chris PeBenito c8d5b3
## </param>
Chris PeBenito c8d5b3
#
Chris PeBenito c8d5b3
interface(`xserver_read_xkb_libs',`
Chris PeBenito c8d5b3
	gen_require(`
Chris PeBenito c8d5b3
		type xkb_var_lib_t;
Chris PeBenito c8d5b3
	')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
	files_search_var_lib($1)
Chris PeBenito c8d5b3
	allow $1 xkb_var_lib_t:dir list_dir_perms;
Chris PeBenito c8d5b3
	allow $1 xkb_var_lib_t:file r_file_perms;
Chris PeBenito c8d5b3
	allow $1 xkb_var_lib_t:lnk_file { getattr read };
Chris PeBenito c8d5b3
')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
########################################
Chris PeBenito c8d5b3
## <summary>
Chris PeBenito c8d5b3
##	Read xdm temporary files.
Chris PeBenito c8d5b3
## </summary>
Chris PeBenito c8d5b3
## <param name="domain">
Chris PeBenito c8d5b3
##	<summary>
Chris PeBenito c8d5b3
##	Domain to not audit
Chris PeBenito c8d5b3
##	</summary>
Chris PeBenito c8d5b3
## </param>
Chris PeBenito c8d5b3
#
Chris PeBenito c8d5b3
interface(`xserver_read_xdm_xserver_tmp_files',`
Chris PeBenito c8d5b3
	gen_require(`
Chris PeBenito c8d5b3
		type xdm_xserver_tmp_t;
Chris PeBenito c8d5b3
	')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
	allow $1 xdm_xserver_tmp_t:file { getattr read };
Chris PeBenito c8d5b3
')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
########################################
Chris PeBenito c8d5b3
## <summary>
Chris PeBenito c8d5b3
##	Kill XDM X servers
Chris PeBenito c8d5b3
## </summary>
Chris PeBenito c8d5b3
## <param name="domain">
Chris PeBenito c8d5b3
##	<summary>
Chris PeBenito c8d5b3
##	Domain to not audit
Chris PeBenito c8d5b3
##	</summary>
Chris PeBenito c8d5b3
## </param>
Chris PeBenito c8d5b3
#
Chris PeBenito c8d5b3
interface(`xserver_kill_xdm_xserver',`
Chris PeBenito c8d5b3
	gen_require(`
Chris PeBenito c8d5b3
		type xdm_xserver_t;
Chris PeBenito c8d5b3
	')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
	allow $1 xdm_xserver_t:process sigkill;
Chris PeBenito c8d5b3
')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
########################################
Chris PeBenito c8d5b3
## <summary>
Chris PeBenito c8d5b3
##	Do not audit attempts to read and write to
Chris PeBenito c8d5b3
##	a XDM X server socket.
Chris PeBenito c8d5b3
## </summary>
Chris PeBenito c8d5b3
## <param name="domain">
Chris PeBenito c8d5b3
##	<summary>
Chris PeBenito c8d5b3
##	Domain to not audit
Chris PeBenito c8d5b3
##	</summary>
Chris PeBenito c8d5b3
## </param>
Chris PeBenito c8d5b3
#
Chris PeBenito c8d5b3
interface(`xserver_dontaudit_rw_xdm_xserver_tcp_sockets',`
Chris PeBenito c8d5b3
	gen_require(`
Chris PeBenito c8d5b3
		type xdm_xserver_t;
Chris PeBenito c8d5b3
	')
Chris PeBenito c8d5b3
Chris PeBenito c8d5b3
	dontaudit $1 xdm_xserver_t:tcp_socket { read write };
Chris PeBenito c8d5b3
')