## QEMU machine emulator and virtualizer ######################################## ## ## Creates types and rules for a basic ## qemu process domain. ## ## ## ## Prefix for the domain. ## ## # template(`qemu_domain_template',` ############################## # # Local Policy # type $1_t; domain_type($1_t) type $1_tmp_t; files_tmp_file($1_tmp_t) type $1_tmpfs_t; files_tmpfs_file($1_tmpfs_t) ############################## # # Local Policy # allow $1_t self:capability { dac_read_search }; allow $1_t self:process { execstack execmem signal getsched }; allow $1_t self:fifo_file rw_file_perms; allow $1_t self:shm create_shm_perms; allow $1_t self:unix_stream_socket create_stream_socket_perms; allow $1_t self:tcp_socket create_stream_socket_perms; allow $1_t self:tun_socket create; manage_dirs_pattern($1_t, $1_tmp_t, $1_tmp_t) manage_files_pattern($1_t, $1_tmp_t, $1_tmp_t) files_tmp_filetrans($1_t, $1_tmp_t, { file dir }) manage_dirs_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t) manage_files_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t) fs_tmpfs_filetrans($1_t, $1_tmpfs_t, { file dir }) kernel_read_system_state($1_t) corenet_all_recvfrom_netlabel($1_t) corenet_tcp_sendrecv_generic_if($1_t) corenet_tcp_sendrecv_generic_node($1_t) corenet_tcp_sendrecv_all_ports($1_t) corenet_tcp_bind_generic_node($1_t) corenet_tcp_bind_vnc_port($1_t) corenet_rw_tun_tap_dev($1_t) # dev_rw_kvm($1_t) domain_use_interactive_fds($1_t) files_read_etc_files($1_t) files_read_usr_files($1_t) files_read_var_files($1_t) files_search_all($1_t) storage_raw_write_removable_device($1_t) storage_raw_read_removable_device($1_t) term_use_ptmx($1_t) term_getattr_pty_fs($1_t) term_use_generic_ptys($1_t) sysnet_read_config($1_t) userdom_use_inherited_user_terminals($1_t) userdom_attach_admin_tun_iface($1_t) optional_policy(` samba_domtrans_smbd($1_t) ') optional_policy(` virt_manage_images($1_t) virt_read_config($1_t) virt_read_lib_files($1_t) virt_attach_tun_iface($1_t) ') optional_policy(` xserver_stream_connect($1_t) xserver_read_xdm_tmp_files($1_t) xserver_read_xdm_pid($1_t) # xserver_xdm_rw_shm($1_t) ') ') ######################################## ## ## Execute a domain transition to run qemu. ## ## ## ## Domain allowed to transition. ## ## # interface(`qemu_domtrans',` gen_require(` type qemu_t, qemu_exec_t; ') domtrans_pattern($1, qemu_exec_t, qemu_t) ') ######################################## ## ## Execute a qemu in the callers domain ## ## ## ## Domain allowed access. ## ## # interface(`qemu_exec',` gen_require(` type qemu_exec_t; ') can_exec($1, qemu_exec_t) ') ######################################## ## ## Execute qemu in the qemu domain. ## ## ## ## Domain allowed to transition. ## ## ## ## ## The role to allow the qemu domain. ## ## ## # interface(`qemu_run',` gen_require(` type qemu_t; ') qemu_domtrans($1) role $2 types qemu_t; allow qemu_t $1:process signull; allow $1 qemu_t:process signull; ') ######################################## ## ## Allow the domain to read state files in /proc. ## ## ## ## Domain to allow access. ## ## # interface(`qemu_read_state',` gen_require(` type qemu_t; ') read_files_pattern($1, qemu_t, qemu_t) ') ######################################## ## ## Set the schedule on qemu. ## ## ## ## Domain allowed access. ## ## # interface(`qemu_setsched',` gen_require(` type qemu_t; ') allow $1 qemu_t:process setsched; ') ######################################## ## ## Send a signal to qemu. ## ## ## ## Domain allowed access. ## ## # interface(`qemu_signal',` gen_require(` type qemu_t; ') allow $1 qemu_t:process signal; ') ######################################## ## ## Send a sigill to qemu ## ## ## ## Domain allowed access. ## ## # interface(`qemu_kill',` gen_require(` type qemu_t; ') allow $1 qemu_t:process sigkill; ') ######################################## ## ## Execute qemu_exec_t ## in the specified domain but do not ## do it automatically. This is an explicit ## transition, requiring the caller to use setexeccon(). ## ## ##

## Execute qemu_exec_t ## in the specified domain. This allows ## the specified domain to qemu programs ## on these filesystems in the specified ## domain. ##

##
## ## ## Domain allowed access. ## ## ## ## ## The type of the new process. ## ## # interface(`qemu_spec_domtrans',` gen_require(` type qemu_exec_t; ') read_lnk_files_pattern($1, qemu_exec_t, qemu_exec_t) domain_transition_pattern($1, qemu_exec_t, $2) domain_entry_file($2,qemu_exec_t) can_exec($1,qemu_exec_t) allow $2 $1:fd use; allow $2 $1:fifo_file rw_fifo_file_perms; allow $2 $1:process sigchld; ') ######################################## ## ## Execute qemu unconfined programs in the role. ## ## ## ## The role to allow the qemu unconfined domain. ## ## # interface(`qemu_unconfined_role',` gen_require(` type unconfined_qemu_t; type qemu_t; ') role $1 types unconfined_qemu_t; role $1 types qemu_t; ') ######################################## ## ## Manage qemu temporary dirs. ## ## ## ## Domain allowed access. ## ## # interface(`qemu_manage_tmp_dirs',` gen_require(` type qemu_tmp_t; ') manage_dirs_pattern($1, qemu_tmp_t, qemu_tmp_t) ') ######################################## ## ## Manage qemu temporary files. ## ## ## ## Domain allowed access. ## ## # interface(`qemu_manage_tmp_files',` gen_require(` type qemu_tmp_t; ') manage_files_pattern($1, qemu_tmp_t, qemu_tmp_t) ') ######################################## ## ## Make qemu_exec_t an entrypoint for ## the specified domain. ## ## ## ## The domain for which qemu_exec_t is an entrypoint. ## ## # interface(`qemu_entry_type',` gen_require(` type qemu_exec_t; ') domain_entry_file($1, qemu_exec_t) ') ####################################### ## ## Getattr on qemu executable. ## ## ## ## Domain allowed to transition. ## ## # interface(`qemu_getattr_exec',` gen_require(` type qemu_exec_t; ') allow $1 qemu_exec_t:file getattr; ')