Chris PeBenito 5b6ddb9
## <summary>Policy for UML</summary>
Chris PeBenito 2a98379
Chris PeBenito 5b6ddb9
#######################################
Chris PeBenito 5b6ddb9
## <summary>
Chris PeBenito bbcd3c9
##	The per role template for the uml module.
Chris PeBenito 5b6ddb9
## </summary>
Chris PeBenito 5b6ddb9
## <desc>
Chris PeBenito 5b6ddb9
##	

Chris PeBenito 5b6ddb9
##	This template creates a derived domains which are used
Chris PeBenito 5b6ddb9
##	for uml program.
Chris PeBenito 5b6ddb9
##	

Chris PeBenito 5b6ddb9
##	

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

Chris PeBenito 5b6ddb9
## </desc>
Chris PeBenito 5b6ddb9
## <param name="userdomain_prefix">
Chris PeBenito 5b6ddb9
##	<summary>
Chris PeBenito 5b6ddb9
##	The prefix of the user domain (e.g., user
Chris PeBenito 5b6ddb9
##	is the prefix for user_t).
Chris PeBenito 5b6ddb9
##	</summary>
Chris PeBenito 5b6ddb9
## </param>
Chris PeBenito 5b6ddb9
## <param name="user_domain">
Chris PeBenito 5b6ddb9
##	<summary>
Chris PeBenito 5b6ddb9
##	The type of the user domain.
Chris PeBenito 5b6ddb9
##	</summary>
Chris PeBenito 5b6ddb9
## </param>
Chris PeBenito 5b6ddb9
## <param name="user_role">
Chris PeBenito 5b6ddb9
##	<summary>
Chris PeBenito 5b6ddb9
##	The role associated with the user domain.
Chris PeBenito 5b6ddb9
##	</summary>
Chris PeBenito 5b6ddb9
## </param>
Chris PeBenito 5b6ddb9
#
Chris PeBenito bbcd3c9
template(`uml_per_role_template',`
Chris PeBenito 6b19be3
	gen_require(`
Chris PeBenito 6b19be3
		type uml_ro_t, uml_exec_t;
Chris PeBenito 6b19be3
	')
Chris PeBenito 6b19be3
Chris PeBenito 5b6ddb9
	########################################
Chris PeBenito 5b6ddb9
	#
Chris PeBenito 5b6ddb9
	# Declarations
Chris PeBenito 5b6ddb9
	#
Chris PeBenito d139413
Chris PeBenito 5b6ddb9
	type $1_uml_t;
Chris PeBenito 5b6ddb9
	type $1_uml_exec_t;
Chris PeBenito 0bfccda
	application_domain($1_uml_t, $1_uml_exec_t)
Chris PeBenito d46cfe4
	role $3 types $1_uml_t;
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	type $1_uml_ro_t;
Chris PeBenito 5b6ddb9
	files_type($1_uml_ro_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	type $1_uml_rw_t;
Chris PeBenito 5b6ddb9
	files_type($1_uml_rw_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	type $1_uml_tmp_t;
Chris PeBenito 5b6ddb9
	files_tmp_file($1_uml_tmp_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	type $1_uml_tmpfs_t;
Chris PeBenito 5b6ddb9
	files_tmpfs_file($1_uml_tmpfs_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	type $1_uml_devpts_t;
Chris PeBenito 5b6ddb9
	term_pty($1_uml_devpts_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	########################################
Chris PeBenito 5b6ddb9
	#
Chris PeBenito 5b6ddb9
	# Local policy
Chris PeBenito 5b6ddb9
	#
Chris PeBenito c0868a7
Chris PeBenito c0868a7
	allow $1_uml_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito c0d8c41
	allow $1_uml_t self:process { signal_perms ptrace };
Chris PeBenito 5b6ddb9
	allow $1_uml_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 5b6ddb9
	allow $1_uml_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 5b6ddb9
	# Use the network.
Chris PeBenito 5b6ddb9
	allow $1_uml_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 5b6ddb9
	allow $1_uml_t self:udp_socket create_socket_perms;
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	allow $1_uml_t $2:process sigchld;
Chris PeBenito 5b6ddb9
	allow $1_uml_t $2:fifo_file { ioctl read write getattr lock append };
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# allow the UML thing to happen
Chris PeBenito 5b6ddb9
	allow $1_uml_t $1_uml_devpts_t:chr_file { rw_file_perms setattr };
Chris PeBenito 5b6ddb9
	term_create_pty($1_uml_t,$1_uml_devpts_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 0bfccda
	manage_dirs_pattern($1_uml_t, $1_uml_tmp_t, $1_uml_tmp_t)
Chris PeBenito 0bfccda
	manage_files_pattern($1_uml_t, $1_uml_tmp_t, $1_uml_tmp_t)
Chris PeBenito 103fe28
	files_tmp_filetrans($1_uml_t, $1_uml_tmp_t, { file dir })
Chris PeBenito 5b6ddb9
	can_exec($1_uml_t, $1_uml_tmp_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 0bfccda
	manage_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
Chris PeBenito 0bfccda
	manage_fifo_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
Chris PeBenito 0bfccda
	manage_sock_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
Chris PeBenito 0bfccda
	fs_tmpfs_filetrans($1_uml_t, $1_uml_tmpfs_t, { file lnk_file sock_file fifo_file })
Chris PeBenito 5b6ddb9
	can_exec($1_uml_t, $1_uml_tmpfs_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# access config files
Chris PeBenito c0868a7
	allow $1_uml_t { $1_uml_ro_t uml_ro_t }:dir list_dir_perms;
Chris PeBenito 0bfccda
	read_files_pattern($1_uml_t, { $1_uml_ro_t uml_ro_t }, { $1_uml_ro_t uml_ro_t })
Chris PeBenito 0bfccda
	read_lnk_files_pattern($1_uml_t, { $1_uml_ro_t uml_ro_t }, { $1_uml_ro_t uml_ro_t })
Chris PeBenito c0868a7
Chris PeBenito 0bfccda
	manage_dirs_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
Chris PeBenito 0bfccda
	manage_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
Chris PeBenito 0bfccda
	manage_fifo_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
Chris PeBenito 0bfccda
	manage_sock_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
Chris PeBenito 0bfccda
	userdom_user_home_dir_filetrans($1, $1_uml_t, $1_uml_rw_t, { file lnk_file sock_file fifo_file })
Chris PeBenito 5b6ddb9
Chris PeBenito c0868a7
	allow $2 uml_ro_t:dir list_dir_perms;
Chris PeBenito 0bfccda
	read_files_pattern($2,uml_ro_t, uml_ro_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($2,uml_ro_t, uml_ro_t)
Chris PeBenito 0bfccda
Chris PeBenito 0bfccda
	manage_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	manage_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	manage_fifo_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	manage_sock_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	relabel_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	relabel_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	relabel_lnk_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	relabel_fifo_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
	relabel_sock_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
Chris PeBenito 0bfccda
Chris PeBenito 0bfccda
	manage_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
Chris PeBenito 0bfccda
	manage_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
Chris PeBenito 0bfccda
	relabel_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
Chris PeBenito 0bfccda
	relabel_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# allow ps, ptrace, signal
Chris PeBenito c0868a7
	ps_process_pattern($2,$1_uml_t)
Chris PeBenito c0868a7
	allow $2 $1_uml_t:process { ptrace signal_perms };
Chris PeBenito 5b6ddb9
Chris PeBenito 0bfccda
	manage_dirs_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
Chris PeBenito 0bfccda
	manage_files_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
Chris PeBenito 0bfccda
	manage_sock_files_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# Transition from the user domain to this domain.
Chris PeBenito 5b6ddb9
	domain_auto_trans($2, { uml_exec_t $1_uml_exec_t }, $1_uml_t)
Chris PeBenito 5b6ddb9
	can_exec($1_uml_t, { uml_exec_t $1_uml_exec_t })
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# for mconsole
Chris PeBenito 5b6ddb9
	allow { $2 $1_uml_t } $1_uml_t:unix_dgram_socket sendto;
Chris PeBenito 5b6ddb9
	allow $1_uml_t $2:unix_dgram_socket sendto;
Chris PeBenito 2a98379
Chris PeBenito 5b6ddb9
	kernel_read_system_state($1_uml_t)
Chris PeBenito 5b6ddb9
	# for SKAS - need something better
Chris PeBenito 5b6ddb9
	kernel_write_proc_files($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# for xterm
Chris PeBenito 5b6ddb9
	corecmd_exec_bin($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 1900668
	corenet_all_recvfrom_unlabeled($1_uml_t)
Chris PeBenito 1900668
	corenet_all_recvfrom_netlabel($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_tcp_sendrecv_generic_if($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_udp_sendrecv_generic_if($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_tcp_sendrecv_all_nodes($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_udp_sendrecv_all_nodes($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_tcp_sendrecv_all_ports($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_udp_sendrecv_all_ports($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_tcp_connect_all_ports($1_uml_t)
Chris PeBenito c0d8c41
	corenet_sendrecv_all_client_packets($1_uml_t)
Chris PeBenito 5b6ddb9
	corenet_rw_tun_tap_dev($1_uml_t)
Chris PeBenito 2a98379
Chris PeBenito 15722ec
	domain_use_interactive_fds($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# for xterm
Chris PeBenito 5b6ddb9
	files_read_etc_files($1_uml_t)
Chris PeBenito 5b6ddb9
	files_dontaudit_read_etc_runtime_files($1_uml_t)
Chris PeBenito 5b6ddb9
	# putting uml data under /var is usual...
Chris PeBenito 5b6ddb9
	files_search_var($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	fs_getattr_xattr_fs($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	init_read_utmp($1_uml_t)
Chris PeBenito 5b6ddb9
	init_dontaudit_write_utmp($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# for xterm
Chris PeBenito 5b6ddb9
	libs_exec_lib_files($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# Inherit and use descriptors from newrole.
Chris PeBenito 15722ec
	seutil_use_newrole_fds($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	# Use the network.
Chris PeBenito 5b6ddb9
	sysnet_read_config($1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito 0bfccda
	userdom_use_user_terminals($1, $1_uml_t)
Chris PeBenito 5b6ddb9
Chris PeBenito bb7170f
	optional_policy(`
Chris PeBenito 5b6ddb9
		nis_use_ypbind($1_uml_t)
Chris PeBenito 5b6ddb9
	')
Chris PeBenito 5b6ddb9
')
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
########################################
Chris PeBenito 5b6ddb9
## <summary>
Chris PeBenito 5b6ddb9
##	Set attributes on uml utility socket files.
Chris PeBenito 5b6ddb9
## </summary>
Chris PeBenito 5b6ddb9
## <param name="domain">
Chris PeBenito 5b6ddb9
##	<summary>
Chris PeBenito 5b6ddb9
##	Domain allowed access.
Chris PeBenito 5b6ddb9
##	</summary>
Chris PeBenito 5b6ddb9
## </param>
Chris PeBenito 5b6ddb9
#
Chris PeBenito 5b6ddb9
interface(`uml_setattr_util_sockets',`
Chris PeBenito 5b6ddb9
	gen_require(`
Chris PeBenito 5b6ddb9
		type uml_switch_var_run_t;
Chris PeBenito 5b6ddb9
	')
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
	allow $1 uml_switch_var_run_t:sock_file setattr;
Chris PeBenito 5b6ddb9
')
Chris PeBenito 5b6ddb9
Chris PeBenito 5b6ddb9
########################################
Chris PeBenito 5b6ddb9
## <summary>
Chris PeBenito 5b6ddb9
##	Manage uml utility files.
Chris PeBenito 5b6ddb9
## </summary>
Chris PeBenito 5b6ddb9
## <param name="domain">
Chris PeBenito 5b6ddb9
##	<summary>
Chris PeBenito 5b6ddb9
##	Domain allowed access.
Chris PeBenito 5b6ddb9
##	</summary>
Chris PeBenito 5b6ddb9
## </param>
Chris PeBenito 5b6ddb9
#
Chris PeBenito 5b6ddb9
interface(`uml_manage_util_files',`
Chris PeBenito 5b6ddb9
	gen_require(`
Chris PeBenito 5b6ddb9
		type uml_switch_var_run_t;
Chris PeBenito 5b6ddb9
	')
Chris PeBenito 5b6ddb9
Chris PeBenito 0bfccda
	manage_files_pattern($1, uml_switch_var_run_t, uml_switch_var_run_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1, uml_switch_var_run_t, uml_switch_var_run_t)
Chris PeBenito 5b6ddb9
')