Chris PeBenito 17de1b
## <summary>X Windows Server</summary>
Chris PeBenito 17de1b
Chris PeBenito 296273
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Rules required for using the X Windows server
Chris PeBenito 93c49b
##	and environment, for restricted users.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 296273
## <param name="role">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 296273
##	Role allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 296273
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 296273
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 93c49b
interface(`xserver_restricted_role',`
Chris PeBenito 563e58
	gen_require(`
Chris PeBenito 296273
		type xserver_t, xserver_exec_t, xserver_tmp_t, xserver_tmpfs_t;
Dan Walsh 3eaa99
		type user_fonts_t, user_fonts_cache_t, user_fonts_config_t, xdm_tmp_t;
Chris PeBenito 296273
		type iceauth_t, iceauth_exec_t, iceauth_home_t;
Chris PeBenito 296273
		type xauth_t, xauth_exec_t, xauth_home_t;
Dan Walsh 3eaa99
		class dbus send_msg;
Chris PeBenito 296273
	')
Chris PeBenito 17de1b
Chris PeBenito 296273
	role $1 types { xserver_t xauth_t iceauth_t };
Chris PeBenito 17de1b
Chris PeBenito 93c49b
	# Xserver read/write client shm
Chris PeBenito 93c49b
	allow xserver_t $2:fd use;
Chris PeBenito 93c49b
	allow xserver_t $2:shm rw_shm_perms;
Chris PeBenito 93c49b
Chris PeBenito 296273
	domtrans_pattern($2, xserver_exec_t, xserver_t)
Dan Walsh 3eaa99
	allow xserver_t $2:process { getpgid signal };
Chris PeBenito 17de1b
Chris PeBenito 296273
	allow xserver_t $2:shm rw_shm_perms;
Chris PeBenito 17de1b
Chris PeBenito 93c49b
	allow $2 user_fonts_t:dir list_dir_perms;
Chris PeBenito 93c49b
	allow $2 user_fonts_t:file read_file_perms;
Dan Walsh dfe675
	allow $2 user_fonts_t:lnk_file read_lnk_file_perms;
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	allow $2 user_fonts_config_t:dir list_dir_perms;
Chris PeBenito 93c49b
	allow $2 user_fonts_config_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 296273
	manage_dirs_pattern($2, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 296273
	manage_files_pattern($2, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
	stream_connect_pattern($2, xserver_tmp_t, xserver_tmp_t, xserver_t)
Dan Walsh 3eaa99
	allow $2 xserver_tmp_t:sock_file unlink;
Chris PeBenito 93c49b
	files_search_tmp($2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Communicate via System V shared memory.
Chris PeBenito 93c49b
	allow $2 xserver_t:shm r_shm_perms;
Chris PeBenito 93c49b
	allow $2 xserver_tmpfs_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 296273
	# allow ps to show iceauth
Chris PeBenito 296273
	ps_process_pattern($2, iceauth_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
	domtrans_pattern($2, iceauth_exec_t, iceauth_t)
Chris PeBenito 17de1b
Chris PeBenito 93c49b
	allow $2 iceauth_home_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 296273
	domtrans_pattern($2, xauth_exec_t, xauth_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
	allow $2 xauth_t:process signal;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# allow ps to show xauth
Chris PeBenito 3f67f7
	ps_process_pattern($2, xauth_t)
Chris PeBenito 93c49b
	allow $2 xserver_t:process signal;
Chris PeBenito 17de1b
Chris PeBenito 93c49b
	allow $2 xauth_home_t:file read_file_perms;
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	# for when /tmp/.X11-unix is created by the system
Chris PeBenito 93c49b
	allow $2 xdm_t:fd use;
Dominick Grift 59c034
	allow $2 xdm_t:fifo_file rw_inherited_fifo_file_perms;
Dan Walsh 3eaa99
	allow $2 xdm_tmp_t:dir search_dir_perms;
Dominick Grift 59c034
	allow $2 xdm_tmp_t:sock_file rw_inherited_sock_file_perms;
Chris PeBenito 93c49b
	dontaudit $2 xdm_t:tcp_socket { read write };
Dominick Grift 59c034
	dontaudit $2 xdm_tmp_t:dir setattr_dir_perms;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $2 xdm_t:dbus send_msg;
Dan Walsh 3eaa99
	allow xdm_t  $2:dbus send_msg;
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	# Client read xserver shm
Chris PeBenito 93c49b
	allow $2 xserver_t:fd use;
Chris PeBenito 93c49b
	allow $2 xserver_tmpfs_t:file read_file_perms;
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	# Read /tmp/.X0-lock
Dominick Grift 59c034
	allow $2 xserver_tmp_t:file read_inherited_file_perms;
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	dev_rw_xserver_misc($2)
Chris PeBenito 93c49b
	dev_rw_power_management($2)
Chris PeBenito 93c49b
	dev_read_input($2)
Chris PeBenito 93c49b
	dev_read_misc($2)
Chris PeBenito 93c49b
	dev_write_misc($2)
Chris PeBenito 93c49b
	# open office is looking for the following
Chris PeBenito 93c49b
	dev_getattr_agp_dev($2)
Dan Walsh 3eaa99
Chris PeBenito 93c49b
	# GNOME checks for usb and other devices:
Chris PeBenito 93c49b
	dev_rw_usbfs($2)
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	miscfiles_read_fonts($2)
Dan Walsh 3eaa99
	miscfiles_setattr_fonts_cache_dirs($2)
Chris PeBenito 17de1b
Chris PeBenito 296273
	xserver_common_x_domain_template(user, $2)
Chris PeBenito 93c49b
	xserver_xsession_entry_type($2)
Chris PeBenito 93c49b
	xserver_dontaudit_write_log($2)
Chris PeBenito 93c49b
	xserver_stream_connect_xdm($2)
Chris PeBenito 93c49b
	# certain apps want to read xdm.pid file
Chris PeBenito 93c49b
	xserver_read_xdm_pid($2)
Chris PeBenito 93c49b
	# gnome-session creates socket under /tmp/.ICE-unix/
Chris PeBenito 93c49b
	xserver_create_xdm_tmp_sockets($2)
Chris PeBenito 93c49b
	# Needed for escd, remove if we get escd policy
Chris PeBenito 93c49b
	xserver_manage_xdm_tmp_files($2)
Chris PeBenito 93c49b
Dominick Grift 2d102f
	ifdef(`hide_broken_symptoms',`
Dominick Grift 60d27b
		dontaudit iceauth_t $2:socket_class_set { read write };
Dominick Grift 60d27b
	')
Dominick Grift 60d27b
Chris PeBenito 93c49b
	# Client write xserver shm
Chris PeBenito 93c49b
	tunable_policy(`allow_write_xshm',`
Chris PeBenito 93c49b
		allow $2 xserver_t:shm rw_shm_perms;
Chris PeBenito 93c49b
		allow $2 xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 93c49b
	')
Dominick Grift 60d27b
Dominick Grift 60d27b
	tunable_policy(`user_direct_dri',`
Dominick Grift 60d27b
		dev_rw_dri($2)
Dominick Grift 60d27b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 93c49b
########################################
Chris PeBenito 93c49b
## <summary>
Chris PeBenito 93c49b
##	Rules required for using the X Windows server
Chris PeBenito 93c49b
##	and environment.
Chris PeBenito 93c49b
## </summary>
Chris PeBenito 93c49b
## <param name="role">
Chris PeBenito 93c49b
##	<summary>
Chris PeBenito 93c49b
##	Role allowed access.
Chris PeBenito 93c49b
##	</summary>
Chris PeBenito 93c49b
## </param>
Chris PeBenito 93c49b
## <param name="domain">
Chris PeBenito 93c49b
##	<summary>
Chris PeBenito 93c49b
##	Domain allowed access.
Chris PeBenito 93c49b
##	</summary>
Chris PeBenito 93c49b
## </param>
Chris PeBenito 93c49b
#
Chris PeBenito 93c49b
interface(`xserver_role',`
Chris PeBenito 93c49b
	gen_require(`
Chris PeBenito 93c49b
		type iceauth_home_t, xserver_t, xserver_tmpfs_t, xauth_home_t;
Chris PeBenito 93c49b
		type user_fonts_t, user_fonts_cache_t, user_fonts_config_t;
Chris PeBenito 93c49b
	')
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	xserver_restricted_role($1, $2)
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	# Communicate via System V shared memory.
Chris PeBenito 93c49b
	allow $2 xserver_t:shm rw_shm_perms;
Chris PeBenito 93c49b
	allow $2 xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	allow $2 iceauth_home_t:file manage_file_perms;
Dominick Grift a3d20a
	allow $2 iceauth_home_t:file relabel_file_perms;
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	allow $2 xauth_home_t:file manage_file_perms;
Dominick Grift a3d20a
	allow $2 xauth_home_t:file relabel_file_perms;
Chris PeBenito 93c49b
Dan Walsh 3eaa99
	mls_xwin_read_to_clearance($2)
Chris PeBenito 93c49b
	manage_dirs_pattern($2, user_fonts_t, user_fonts_t)
Chris PeBenito 93c49b
	manage_files_pattern($2, user_fonts_t, user_fonts_t)
Dan Walsh dfe675
	allow $2 user_fonts_t:lnk_file read_lnk_file_perms;
Chris PeBenito 93c49b
	relabel_dirs_pattern($2, user_fonts_t, user_fonts_t)
Chris PeBenito 93c49b
	relabel_files_pattern($2, user_fonts_t, user_fonts_t)
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	manage_dirs_pattern($2, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 93c49b
	manage_files_pattern($2, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 93c49b
	relabel_dirs_pattern($2, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 93c49b
	relabel_files_pattern($2, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 93c49b
Chris PeBenito 93c49b
	manage_dirs_pattern($2, user_fonts_config_t, user_fonts_config_t)
Chris PeBenito 93c49b
	manage_files_pattern($2, user_fonts_config_t, user_fonts_config_t)
Chris PeBenito 93c49b
	relabel_dirs_pattern($2, user_fonts_config_t, user_fonts_config_t)
Chris PeBenito 93c49b
	relabel_files_pattern($2, user_fonts_config_t, user_fonts_config_t)
Chris PeBenito 93c49b
')
Chris PeBenito 93c49b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Create sessions on the X server, with read-only
Chris PeBenito 17de1b
##	access to the X server shared
Chris PeBenito 17de1b
##	memory segments.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="tmpfs_type">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the domain SYSV tmpfs files.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`xserver_ro_session',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		type xserver_t, xserver_tmp_t, xserver_tmpfs_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Xserver read/write client shm
Chris PeBenito 296273
	allow xserver_t $1:fd use;
Chris PeBenito 296273
	allow xserver_t $1:shm rw_shm_perms;
Chris PeBenito 296273
	allow xserver_t $2:file rw_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Connect to xserver
Chris PeBenito 296273
	allow $1 xserver_t:unix_stream_socket connectto;
Chris PeBenito 296273
	allow $1 xserver_t:process signal;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Read /tmp/.X0-lock
Dan Walsh 3eaa99
	allow $1 xserver_tmp_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Client read xserver shm
Chris PeBenito 296273
	allow $1 xserver_t:fd use;
Chris PeBenito 296273
	allow $1 xserver_t:shm r_shm_perms;
Chris PeBenito 296273
	allow $1 xserver_tmpfs_t:file read_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Create sessions on the X server, with read and write
Chris PeBenito 17de1b
##	access to the X server shared
Chris PeBenito 17de1b
##	memory segments.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="tmpfs_type">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the domain SYSV tmpfs files.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`xserver_rw_session',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		type xserver_t, xserver_tmpfs_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Dominick Grift 2a7245
	xserver_ro_session($1, $2)
Chris PeBenito 296273
	allow $1 xserver_t:shm rw_shm_perms;
Chris PeBenito 296273
	allow $1 xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 6246e7
##	Create non-drawing client sessions on an X server.
Chris PeBenito 6246e7
## </summary>
Chris PeBenito 6246e7
## <param name="domain">
Chris PeBenito 6246e7
##	<summary>
Chris PeBenito 6246e7
##	Domain allowed access.
Chris PeBenito 6246e7
##	</summary>
Chris PeBenito 6246e7
## </param>
Chris PeBenito 6246e7
#
Chris PeBenito 6246e7
interface(`xserver_non_drawing_client',`
Chris PeBenito 6246e7
	gen_require(`
Chris PeBenito 6246e7
		class x_drawable { getattr get_property };
Chris PeBenito 6246e7
		class x_extension { query use };
Chris PeBenito 6246e7
		class x_gc { create setattr };
Chris PeBenito 6246e7
		class x_property read;
Chris PeBenito 6246e7
Chris PeBenito 6246e7
		type xserver_t, xdm_var_run_t;
Chris PeBenito 6246e7
		type xextension_t, xproperty_t, root_xdrawable_t;
Chris PeBenito 6246e7
	')
Chris PeBenito 6246e7
Chris PeBenito 6246e7
	allow $1 self:x_gc { create setattr };
Chris PeBenito 6246e7
Chris PeBenito 6246e7
	allow $1 xdm_var_run_t:dir search;
Chris PeBenito 6246e7
	allow $1 xserver_t:unix_stream_socket connectto;
Chris PeBenito 6246e7
Chris PeBenito 6246e7
	allow $1 xextension_t:x_extension { query use };
Chris PeBenito 6246e7
	allow $1 root_xdrawable_t:x_drawable { getattr get_property };
Chris PeBenito 6246e7
	allow $1 xproperty_t:x_property read;
Chris PeBenito 6246e7
')
Chris PeBenito 6246e7
Chris PeBenito 6246e7
#######################################
Chris PeBenito 6246e7
## <summary>
Chris PeBenito 296273
##	Create full client sessions
Chris PeBenito 17de1b
##	on a user X server.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="tmpfs_type">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the domain SYSV tmpfs files.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`xserver_user_client',`
Chris PeBenito 427989
	refpolicywarn(`$0() has been deprecated, please use xserver_user_x_domain_template instead.')
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_t, xdm_tmp_t;
Chris PeBenito 296273
		type xauth_home_t, iceauth_home_t, xserver_t, xserver_tmpfs_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 296273
	allow $1 self:shm create_shm_perms;
Chris PeBenito 296273
	allow $1 self:unix_dgram_socket create_socket_perms;
Chris PeBenito 296273
	allow $1 self:unix_stream_socket { connectto create_stream_socket_perms };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Read .Xauthority file
Dan Walsh 3eaa99
	allow $1 xauth_home_t:file read_file_perms;
Dan Walsh 3eaa99
	allow $1 iceauth_home_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# for when /tmp/.X11-unix is created by the system
Chris PeBenito 296273
	allow $1 xdm_t:fd use;
Dan Walsh 3eaa99
	allow $1 xdm_t:fifo_file rw_inherited_fifo_file_perms;
Chris PeBenito 296273
	allow $1 xdm_tmp_t:dir search;
Chris PeBenito 296273
	allow $1 xdm_tmp_t:sock_file { read write };
Chris PeBenito 296273
	dontaudit $1 xdm_t:tcp_socket { read write };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Allow connections to X server.
Chris PeBenito 296273
	files_search_tmp($1)
Chris PeBenito 17de1b
Chris PeBenito 296273
	miscfiles_read_fonts($1)
Chris PeBenito 17de1b
Chris PeBenito 296273
	userdom_search_user_home_dirs($1)
Chris PeBenito 17de1b
	# for .xsession-errors
Chris PeBenito 296273
	userdom_dontaudit_write_user_home_content_files($1)
Chris PeBenito 17de1b
Chris PeBenito 296273
	xserver_ro_session($1,$2)
Chris PeBenito 296273
	xserver_use_user_fonts($1)
Chris PeBenito 17de1b
Chris PeBenito 296273
	xserver_read_xdm_tmp_files($1)
Chris PeBenito 6b19be
Chris PeBenito 17de1b
	# Client write xserver shm
Chris PeBenito 17de1b
	tunable_policy(`allow_write_xshm',`
Chris PeBenito 296273
		allow $1 xserver_t:shm rw_shm_perms;
Chris PeBenito 296273
		allow $1 xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 2c12b4
#######################################
Chris PeBenito 2c12b4
## <summary>
Chris PeBenito 2c12b4
##	Interface to provide X object permissions on a given X server to
Chris PeBenito 2c12b4
##	an X client domain.  Provides the minimal set required by a basic
Chris PeBenito 2c12b4
##	X client application.
Chris PeBenito 2c12b4
## </summary>
Chris PeBenito 2c12b4
## <param name="prefix">
Chris PeBenito 2c12b4
##	<summary>
Chris PeBenito 2c12b4
##	The prefix of the X client domain (e.g., user
Chris PeBenito 2c12b4
##	is the prefix for user_t).
Chris PeBenito 2c12b4
##	</summary>
Chris PeBenito 2c12b4
## </param>
Chris PeBenito 2c12b4
## <param name="domain">
Chris PeBenito 2c12b4
##	<summary>
Chris PeBenito 2c12b4
##	Client domain allowed access.
Chris PeBenito 2c12b4
##	</summary>
Chris PeBenito 2c12b4
## </param>
Chris PeBenito 2c12b4
#
Chris PeBenito 2c12b4
template(`xserver_common_x_domain_template',`
Chris PeBenito 2c12b4
	gen_require(`
Dominick Grift 2528a2
		type root_xdrawable_t, xdm_t, xserver_t;
Eamon Walsh 5242ec
		type xproperty_t, $1_xproperty_t;
Chris PeBenito 2c12b4
		type xevent_t, client_xevent_t;
Eamon Walsh 5242ec
		type input_xevent_t, $1_input_xevent_t;
Chris PeBenito 2c12b4
Dominick Grift 2f94f4
		attribute x_domain, input_xevent_type;
Eamon Walsh 5242ec
		attribute xdrawable_type, xcolormap_type;
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
		class x_drawable all_x_drawable_perms;
Chris PeBenito 2c12b4
		class x_property all_x_property_perms;
Chris PeBenito 2c12b4
		class x_event all_x_event_perms;
Chris PeBenito 2c12b4
		class x_synthetic_event all_x_synthetic_event_perms;
Dan Walsh 3eaa99
		class x_client destroy;
Dan Walsh 3eaa99
		class x_server manage;
Dan Walsh 3eaa99
		class x_screen { saver_setattr saver_hide saver_show };
Dan Walsh 3eaa99
		class x_pointer { get_property set_property manage };
Dan Walsh 3eaa99
		class x_keyboard { read manage };
Chris PeBenito 2c12b4
	')
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	##############################
Chris PeBenito 2c12b4
	#
Chris PeBenito 296273
	# Local Policy
Chris PeBenito 2c12b4
	#
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	# Type attributes
Chris PeBenito 296273
	typeattribute $2 x_domain;
Eamon Walsh 5242ec
	typeattribute $2 xdrawable_type, xcolormap_type;
Chris PeBenito 2c12b4
Chris PeBenito 296273
	# X Properties
Eamon Walsh 5242ec
	# disable property transitions for the time being.
Eamon Walsh 5242ec
#	type_transition $2 xproperty_t:x_property $1_xproperty_t;
Chris PeBenito 2c12b4
Chris PeBenito 296273
	# X Windows
Chris PeBenito 296273
	# new windows have the domain type
Eamon Walsh 5242ec
	type_transition $2 root_xdrawable_t:x_drawable $2;
Chris PeBenito 296273
Chris PeBenito 296273
	# X Input
Eamon Walsh 5242ec
	# distinguish input events
Eamon Walsh 5242ec
	type_transition $2 input_xevent_t:x_event $1_input_xevent_t;
Eamon Walsh 5242ec
	# can send own events
Eamon Walsh 5242ec
	allow $2 $1_input_xevent_t:{ x_event x_synthetic_event } send;
Chris PeBenito 296273
	# can receive own events
Chris PeBenito 296273
	allow $2 $1_input_xevent_t:{ x_event x_synthetic_event } receive;
Eamon Walsh 5242ec
	# can receive default events
Eamon Walsh 5242ec
	allow $2 client_xevent_t:{ x_event x_synthetic_event } receive;
Eamon Walsh 5242ec
	allow $2 xevent_t:{ x_event x_synthetic_event } receive;
Eamon Walsh 5242ec
	# dont audit send failures
Eamon Walsh 5242ec
	dontaudit $2 input_xevent_type:x_event send;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $2 xdm_t:x_drawable { hide read add_child manage };
Dan Walsh 3eaa99
	allow $2 xdm_t:x_client destroy;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $2 root_xdrawable_t:x_drawable write;
Dan Walsh 3eaa99
	allow $2 xserver_t:x_server manage;
Dan Walsh 3eaa99
	allow $2 xserver_t:x_screen { saver_setattr saver_hide saver_show };
Dan Walsh 3eaa99
	allow $2 xserver_t:x_pointer { get_property set_property manage };
Dan Walsh 3eaa99
	allow $2 xserver_t:x_keyboard { read manage };
Chris PeBenito 296273
')
Chris PeBenito 296273
Chris PeBenito 296273
#######################################
Chris PeBenito 296273
## <summary>
Chris PeBenito 296273
##	Template for creating the set of types used
Chris PeBenito 296273
##	in an X windows domain.
Chris PeBenito 296273
## </summary>
Chris PeBenito 296273
## <param name="prefix">
Chris PeBenito 296273
##	<summary>
Chris PeBenito 296273
##	The prefix of the X client domain (e.g., user
Chris PeBenito 296273
##	is the prefix for user_t).
Chris PeBenito 296273
##	</summary>
Chris PeBenito 296273
## </param>
Chris PeBenito 296273
#
Chris PeBenito 296273
template(`xserver_object_types_template',`
Chris PeBenito 296273
	gen_require(`
Chris PeBenito 296273
		attribute xproperty_type, input_xevent_type, xevent_type;
Chris PeBenito 296273
	')
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	##############################
Chris PeBenito 2c12b4
	#
Chris PeBenito 296273
	# Declarations
Chris PeBenito 2c12b4
	#
Chris PeBenito 2c12b4
Chris PeBenito 296273
	# Types for properties
Eamon Walsh 5242ec
	type $1_xproperty_t, xproperty_type;
Chris PeBenito 296273
	ubac_constrained($1_xproperty_t)
Chris PeBenito 2c12b4
Chris PeBenito 296273
	# Types for events
Chris PeBenito 296273
	type $1_input_xevent_t, input_xevent_type, xevent_type;
Chris PeBenito 296273
	ubac_constrained($1_input_xevent_t)
Chris PeBenito 2c12b4
')
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
#######################################
Chris PeBenito 2c12b4
## <summary>
Chris PeBenito 2c12b4
##	Interface to provide X object permissions on a given X server to
Chris PeBenito 2c12b4
##	an X client domain.  Provides the minimal set required by a basic
Chris PeBenito 2c12b4
##	X client application.
Chris PeBenito 2c12b4
## </summary>
Chris PeBenito 2c12b4
## <param name="prefix">
Chris PeBenito 2c12b4
##	<summary>
Chris PeBenito 2c12b4
##	The prefix of the X client domain (e.g., user
Chris PeBenito 2c12b4
##	is the prefix for user_t).
Chris PeBenito 2c12b4
##	</summary>
Chris PeBenito 2c12b4
## </param>
Chris PeBenito 2c12b4
## <param name="domain">
Chris PeBenito 2c12b4
##	<summary>
Chris PeBenito 2c12b4
##	Client domain allowed access.
Chris PeBenito 2c12b4
##	</summary>
Chris PeBenito 2c12b4
## </param>
Chris PeBenito 2c12b4
## <param name="tmpfs_type">
Chris PeBenito 2c12b4
##	<summary>
Chris PeBenito 2c12b4
##	The type of the domain SYSV tmpfs files.
Chris PeBenito 2c12b4
##	</summary>
Chris PeBenito 2c12b4
## </param>
Chris PeBenito 2c12b4
#
Chris PeBenito 2c12b4
template(`xserver_user_x_domain_template',`
Chris PeBenito 2c12b4
	gen_require(`
Dominick Grift 2528a2
		type xdm_t, xdm_tmp_t, xserver_tmpfs_t;
Dominick Grift 2528a2
		type xauth_home_t, iceauth_home_t, xserver_t;
Chris PeBenito 2c12b4
	')
Chris PeBenito 2c12b4
Chris PeBenito 296273
	allow $2 self:shm create_shm_perms;
Chris PeBenito 296273
	allow $2 self:unix_dgram_socket create_socket_perms;
Chris PeBenito 296273
	allow $2 self:unix_stream_socket { connectto create_stream_socket_perms };
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	# Read .Xauthority file
Chris PeBenito 296273
	allow $2 xauth_home_t:file read_file_perms;
Chris PeBenito 296273
	allow $2 iceauth_home_t:file read_file_perms;
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	# for when /tmp/.X11-unix is created by the system
Chris PeBenito 296273
	allow $2 xdm_t:fd use;
Dominick Grift 59c034
	allow $2 xdm_t:fifo_file rw_inherited_fifo_file_perms;
Chris PeBenito 296273
	allow $2 xdm_tmp_t:dir search_dir_perms;
Dominick Grift 59c034
	allow $2 xdm_tmp_t:sock_file rw_inherited_sock_file_perms;
Chris PeBenito 296273
	dontaudit $2 xdm_t:tcp_socket { read write };
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	# Allow connections to X server.
Chris PeBenito 296273
	files_search_tmp($2)
Chris PeBenito 2c12b4
Chris PeBenito 296273
	miscfiles_read_fonts($2)
Chris PeBenito 2c12b4
Chris PeBenito 296273
	userdom_search_user_home_dirs($2)
Chris PeBenito 2c12b4
	# for .xsession-errors
Chris PeBenito 296273
	userdom_dontaudit_write_user_home_content_files($2)
Chris PeBenito 2c12b4
Dominick Grift 2d102f
	xserver_ro_session($2, $3)
Chris PeBenito 296273
	xserver_use_user_fonts($2)
Chris PeBenito 2c12b4
Chris PeBenito 296273
	xserver_read_xdm_tmp_files($2)
Dan Walsh 3eaa99
	xserver_read_xdm_pid($2)
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	# X object manager
Chris PeBenito 296273
	xserver_object_types_template($1)
Dominick Grift 2d102f
	xserver_common_x_domain_template($1, $2)
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
	# Client write xserver shm
Chris PeBenito 2c12b4
	tunable_policy(`allow_write_xshm',`
Chris PeBenito 296273
		allow $2 xserver_t:shm rw_shm_perms;
Chris PeBenito 296273
		allow $2 xserver_tmpfs_t:file rw_file_perms;
Chris PeBenito 2c12b4
	')
Dominick Grift 60d27b
Dominick Grift 60d27b
	tunable_policy(`user_direct_dri',`
Dominick Grift 60d27b
		dev_rw_dri($2)
Dominick Grift 60d27b
	')
Chris PeBenito 2c12b4
')
Chris PeBenito 2c12b4
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read user fonts, user font configuration,
Chris PeBenito 17de1b
##	and manage the user font cache.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##	

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

Chris PeBenito 17de1b
##	

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

Chris PeBenito 17de1b
## </desc>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`xserver_use_user_fonts',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		type user_fonts_t, user_fonts_cache_t, user_fonts_config_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Read per user fonts
Chris PeBenito 296273
	allow $1 user_fonts_t:dir list_dir_perms;
Chris PeBenito 296273
	allow $1 user_fonts_t:file read_file_perms;
Dan Walsh dfe675
	allow $1 user_fonts_t:lnk_file read_lnk_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Manipulate the global font cache
Chris PeBenito 296273
	manage_dirs_pattern($1, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 296273
	manage_files_pattern($1, user_fonts_cache_t, user_fonts_cache_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Read per user font config
Chris PeBenito 296273
	allow $1 user_fonts_config_t:dir list_dir_perms;
Chris PeBenito 296273
	allow $1 user_fonts_config_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 296273
	userdom_search_user_home_dirs($1)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Transition to the Xauthority domain.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Dominick Grift 288845
##	Domain allowed to transition.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`xserver_domtrans_xauth',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		type xauth_t, xauth_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 296273
	domtrans_pattern($1, xauth_exec_t, xauth_t)
Dominick Grift 60d27b
Dominick Grift 2d102f
	ifdef(`hide_broken_symptoms',`
Dan Walsh f79af2
		dontaudit xauth_t $1:socket_class_set { read write };
Dan Walsh f79af2
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Dontaudit exec of Xauthority program.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_dontaudit_exec_xauth',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xauth_exec_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	dontaudit $1 xauth_exec_t:file execute;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Create a Xauthority file in the user home directory.
Chris PeBenito 6b19be
## </summary>
Chris PeBenito 6b19be
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Chris PeBenito 6b19be
##	Domain allowed access.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 296273
interface(`xserver_user_home_dir_filetrans_user_xauth',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 296273
		type xauth_home_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Chris PeBenito 296273
	userdom_user_home_dir_filetrans($1, xauth_home_t, file)
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito 17de1b
##	Read all users fonts, user font configurations,
Chris PeBenito 17de1b
##	and manage all users font caches.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_use_all_users_fonts',`
Chris PeBenito 296273
	refpolicywarn(`$0() has been deprecated, please use xserver_use_user_fonts.')
Chris PeBenito 296273
	xserver_use_user_fonts($1)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 4967aa
##	Read all users .Xauthority.
Chris PeBenito 4967aa
## </summary>
Chris PeBenito 4967aa
## <param name="domain">
Chris PeBenito 4967aa
##	<summary>
Chris PeBenito 4967aa
##	Domain allowed access.
Chris PeBenito 4967aa
##	</summary>
Chris PeBenito 4967aa
## </param>
Chris PeBenito 4967aa
#
Chris PeBenito 296273
interface(`xserver_read_user_xauth',`
Chris PeBenito 4967aa
	gen_require(`
Chris PeBenito 296273
		type xauth_home_t;
Chris PeBenito 4967aa
	')
Chris PeBenito 4967aa
Chris PeBenito 296273
	allow $1 xauth_home_t:file read_file_perms;
Chris PeBenito 296273
	userdom_search_user_home_dirs($1)
Dan Walsh 3eaa99
	xserver_read_xdm_pid($1)
Chris PeBenito 4967aa
')
Chris PeBenito 4967aa
Chris PeBenito 4967aa
########################################
Chris PeBenito 4967aa
## <summary>
Chris PeBenito 17de1b
##	Set the attributes of the X windows console named pipes.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_setattr_console_pipes',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xconsole_device_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Dominick Grift 59c034
	allow $1 xconsole_device_t:fifo_file setattr_fifo_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read and write the X windows console named pipe.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_rw_console',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xconsole_device_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 5f63dd
	allow $1 xconsole_device_t:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Use file descriptors for xdm.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_use_xdm_fds',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Dominick Grift 2d102f
	allow $1 xdm_t:fd use;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito d6d16b
##	Do not audit attempts to inherit
Chris PeBenito d6d16b
##	XDM file descriptors.
Chris PeBenito d6d16b
## </summary>
Chris PeBenito d6d16b
## <param name="domain">
Chris PeBenito d6d16b
##	<summary>
Chris PeBenito d6d16b
##	Domain to not audit.
Chris PeBenito d6d16b
##	</summary>
Chris PeBenito d6d16b
## </param>
Chris PeBenito d6d16b
#
Chris PeBenito d6d16b
interface(`xserver_dontaudit_use_xdm_fds',`
Chris PeBenito d6d16b
	gen_require(`
Chris PeBenito d6d16b
		type xdm_t;
Chris PeBenito d6d16b
	')
Chris PeBenito d6d16b
Dominick Grift 2d102f
	dontaudit $1 xdm_t:fd use;
Chris PeBenito d6d16b
')
Chris PeBenito d6d16b
Chris PeBenito d6d16b
########################################
Chris PeBenito d6d16b
## <summary>
Chris PeBenito 17de1b
##	Read and write XDM unnamed pipes.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito d6d16b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_rw_xdm_pipes',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Dominick Grift 59c034
	allow $1 xdm_t:fifo_file rw_inherited_fifo_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito d6d16b
##	Do not audit attempts to read and write
Chris PeBenito d6d16b
##	XDM unnamed pipes.
Chris PeBenito d6d16b
## </summary>
Chris PeBenito d6d16b
## <param name="domain">
Chris PeBenito d6d16b
##	<summary>
Chris PeBenito d6d16b
##	Domain to not audit.
Chris PeBenito d6d16b
##	</summary>
Chris PeBenito d6d16b
## </param>
Chris PeBenito d6d16b
#
Chris PeBenito d6d16b
interface(`xserver_dontaudit_rw_xdm_pipes',`
Chris PeBenito d6d16b
	gen_require(`
Chris PeBenito d6d16b
		type xdm_t;
Chris PeBenito d6d16b
	')
Chris PeBenito d6d16b
Dominick Grift 2d102f
	dontaudit $1 xdm_t:fifo_file rw_fifo_file_perms;
Chris PeBenito d6d16b
')
Chris PeBenito d6d16b
Chris PeBenito d6d16b
########################################
Chris PeBenito d6d16b
## <summary>
Chris PeBenito 17de1b
##	Connect to XDM over a unix domain
Chris PeBenito 17de1b
##	stream socket.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_stream_connect_xdm',`
Chris PeBenito 17de1b
	gen_require(`
Dominick Grift 2f94f4
		type xdm_t, xdm_tmp_t, xdm_var_run_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito eac818
	files_search_tmp($1)
Dominick Grift f92662
	files_search_pids($1)
Chris PeBenito 0bfccd
	stream_connect_pattern($1, xdm_tmp_t, xdm_tmp_t, xdm_t)
Dan Walsh 3eaa99
	stream_connect_pattern($1, xdm_var_run_t, xdm_var_run_t, xdm_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read xdm-writable configuration files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_read_xdm_rw_config',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_rw_etc_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_etc($1)
Chris PeBenito 82d277
	allow $1 xdm_rw_etc_t:file read_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Set the attributes of XDM temporary directories.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_setattr_xdm_tmp_dirs',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_tmp_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Dominick Grift 59c034
	allow $1 xdm_tmp_t:dir setattr_dir_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Create a named socket in a XDM
Chris PeBenito 17de1b
##	temporary directory.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_create_xdm_tmp_sockets',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_tmp_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_tmp($1)
Chris PeBenito c0868a
	allow $1 xdm_tmp_t:dir list_dir_perms;
Chris PeBenito 0bfccd
	create_sock_files_pattern($1, xdm_tmp_t, xdm_tmp_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read XDM pid files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_read_xdm_pid',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_var_run_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_pids($1)
Dan Walsh 3eaa99
	read_files_pattern($1, xdm_var_run_t, xdm_var_run_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito ff8f0a
##	Read XDM var lib files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito ff8f0a
##	<summary>
Chris PeBenito ff8f0a
##	Domain allowed access.
Chris PeBenito ff8f0a
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_read_xdm_lib_files',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xdm_var_lib_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 82d277
	allow $1 xdm_var_lib_t:file read_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Make an X session script an entrypoint for the specified domain.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The domain for which the shell is an entrypoint.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_xsession_entry_type',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xsession_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
	domain_entry_file($1, xsession_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Execute an X session in the target domain.  This
Chris PeBenito 17de1b
##	is an explicit transition, requiring the
Chris PeBenito 17de1b
##	caller to use setexeccon().
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	Execute an Xsession in the target domain.  This
Chris PeBenito 17de1b
##	is an explicit transition, requiring the
Chris PeBenito 17de1b
##	caller to use setexeccon().
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	

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

Chris PeBenito 17de1b
## </desc>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Dominick Grift 288845
##	Domain allowed to transition.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="target_domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the shell process.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_xsession_spec_domtrans',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xsession_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
	domain_trans($1, xsession_exec_t, $2)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Get the attributes of X server logs.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_getattr_log',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xserver_log_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	logging_search_logs($1)
Dominick Grift 59c034
	allow $1 xserver_log_t:file getattr_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Do not audit attempts to write the X server
Chris PeBenito 17de1b
##	log files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito a7ee7f
##	Domain to not audit.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_dontaudit_write_log',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xserver_log_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Dan Walsh 3eaa99
	dontaudit $1 xserver_log_t:file rw_inherited_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito a7ee7f
##	Delete X server log files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_delete_log',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xserver_log_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	logging_search_logs($1)
Chris PeBenito c0868a
	allow $1 xserver_log_t:dir list_dir_perms;
Chris PeBenito 0bfccd
	delete_files_pattern($1, xserver_log_t, xserver_log_t)
Chris PeBenito 0bfccd
	delete_fifo_files_pattern($1, xserver_log_t, xserver_log_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read X keyboard extension libraries.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`xserver_read_xkb_libs',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xkb_var_lib_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_var_lib($1)
Chris PeBenito 17de1b
	allow $1 xkb_var_lib_t:dir list_dir_perms;
Chris PeBenito 0bfccd
	read_files_pattern($1, xkb_var_lib_t, xkb_var_lib_t)
Chris PeBenito 0bfccd
	read_lnk_files_pattern($1, xkb_var_lib_t, xkb_var_lib_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Dan Walsh 3eaa99
##	Read xdm config files.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain to not audit
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_read_xdm_etc_files',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xdm_etc_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dominick Grift 2d102f
	files_search_etc($1)
Dan Walsh 3eaa99
	read_files_pattern($1, xdm_etc_t, xdm_etc_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Manage xdm config files.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain to not audit
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_manage_xdm_etc_files',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xdm_etc_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dominick Grift 2d102f
	files_search_etc($1)
Dan Walsh 3eaa99
	manage_files_pattern($1, xdm_etc_t, xdm_etc_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Chris PeBenito 17de1b
##	Read xdm temporary files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito eac818
interface(`xserver_read_xdm_tmp_files',`
Chris PeBenito eac818
	gen_require(`
Chris PeBenito eac818
		type xdm_tmp_t;
Chris PeBenito eac818
	')
Chris PeBenito eac818
Dominick Grift 2d102f
	files_search_tmp($1)
Chris PeBenito 0bfccd
	read_files_pattern($1, xdm_tmp_t, xdm_tmp_t)
Chris PeBenito eac818
')
Chris PeBenito eac818
Chris PeBenito eac818
########################################
Chris PeBenito eac818
## <summary>
Chris PeBenito 6b19be
##	Do not audit attempts to read xdm temporary files.
Chris PeBenito 6b19be
## </summary>
Chris PeBenito 6b19be
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Chris PeBenito a7ee7f
##	Domain to not audit.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
interface(`xserver_dontaudit_read_xdm_tmp_files',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type xdm_tmp_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
	dontaudit $1 xdm_tmp_t:dir search_dir_perms;
Chris PeBenito ef659a
	dontaudit $1 xdm_tmp_t:file read_file_perms;
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito 6b19be
##	Read write xdm temporary files.
Chris PeBenito 6b19be
## </summary>
Chris PeBenito 6b19be
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
interface(`xserver_rw_xdm_tmp_files',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type xdm_tmp_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
	allow $1 xdm_tmp_t:dir search_dir_perms;
Chris PeBenito 6b19be
	allow $1 xdm_tmp_t:file rw_file_perms;
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito 6b19be
##	Create, read, write, and delete xdm temporary files.
Chris PeBenito 6b19be
## </summary>
Chris PeBenito 6b19be
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
interface(`xserver_manage_xdm_tmp_files',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type xdm_tmp_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Chris PeBenito 0bfccd
	manage_files_pattern($1, xdm_tmp_t, xdm_tmp_t)
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito a7ee7f
##	Do not audit attempts to get the attributes of
Chris PeBenito a7ee7f
##	xdm temporary named sockets.
Chris PeBenito 6b19be
## </summary>
Chris PeBenito 6b19be
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Chris PeBenito a7ee7f
##	Domain to not audit.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
interface(`xserver_dontaudit_getattr_xdm_tmp_sockets',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type xdm_tmp_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Dominick Grift 59c034
	dontaudit $1 xdm_tmp_t:sock_file getattr_sock_file_perms;
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito 296273
##	Execute the X server in the X server domain.
Chris PeBenito 296273
## </summary>
Chris PeBenito 296273
## <param name="domain">
Chris PeBenito 296273
##	<summary>
Dominick Grift 288845
##	Domain allowed to transition.
Chris PeBenito 296273
##	</summary>
Chris PeBenito 296273
## </param>
Chris PeBenito 296273
#
Chris PeBenito 296273
interface(`xserver_domtrans',`
Chris PeBenito 296273
	gen_require(`
Chris PeBenito 296273
		type xserver_t, xserver_exec_t;
Chris PeBenito 296273
	')
Chris PeBenito 296273
Dominick Grift 2d102f
	allow $1 xserver_t:process siginh;
Chris PeBenito 296273
	domtrans_pattern($1, xserver_exec_t, xserver_t)
Dan Walsh c6fa93
Dan Walsh c6fa93
	allow xserver_t $1:process getpgid;
Chris PeBenito 296273
')
Chris PeBenito 296273
Chris PeBenito 296273
########################################
Chris PeBenito 296273
## <summary>
Chris PeBenito 296273
##	Signal X servers
Chris PeBenito 75beb9
## </summary>
Chris PeBenito 75beb9
## <param name="domain">
Chris PeBenito 75beb9
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 75beb9
##	</summary>
Chris PeBenito 75beb9
## </param>
Chris PeBenito 75beb9
#
Chris PeBenito 296273
interface(`xserver_signal',`
Chris PeBenito 75beb9
	gen_require(`
Chris PeBenito 296273
		type xserver_t;
Chris PeBenito 75beb9
	')
Chris PeBenito 75beb9
Chris PeBenito 296273
	allow $1 xserver_t:process signal;
Chris PeBenito 75beb9
')
Chris PeBenito 75beb9
Chris PeBenito 75beb9
########################################
Chris PeBenito 75beb9
## <summary>
Chris PeBenito 296273
##	Kill X servers
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`xserver_kill',`
Chris PeBenito 296273
	gen_require(`
Chris PeBenito 296273
		type xserver_t;
Chris PeBenito 296273
	')
Chris PeBenito 296273
Chris PeBenito 296273
	allow $1 xserver_t:process sigkill;
Chris PeBenito 296273
')
Chris PeBenito 296273
Chris PeBenito 296273
########################################
Chris PeBenito 296273
## <summary>
Chris PeBenito 296273
##	Read and write X server Sys V Shared
Chris PeBenito 296273
##	memory segments.
Chris PeBenito 296273
## </summary>
Chris PeBenito 296273
## <param name="domain">
Chris PeBenito 296273
##	<summary>
Chris PeBenito 296273
##	Domain allowed access.
Chris PeBenito 296273
##	</summary>
Chris PeBenito 296273
## </param>
Chris PeBenito 296273
#
Chris PeBenito 296273
interface(`xserver_rw_shm',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		type xserver_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 296273
	allow $1 xserver_t:shm rw_shm_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Do not audit attempts to read and write to
Chris PeBenito 296273
##	X server sockets.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito a7ee7f
##	Domain to not audit.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`xserver_dontaudit_rw_tcp_sockets',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		type xserver_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 296273
	dontaudit $1 xserver_t:tcp_socket { read write };
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Do not audit attempts to read and write X server
Chris PeBenito 6b19be
##	unix domain stream sockets.
Chris PeBenito 6b19be
## </summary>
Chris PeBenito 6b19be
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Dominick Grift 288845
##	Domain to not audit.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 296273
interface(`xserver_dontaudit_rw_stream_sockets',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 296273
		type xserver_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Chris PeBenito 296273
	dontaudit $1 xserver_t:unix_stream_socket { read write };
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito 296273
##	Connect to the X server over a unix domain
Chris PeBenito 17de1b
##	stream socket.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Dan Walsh f79af2
interface(`xserver_stream_connect',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		type xserver_t, xserver_tmp_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_tmp($1)
Chris PeBenito 296273
	stream_connect_pattern($1, xserver_tmp_t, xserver_tmp_t, xserver_t)
Dan Walsh 0745e4
	allow xserver_t $1:shm rw_shm_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
########################################
Chris PeBenito 2c12b4
## <summary>
Chris PeBenito 296273
##	Read X server temporary files.
Chris PeBenito 21ea2b
## </summary>
Chris PeBenito 21ea2b
## <param name="domain">
Chris PeBenito 21ea2b
##	<summary>
Chris PeBenito a7ee7f
##	Domain allowed access.
Chris PeBenito 21ea2b
##	</summary>
Chris PeBenito 21ea2b
## </param>
Chris PeBenito 21ea2b
#
Chris PeBenito 296273
interface(`xserver_read_tmp_files',`
Chris PeBenito 21ea2b
	gen_require(`
Chris PeBenito 296273
		type xserver_tmp_t;
Chris PeBenito 21ea2b
	')
Chris PeBenito 21ea2b
Chris PeBenito 296273
	allow $1 xserver_tmp_t:file read_file_perms;
Chris PeBenito 296273
	files_search_tmp($1)
Chris PeBenito 21ea2b
')
Chris PeBenito 21ea2b
Chris PeBenito 21ea2b
########################################
Chris PeBenito 21ea2b
## <summary>
Chris PeBenito 2c12b4
##	Interface to provide X object permissions on a given X server to
Eamon Walsh 5242ec
##	an X client domain.  Gives the domain permission to read the
Dominick Grift 2d102f
##	virtual core keyboard and virtual core pointer devices.
Eamon Walsh 5242ec
## </summary>
Eamon Walsh 5242ec
## <param name="domain">
Eamon Walsh 5242ec
##	<summary>
Eamon Walsh 5242ec
##	Domain allowed access.
Eamon Walsh 5242ec
##	</summary>
Eamon Walsh 5242ec
## </param>
Eamon Walsh 5242ec
#
Eamon Walsh 5242ec
interface(`xserver_manage_core_devices',`
Eamon Walsh 5242ec
	gen_require(`
Dominick Grift 2f94f4
		type xserver_t, root_xdrawable_t;
Eamon Walsh 5242ec
		class x_device all_x_device_perms;
Eamon Walsh 5242ec
		class x_pointer all_x_pointer_perms;
Eamon Walsh 5242ec
		class x_keyboard all_x_keyboard_perms;
Dan Walsh 3eaa99
		class x_screen all_x_screen_perms;
Dan Walsh 3eaa99
		class x_drawable { manage };
Dan Walsh 3eaa99
		attribute x_domain;
Dan Walsh 3eaa99
		class x_drawable { read manage setattr show };
Dan Walsh 3eaa99
		class x_resource { write read };
Eamon Walsh 5242ec
	')
Eamon Walsh 5242ec
Eamon Walsh 5242ec
	allow $1 xserver_t:{ x_device x_pointer x_keyboard } *;
Dan Walsh 3eaa99
	allow $1 xserver_t:{ x_screen } setattr;
Dan Walsh 3eaa99
	
Dan Walsh 3eaa99
	allow $1 x_domain:x_drawable { read manage setattr show };
Dan Walsh 3eaa99
	allow $1 x_domain:x_resource { write read };
Dan Walsh 3eaa99
	allow $1 root_xdrawable_t:x_drawable { manage read };
Eamon Walsh 5242ec
')
Eamon Walsh 5242ec
Eamon Walsh 5242ec
########################################
Eamon Walsh 5242ec
## <summary>
Eamon Walsh 5242ec
##	Interface to provide X object permissions on a given X server to
Chris PeBenito 2c12b4
##	an X client domain.  Gives the domain complete control over the
Chris PeBenito 2c12b4
##	display.
Chris PeBenito 2c12b4
## </summary>
Chris PeBenito 2c12b4
## <param name="domain">
Chris PeBenito 2c12b4
##	<summary>
Chris PeBenito 2c12b4
##	Domain allowed access.
Chris PeBenito 2c12b4
##	</summary>
Chris PeBenito 2c12b4
## </param>
Chris PeBenito 2c12b4
#
Chris PeBenito 2c12b4
interface(`xserver_unconfined',`
Chris PeBenito 2c12b4
	gen_require(`
Dominick Grift 2f94f4
		attribute x_domain, xserver_unconfined_type;
Chris PeBenito 2c12b4
	')
Chris PeBenito 2c12b4
Eamon Walsh 5242ec
	typeattribute $1 x_domain;
Chris PeBenito 2c12b4
	typeattribute $1 xserver_unconfined_type;
Chris PeBenito 2c12b4
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Dontaudit append to .xsession-errors file
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain to not audit
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_dontaudit_append_xdm_home_files',`
Dan Walsh 3eaa99
	gen_require(`
Dominick Grift 2f94f4
		type xdm_home_t, xserver_tmp_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	dontaudit $1 xdm_home_t:file rw_inherited_file_perms;
Dan Walsh 3eaa99
	dontaudit $1 xserver_tmp_t:file rw_inherited_file_perms;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	tunable_policy(`use_nfs_home_dirs',`
Dan Walsh 3eaa99
		fs_dontaudit_rw_nfs_files($1)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	tunable_policy(`use_samba_home_dirs',`
Dan Walsh 3eaa99
		fs_dontaudit_rw_cifs_files($1)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	append to .xsession-errors file
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain to not audit
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_append_xdm_home_files',`
Dan Walsh 3eaa99
	gen_require(`
Dominick Grift 2f94f4
		type xdm_home_t, xserver_tmp_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $1 xdm_home_t:file append_file_perms;
Dan Walsh 3eaa99
	allow $1 xserver_tmp_t:file append_file_perms;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	tunable_policy(`use_nfs_home_dirs',`
Dan Walsh 3eaa99
		fs_append_nfs_files($1)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	tunable_policy(`use_samba_home_dirs',`
Dan Walsh 3eaa99
		fs_append_cifs_files($1)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Manage the xdm_spool files
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_xdm_manage_spool',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xdm_spool_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	files_search_spool($1)
Dan Walsh 3eaa99
	manage_files_pattern($1, xdm_spool_t, xdm_spool_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Send and receive messages from
Dan Walsh 3eaa99
##	xdm over dbus.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_dbus_chat_xdm',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xdm_t;
Dan Walsh 3eaa99
		class dbus send_msg;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $1 xdm_t:dbus send_msg;
Dan Walsh 3eaa99
	allow xdm_t $1:dbus send_msg;
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Read xserver files created in /var/run
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_read_pid',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xserver_var_run_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	files_search_pids($1)
Dan Walsh 3eaa99
	read_files_pattern($1, xserver_var_run_t, xserver_var_run_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Execute xserver files created in /var/run
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_exec_pid',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xserver_var_run_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	files_search_pids($1)
Dan Walsh 3eaa99
	exec_files_pattern($1, xserver_var_run_t, xserver_var_run_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Write xserver files created in /var/run
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_write_pid',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xserver_var_run_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	files_search_pids($1)
Dan Walsh 3eaa99
	write_files_pattern($1, xserver_var_run_t, xserver_var_run_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Allow append the xdm
Dan Walsh 3eaa99
##	log files.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain to not audit
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_xdm_append_log',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xdm_log_t;
Dan Walsh 3eaa99
		attribute xdmhomewriter;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	typeattribute $1 xdmhomewriter;
Dan Walsh 3eaa99
	append_files_pattern($1, xdm_log_t, xdm_log_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Read a user Iceauthority domain.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
template(`xserver_read_user_iceauth',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type iceauth_home_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	# Read .Iceauthority file
Dan Walsh 3eaa99
	allow $1 iceauth_home_t:file read_file_perms;
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Read user homedir fonts.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_rw_inherited_user_fonts',`
Dan Walsh 3eaa99
	gen_require(`
Dominick Grift 2f94f4
		type user_fonts_t, user_fonts_config_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $1 user_fonts_t:file rw_inherited_file_perms;
Dan Walsh 3eaa99
	allow $1 user_fonts_t:file read_lnk_file_perms;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $1 user_fonts_config_t:file rw_inherited_file_perms;
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Search XDM var lib dirs.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_search_xdm_lib',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xdm_var_lib_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	allow $1 xdm_var_lib_t:dir search_dir_perms;
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Make an X executable an entrypoint for the specified domain.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	The domain for which the shell is an entrypoint.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_entry_type',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xserver_exec_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	domain_entry_file($1, xserver_exec_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Execute xsever in the xserver domain, and
Dan Walsh 3eaa99
##	allow the specified role the xserver domain.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
## <param name="role">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	The role to be allowed the xserver domain.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dominick Grift 9c9e4c
## <rolecap/>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_run',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xserver_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	xserver_domtrans($1)
Dan Walsh 3eaa99
	role $2 types xserver_t;
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Execute xsever in the xserver domain, and
Dan Walsh 3eaa99
##	allow the specified role the xserver domain.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
## <param name="role">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	The role to be allowed the xserver domain.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dominick Grift 9c9e4c
## <rolecap/>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_run_xauth',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		type xauth_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	xserver_domtrans_xauth($1)
Dan Walsh 3eaa99
	role $2 types xauth_t;
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Dan Walsh 3eaa99
##	Read user homedir fonts.
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
## <rolecap/>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`xserver_manage_home_fonts',`
Dan Walsh 3eaa99
	gen_require(`
Dominick Grift 2f94f4
		type user_fonts_t, user_fonts_config_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	manage_dirs_pattern($1, user_fonts_t, user_fonts_t)
Dan Walsh 3eaa99
	manage_files_pattern($1, user_fonts_t, user_fonts_t)
Dan Walsh 3eaa99
	manage_lnk_files_pattern($1, user_fonts_t, user_fonts_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	manage_files_pattern($1, user_fonts_config_t, user_fonts_config_t)
Dan Walsh 3eaa99
')