|
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 |
## <param name="terminal">
|
|
Chris PeBenito |
eb4216 |
## <summary>
|
|
Chris PeBenito |
eb4216 |
## The type of the terminal allow the qemu domain to use.
|
|
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 |
allow qemu_t $3:chr_file rw_file_perms;
|
|
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;
|
|
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 |
eb4216 |
corenet_tcp_sendrecv_all_if($1_t)
|
|
Chris PeBenito |
eb4216 |
corenet_tcp_sendrecv_all_nodes($1_t)
|
|
Chris PeBenito |
eb4216 |
corenet_tcp_sendrecv_all_ports($1_t)
|
|
Chris PeBenito |
eb4216 |
corenet_tcp_bind_all_nodes($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 |
libs_use_ld_so($1_t)
|
|
Chris PeBenito |
eb4216 |
libs_use_shared_libs($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 |
eb4216 |
# optional_policy(`
|
|
Chris PeBenito |
eb4216 |
# samba_domtrans_smb($1_t)
|
|
Chris PeBenito |
eb4216 |
# ')
|
|
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)
|
|
Chris PeBenito |
eb4216 |
')
|
|
Chris PeBenito |
eb4216 |
|
|
Chris PeBenito |
eb4216 |
optional_policy(`
|
|
Chris PeBenito |
eb4216 |
xserver_stream_connect_xdm_xserver($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 |
')
|