Chris PeBenito 488ec7
## <summary>X Windows Server</summary>
Chris PeBenito 488ec7
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 a52492
	gen_require(`
Chris PeBenito a52492
		type xkb_var_lib_t, xserver_log_t;
Chris PeBenito a52492
	')
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 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 488ec7
	allow $1_xserver_t self:process { execmem execheap 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 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 488ec7
	files_filetrans_tmp($1_xserver_t, $1_xserver_tmp_t, { file dir sock_file })
Chris PeBenito 488ec7
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 488ec7
	fs_filetrans_tmpfs($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 488ec7
	logging_filetrans_log($1_xserver_t,xserver_log_t,file)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	kernel_read_system_state($1_xserver_t)
Chris PeBenito 488ec7
	kernel_read_device_sysctl($1_xserver_t)
Chris PeBenito 07620c
	kernel_read_modprobe_sysctl($1_xserver_t)
Chris PeBenito 488ec7
	# Xorg wants to check if kernel is tainted
Chris PeBenito 488ec7
	kernel_read_kernel_sysctl($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 488ec7
	dev_rw_agp_dev($1_xserver_t)
Chris PeBenito 488ec7
	dev_rw_framebuffer($1_xserver_t)
Chris PeBenito 488ec7
	dev_manage_dri_dev($1_xserver_t)
Chris PeBenito 488ec7
	dev_create_dir($1_xserver_t)
Chris PeBenito 488ec7
	dev_setattr_dev_dir($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 488ec7
	dev_rw_xserver_misc_dev($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 488ec7
Chris PeBenito 488ec7
	files_read_etc_files($1_xserver_t)
Chris PeBenito 488ec7
	files_read_etc_runtime_files($1_xserver_t)
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 488ec7
	term_setattr_unallocated_ttys($1_xserver_t)
Chris PeBenito 488ec7
	term_use_unallocated_tty($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 488ec7
	optional_policy(`authlogin',`
Chris PeBenito 488ec7
		auth_search_pam_console_data($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	optional_policy(`nis',`
Chris PeBenito 488ec7
		nis_use_ypbind($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	optional_policy(`nscd',`
Chris PeBenito 488ec7
		nscd_use_socket($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
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 488ec7
			rpm_use_fd($1_xserver_t)
Chris PeBenito 488ec7
		')
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	file_type_auto_trans($1_xserver_t, xdm_xserver_tmp_t, $1_xserver_tmp_t, sock_file)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	# Connect to xfs.
Chris PeBenito 488ec7
	ifdef(`xfs.te', `
Chris PeBenito 488ec7
		can_unix_connect($1_xserver_t, xfs_t)
Chris PeBenito 488ec7
		allow $1_xserver_t xfs_tmp_t:dir r_dir_perms;
Chris PeBenito 488ec7
		allow $1_xserver_t xfs_tmp_t:sock_file rw_file_perms;
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 488ec7
##	The prefix of the user domain (e.g., user
Chris PeBenito 488ec7
##	is the prefix for user_t).
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
## <param name="user_domain">
Chris PeBenito 488ec7
##	The type of the user domain.
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
## <param name="user_role">
Chris PeBenito 488ec7
##	The role associated with the user domain.
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 a52492
	gen_require(`
Chris PeBenito a52492
		type xauth_exec_t;
Chris PeBenito a52492
		type xserver_exec_t;
Chris PeBenito a52492
		type iceauth_exec_t;
Chris PeBenito a52492
	')
Chris PeBenito a52492
Chris PeBenito 488ec7
	xserver_common_domain_template($1)
Chris PeBenito 488ec7
	role $3 types $1_xserver_t;
Chris PeBenito 488ec7
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 acd87c
	userdom_home_file($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 acd87c
	userdom_home_file($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 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 488ec7
	getty_use_fd($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	locallogin_use_fd($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	userdom_search_user_home($1,$1_xserver_t)
Chris PeBenito 488ec7
	userdom_use_user_tty($1,$1_xserver_t)
Chris PeBenito 488ec7
	userdom_setattr_user_tty($1,$1_xserver_t)
Chris PeBenito 488ec7
	userdom_rw_user_tmpfs_files($1,$1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	optional_policy(`userhelper',`
Chris PeBenito 488ec7
		userhelper_search_config($1_xserver_t)
Chris PeBenito 488ec7
	')
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	ifdef(`TODO',`
Chris PeBenito 488ec7
	# Read fonts
Chris PeBenito 488ec7
	read_fonts($1_xserver_t, $1)
Chris PeBenito 488ec7
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 acd87c
	userdom_filetrans_user_home_dir($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 acd87c
	files_filetrans_tmp($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 acd87c
	domain_use_wide_inherit_fd($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 acd87c
	optional_policy(`nis',`
Chris PeBenito acd87c
		nis_use_ypbind($1_xauth_t)
Chris PeBenito acd87c
	')
Chris PeBenito acd87c
Chris PeBenito 3b3113
	optional_policy(`ssh',`
Chris PeBenito 3b3113
		ssh_sigchld($1_xauth_t)
Chris PeBenito 3b3113
		ssh_read_pipe($1_xauth_t)
Chris PeBenito 3b3113
		ssh_dontaudit_rw_tcp_socket($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 acd87c
	userdom_filetrans_user_home_dir($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 488ec7
#######################################
Chris PeBenito 488ec7
## <summary>
Chris PeBenito 488ec7
##	Define a derived domain for the X server when executed
Chris PeBenito 488ec7
##	by an X Display Manager.
Chris PeBenito 488ec7
## </summary>
Chris PeBenito 488ec7
## <param name="prefix">
Chris PeBenito 488ec7
##	The prefix of the display manager domain.
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
## <param name="xdm_domain">
Chris PeBenito 488ec7
##	The type of the display manager domain.
Chris PeBenito 488ec7
## </param>
Chris PeBenito 488ec7
#
Chris PeBenito 488ec7
template(`xserver_displaymgr_domain_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 dace0b
	init_system_domain($1_xserver_t,xserver_exec_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	##############################
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
	# Local policy
Chris PeBenito 488ec7
	#
Chris PeBenito 488ec7
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 07620c
	allow $2 $1_xserver_t:process { noatsecure siginh rlimitinh signal sigkill };
Chris PeBenito 488ec7
Chris PeBenito 07620c
	allow $2 $1_xserver_tmp_t:file unlink;
Chris PeBenito 488ec7
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_t:shm rw_shm_perms;
Chris PeBenito 488ec7
	allow $1_xserver_t $2:shm rw_shm_perms;
Chris PeBenito 488ec7
Chris PeBenito 07620c
	# Run xkbcomp.
Chris PeBenito 07620c
	can_exec($1_xserver_t, xkb_var_lib_t)
Chris PeBenito 07620c
	allow $1_xserver_t xkb_var_lib_t:lnk_file read;
Chris PeBenito 07620c
	files_search_var_lib($1_xserver_t)
Chris PeBenito 07620c
Chris PeBenito 488ec7
	init_use_fd($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	userdom_dontaudit_search_all_users_home($1_xserver_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	ifdef(`TODO',`
Chris PeBenito 488ec7
	# Read all global and per user fonts
Chris PeBenito 488ec7
	read_fonts($1_xserver_t, sysadm)
Chris PeBenito 488ec7
	read_fonts($1_xserver_t, staff)
Chris PeBenito 488ec7
	read_fonts($1_xserver_t, user)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
	dontaudit $1_xserver_t sysadm_t:shm { unix_read unix_write };
Chris PeBenito 488ec7
	allow $1_xserver_t xdm_tmpfs_t:file rw_file_perms;
Chris PeBenito 488ec7
	') dnl end TODO
Chris PeBenito 488ec7
')
Chris PeBenito 3b3113
Chris PeBenito 3b3113
########################################
Chris PeBenito 3b3113
## <summary>
Chris PeBenito 3b3113
##	Transition to a user Xauthority domain.
Chris PeBenito 3b3113
## </summary>
Chris PeBenito 3b3113
## <desc>
Chris PeBenito 3b3113
##	

Chris PeBenito 3b3113
##	Transition to a user Xauthority domain.
Chris PeBenito 3b3113
##	

Chris PeBenito 3b3113
##	

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

Chris PeBenito 3b3113
## </desc>
Chris PeBenito 3b3113
## <param name="userdomain_prefix">
Chris PeBenito 3b3113
##	The prefix of the user domain (e.g., user
Chris PeBenito 3b3113
##	is the prefix for user_t).
Chris PeBenito 3b3113
## </param>
Chris PeBenito 3b3113
## <param name="domain">
Chris PeBenito 3b3113
##	Domain allowed access.
Chris PeBenito 3b3113
## </param>
Chris PeBenito 3b3113
#
Chris PeBenito 3b3113
template(`xserver_domtrans_user_xauth',`
Chris PeBenito 3b3113
	gen_require(`
Chris PeBenito 3b3113
		type $1_xauth_t, xauth_exec_t;
Chris PeBenito 3b3113
	')
Chris PeBenito 3b3113
Chris PeBenito 3b3113
	domain_auto_trans($2, xauth_exec_t, $1_xauth_t)
Chris PeBenito 3b3113
	allow $2 $1_xauth_t:fd use;
Chris PeBenito 3b3113
	allow $1_xauth_t $2:fd use;
Chris PeBenito 3b3113
	allow $1_xauth_t $2:fifo_file rw_file_perms;
Chris PeBenito 3b3113
	allow $1_xauth_t $2:process sigchld;
Chris PeBenito 3b3113
')
Chris PeBenito 3b3113
Chris PeBenito 3b3113
########################################
Chris PeBenito 3b3113
## <summary>
Chris PeBenito 3b3113
##	Do not audit attempts to read all user
Chris PeBenito 3b3113
##	.ICEauthority files.
Chris PeBenito 3b3113
## </summary>
Chris PeBenito 3b3113
## <param name="domain">
Chris PeBenito 3b3113
##	Domain do not audit.
Chris PeBenito 3b3113
## </param>
Chris PeBenito 3b3113
#
Chris PeBenito 3b3113
interface(`xserver_dontaudit_read_all_users_iceauth',`
Chris PeBenito 3b3113
	gen_require(`
Chris PeBenito 3b3113
		attribute iceauth_home_type;
Chris PeBenito 3b3113
	')
Chris PeBenito 3b3113
Chris PeBenito 3b3113
	dontaudit $1 iceauth_home_type:file r_file_perms;
Chris PeBenito 3b3113
')