Chris PeBenito a3cf80
Chris PeBenito 35a4b3
policy_module(xen,1.0.5)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
########################################
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
# Declarations
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# console ptys
Chris PeBenito a3cf80
type xen_devpts_t;
Chris PeBenito a3cf80
term_pty(xen_devpts_t);
Chris PeBenito a3cf80
files_type(xen_devpts_t);
Chris PeBenito a3cf80
Chris PeBenito a3cf80
type xend_t;
Chris PeBenito a3cf80
type xend_exec_t;
Chris PeBenito a3cf80
domain_type(xend_t)
Chris PeBenito a3cf80
init_daemon_domain(xend_t, xend_exec_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# var/lib files
Chris PeBenito a3cf80
type xend_var_lib_t;
Chris PeBenito a3cf80
files_type(xend_var_lib_t)
Chris PeBenito cdc86e
# for mounting an NFS store
Chris PeBenito cdc86e
files_mountpoint(xend_var_lib_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# log files
Chris PeBenito a3cf80
type xend_var_log_t;
Chris PeBenito a3cf80
logging_log_file(xend_var_log_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# pid files
Chris PeBenito a3cf80
type xend_var_run_t;
Chris PeBenito a3cf80
files_pid_file(xend_var_run_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
type xenstored_t;
Chris PeBenito a3cf80
type xenstored_exec_t;
Chris PeBenito a3cf80
domain_type(xenstored_t)
Chris PeBenito a3cf80
domain_entry_file(xenstored_t,xenstored_exec_t)
Chris PeBenito a3cf80
role system_r types xenstored_t;
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# var/lib files
Chris PeBenito a3cf80
type xenstored_var_lib_t;
Chris PeBenito a3cf80
files_type(xenstored_var_lib_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# pid files
Chris PeBenito a3cf80
type xenstored_var_run_t;
Chris PeBenito a3cf80
files_pid_file(xenstored_var_run_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
type xenconsoled_t;
Chris PeBenito a3cf80
type xenconsoled_exec_t;
Chris PeBenito a3cf80
domain_type(xenconsoled_t)
Chris PeBenito a3cf80
domain_entry_file(xenconsoled_t,xenconsoled_exec_t)
Chris PeBenito a3cf80
role system_r types xenconsoled_t;
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# pid files
Chris PeBenito a3cf80
type xenconsoled_var_run_t;
Chris PeBenito a3cf80
files_pid_file(xenconsoled_var_run_t)
Chris PeBenito a3cf80
Chris PeBenito e99359
type xm_t;
Chris PeBenito e99359
type xm_exec_t;
Chris PeBenito e99359
domain_type(xm_t)
Chris PeBenito e99359
init_daemon_domain(xm_t, xm_exec_t)
Chris PeBenito e99359
Chris PeBenito a3cf80
########################################
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
# xend local policy
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
Chris PeBenito a3cf80
allow xend_t self:capability { dac_override ipc_lock net_admin setuid sys_nice sys_tty_config };
Chris PeBenito a3cf80
allow xend_t self:process { signal sigkill };
Chris PeBenito a3cf80
# internal communication is often done using fifo and unix sockets.
Chris PeBenito a3cf80
allow xend_t self:fifo_file rw_file_perms;
Chris PeBenito a3cf80
allow xend_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito a3cf80
allow xend_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito a3cf80
allow xend_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito a3cf80
allow xend_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito a3cf80
allow xend_t self:packet_socket create_socket_perms;
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# pid file
Chris PeBenito a3cf80
allow xend_t xend_var_run_t:file manage_file_perms;
Chris PeBenito a3cf80
allow xend_t xend_var_run_t:sock_file manage_file_perms;
Chris PeBenito 87eb5c
allow xend_t xend_var_run_t:dir { setattr rw_dir_perms };
Chris PeBenito a3cf80
files_pid_filetrans(xend_t,xend_var_run_t, { file sock_file })
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# log files
Chris PeBenito a3cf80
allow xend_t xend_var_log_t:file create_file_perms;
Chris PeBenito a3cf80
allow xend_t xend_var_log_t:sock_file create_file_perms;
Chris PeBenito a3cf80
allow xend_t xend_var_log_t:dir { rw_dir_perms setattr };
Chris PeBenito a3cf80
logging_log_filetrans(xend_t,xend_var_log_t,{ sock_file file dir })
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# var/lib files for xend
Chris PeBenito a3cf80
allow xend_t xend_var_lib_t:file create_file_perms;
Chris PeBenito a3cf80
allow xend_t xend_var_lib_t:sock_file create_file_perms;
Chris PeBenito a3cf80
allow xend_t xend_var_lib_t:dir create_dir_perms;
Chris PeBenito a3cf80
files_var_lib_filetrans(xend_t,xend_var_lib_t,{ file dir sock_file })
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# transition to store
Chris PeBenito a3cf80
domain_auto_trans(xend_t, xenstored_exec_t, xenstored_t)
Chris PeBenito a3cf80
allow xenstored_t xend_t:fd use;
Chris PeBenito a3cf80
allow xenstored_t xend_t:process sigchld;
Chris PeBenito a3cf80
allow xenstored_t xend_t:fifo_file write;
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# transition to console
Chris PeBenito a3cf80
domain_auto_trans(xend_t, xenconsoled_exec_t, xenconsoled_t)
Chris PeBenito a3cf80
allow xenconsoled_t xend_t:fd use;
Chris PeBenito a3cf80
Chris PeBenito a3cf80
kernel_read_kernel_sysctls(xend_t)
Chris PeBenito a3cf80
kernel_read_system_state(xend_t)
Chris PeBenito a3cf80
kernel_write_xen_state(xend_t)
Chris PeBenito a3cf80
kernel_read_xen_state(xend_t)
Chris PeBenito a3cf80
kernel_rw_net_sysctls(xend_t)
Chris PeBenito a3cf80
kernel_read_network_state(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
corecmd_exec_sbin(xend_t)
Chris PeBenito a3cf80
corecmd_exec_bin(xend_t)
Chris PeBenito a3cf80
corecmd_exec_shell(xend_t)
Chris PeBenito a3cf80
Chris PeBenito 35a4b3
corenet_non_ipsec_sendrecv(xend_t)
Chris PeBenito a3cf80
corenet_tcp_sendrecv_all_if(xend_t)
Chris PeBenito a3cf80
corenet_tcp_sendrecv_all_nodes(xend_t)
Chris PeBenito a3cf80
corenet_tcp_sendrecv_all_ports(xend_t)
Chris PeBenito a3cf80
corenet_tcp_bind_xen_port(xend_t)
Chris PeBenito a3cf80
corenet_tcp_bind_soundd_port(xend_t)
Chris PeBenito 35a4b3
corenet_sendrecv_xen_server_packets(xend_t)
Chris PeBenito 35a4b3
corenet_sendrecv_soundd_server_packets(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
dev_read_urand(xend_t)
Chris PeBenito a3cf80
dev_manage_xen(xend_t)
Chris PeBenito a3cf80
dev_filetrans_xen(xend_t)
Chris PeBenito a3cf80
dev_rw_sysfs(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
domain_read_all_domains_state(xend_t)
Chris PeBenito a3cf80
domain_dontaudit_read_all_domains_state(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
files_read_etc_files(xend_t)
Chris PeBenito cdc86e
files_read_kernel_symbol_table(xend_t)
Chris PeBenito 0e1c46
files_read_kernel_img(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
storage_raw_read_fixed_disk(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
term_dontaudit_getattr_all_user_ptys(xend_t)
Chris PeBenito a3cf80
term_dontaudit_use_generic_ptys(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
init_use_fds(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
libs_use_ld_so(xend_t)
Chris PeBenito a3cf80
libs_use_shared_libs(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
logging_send_syslog_msg(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
miscfiles_read_localization(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
sysnet_domtrans_dhcpc(xend_t)
Chris PeBenito a3cf80
sysnet_signal_dhcpc(xend_t)
Chris PeBenito a3cf80
sysnet_domtrans_ifconfig(xend_t)
Chris PeBenito a3cf80
sysnet_dns_name_resolve(xend_t)
Chris PeBenito a3cf80
sysnet_delete_dhcpc_pid(xend_t)
Chris PeBenito a3cf80
sysnet_read_dhcpc_pid(xend_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
xen_stream_connect_xenstore(xend_t)
Chris PeBenito a3cf80
Chris PeBenito 87eb5c
optional_policy(`
Chris PeBenito 87eb5c
	consoletype_domtrans(xend_t)
Chris PeBenito 87eb5c
')
Chris PeBenito 87eb5c
Chris PeBenito a3cf80
########################################
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
# Xen console local policy
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
Chris PeBenito a3cf80
allow xenconsoled_t self:capability { dac_override fsetid ipc_lock };
Chris PeBenito a3cf80
allow xenconsoled_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito a3cf80
allow xenconsoled_t self:fifo_file { read write };
Chris PeBenito a3cf80
Chris PeBenito a3cf80
allow xenconsoled_t xen_devpts_t:chr_file rw_term_perms;
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# pid file
Chris PeBenito a3cf80
allow xenconsoled_t xenconsoled_var_run_t:file manage_file_perms;
Chris PeBenito a3cf80
allow xenconsoled_t xenconsoled_var_run_t:sock_file manage_file_perms;
Chris PeBenito a3cf80
allow xenconsoled_t xenconsoled_var_run_t:dir rw_dir_perms;
Chris PeBenito a3cf80
files_pid_filetrans(xenconsoled_t,xenconsoled_var_run_t, { file sock_file })
Chris PeBenito a3cf80
Chris PeBenito a3cf80
kernel_read_kernel_sysctls(xenconsoled_t)
Chris PeBenito a3cf80
kernel_write_xen_state(xenconsoled_t)
Chris PeBenito a3cf80
kernel_read_xen_state(xenconsoled_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
term_create_pty(xenconsoled_t,xen_devpts_t);
Chris PeBenito a3cf80
term_dontaudit_use_generic_ptys(xenconsoled_t)
Chris PeBenito 87eb5c
term_use_console(xenconsoled_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
init_use_fds(xenconsoled_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
libs_use_ld_so(xenconsoled_t)
Chris PeBenito a3cf80
libs_use_shared_libs(xenconsoled_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
miscfiles_read_localization(xenconsoled_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
xen_append_log(xenconsoled_t)
Chris PeBenito a3cf80
xen_stream_connect_xenstore(xenconsoled_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
########################################
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
# Xen store local policy
Chris PeBenito a3cf80
#
Chris PeBenito a3cf80
Chris PeBenito a3cf80
allow xenstored_t self:capability { dac_override mknod ipc_lock };
Chris PeBenito a3cf80
allow xenstored_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 87eb5c
allow xenstored_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# pid file
Chris PeBenito a3cf80
allow xenstored_t xenstored_var_run_t:file manage_file_perms;
Chris PeBenito a3cf80
allow xenstored_t xenstored_var_run_t:sock_file manage_file_perms;
Chris PeBenito a3cf80
allow xenstored_t xenstored_var_run_t:dir rw_dir_perms;
Chris PeBenito a3cf80
files_pid_filetrans(xenstored_t,xenstored_var_run_t, { file sock_file })
Chris PeBenito a3cf80
Chris PeBenito a3cf80
# var/lib files for xenstored
Chris PeBenito a3cf80
allow xenstored_t xenstored_var_lib_t:file create_file_perms;
Chris PeBenito a3cf80
allow xenstored_t xenstored_var_lib_t:sock_file create_file_perms;
Chris PeBenito a3cf80
allow xenstored_t xenstored_var_lib_t:dir create_dir_perms;
Chris PeBenito a3cf80
files_var_lib_filetrans(xenstored_t,xenstored_var_lib_t,{ file dir sock_file })
Chris PeBenito a3cf80
Chris PeBenito a3cf80
kernel_write_xen_state(xenstored_t)
Chris PeBenito a3cf80
kernel_read_xen_state(xenstored_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
dev_create_generic_dirs(xenstored_t)
Chris PeBenito a3cf80
dev_manage_xen(xenconsoled_t)
Chris PeBenito a3cf80
dev_filetrans_xen(xenstored_t)
Chris PeBenito cdc86e
dev_rw_xen(xenstored_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
term_dontaudit_use_generic_ptys(xenstored_t)
Chris PeBenito 87eb5c
term_dontaudit_use_console(xenconsoled_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
init_use_fds(xenstored_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
libs_use_ld_so(xenstored_t)
Chris PeBenito a3cf80
libs_use_shared_libs(xenstored_t)
Chris PeBenito a3cf80
Chris PeBenito 87eb5c
logging_send_syslog_msg(xenstored_t)
Chris PeBenito 87eb5c
Chris PeBenito a3cf80
miscfiles_read_localization(xenstored_t)
Chris PeBenito a3cf80
Chris PeBenito a3cf80
xen_append_log(xenstored_t)
Chris PeBenito e99359
Chris PeBenito e99359
########################################
Chris PeBenito e99359
#
Chris PeBenito e99359
# xm local policy
Chris PeBenito e99359
#
Chris PeBenito e99359
Chris PeBenito e99359
allow xm_t self:capability dac_override;
Chris PeBenito e99359
# internal communication is often done using fifo and unix sockets.
Chris PeBenito e99359
allow xm_t self:fifo_file { read write };
Chris PeBenito e99359
allow xm_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito e99359
Chris PeBenito e99359
kernel_read_system_state(xm_t)
Chris PeBenito e99359
kernel_read_kernel_sysctls(xm_t)
Chris PeBenito e99359
kernel_read_xen_state(xm_t)
Chris PeBenito e99359
kernel_write_xen_state(xm_t)
Chris PeBenito e99359
Chris PeBenito e99359
corecmd_exec_bin(xm_t)
Chris PeBenito e99359
corecmd_exec_sbin(xm_t)
Chris PeBenito e99359
Chris PeBenito e99359
dev_read_urand(xm_t)
Chris PeBenito e99359
Chris PeBenito e99359
# Some common macros (you might be able to remove some)
Chris PeBenito e99359
files_read_etc_files(xm_t)
Chris PeBenito e99359
Chris PeBenito e99359
term_use_all_terms(xm_t)
Chris PeBenito e99359
Chris PeBenito e99359
libs_use_ld_so(xm_t)
Chris PeBenito e99359
libs_use_shared_libs(xm_t)
Chris PeBenito e99359
Chris PeBenito e99359
miscfiles_read_localization(xm_t)
Chris PeBenito e99359
Chris PeBenito e99359
xen_append_log(xm_t)
Chris PeBenito e99359
xen_stream_connect(xm_t)
Chris PeBenito e99359
xen_stream_connect_xenstore(xm_t)