Chris PeBenito fbc0a2
## <summary>Games</summary>
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
#######################################
Chris PeBenito fbc0a2
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the games module.
Chris PeBenito fbc0a2
## </summary>
Chris PeBenito fbc0a2
## <desc>
Chris PeBenito fbc0a2
##	

Chris PeBenito fbc0a2
##	This template creates a derived domains which are used
Chris PeBenito fbc0a2
##	for games.
Chris PeBenito fbc0a2
##	

Chris PeBenito fbc0a2
##	

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

Chris PeBenito fbc0a2
## </desc>
Chris PeBenito fbc0a2
## <param name="userdomain_prefix">
Chris PeBenito fbc0a2
##	<summary>
Chris PeBenito fbc0a2
##	The prefix of the user domain (e.g., user
Chris PeBenito fbc0a2
##	is the prefix for user_t).
Chris PeBenito fbc0a2
##	</summary>
Chris PeBenito fbc0a2
## </param>
Chris PeBenito fbc0a2
## <param name="user_domain">
Chris PeBenito fbc0a2
##	<summary>
Chris PeBenito fbc0a2
##	The type of the user domain.
Chris PeBenito fbc0a2
##	</summary>
Chris PeBenito fbc0a2
## </param>
Chris PeBenito fbc0a2
## <param name="user_role">
Chris PeBenito fbc0a2
##	<summary>
Chris PeBenito fbc0a2
##	The role associated with the user domain.
Chris PeBenito fbc0a2
##	</summary>
Chris PeBenito fbc0a2
## </param>
Chris PeBenito fbc0a2
#
Chris PeBenito bbcd3c
template(`games_per_role_template',`
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	########################################
Chris PeBenito fbc0a2
	#
Chris PeBenito fbc0a2
	# Declarations
Chris PeBenito fbc0a2
	#
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	type $1_games_t;
Chris PeBenito fbc0a2
	domain_type($1_games_t)
Chris PeBenito d40c0e
	domain_entry_file($1_games_t,games_exec_t)
Chris PeBenito fbc0a2
	role $3 types $1_games_t;
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	type $1_games_devpts_t;
Chris PeBenito fbc0a2
	term_pty($1_games_devpts_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	type $1_games_tmpfs_t;
Chris PeBenito fbc0a2
	files_tmpfs_file($1_games_tmpfs_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	type $1_games_tmp_t;
Chris PeBenito fbc0a2
	files_tmp_file($1_games_tmp_t)
Chris PeBenito fbc0a2
	
Chris PeBenito fbc0a2
	########################################
Chris PeBenito fbc0a2
	#
Chris PeBenito fbc0a2
	# Local policy
Chris PeBenito fbc0a2
	#
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	allow $1_games_t self:sem create_sem_perms;
Chris PeBenito fbc0a2
	allow $1_games_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito fbc0a2
	allow $1_games_t self:udp_socket create_socket_perms;
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_tmpfs_t:dir rw_dir_perms;
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_tmpfs_t:file manage_file_perms;
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_tmpfs_t:lnk_file create_lnk_perms;
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_tmpfs_t:sock_file manage_file_perms;
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_tmpfs_t:fifo_file manage_file_perms;
Chris PeBenito fbc0a2
	fs_tmpfs_filetrans($1_games_t,$1_games_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_tmp_t:dir manage_dir_perms;
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_tmp_t:file manage_file_perms;
Chris PeBenito fbc0a2
	files_tmp_filetrans($1_games_t, $1_games_tmp_t, { file dir })
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	allow $1_games_t $1_games_devpts_t:chr_file { rw_file_perms setattr };
Chris PeBenito fbc0a2
	term_create_pty($1_games_t,$1_games_devpts_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	allow $1_games_t games_data_t:dir rw_dir_perms;
Chris PeBenito fbc0a2
	allow $1_games_t games_data_t:file manage_file_perms;
Chris PeBenito fbc0a2
	allow $1_games_t games_data_t:lnk_file create_lnk_perms;
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	can_exec($1_games_t, games_exec_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	allow $2 $1_games_t:unix_stream_socket connectto;
Chris PeBenito fbc0a2
	allow $1_games_t $2:unix_stream_socket connectto;
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	kernel_read_system_state($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	corecmd_exec_bin($1_games_t)
Chris PeBenito fbc0a2
	corecmd_exec_sbin($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito c0d8c4
	corenet_non_ipsec_sendrecv($1_games_t)
Chris PeBenito fbc0a2
	corenet_tcp_sendrecv_generic_if($1_games_t)
Chris PeBenito fbc0a2
	corenet_udp_sendrecv_generic_if($1_games_t)
Chris PeBenito fbc0a2
	corenet_tcp_sendrecv_all_nodes($1_games_t)
Chris PeBenito fbc0a2
	corenet_udp_sendrecv_all_nodes($1_games_t)
Chris PeBenito fbc0a2
	corenet_tcp_sendrecv_all_ports($1_games_t)
Chris PeBenito fbc0a2
	corenet_udp_sendrecv_all_ports($1_games_t)
Chris PeBenito fbc0a2
	corenet_tcp_bind_all_nodes($1_games_t)
Chris PeBenito fbc0a2
	corenet_tcp_bind_generic_port($1_games_t)
Chris PeBenito fbc0a2
	corenet_tcp_connect_generic_port($1_games_t)
Chris PeBenito c0d8c4
	corenet_sendrecv_generic_client_packets($1_games_t)
Chris PeBenito c0d8c4
	corenet_sendrecv_generic_server_packets($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	dev_read_sound($1_games_t)
Chris PeBenito fbc0a2
	dev_write_sound($1_games_t)
Chris PeBenito fbc0a2
	dev_read_input($1_games_t)
Chris PeBenito fbc0a2
	dev_read_mouse($1_games_t)
Chris PeBenito fbc0a2
	dev_read_urand($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	files_list_var($1_games_t)
Chris PeBenito fbc0a2
	files_search_var_lib($1_games_t)
Chris PeBenito fbc0a2
	files_dontaudit_search_var($1_games_t)
Chris PeBenito fbc0a2
	files_read_etc_files($1_games_t)
Chris PeBenito fbc0a2
	files_read_usr_files($1_games_t)
Chris PeBenito fbc0a2
	files_read_var_files($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	init_dontaudit_rw_utmp($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	logging_dontaudit_search_logs($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	libs_use_shared_libs($1_games_t)
Chris PeBenito fbc0a2
	libs_use_ld_so($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	miscfiles_read_man_pages($1_games_t)
Chris PeBenito fbc0a2
	miscfiles_read_localization($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	sysnet_read_config($1_games_t)
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	userdom_manage_user_tmp_dirs($1,$1_games_t)
Chris PeBenito fbc0a2
	userdom_manage_user_tmp_files($1,$1_games_t)
Chris PeBenito fbc0a2
	userdom_manage_user_tmp_symlinks($1,$1_games_t)
Chris PeBenito fbc0a2
	userdom_manage_user_tmp_sockets($1,$1_games_t)
Chris PeBenito fbc0a2
	# Suppress .icons denial until properly implemented
Chris PeBenito fbc0a2
	userdom_dontaudit_read_user_home_content_files($1,$1_games_t)
Chris PeBenito fbc0a2
	
Chris PeBenito fbc0a2
	# Type transition
Chris PeBenito fbc0a2
	tunable_policy(`!disable_games_trans',`
Chris PeBenito fbc0a2
		domain_auto_trans($2, games_exec_t, $1_games_t)
Chris PeBenito fbc0a2
	')
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	tunable_policy(`allow_execmem',`
Chris PeBenito fbc0a2
		allow $1_games_t self:process execmem;
Chris PeBenito fbc0a2
	')
Chris PeBenito fbc0a2
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito fbc0a2
		nscd_socket_use($1_games_t)
Chris PeBenito fbc0a2
	')
Chris PeBenito fbc0a2
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito fbc0a2
		xserver_user_client_template($1,$1_games_t,$1_games_tmpfs_t)
Chris PeBenito fbc0a2
		xserver_create_xdm_tmp_sockets($1_games_t)
Chris PeBenito fbc0a2
		xserver_read_xdm_lib_files($1_games_t)
Chris PeBenito fbc0a2
	')
Chris PeBenito fbc0a2
Chris PeBenito fbc0a2
	ifdef(`TODO',`
Chris PeBenito fbc0a2
		gnome_application($1_games, $1)
Chris PeBenito fbc0a2
		gnome_file_dialog($1_games, $1)
Chris PeBenito fbc0a2
		# Access /home/user/.gnome2
Chris PeBenito fbc0a2
		# FIXME: Change to use per app types
Chris PeBenito fbc0a2
		allow $1_games_t $1_gnome_settings_t:dir create_dir_perms;
Chris PeBenito fbc0a2
		allow $1_games_t $1_gnome_settings_t:file create_file_perms;
Chris PeBenito fbc0a2
		allow $1_games_t $1_gnome_settings_t:lnk_file create_lnk_perms;
Chris PeBenito fbc0a2
		#missing policy
Chris PeBenito bb7170
		optional_policy(`
Chris PeBenito fbc0a2
			dontaudit $1_games_t $1_mozilla_t:unix_stream_socket connectto;
Chris PeBenito fbc0a2
		')
Chris PeBenito fbc0a2
	')
Chris PeBenito fbc0a2
')