Chris PeBenito eb4216
## <summary>QEMU machine emulator and virtualizer</summary>
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Execute a domain transition to run qemu.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Domain allowed to transition.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`qemu_domtrans',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type qemu_t, qemu_exec_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	domtrans_pattern($1, qemu_exec_t, qemu_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Execute qemu in the qemu domain.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
## <param name="role">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	The role to allow the qemu domain.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`qemu_run',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type qemu_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	qemu_domtrans($1)
Chris PeBenito eb4216
	role $2 types qemu_t;
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Allow the domain to read state files in /proc.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain to allow access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`qemu_read_state',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type qemu_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	read_files_pattern($1, qemu_t, qemu_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Send a signal to qemu.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`qemu_signal',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type qemu_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	allow $1 qemu_t:process signal;
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Send a sigill to qemu
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`qemu_kill',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type qemu_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	allow $1 qemu_t:process sigkill;
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Execute a domain transition to run qemu unconfined.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Domain allowed to transition.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`qemu_domtrans_unconfined',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type qemu_unconfined_t, qemu_exec_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	domtrans_pattern($1, qemu_exec_t, qemu_unconfined_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Creates types and rules for a basic
Chris PeBenito eb4216
##	qemu process domain.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="prefix">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Prefix for the domain.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
template(`qemu_domain_template',`
Chris PeBenito eb4216
Chris PeBenito eb4216
	##############################
Chris PeBenito eb4216
	#
Chris PeBenito eb4216
	# Local Policy
Chris PeBenito eb4216
	#
Chris PeBenito eb4216
Chris PeBenito eb4216
	type $1_t;
Chris PeBenito eb4216
	domain_type($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	type $1_tmp_t;
Chris PeBenito eb4216
	files_tmp_file($1_tmp_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	##############################
Chris PeBenito eb4216
	#
Chris PeBenito eb4216
	# Local Policy
Chris PeBenito eb4216
	#
Chris PeBenito eb4216
Chris PeBenito eb4216
	allow $1_t self:capability { dac_read_search dac_override };
Chris PeBenito eb4216
	allow $1_t self:process { execstack execmem signal getsched };
Chris PeBenito eb4216
	allow $1_t self:fifo_file rw_file_perms;
Chris PeBenito eb4216
	allow $1_t self:shm create_shm_perms;
Chris PeBenito eb4216
	allow $1_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito eb4216
	allow $1_t self:tcp_socket create_stream_socket_perms;
Paul Moore 9dc3cd
	allow $1_t self:tun_socket create;
Chris PeBenito eb4216
Chris PeBenito eb4216
	manage_dirs_pattern($1_t, $1_tmp_t, $1_tmp_t)
Chris PeBenito eb4216
	manage_files_pattern($1_t, $1_tmp_t, $1_tmp_t)
Chris PeBenito eb4216
	files_tmp_filetrans($1_t, $1_tmp_t, { file dir })
Chris PeBenito eb4216
Chris PeBenito eb4216
	kernel_read_system_state($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	corenet_all_recvfrom_unlabeled($1_t)
Chris PeBenito eb4216
	corenet_all_recvfrom_netlabel($1_t)
Chris PeBenito 668b30
	corenet_tcp_sendrecv_generic_if($1_t)
Chris PeBenito c12621
	corenet_tcp_sendrecv_generic_node($1_t)
Chris PeBenito eb4216
	corenet_tcp_sendrecv_all_ports($1_t)
Chris PeBenito c12621
	corenet_tcp_bind_generic_node($1_t)
Chris PeBenito eb4216
	corenet_tcp_bind_vnc_port($1_t)
Chris PeBenito eb4216
	corenet_rw_tun_tap_dev($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
#	dev_rw_kvm($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	domain_use_interactive_fds($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	files_read_etc_files($1_t)
Chris PeBenito eb4216
	files_read_usr_files($1_t)
Chris PeBenito eb4216
	files_read_var_files($1_t)
Chris PeBenito eb4216
	files_search_all($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	fs_list_inotifyfs($1_t)
Chris PeBenito eb4216
	fs_rw_anon_inodefs_files($1_t)
Chris PeBenito eb4216
	fs_rw_tmpfs_files($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	storage_raw_write_removable_device($1_t)
Chris PeBenito eb4216
	storage_raw_read_removable_device($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	term_use_ptmx($1_t)
Chris PeBenito eb4216
	term_getattr_pty_fs($1_t)
Chris PeBenito eb4216
	term_use_generic_ptys($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	miscfiles_read_localization($1_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	sysnet_read_config($1_t)
Chris PeBenito eb4216
Chris PeBenito 296273
	userdom_use_user_terminals($1_t)
Paul Moore 9dc3cd
	userdom_attach_admin_tun_iface($1_t)
Chris PeBenito 296273
Chris PeBenito 0c8917
	optional_policy(`
Chris PeBenito 0c8917
		samba_domtrans_smbd($1_t)
Chris PeBenito 0c8917
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	optional_policy(`
Chris PeBenito eb4216
		virt_manage_images($1_t)
Chris PeBenito eb4216
		virt_read_config($1_t)
Chris PeBenito eb4216
		virt_read_lib_files($1_t)
Paul Moore 9dc3cd
		virt_attach_tun_iface($1_t)
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	optional_policy(`
Chris PeBenito 296273
		xserver_stream_connect($1_t)
Chris PeBenito eb4216
		xserver_read_xdm_tmp_files($1_t)
Chris PeBenito eb4216
		xserver_read_xdm_pid($1_t)
Chris PeBenito eb4216
#		xserver_xdm_rw_shm($1_t)
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
')