Chris PeBenito 29af4c
policy_module(virt, 1.4.0)
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
#
Chris PeBenito eb4216
# Declarations
Chris PeBenito eb4216
#
Dan Walsh 3eaa99
attribute virsh_transition_domain;
Chris PeBenito eb4216
Chris PeBenito eb4216
## <desc>
Chris PeBenito eb4216
## 

Chris PeBenito 3079cb
## Allow virt to use serial/parallell communication ports
Chris PeBenito 3079cb
## 

Chris PeBenito 3079cb
## </desc>
Chris PeBenito 3079cb
gen_tunable(virt_use_comm, false)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
## <desc>
Chris PeBenito 3079cb
## 

Chris PeBenito 763020
## Allow virt to read fuse files
Chris PeBenito 763020
## 

Chris PeBenito 763020
## </desc>
Chris PeBenito 763020
gen_tunable(virt_use_fusefs, false)
Chris PeBenito 763020
Chris PeBenito 763020
## <desc>
Chris PeBenito 763020
## 

Chris PeBenito eb4216
## Allow virt to manage nfs files
Chris PeBenito eb4216
## 

Chris PeBenito eb4216
## </desc>
Chris PeBenito eb4216
gen_tunable(virt_use_nfs, false)
Chris PeBenito eb4216
Chris PeBenito eb4216
## <desc>
Chris PeBenito eb4216
## 

Chris PeBenito eb4216
## Allow virt to manage cifs files
Chris PeBenito eb4216
## 

Chris PeBenito eb4216
## </desc>
Chris PeBenito eb4216
gen_tunable(virt_use_samba, false)
Chris PeBenito eb4216
Chris PeBenito 3079cb
## <desc>
Chris PeBenito 3079cb
## 

Chris PeBenito 3079cb
## Allow virt to manage device configuration, (pci)
Chris PeBenito 3079cb
## 

Chris PeBenito 3079cb
## </desc>
Chris PeBenito 3079cb
gen_tunable(virt_use_sysfs, false)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
## <desc>
Chris PeBenito 3079cb
## 

Dan Walsh a75a59
## Allow virtual machine to interact with the xserver
Dan Walsh a75a59
## 

Dan Walsh a75a59
## </desc>
Dan Walsh a75a59
gen_tunable(virt_use_xserver, false)
Dan Walsh a75a59
Dan Walsh a75a59
## <desc>
Dan Walsh a75a59
## 

Chris PeBenito 3079cb
## Allow virt to use usb devices
Chris PeBenito 3079cb
## 

Chris PeBenito 3079cb
## </desc>
Chris PeBenito 3079cb
gen_tunable(virt_use_usb, true)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
virt_domain_template(svirt)
Chris PeBenito 3079cb
role system_r types svirt_t;
Chris PeBenito 3079cb
Chris PeBenito 3079cb
attribute virt_domain;
Chris PeBenito fb4826
attribute virt_image_type;
Chris PeBenito fb4826
Dan Walsh 3eaa99
type virt_cache_t alias svirt_cache_t;
Dan Walsh 3eaa99
files_type(virt_cache_t)
Dan Walsh 3eaa99
Chris PeBenito eb4216
type virt_etc_t;
Chris PeBenito eb4216
files_config_file(virt_etc_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
type virt_etc_rw_t;
Chris PeBenito eb4216
files_type(virt_etc_rw_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
# virt Image files
Chris PeBenito 3079cb
type virt_image_t; # customizable
Chris PeBenito fb4826
virt_image(virt_image_t)
Dan Walsh 3eaa99
files_mountpoint(virt_image_t)
Chris PeBenito eb4216
Chris PeBenito 3079cb
# virt Image files
Chris PeBenito 3079cb
type virt_content_t; # customizable
Chris PeBenito 3079cb
virt_image(virt_content_t)
Chris PeBenito 3079cb
userdom_user_home_content(virt_content_t)
Chris PeBenito 3079cb
Dan Walsh 3eaa99
type virt_tmp_t;
Dan Walsh 3eaa99
files_tmp_file(virt_tmp_t)
Dan Walsh 3eaa99
Chris PeBenito eb4216
type virt_log_t;
Chris PeBenito eb4216
logging_log_file(virt_log_t)
Dan Walsh 3eaa99
mls_trusted_object(virt_log_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
type virt_var_run_t;
Chris PeBenito eb4216
files_pid_file(virt_var_run_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
type virt_var_lib_t;
Dan Walsh 3eaa99
files_mountpoint(virt_var_lib_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
type virtd_t;
Chris PeBenito eb4216
type virtd_exec_t;
Chris PeBenito eb4216
init_daemon_domain(virtd_t, virtd_exec_t)
Chris PeBenito 3079cb
domain_obj_id_change_exemption(virtd_t)
Chris PeBenito 3079cb
domain_subj_id_change_exemption(virtd_t)
Chris PeBenito eb4216
Chris PeBenito fb4826
type virtd_initrc_exec_t;
Chris PeBenito fb4826
init_script_file(virtd_initrc_exec_t)
Chris PeBenito fb4826
Dan Walsh 3eaa99
type qemu_var_run_t;
Dan Walsh 3eaa99
typealias qemu_var_run_t alias svirt_var_run_t;
Dan Walsh 3eaa99
files_pid_file(qemu_var_run_t)
Dan Walsh 3eaa99
mls_trusted_object(qemu_var_run_t)
Dan Walsh 3eaa99
Chris PeBenito 3079cb
ifdef(`enable_mcs',`
Chris PeBenito 763020
	init_ranged_daemon_domain(virtd_t, virtd_exec_t, s0 - mcs_systemhigh)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
ifdef(`enable_mls',`
Chris PeBenito 763020
	init_ranged_daemon_domain(virtd_t, virtd_exec_t, s0 - mls_systemhigh)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
########################################
Chris PeBenito 3079cb
#
Chris PeBenito 3079cb
# svirt local policy
Chris PeBenito 3079cb
#
Chris PeBenito 3079cb
Chris PeBenito 3079cb
allow svirt_t self:udp_socket create_socket_perms;
Chris PeBenito 3079cb
Chris PeBenito 3079cb
read_lnk_files_pattern(svirt_t, virt_image_t, virt_image_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
allow svirt_t svirt_image_t:dir search_dir_perms;
Chris PeBenito 3079cb
manage_dirs_pattern(svirt_t, svirt_image_t, svirt_image_t)
Chris PeBenito 3079cb
manage_files_pattern(svirt_t, svirt_image_t, svirt_image_t)
Dan Walsh 3eaa99
manage_fifo_files_pattern(svirt_t, svirt_image_t, svirt_image_t)
Chris PeBenito 763020
fs_hugetlbfs_filetrans(svirt_t, svirt_image_t, file)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
list_dirs_pattern(svirt_t, virt_content_t, virt_content_t)
Chris PeBenito 3079cb
read_files_pattern(svirt_t, virt_content_t, virt_content_t)
Chris PeBenito 3079cb
dontaudit svirt_t virt_content_t:file write_file_perms;
Chris PeBenito 3079cb
dontaudit svirt_t virt_content_t:dir write;
Chris PeBenito 3079cb
Chris PeBenito 3079cb
corenet_udp_sendrecv_generic_if(svirt_t)
Chris PeBenito 3079cb
corenet_udp_sendrecv_generic_node(svirt_t)
Chris PeBenito 3079cb
corenet_udp_sendrecv_all_ports(svirt_t)
Chris PeBenito 3079cb
corenet_udp_bind_generic_node(svirt_t)
Chris PeBenito 3079cb
corenet_udp_bind_all_ports(svirt_t)
Chris PeBenito 763020
corenet_tcp_bind_all_ports(svirt_t)
Chris PeBenito 763020
corenet_tcp_connect_all_ports(svirt_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
dev_list_sysfs(svirt_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
userdom_search_user_home_content(svirt_t)
Chris PeBenito 763020
userdom_read_user_home_content_symlinks(svirt_t)
Chris PeBenito 3079cb
userdom_read_all_users_state(svirt_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
tunable_policy(`virt_use_comm',`
Chris PeBenito 3079cb
	term_use_unallocated_ttys(svirt_t)
Chris PeBenito 3079cb
	dev_rw_printer(svirt_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 763020
tunable_policy(`virt_use_fusefs',`
Chris PeBenito 763020
	fs_read_fusefs_files(svirt_t)
Chris PeBenito 763020
	fs_read_fusefs_symlinks(svirt_t)
Chris PeBenito 763020
')
Chris PeBenito 763020
Chris PeBenito 3079cb
tunable_policy(`virt_use_nfs',`
Chris PeBenito 3079cb
	fs_manage_nfs_dirs(svirt_t)
Chris PeBenito 3079cb
	fs_manage_nfs_files(svirt_t)
Dan Walsh 3eaa99
	fs_manage_nfs_named_sockets(svirt_t)
Dan Walsh 3eaa99
	fs_read_nfs_symlinks(svirt_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
tunable_policy(`virt_use_samba',`
Chris PeBenito 3079cb
	fs_manage_cifs_dirs(svirt_t)
Chris PeBenito 3079cb
	fs_manage_cifs_files(svirt_t)
Dan Walsh 3eaa99
	fs_manage_cifs_named_sockets(svirt_t)
Dan Walsh 3eaa99
	fs_read_cifs_symlinks(virtd_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
tunable_policy(`virt_use_sysfs',`
Chris PeBenito 3079cb
	dev_rw_sysfs(svirt_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
tunable_policy(`virt_use_usb',`
Chris PeBenito 3079cb
	dev_rw_usbfs(svirt_t)
Dan Walsh 3eaa99
	dev_read_sysfs(svirt_t)
Chris PeBenito 3079cb
	fs_manage_dos_dirs(svirt_t)
Chris PeBenito 3079cb
	fs_manage_dos_files(svirt_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
optional_policy(`
Dan Walsh a75a59
	tunable_policy(`virt_use_xserver',`
Dan Walsh a75a59
		xserver_stream_connect(svirt_t)
Dan Walsh a75a59
	')
Dan Walsh a75a59
')
Dan Walsh a75a59
Dan Walsh a75a59
optional_policy(`
Chris PeBenito 3079cb
	xen_rw_image_files(svirt_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	xen_rw_image_files(svirt_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
#
Chris PeBenito eb4216
# virtd local policy
Chris PeBenito eb4216
#
Chris PeBenito eb4216
Chris PeBenito 3079cb
allow virtd_t self:capability { chown dac_override fowner ipc_lock kill mknod net_admin net_raw setpcap setuid setgid sys_admin sys_nice sys_ptrace };
Dan Walsh 3eaa99
allow virtd_t self:process { getcap getsched setcap sigkill signal signull execmem setexec setfscreate setsockcreate setsched };
Chris PeBenito 3079cb
Chris PeBenito 3079cb
allow virtd_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito eb4216
allow virtd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito eb4216
allow virtd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 3079cb
allow virtd_t self:tun_socket create_socket_perms;
Dan Walsh 3eaa99
allow virtd_t self:rawip_socket create_socket_perms;
Chris PeBenito 763020
allow virtd_t self:netlink_kobject_uevent_socket create_socket_perms;
Chris PeBenito 3079cb
Dan Walsh 3eaa99
manage_dirs_pattern(virtd_t, virt_cache_t, virt_cache_t)
Dan Walsh 3eaa99
manage_files_pattern(virtd_t, virt_cache_t, virt_cache_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
manage_dirs_pattern(virtd_t, virt_content_t, virt_content_t)
Chris PeBenito 3079cb
manage_files_pattern(virtd_t, virt_content_t, virt_content_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
allow virtd_t virt_domain:process { getattr getsched setsched transition signal signull sigkill };
Chris PeBenito eb4216
Dan Walsh 3eaa99
allow virtd_t qemu_var_run_t:file relabel_file_perms;
Dan Walsh 3eaa99
manage_dirs_pattern(virtd_t, qemu_var_run_t, qemu_var_run_t)
Dan Walsh 3eaa99
manage_files_pattern(virtd_t, qemu_var_run_t, qemu_var_run_t)
Dan Walsh 3eaa99
manage_sock_files_pattern(virtd_t, qemu_var_run_t, qemu_var_run_t)
Dan Walsh 3eaa99
stream_connect_pattern(virtd_t, qemu_var_run_t, qemu_var_run_t, virt_domain)
Dan Walsh 3eaa99
Chris PeBenito eb4216
read_files_pattern(virtd_t, virt_etc_t, virt_etc_t)
Chris PeBenito eb4216
read_lnk_files_pattern(virtd_t, virt_etc_t, virt_etc_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
manage_dirs_pattern(virtd_t, virt_etc_rw_t, virt_etc_rw_t)
Chris PeBenito eb4216
manage_files_pattern(virtd_t, virt_etc_rw_t, virt_etc_rw_t)
Chris PeBenito eb4216
manage_lnk_files_pattern(virtd_t, virt_etc_rw_t, virt_etc_rw_t)
Chris PeBenito eb4216
filetrans_pattern(virtd_t, virt_etc_t, virt_etc_rw_t, dir)
Chris PeBenito eb4216
Chris PeBenito fb4826
manage_files_pattern(virtd_t, virt_image_type, virt_image_type)
Chris PeBenito 3079cb
manage_blk_files_pattern(virtd_t, virt_image_type, virt_image_type)
Dan Walsh 3eaa99
manage_lnk_files_pattern(virtd_t, virt_image_type, virt_image_type)
Dominick Grift 83029f
allow virtd_t virt_image_type:file relabel_file_perms;
Dominick Grift 83029f
allow virtd_t virt_image_type:blk_file relabel_blk_file_perms;
Chris PeBenito eb4216
Dan Walsh 3eaa99
manage_dirs_pattern(virtd_t, virt_tmp_t, virt_tmp_t)
Dan Walsh 3eaa99
manage_files_pattern(virtd_t, virt_tmp_t, virt_tmp_t)
Dan Walsh 3eaa99
files_tmp_filetrans(virtd_t, virt_tmp_t, { file dir })
Dan Walsh 3eaa99
can_exec(virtd_t, virt_tmp_t)
Dan Walsh 3eaa99
Chris PeBenito eb4216
manage_dirs_pattern(virtd_t, virt_log_t, virt_log_t)
Chris PeBenito eb4216
manage_files_pattern(virtd_t, virt_log_t, virt_log_t)
Chris PeBenito eb4216
logging_log_filetrans(virtd_t, virt_log_t, { file dir })
Chris PeBenito eb4216
Chris PeBenito eb4216
manage_dirs_pattern(virtd_t, virt_var_lib_t, virt_var_lib_t)
Chris PeBenito eb4216
manage_files_pattern(virtd_t, virt_var_lib_t, virt_var_lib_t)
Chris PeBenito 3079cb
manage_sock_files_pattern(virtd_t, virt_var_lib_t, virt_var_lib_t)
Chris PeBenito eb4216
files_var_lib_filetrans(virtd_t, virt_var_lib_t, { file dir })
Chris PeBenito eb4216
Chris PeBenito eb4216
manage_dirs_pattern(virtd_t, virt_var_run_t, virt_var_run_t)
Chris PeBenito eb4216
manage_files_pattern(virtd_t, virt_var_run_t, virt_var_run_t)
Chris PeBenito eb4216
manage_sock_files_pattern(virtd_t, virt_var_run_t, virt_var_run_t)
Chris PeBenito eb4216
files_pid_filetrans(virtd_t, virt_var_run_t, { file dir })
Chris PeBenito eb4216
Chris PeBenito eb4216
kernel_read_system_state(virtd_t)
Chris PeBenito eb4216
kernel_read_network_state(virtd_t)
Chris PeBenito eb4216
kernel_rw_net_sysctls(virtd_t)
Dan Walsh 3eaa99
kernel_read_kernel_sysctls(virtd_t)
Chris PeBenito 3079cb
kernel_request_load_module(virtd_t)
Chris PeBenito 3079cb
kernel_search_debugfs(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
corecmd_exec_bin(virtd_t)
Chris PeBenito eb4216
corecmd_exec_shell(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
corenet_all_recvfrom_unlabeled(virtd_t)
Chris PeBenito eb4216
corenet_all_recvfrom_netlabel(virtd_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(virtd_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(virtd_t)
Chris PeBenito eb4216
corenet_tcp_sendrecv_all_ports(virtd_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(virtd_t)
Chris PeBenito 3079cb
corenet_tcp_bind_virt_port(virtd_t)
Chris PeBenito eb4216
corenet_tcp_bind_vnc_port(virtd_t)
Chris PeBenito eb4216
corenet_tcp_connect_vnc_port(virtd_t)
Chris PeBenito eb4216
corenet_tcp_connect_soundd_port(virtd_t)
Chris PeBenito eb4216
corenet_rw_tun_tap_dev(virtd_t)
Chris PeBenito eb4216
Chris PeBenito 3079cb
dev_rw_sysfs(virtd_t)
Chris PeBenito eb4216
dev_read_rand(virtd_t)
Chris PeBenito 3079cb
dev_rw_kvm(virtd_t)
Chris PeBenito 3079cb
dev_getattr_all_chr_files(virtd_t)
Chris PeBenito 763020
dev_rw_mtrr(virtd_t)
Dan Walsh 3eaa99
dev_rw_vhost(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
# Init script handling
Chris PeBenito eb4216
domain_use_interactive_fds(virtd_t)
Chris PeBenito 3079cb
domain_read_all_domains_state(virtd_t)
Dan Walsh 3eaa99
domain_read_all_domains_state(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
files_read_usr_files(virtd_t)
Chris PeBenito eb4216
files_read_etc_files(virtd_t)
Dan Walsh 3eaa99
files_read_usr_files(virtd_t)
Chris PeBenito eb4216
files_read_etc_runtime_files(virtd_t)
Chris PeBenito eb4216
files_search_all(virtd_t)
Chris PeBenito 3079cb
files_read_kernel_modules(virtd_t)
Chris PeBenito 3079cb
files_read_usr_src_files(virtd_t)
Dan Walsh 4765a5
files_relabelto_system_conf_files(virtd_t)
Dan Walsh 4765a5
files_relabelfrom_system_conf_files(virtd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
# Manages /etc/sysconfig/system-config-firewall
Dan Walsh 3eaa99
files_manage_system_conf_files(virtd_t)
Dan Walsh 3eaa99
files_manage_system_conf_files(virtd_t)
Dan Walsh 3eaa99
files_etc_filetrans_system_conf(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
fs_list_auto_mountpoints(virtd_t)
Chris PeBenito 3079cb
fs_getattr_xattr_fs(virtd_t)
Chris PeBenito 3079cb
fs_rw_anon_inodefs_files(virtd_t)
Chris PeBenito 3079cb
fs_list_inotifyfs(virtd_t)
Chris PeBenito 763020
fs_manage_cgroup_dirs(virtd_t)
Chris PeBenito 763020
fs_rw_cgroup_files(virtd_t)
Dan Walsh 3eaa99
fs_manage_hugetlbfs_dirs(virtd_t)
Dan Walsh 3eaa99
fs_rw_hugetlbfs_files(virtd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
mls_fd_share_all_levels(virtd_t)
Dan Walsh 3eaa99
mls_file_read_to_clearance(virtd_t)
Dan Walsh 3eaa99
mls_file_write_to_clearance(virtd_t)
Dan Walsh 9461b6
mls_process_read_to_clearance(virtd_t)
Dan Walsh 3eaa99
mls_process_write_to_clearance(virtd_t)
Dan Walsh 3eaa99
mls_net_write_within_range(virtd_t)
Dan Walsh 3eaa99
mls_socket_write_to_clearance(virtd_t)
Dan Walsh 3eaa99
mls_socket_read_to_clearance(virtd_t)
Dan Walsh 3eaa99
mls_rangetrans_source(virtd_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
mcs_process_set_categories(virtd_t)
Chris PeBenito eb4216
Chris PeBenito 3079cb
storage_manage_fixed_disk(virtd_t)
Chris PeBenito 3079cb
storage_relabel_fixed_disk(virtd_t)
Chris PeBenito eb4216
storage_raw_write_removable_device(virtd_t)
Chris PeBenito eb4216
storage_raw_read_removable_device(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
term_getattr_pty_fs(virtd_t)
Chris PeBenito 3079cb
term_use_generic_ptys(virtd_t)
Chris PeBenito eb4216
term_use_ptmx(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
auth_use_nsswitch(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
miscfiles_read_localization(virtd_t)
Dominick Grift 834062
miscfiles_read_generic_certs(virtd_t)
Chris PeBenito 763020
miscfiles_read_hwdata(virtd_t)
Chris PeBenito eb4216
Chris PeBenito 3079cb
modutils_read_module_deps(virtd_t)
Chris PeBenito 763020
modutils_read_module_config(virtd_t)
Chris PeBenito 3079cb
modutils_manage_module_config(virtd_t)
Chris PeBenito 3079cb
Chris PeBenito eb4216
logging_send_syslog_msg(virtd_t)
Chris PeBenito eb4216
Dan Walsh 3eaa99
selinux_validate_context(virtd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
seutil_read_config(virtd_t)
Chris PeBenito 3079cb
seutil_read_default_contexts(virtd_t)
Dan Walsh 3eaa99
seutil_read_file_contexts(virtd_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
sysnet_domtrans_ifconfig(virtd_t)
Chris PeBenito 3079cb
sysnet_read_config(virtd_t)
Chris PeBenito 3079cb
Dan Walsh 3eaa99
userdom_list_admin_dir(virtd_t)
Chris PeBenito 3079cb
userdom_getattr_all_users(virtd_t)
Chris PeBenito 3079cb
userdom_list_user_home_content(virtd_t)
Chris PeBenito eb4216
userdom_read_all_users_state(virtd_t)
Chris PeBenito 3079cb
userdom_read_user_home_content_files(virtd_t)
Dan Walsh 3eaa99
userdom_relabel_user_home_files(virtd_t)
Dan Walsh 3eaa99
userdom_setattr_user_home_content_files(virtd_t)
Chris PeBenito eb4216
Dan Walsh 9561b0
consoletype_exec(virtd_t)
Dan Walsh 9561b0
Chris PeBenito eb4216
tunable_policy(`virt_use_nfs',`
Chris PeBenito eb4216
	fs_manage_nfs_dirs(virtd_t)
Chris PeBenito eb4216
	fs_manage_nfs_files(virtd_t)
Chris PeBenito eb4216
	fs_read_nfs_symlinks(virtd_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
tunable_policy(`virt_use_samba',`
Chris PeBenito eb4216
	fs_manage_nfs_files(virtd_t)
Chris PeBenito eb4216
	fs_manage_cifs_files(virtd_t)
Chris PeBenito eb4216
	fs_read_cifs_symlinks(virtd_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
optional_policy(`
Chris PeBenito eb4216
	brctl_domtrans(virtd_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
optional_policy(`
Chris PeBenito 296273
	dbus_system_bus_client(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	optional_policy(`
Chris PeBenito eb4216
		avahi_dbus_chat(virtd_t)
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	optional_policy(`
Chris PeBenito eb4216
		consolekit_dbus_chat(virtd_t)
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	optional_policy(`
Chris PeBenito eb4216
		hal_dbus_chat(virtd_t)
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito fb4826
optional_policy(`
Chris PeBenito fb4826
	dnsmasq_domtrans(virtd_t)
Chris PeBenito fb4826
	dnsmasq_signal(virtd_t)
Chris PeBenito fb4826
	dnsmasq_kill(virtd_t)
Chris PeBenito 3079cb
	dnsmasq_read_pid_files(virtd_t)
Chris PeBenito 3079cb
	dnsmasq_signull(virtd_t)
Chris PeBenito fb4826
')
Chris PeBenito eb4216
Chris PeBenito eb4216
optional_policy(`
Chris PeBenito eb4216
	iptables_domtrans(virtd_t)
Chris PeBenito 3079cb
	iptables_initrc_domtrans(virtd_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
	# Manages /etc/sysconfig/system-config-firewall
Chris PeBenito 3079cb
	iptables_manage_config(virtd_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito 3079cb
optional_policy(`
Chris PeBenito 3079cb
	kerberos_keytab_template(virtd, virtd_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
optional_policy(`
Chris PeBenito 3079cb
	lvm_domtrans(virtd_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
optional_policy(`
Chris PeBenito 763020
	policykit_dbus_chat(virtd_t)
Chris PeBenito 3079cb
	policykit_domtrans_auth(virtd_t)
Chris PeBenito 3079cb
	policykit_domtrans_resolve(virtd_t)
Chris PeBenito 3079cb
	policykit_read_lib(virtd_t)
Chris PeBenito 3079cb
')
Chris PeBenito eb4216
Chris PeBenito eb4216
optional_policy(`
Chris PeBenito eb4216
	qemu_domtrans(virtd_t)
Chris PeBenito eb4216
	qemu_read_state(virtd_t)
Chris PeBenito eb4216
	qemu_signal(virtd_t)
Chris PeBenito eb4216
	qemu_kill(virtd_t)
Chris PeBenito 763020
	qemu_setsched(virtd_t)
Dan Walsh 3eaa99
	qemu_entry_type(virt_domain)
Dan Walsh a75a59
	qemu_exec(virt_domain)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
optional_policy(`
Chris PeBenito eb4216
	sasl_connect(virtd_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
optional_policy(`
Chris PeBenito eb4216
	kernel_read_xen_state(virtd_t)
Chris PeBenito eb4216
	kernel_write_xen_state(virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	xen_stream_connect(virtd_t)
Chris PeBenito eb4216
	xen_stream_connect_xenstore(virtd_t)
Chris PeBenito 3079cb
	xen_read_image_files(virtd_t)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
optional_policy(`
Chris PeBenito 3079cb
	udev_domtrans(virtd_t)
Chris PeBenito 763020
	udev_read_db(virtd_t)
Chris PeBenito eb4216
')
Chris PeBenito fb4826
Chris PeBenito fb4826
optional_policy(`
Chris PeBenito fb4826
	unconfined_domain(virtd_t)
Chris PeBenito fb4826
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
########################################
Chris PeBenito 3079cb
#
Chris PeBenito 3079cb
# virtual domains common policy
Chris PeBenito 3079cb
#
Chris PeBenito 3079cb
Chris PeBenito 763020
allow virt_domain self:capability { dac_read_search dac_override kill };
Chris PeBenito 763020
allow virt_domain self:process { execmem execstack signal getsched signull };
Chris PeBenito 3079cb
allow virt_domain self:fifo_file rw_file_perms;
Chris PeBenito 3079cb
allow virt_domain self:shm create_shm_perms;
Chris PeBenito 3079cb
allow virt_domain self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 3079cb
allow virt_domain self:unix_dgram_socket { create_socket_perms sendto };
Chris PeBenito 3079cb
allow virt_domain self:tcp_socket create_stream_socket_perms;
Chris PeBenito 3079cb
Dan Walsh 3eaa99
manage_dirs_pattern(virt_domain, virt_cache_t, virt_cache_t)
Dan Walsh 3eaa99
manage_files_pattern(virt_domain, virt_cache_t, virt_cache_t)
Dan Walsh 3eaa99
files_var_filetrans(virt_domain, virt_cache_t, { file dir })
Dan Walsh 3eaa99
Dan Walsh 3eaa99
manage_dirs_pattern(virt_domain, qemu_var_run_t, qemu_var_run_t)
Dan Walsh 3eaa99
manage_files_pattern(virt_domain, qemu_var_run_t, qemu_var_run_t)
Dan Walsh 3eaa99
manage_sock_files_pattern(virt_domain, qemu_var_run_t, qemu_var_run_t)
Dan Walsh 3eaa99
manage_lnk_files_pattern(virt_domain, qemu_var_run_t, qemu_var_run_t)
Dan Walsh 3eaa99
files_pid_filetrans(virt_domain, qemu_var_run_t, { dir file })
Dan Walsh 3eaa99
stream_connect_pattern(virt_domain, qemu_var_run_t, qemu_var_run_t, virtd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
dontaudit virtd_t virt_domain:process  { siginh noatsecure rlimitinh };
Dan Walsh 3eaa99
Chris PeBenito 3079cb
append_files_pattern(virt_domain, virt_log_t, virt_log_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
append_files_pattern(virt_domain, virt_var_lib_t, virt_var_lib_t)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
kernel_read_system_state(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
corecmd_exec_bin(virt_domain)
Chris PeBenito 3079cb
corecmd_exec_shell(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
corenet_all_recvfrom_unlabeled(virt_domain)
Chris PeBenito 3079cb
corenet_all_recvfrom_netlabel(virt_domain)
Chris PeBenito 3079cb
corenet_tcp_sendrecv_generic_if(virt_domain)
Chris PeBenito 3079cb
corenet_tcp_sendrecv_generic_node(virt_domain)
Chris PeBenito 3079cb
corenet_tcp_sendrecv_all_ports(virt_domain)
Chris PeBenito 3079cb
corenet_tcp_bind_generic_node(virt_domain)
Chris PeBenito 3079cb
corenet_tcp_bind_vnc_port(virt_domain)
Chris PeBenito 3079cb
corenet_rw_tun_tap_dev(virt_domain)
Chris PeBenito 3079cb
corenet_tcp_bind_virt_migration_port(virt_domain)
Chris PeBenito 3079cb
corenet_tcp_connect_virt_migration_port(virt_domain)
Chris PeBenito 3079cb
Dan Walsh 3eaa99
dev_read_generic_symlinks(virt_domain)
Chris PeBenito 763020
dev_read_rand(virt_domain)
Chris PeBenito 3079cb
dev_read_sound(virt_domain)
Chris PeBenito 763020
dev_read_urand(virt_domain)
Chris PeBenito 3079cb
dev_write_sound(virt_domain)
Chris PeBenito 3079cb
dev_rw_ksm(virt_domain)
Chris PeBenito 3079cb
dev_rw_kvm(virt_domain)
Chris PeBenito 3079cb
dev_rw_qemu(virt_domain)
Dan Walsh 3eaa99
dev_rw_vhost(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
domain_use_interactive_fds(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
files_read_etc_files(virt_domain)
Dan Walsh 3eaa99
files_read_mnt_symlinks(virt_domain)
Chris PeBenito 3079cb
files_read_usr_files(virt_domain)
Chris PeBenito 3079cb
files_read_var_files(virt_domain)
Chris PeBenito 763020
files_search_all(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
fs_getattr_tmpfs(virt_domain)
Chris PeBenito 3079cb
fs_rw_anon_inodefs_files(virt_domain)
Chris PeBenito 3079cb
fs_rw_tmpfs_files(virt_domain)
Dan Walsh 3eaa99
fs_getattr_hugetlbfs(virt_domain)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
# I think we need these for now.
Dan Walsh 3eaa99
miscfiles_read_public_files(virt_domain)
Dan Walsh 3eaa99
storage_raw_read_removable_device(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 763020
term_use_all_terms(virt_domain)
Chris PeBenito 763020
term_getattr_pty_fs(virt_domain)
Chris PeBenito 763020
term_use_generic_ptys(virt_domain)
Chris PeBenito 763020
term_use_ptmx(virt_domain)
Chris PeBenito 763020
Chris PeBenito 3079cb
auth_use_nsswitch(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
logging_send_syslog_msg(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
miscfiles_read_localization(virt_domain)
Chris PeBenito 3079cb
Chris PeBenito 3079cb
optional_policy(`
Chris PeBenito 3079cb
	ptchown_domtrans(virt_domain)
Chris PeBenito 3079cb
')
Chris PeBenito 3079cb
Chris PeBenito 3079cb
optional_policy(`
Dan Walsh 3eaa99
	pulseaudio_dontaudit_exec(virt_domain)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Chris PeBenito 3079cb
	virt_read_config(virt_domain)
Chris PeBenito 3079cb
	virt_read_lib_files(virt_domain)
Chris PeBenito 3079cb
	virt_read_content(virt_domain)
Chris PeBenito 3079cb
	virt_stream_connect(virt_domain)
Chris PeBenito 3079cb
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
# xm local policy
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
type virsh_t;
Dan Walsh 3eaa99
type virsh_exec_t;
Dan Walsh 3eaa99
domain_type(virsh_t)
Dan Walsh 3eaa99
init_system_domain(virsh_t, virsh_exec_t)
Dan Walsh 3eaa99
typealias virsh_t alias xm_t;
Dan Walsh 3eaa99
typealias virsh_exec_t alias xm_exec_t;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
allow virsh_t self:capability { dac_override ipc_lock sys_tty_config };
Dan Walsh 3eaa99
allow virsh_t self:process { getcap getsched setcap signal };
Dan Walsh 3eaa99
Dan Walsh 3eaa99
# internal communication is often done using fifo and unix sockets.
Dan Walsh 3eaa99
allow virsh_t self:fifo_file rw_fifo_file_perms;
Dan Walsh 3eaa99
allow virsh_t self:unix_stream_socket { create_stream_socket_perms connectto };
Dan Walsh 3eaa99
allow virsh_t self:tcp_socket create_stream_socket_perms;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
manage_files_pattern(virsh_t, virt_image_type, virt_image_type)
Dan Walsh 3eaa99
manage_blk_files_pattern(virsh_t, virt_image_type, virt_image_type)
Dan Walsh 3eaa99
manage_lnk_files_pattern(virsh_t, virt_image_type, virt_image_type)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
dontaudit virsh_t virt_var_lib_t:file read_inherited_file_perms;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
kernel_read_system_state(virsh_t)
Dan Walsh 3eaa99
kernel_read_network_state(virsh_t)
Dan Walsh 3eaa99
kernel_read_kernel_sysctls(virsh_t)
Dan Walsh 3eaa99
kernel_read_sysctl(virsh_t)
Dan Walsh 3eaa99
kernel_read_xen_state(virsh_t)
Dan Walsh 3eaa99
kernel_write_xen_state(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
corecmd_exec_bin(virsh_t)
Dan Walsh 3eaa99
corecmd_exec_shell(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
corenet_tcp_sendrecv_generic_if(virsh_t)
Dan Walsh 3eaa99
corenet_tcp_sendrecv_generic_node(virsh_t)
Dan Walsh 3eaa99
corenet_tcp_connect_soundd_port(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
dev_read_urand(virsh_t)
Dan Walsh 3eaa99
dev_read_sysfs(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
files_read_etc_runtime_files(virsh_t)
Dan Walsh 3eaa99
files_read_usr_files(virsh_t)
Dan Walsh 3eaa99
files_list_mnt(virsh_t)
Dan Walsh 3eaa99
# Some common macros (you might be able to remove some)
Dan Walsh 3eaa99
files_read_etc_files(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
fs_getattr_all_fs(virsh_t)
Dan Walsh 3eaa99
fs_manage_xenfs_dirs(virsh_t)
Dan Walsh 3eaa99
fs_manage_xenfs_files(virsh_t)
Dan Walsh 3eaa99
fs_search_auto_mountpoints(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
storage_raw_read_fixed_disk(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
term_use_all_terms(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
init_stream_connect_script(virsh_t)
Dan Walsh 3eaa99
init_rw_script_stream_sockets(virsh_t)
Dan Walsh 3eaa99
init_use_fds(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
miscfiles_read_localization(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
sysnet_dns_name_resolve(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	xen_manage_image_dirs(virsh_t)
Dan Walsh 3eaa99
	xen_append_log(virsh_t)
Dan Walsh 3eaa99
	xen_stream_connect(virsh_t)
Dan Walsh 3eaa99
	xen_stream_connect_xenstore(virsh_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	dbus_system_bus_client(virsh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	optional_policy(`
Dan Walsh 3eaa99
		hal_dbus_chat(virsh_t)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	vhostmd_rw_tmpfs_files(virsh_t)
Dan Walsh 3eaa99
    	vhostmd_stream_connect(virsh_t)
Dan Walsh 3eaa99
	vhostmd_dontaudit_rw_stream_connect(virsh_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	virt_domtrans(virsh_t)
Dan Walsh 3eaa99
	virt_manage_images(virsh_t)
Dan Walsh 3eaa99
	virt_manage_config(virsh_t)
Dan Walsh 3eaa99
	virt_stream_connect(virsh_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	ssh_basic_client_template(virsh, virsh_t, system_r)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	kernel_read_xen_state(virsh_ssh_t)
Dan Walsh 3eaa99
	kernel_write_xen_state(virsh_ssh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	dontaudit virsh_ssh_t virsh_transition_domain:fifo_file rw_inherited_fifo_file_perms;
Dan Walsh 3eaa99
	files_search_tmp(virsh_ssh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	fs_manage_xenfs_dirs(virsh_ssh_t)
Dan Walsh 3eaa99
	fs_manage_xenfs_files(virsh_ssh_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	userdom_search_admin_dir(virsh_ssh_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99