Chris PeBenito 17de1b
Chris PeBenito d9845a
policy_module(xen,1.1.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# console ptys
Chris PeBenito 17de1b
type xen_devpts_t;
Chris PeBenito 17de1b
term_pty(xen_devpts_t);
Chris PeBenito 17de1b
files_type(xen_devpts_t);
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Xen Image files
Chris PeBenito 17de1b
type xen_image_t; # customizable
Chris PeBenito 17de1b
files_type(xen_image_t)
Chris PeBenito d9845a
# xen_image_t can be assigned to blk devices
Chris PeBenito d9845a
dev_node(xen_image_t)
Chris PeBenito d9845a
Chris PeBenito d9845a
type xenctl_t;
Chris PeBenito d9845a
files_type(xenctl_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type xend_t;
Chris PeBenito 17de1b
type xend_exec_t;
Chris PeBenito 17de1b
domain_type(xend_t)
Chris PeBenito 17de1b
init_daemon_domain(xend_t, xend_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# var/lib files
Chris PeBenito 17de1b
type xend_var_lib_t;
Chris PeBenito 17de1b
files_type(xend_var_lib_t)
Chris PeBenito 17de1b
# for mounting an NFS store
Chris PeBenito 17de1b
files_mountpoint(xend_var_lib_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# log files
Chris PeBenito 17de1b
type xend_var_log_t;
Chris PeBenito 17de1b
logging_log_file(xend_var_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid files
Chris PeBenito 17de1b
type xend_var_run_t;
Chris PeBenito 17de1b
files_pid_file(xend_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type xenstored_t;
Chris PeBenito 17de1b
type xenstored_exec_t;
Chris PeBenito 17de1b
domain_type(xenstored_t)
Chris PeBenito 17de1b
domain_entry_file(xenstored_t,xenstored_exec_t)
Chris PeBenito 17de1b
role system_r types xenstored_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# var/lib files
Chris PeBenito 17de1b
type xenstored_var_lib_t;
Chris PeBenito 17de1b
files_type(xenstored_var_lib_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid files
Chris PeBenito 17de1b
type xenstored_var_run_t;
Chris PeBenito 17de1b
files_pid_file(xenstored_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type xenconsoled_t;
Chris PeBenito 17de1b
type xenconsoled_exec_t;
Chris PeBenito 17de1b
domain_type(xenconsoled_t)
Chris PeBenito 17de1b
domain_entry_file(xenconsoled_t,xenconsoled_exec_t)
Chris PeBenito 17de1b
role system_r types xenconsoled_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid files
Chris PeBenito 17de1b
type xenconsoled_var_run_t;
Chris PeBenito 17de1b
files_pid_file(xenconsoled_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type xm_t;
Chris PeBenito 17de1b
type xm_exec_t;
Chris PeBenito 17de1b
domain_type(xm_t)
Chris PeBenito 17de1b
init_daemon_domain(xm_t, xm_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# xend local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito d9845a
allow xend_t self:capability { mknod dac_override ipc_lock net_admin setuid sys_nice sys_ptrace sys_tty_config net_raw };
Chris PeBenito a5e213
dontaudit xend_t self:capability { sys_ptrace };
Chris PeBenito 17de1b
allow xend_t self:process { signal sigkill };
Chris PeBenito a5e213
dontaudit xend_t self:process ptrace;
Chris PeBenito 17de1b
# internal communication is often done using fifo and unix sockets.
Chris PeBenito 17de1b
allow xend_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
allow xend_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow xend_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow xend_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 17de1b
allow xend_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow xend_t self:packet_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow xend_t xen_image_t:dir r_dir_perms;
Chris PeBenito a5e213
allow xend_t xen_image_t:file rw_file_perms;
Chris PeBenito d9845a
allow xend_t xen_image_t:blk_file rw_file_perms;
Chris PeBenito d9845a
Chris PeBenito d9845a
allow xend_t xenctl_t:fifo_file create_file_perms;
Chris PeBenito d9845a
dev_filetrans(xend_t, xenctl_t, fifo_file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid file
Chris PeBenito 17de1b
allow xend_t xend_var_run_t:file manage_file_perms;
Chris PeBenito 17de1b
allow xend_t xend_var_run_t:sock_file manage_file_perms;
Chris PeBenito 17de1b
allow xend_t xend_var_run_t:dir { setattr rw_dir_perms };
Chris PeBenito 17de1b
files_pid_filetrans(xend_t,xend_var_run_t, { file sock_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# log files
Chris PeBenito 17de1b
allow xend_t xend_var_log_t:file create_file_perms;
Chris PeBenito 17de1b
allow xend_t xend_var_log_t:sock_file create_file_perms;
Chris PeBenito 17de1b
allow xend_t xend_var_log_t:dir { rw_dir_perms setattr };
Chris PeBenito 17de1b
logging_log_filetrans(xend_t,xend_var_log_t,{ sock_file file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# var/lib files for xend
Chris PeBenito 17de1b
allow xend_t xend_var_lib_t:file create_file_perms;
Chris PeBenito 17de1b
allow xend_t xend_var_lib_t:sock_file create_file_perms;
Chris PeBenito 17de1b
allow xend_t xend_var_lib_t:fifo_file create_file_perms;
Chris PeBenito 17de1b
allow xend_t xend_var_lib_t:dir create_dir_perms;
Chris PeBenito 17de1b
files_var_lib_filetrans(xend_t,xend_var_lib_t,{ file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# transition to store
Chris PeBenito 17de1b
domain_auto_trans(xend_t, xenstored_exec_t, xenstored_t)
Chris PeBenito 17de1b
allow xenstored_t xend_t:fd use;
Chris PeBenito 17de1b
allow xenstored_t xend_t:process sigchld;
Chris PeBenito 17de1b
allow xenstored_t xend_t:fifo_file write;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# transition to console
Chris PeBenito 17de1b
domain_auto_trans(xend_t, xenconsoled_exec_t, xenconsoled_t)
Chris PeBenito 17de1b
allow xenconsoled_t xend_t:fd use;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(xend_t)
Chris PeBenito 17de1b
kernel_read_system_state(xend_t)
Chris PeBenito 17de1b
kernel_write_xen_state(xend_t)
Chris PeBenito 17de1b
kernel_read_xen_state(xend_t)
Chris PeBenito 17de1b
kernel_rw_net_sysctls(xend_t)
Chris PeBenito 17de1b
kernel_read_network_state(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_sbin(xend_t)
Chris PeBenito 17de1b
corecmd_exec_bin(xend_t)
Chris PeBenito 17de1b
corecmd_exec_shell(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corenet_non_ipsec_sendrecv(xend_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(xend_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(xend_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(xend_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(xend_t)
Chris PeBenito 17de1b
corenet_tcp_bind_xen_port(xend_t)
Chris PeBenito 17de1b
corenet_tcp_bind_soundd_port(xend_t)
Chris PeBenito a5e213
corenet_tcp_bind_generic_port(xend_t)
Chris PeBenito 75beb9
corenet_tcp_bind_vnc_port(xend_t)
Chris PeBenito d9845a
corenet_tcp_connect_xserver_port(xend_t)
Chris PeBenito d9845a
corenet_sendrecv_xserver_client_packets(xend_t)
Chris PeBenito 17de1b
corenet_sendrecv_xen_server_packets(xend_t)
Chris PeBenito 17de1b
corenet_sendrecv_soundd_server_packets(xend_t)
Chris PeBenito a5e213
corenet_rw_tun_tap_dev(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_urand(xend_t)
Chris PeBenito 17de1b
dev_manage_xen(xend_t)
Chris PeBenito 17de1b
dev_filetrans_xen(xend_t)
Chris PeBenito 17de1b
dev_rw_sysfs(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_read_all_domains_state(xend_t)
Chris PeBenito 17de1b
domain_dontaudit_read_all_domains_state(xend_t)
Chris PeBenito a5e213
domain_dontaudit_ptrace_all_domains(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(xend_t)
Chris PeBenito 17de1b
files_read_kernel_symbol_table(xend_t)
Chris PeBenito 17de1b
files_read_kernel_img(xend_t)
Chris PeBenito 17de1b
files_manage_etc_runtime_files(xend_t)
Chris PeBenito 17de1b
files_etc_filetrans_etc_runtime(xend_t,file)
Chris PeBenito a5e213
files_read_usr_files(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
storage_raw_read_fixed_disk(xend_t)
Chris PeBenito 8708d9
storage_raw_read_removable_device(xend_t)
Chris PeBenito 17de1b
Chris PeBenito a5e213
term_getattr_all_user_ptys(xend_t)
Chris PeBenito a5e213
term_use_generic_ptys(xend_t)
Chris PeBenito a5e213
term_use_ptmx(xend_t)
Chris PeBenito a5e213
term_getattr_pty_fs(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(xend_t)
Chris PeBenito a5e213
init_use_script_ptys(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(xend_t)
Chris PeBenito 17de1b
libs_use_shared_libs(xend_t)
Chris PeBenito 17de1b
Chris PeBenito d9845a
locallogin_dontaudit_use_fds(xend_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
logging_send_syslog_msg(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_domtrans_dhcpc(xend_t)
Chris PeBenito 17de1b
sysnet_signal_dhcpc(xend_t)
Chris PeBenito 17de1b
sysnet_domtrans_ifconfig(xend_t)
Chris PeBenito 17de1b
sysnet_dns_name_resolve(xend_t)
Chris PeBenito 17de1b
sysnet_delete_dhcpc_pid(xend_t)
Chris PeBenito 17de1b
sysnet_read_dhcpc_pid(xend_t)
Chris PeBenito d9845a
sysnet_rw_dhcp_config(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 75beb9
userdom_dontaudit_search_sysadm_home_dirs(xend_t)
Chris PeBenito 75beb9
Chris PeBenito 17de1b
xen_stream_connect_xenstore(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
netutils_domtrans(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 465510
	consoletype_exec(xend_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito d9845a
ifdef(`targeted_policy',`
Chris PeBenito d9845a
	term_dontaudit_use_unallocated_ttys(xend_t)
Chris PeBenito d9845a
	term_dontaudit_use_generic_ptys(xend_t)
Chris PeBenito d9845a
Chris PeBenito d9845a
	optional_policy(`
Chris PeBenito d9845a
		unconfined_rw_pipes(xend_t)
Chris PeBenito d9845a
	')
Chris PeBenito d9845a
')
Chris PeBenito d9845a
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Xen console local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow xenconsoled_t self:capability { dac_override fsetid ipc_lock };
Chris PeBenito 17de1b
allow xenconsoled_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow xenconsoled_t self:fifo_file { read write };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow xenconsoled_t xen_devpts_t:chr_file rw_term_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid file
Chris PeBenito 17de1b
allow xenconsoled_t xenconsoled_var_run_t:file manage_file_perms;
Chris PeBenito 17de1b
allow xenconsoled_t xenconsoled_var_run_t:sock_file manage_file_perms;
Chris PeBenito 17de1b
allow xenconsoled_t xenconsoled_var_run_t:dir rw_dir_perms;
Chris PeBenito 17de1b
files_pid_filetrans(xenconsoled_t,xenconsoled_var_run_t, { file sock_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(xenconsoled_t)
Chris PeBenito 17de1b
kernel_write_xen_state(xenconsoled_t)
Chris PeBenito 17de1b
kernel_read_xen_state(xenconsoled_t)
Chris PeBenito 17de1b
Chris PeBenito a5e213
domain_dontaudit_ptrace_all_domains(xenconsoled_t)
Chris PeBenito a5e213
Chris PeBenito d9845a
files_read_usr_files(xenconsoled_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
term_create_pty(xenconsoled_t,xen_devpts_t);
Chris PeBenito a5e213
term_use_generic_ptys(xenconsoled_t)
Chris PeBenito 17de1b
term_use_console(xenconsoled_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(xenconsoled_t)
Chris PeBenito a5e213
init_use_script_ptys(xenconsoled_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(xenconsoled_t)
Chris PeBenito 17de1b
libs_use_shared_libs(xenconsoled_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(xenconsoled_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
xen_append_log(xenconsoled_t)
Chris PeBenito 17de1b
xen_stream_connect_xenstore(xenconsoled_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Xen store local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow xenstored_t self:capability { dac_override mknod ipc_lock };
Chris PeBenito 17de1b
allow xenstored_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow xenstored_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid file
Chris PeBenito 17de1b
allow xenstored_t xenstored_var_run_t:file manage_file_perms;
Chris PeBenito 17de1b
allow xenstored_t xenstored_var_run_t:sock_file manage_file_perms;
Chris PeBenito 17de1b
allow xenstored_t xenstored_var_run_t:dir rw_dir_perms;
Chris PeBenito 17de1b
files_pid_filetrans(xenstored_t,xenstored_var_run_t, { file sock_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# var/lib files for xenstored
Chris PeBenito 17de1b
allow xenstored_t xenstored_var_lib_t:file create_file_perms;
Chris PeBenito 17de1b
allow xenstored_t xenstored_var_lib_t:sock_file create_file_perms;
Chris PeBenito 17de1b
allow xenstored_t xenstored_var_lib_t:dir create_dir_perms;
Chris PeBenito 17de1b
files_var_lib_filetrans(xenstored_t,xenstored_var_lib_t,{ file dir sock_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_write_xen_state(xenstored_t)
Chris PeBenito 17de1b
kernel_read_xen_state(xenstored_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_create_generic_dirs(xenstored_t)
Chris PeBenito d9845a
dev_manage_xen(xenstored_t)
Chris PeBenito 17de1b
dev_filetrans_xen(xenstored_t)
Chris PeBenito 17de1b
dev_rw_xen(xenstored_t)
Chris PeBenito d9845a
dev_read_sysfs(xenstored_t)
Chris PeBenito d9845a
Chris PeBenito d9845a
files_read_usr_files(xenstored_t)
Chris PeBenito 17de1b
Chris PeBenito a5e213
term_use_generic_ptys(xenstored_t)
Chris PeBenito a5e213
term_use_console(xenconsoled_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(xenstored_t)
Chris PeBenito a5e213
init_use_script_ptys(xenstored_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(xenstored_t)
Chris PeBenito 17de1b
libs_use_shared_libs(xenstored_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(xenstored_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(xenstored_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
xen_append_log(xenstored_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# xm local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow xm_t self:capability { dac_override ipc_lock sys_tty_config };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# internal communication is often done using fifo and unix sockets.
Chris PeBenito 17de1b
allow xm_t self:fifo_file { read write };
Chris PeBenito d9845a
allow xm_t self:unix_stream_socket { create_stream_socket_perms connectto };
Chris PeBenito d9845a
allow xm_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow xm_t xend_var_lib_t:dir rw_dir_perms;
Chris PeBenito 17de1b
allow xm_t xend_var_lib_t:fifo_file create_file_perms;
Chris PeBenito 17de1b
allow xm_t xend_var_lib_t:file create_file_perms;
Chris PeBenito 17de1b
files_search_var_lib(xm_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow xm_t xen_image_t:dir rw_dir_perms;
Chris PeBenito 17de1b
allow xm_t xen_image_t:file r_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(xm_t)
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(xm_t)
Chris PeBenito 17de1b
kernel_read_xen_state(xm_t)
Chris PeBenito 17de1b
kernel_write_xen_state(xm_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(xm_t)
Chris PeBenito 17de1b
corecmd_exec_sbin(xm_t)
Chris PeBenito 17de1b
Chris PeBenito d9845a
corenet_tcp_sendrecv_generic_if(xm_t)
Chris PeBenito d9845a
corenet_tcp_sendrecv_all_nodes(xm_t)
Chris PeBenito d9845a
corenet_tcp_connect_soundd_port(xm_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
dev_read_urand(xm_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_runtime_files(xm_t)
Chris PeBenito 17de1b
files_read_usr_files(xm_t)
Chris PeBenito 17de1b
files_list_mnt(xm_t)
Chris PeBenito 17de1b
# Some common macros (you might be able to remove some)
Chris PeBenito 17de1b
files_read_etc_files(xm_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_all_terms(xm_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_rw_script_stream_sockets(xm_t)
Chris PeBenito 17de1b
init_use_fds(xm_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(xm_t)
Chris PeBenito 17de1b
libs_use_shared_libs(xm_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(xm_t)
Chris PeBenito 17de1b
Chris PeBenito d9845a
sysnet_read_config(xm_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
xen_append_log(xm_t)
Chris PeBenito 17de1b
xen_stream_connect(xm_t)
Chris PeBenito 17de1b
xen_stream_connect_xenstore(xm_t)