Chris PeBenito a6a638
## <summary>VMWare Workstation virtual machines</summary>
Chris PeBenito a6a638
Chris PeBenito 677de4
#######################################
Chris PeBenito 677de4
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the vmware module.
Chris PeBenito 677de4
## </summary>
Chris PeBenito 677de4
## <desc>
Chris PeBenito 677de4
##	

Chris PeBenito 03d797
##	This template creates a derived domain which is used
Chris PeBenito 677de4
##	for vmware sessions.
Chris PeBenito 677de4
##	

Chris PeBenito 677de4
##	

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

Chris PeBenito 677de4
## </desc>
Chris PeBenito 677de4
## <param name="userdomain_prefix">
Chris PeBenito 677de4
##	<summary>
Chris PeBenito 677de4
##	The prefix of the user domain (e.g., user
Chris PeBenito 677de4
##	is the prefix for user_t).
Chris PeBenito 677de4
##	</summary>
Chris PeBenito 677de4
## </param>
Chris PeBenito 677de4
## <param name="user_domain">
Chris PeBenito 677de4
##	<summary>
Chris PeBenito 677de4
##	The type of the user domain.
Chris PeBenito 677de4
##	</summary>
Chris PeBenito 677de4
## </param>
Chris PeBenito 677de4
## <param name="user_role">
Chris PeBenito 677de4
##	<summary>
Chris PeBenito 677de4
##	The role associated with the user domain.
Chris PeBenito 677de4
##	</summary>
Chris PeBenito 677de4
## </param>
Chris PeBenito 677de4
#
Chris PeBenito bbcd3c
template(`vmware_per_role_template',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type vmware_exec_t, vmware_sys_conf_t;
Chris PeBenito 6b19be
	')
Chris PeBenito a6a638
Chris PeBenito a6a638
	##############################
Chris PeBenito a6a638
	#
Chris PeBenito a6a638
	# Declarations
Chris PeBenito a6a638
	#
Chris PeBenito a6a638
Chris PeBenito a6a638
	type $1_vmware_t;
Chris PeBenito a6a638
	domain_type($1_vmware_t)
Chris PeBenito a6a638
	domain_entry_file($1_vmware_t,vmware_exec_t)
Chris PeBenito a6a638
	role $3 types $1_vmware_t;
Chris PeBenito a6a638
Chris PeBenito a6a638
	type $1_vmware_conf_t;
Chris PeBenito a6a638
	userdom_user_home_content($1,$1_vmware_conf_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	type $1_vmware_file_t;
Chris PeBenito a6a638
	userdom_user_home_content($1,$1_vmware_file_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	type $1_vmware_tmp_t;
Chris PeBenito a6a638
	files_tmp_file($1_vmware_tmp_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	type $1_vmware_tmpfs_t;
Chris PeBenito a6a638
	files_tmpfs_file($1_vmware_tmpfs_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	type $1_vmware_var_run_t;
Chris PeBenito a6a638
	files_pid_file($1_vmware_var_run_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	##############################
Chris PeBenito a6a638
	#
Chris PeBenito a6a638
	# Local policy
Chris PeBenito a6a638
	#
Chris PeBenito a6a638
Chris PeBenito 03d797
	allow $1_vmware_t self:capability { dac_override setgid sys_nice sys_resource setuid sys_admin sys_rawio chown };
Chris PeBenito 03d797
	dontaudit $1_vmware_t self:capability sys_tty_config;
Chris PeBenito a6a638
	allow $1_vmware_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 03d797
	allow $1_vmware_t self:process { execmem execstack };
Chris PeBenito a6a638
	allow $1_vmware_t self:fd use;
Chris PeBenito c0868a
	allow $1_vmware_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito a6a638
	allow $1_vmware_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito a6a638
	allow $1_vmware_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito a6a638
	allow $1_vmware_t self:unix_dgram_socket sendto;
Chris PeBenito a6a638
	allow $1_vmware_t self:unix_stream_socket connectto;
Chris PeBenito a6a638
	allow $1_vmware_t self:shm create_shm_perms;
Chris PeBenito a6a638
	allow $1_vmware_t self:sem create_sem_perms;
Chris PeBenito a6a638
	allow $1_vmware_t self:msgq create_msgq_perms;
Chris PeBenito a6a638
	allow $1_vmware_t self:msg { send receive };
Chris PeBenito a6a638
Chris PeBenito a6a638
	can_exec($1_vmware_t, vmware_exec_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	# User configuration files
Chris PeBenito a6a638
	allow $1_vmware_t $1_vmware_conf_t:file manage_file_perms;
Chris PeBenito a6a638
Chris PeBenito a6a638
	# VMWare disks
Chris PeBenito c0868a
	manage_files_pattern($1_vmware_t,$1_vmware_file_t,$1_vmware_file_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_vmware_t,$1_vmware_file_t,$1_vmware_file_t)
Chris PeBenito a6a638
Chris PeBenito c0868a
	allow $1_vmware_t $1_vmware_tmp_t:file execute;
Chris PeBenito c0868a
	manage_dirs_pattern($1_vmware_t,$1_vmware_tmp_t,$1_vmware_tmp_t)
Chris PeBenito c0868a
	manage_files_pattern($1_vmware_t,$1_vmware_tmp_t,$1_vmware_tmp_t)
Chris PeBenito c0868a
	manage_sock_files_pattern($1_vmware_t,$1_vmware_tmp_t,$1_vmware_tmp_t)
Chris PeBenito a6a638
	files_tmp_filetrans($1_vmware_t, $1_vmware_tmp_t, { file dir })
Chris PeBenito a6a638
Chris PeBenito c0868a
	manage_files_pattern($1_vmware_t,$1_vmware_tmpfs_t,$1_vmware_tmpfs_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_vmware_t,$1_vmware_tmpfs_t,$1_vmware_tmpfs_t)
Chris PeBenito c0868a
	manage_fifo_files_pattern($1_vmware_t,$1_vmware_tmpfs_t,$1_vmware_tmpfs_t)
Chris PeBenito c0868a
	manage_sock_files_pattern($1_vmware_t,$1_vmware_tmpfs_t,$1_vmware_tmpfs_t)
Chris PeBenito a6a638
	fs_tmpfs_filetrans($1_vmware_t,$1_vmware_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito a6a638
Chris PeBenito a6a638
	# Read clobal configuration files
Chris PeBenito c0868a
	allow $1_vmware_t vmware_sys_conf_t:dir list_dir_perms;
Chris PeBenito c0868a
	read_files_pattern($1_vmware_t,vmware_sys_conf_t,vmware_sys_conf_t)
Chris PeBenito c0868a
	read_lnk_files_pattern($1_vmware_t,vmware_sys_conf_t,vmware_sys_conf_t)
Chris PeBenito c0868a
Chris PeBenito c0868a
	manage_dirs_pattern($1_vmware_t,$1_vmware_var_run_t,$1_vmware_var_run_t)
Chris PeBenito c0868a
	manage_files_pattern($1_vmware_t,$1_vmware_var_run_t,$1_vmware_var_run_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_vmware_t,$1_vmware_var_run_t,$1_vmware_var_run_t)
Chris PeBenito c0868a
	manage_sock_files_pattern($1_vmware_t,$1_vmware_var_run_t,$1_vmware_var_run_t)
Chris PeBenito 03d797
	files_pid_filetrans($1_vmware_t,$1_vmware_var_run_t,{ dir file lnk_file })
Chris PeBenito a6a638
Chris PeBenito c0868a
	domtrans_pattern($2, vmware_exec_t, $1_vmware_t)
Chris PeBenito c0868a
Chris PeBenito a6a638
	kernel_read_system_state($1_vmware_t)
Chris PeBenito a6a638
	kernel_read_network_state($1_vmware_t)
Chris PeBenito 03d797
	kernel_read_kernel_sysctls($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito 03d797
	# startup scripts
Chris PeBenito 03d797
	corecmd_exec_bin($1_vmware_t)
Chris PeBenito 03d797
	corecmd_exec_shell($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	dev_read_raw_memory($1_vmware_t)
Chris PeBenito a6a638
	dev_write_raw_memory($1_vmware_t)
Chris PeBenito a6a638
	dev_read_mouse($1_vmware_t)
Chris PeBenito a6a638
	dev_write_sound($1_vmware_t)
Chris PeBenito a6a638
	dev_read_realtime_clock($1_vmware_t)
Chris PeBenito 03d797
	dev_rwx_vmware($1_vmware_t)
Chris PeBenito 03d797
	dev_rw_usbfs($1_vmware_t)
Chris PeBenito 03d797
	dev_search_sysfs($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	domain_use_interactive_fds($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	files_read_etc_files($1_vmware_t)
Chris PeBenito a6a638
	files_read_etc_runtime_files($1_vmware_t)
Chris PeBenito 03d797
	files_read_usr_files($1_vmware_t)
Chris PeBenito f827eb
	files_list_home($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	fs_getattr_xattr_fs($1_vmware_t)
Chris PeBenito a6a638
	fs_search_auto_mountpoints($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	storage_raw_read_removable_device($1_vmware_t)
Chris PeBenito 03d797
	storage_raw_write_removable_device($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito a6a638
	libs_use_ld_so($1_vmware_t)
Chris PeBenito a6a638
	libs_use_shared_libs($1_vmware_t)
Chris PeBenito 03d797
	# startup scripts run ldd
Chris PeBenito 03d797
	libs_exec_ld_so($1_vmware_t)
Chris PeBenito a6a638
	# Access X11 config files
Chris PeBenito a6a638
	libs_read_lib_files($1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito 03d797
	miscfiles_read_localization($1_vmware_t)
Chris PeBenito 03d797
Chris PeBenito a6a638
	userdom_use_user_terminals($1,$1_vmware_t)
Chris PeBenito a6a638
	userdom_use_unpriv_users_fds($1_vmware_t)
Chris PeBenito f827eb
	userdom_list_user_home_dirs($1,$1_vmware_t)
Chris PeBenito a6a638
	# cjp: why?
Chris PeBenito a6a638
	userdom_read_user_home_content_files($1,$1_vmware_t)
Chris PeBenito a6a638
Chris PeBenito 03d797
	sysnet_dns_name_resolve($1_vmware_t)
Chris PeBenito 03d797
	sysnet_read_config($1_vmware_t)
Chris PeBenito 03d797
Chris PeBenito 2c12b4
	xserver_user_x_domain_template($1,$1_vmware,$1_vmware_t,$1_vmware_tmpfs_t)
Chris PeBenito a6a638
')
Chris PeBenito a6a638
Chris PeBenito a6a638
########################################
Chris PeBenito a6a638
## <summary>
Chris PeBenito a6a638
##	Read VMWare system configuration files.
Chris PeBenito a6a638
## </summary>
Chris PeBenito a6a638
## <param name="domain">
Chris PeBenito a6a638
##	<summary>
Chris PeBenito a6a638
##	Domain allowed access.
Chris PeBenito a6a638
##	</summary>
Chris PeBenito a6a638
## </param>
Chris PeBenito a6a638
#
Chris PeBenito a6a638
interface(`vmware_read_system_config',`
Chris PeBenito a6a638
	gen_require(`
Chris PeBenito a6a638
		type vmware_sys_conf_t;
Chris PeBenito a6a638
	')
Chris PeBenito a6a638
Chris PeBenito a6a638
	allow $1 vmware_sys_conf_t:file { getattr read };
Chris PeBenito a6a638
')
Chris PeBenito a6a638
Chris PeBenito a6a638
########################################
Chris PeBenito a6a638
## <summary>
Chris PeBenito a6a638
##	Append to VMWare system configuration files.
Chris PeBenito a6a638
## </summary>
Chris PeBenito a6a638
## <param name="domain">
Chris PeBenito a6a638
##	<summary>
Chris PeBenito a6a638
##	Domain allowed access.
Chris PeBenito a6a638
##	</summary>
Chris PeBenito a6a638
## </param>
Chris PeBenito a6a638
#
Chris PeBenito a6a638
interface(`vmware_append_system_config',`
Chris PeBenito a6a638
	gen_require(`
Chris PeBenito a6a638
		type vmware_sys_conf_t;
Chris PeBenito a6a638
	')
Chris PeBenito a6a638
Chris PeBenito a6a638
	allow $1 vmware_sys_conf_t:file append;
Chris PeBenito a6a638
')
Chris PeBenito a713ad
Chris PeBenito a713ad
########################################
Chris PeBenito a713ad
## <summary>
Chris PeBenito a713ad
##	Append to VMWare log files.
Chris PeBenito a713ad
## </summary>
Chris PeBenito a713ad
## <param name="domain">
Chris PeBenito a713ad
##	<summary>
Chris PeBenito a713ad
##	Domain allowed access.
Chris PeBenito a713ad
##	</summary>
Chris PeBenito a713ad
## </param>
Chris PeBenito a713ad
#
Chris PeBenito a713ad
interface(`vmware_append_log',`
Chris PeBenito a713ad
	gen_require(`
Chris PeBenito a713ad
		type vmware_log_t;
Chris PeBenito a713ad
	')
Chris PeBenito a713ad
Chris PeBenito a713ad
	logging_search_logs($1)
Chris PeBenito a713ad
	append_files_pattern($1, vmware_log_t, vmware_log_t)
Chris PeBenito a713ad
')