Chris PeBenito 17de1b
Chris PeBenito 9570b2
policy_module(xen, 1.9.0)
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 26410d
term_pty(xen_devpts_t)
Chris PeBenito 26410d
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
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 7f0897
# tmp files
Chris PeBenito 7f0897
type xend_tmp_t;
Chris PeBenito 7f0897
files_tmp_file(xend_tmp_t)
Chris PeBenito 7f0897
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 3f67f7
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 3f67f7
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 d46cfe
init_system_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 c0868a
allow xend_t self:fifo_file rw_fifo_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 c0868a
allow xend_t xen_image_t:dir list_dir_perms;
Chris PeBenito 3f67f7
manage_dirs_pattern(xend_t, xen_image_t, xen_image_t)
Chris PeBenito 3f67f7
manage_files_pattern(xend_t, xen_image_t, xen_image_t)
Chris PeBenito 3f67f7
read_lnk_files_pattern(xend_t, xen_image_t, xen_image_t)
Chris PeBenito 3f67f7
rw_blk_files_pattern(xend_t, xen_image_t, xen_image_t)
Chris PeBenito d9845a
Chris PeBenito c0868a
allow xend_t xenctl_t:fifo_file manage_file_perms;
Chris PeBenito d9845a
dev_filetrans(xend_t, xenctl_t, fifo_file)
Chris PeBenito 17de1b
Chris PeBenito 3f67f7
manage_files_pattern(xend_t, xend_tmp_t, xend_tmp_t)
Chris PeBenito 3f67f7
manage_dirs_pattern(xend_t, xend_tmp_t, xend_tmp_t)
Chris PeBenito 7f0897
files_tmp_filetrans(xend_t, xend_tmp_t, { file dir })
Chris PeBenito 7f0897
Chris PeBenito 17de1b
# pid file
Chris PeBenito c0868a
allow xend_t xend_var_run_t:dir setattr;
Chris PeBenito 3f67f7
manage_files_pattern(xend_t, xend_var_run_t, xend_var_run_t)
Chris PeBenito 3f67f7
manage_sock_files_pattern(xend_t, xend_var_run_t, xend_var_run_t)
Chris PeBenito 3f67f7
manage_fifo_files_pattern(xend_t, xend_var_run_t, xend_var_run_t)
Chris PeBenito 3f67f7
files_pid_filetrans(xend_t, xend_var_run_t, { file sock_file fifo_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# log files
Chris PeBenito c0868a
allow xend_t xend_var_log_t:dir setattr;
Chris PeBenito 3f67f7
manage_files_pattern(xend_t, xend_var_log_t, xend_var_log_t)
Chris PeBenito 3f67f7
manage_sock_files_pattern(xend_t, xend_var_log_t, xend_var_log_t)
Chris PeBenito 3f67f7
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 3f67f7
manage_dirs_pattern(xend_t, xend_var_lib_t, xend_var_lib_t)
Chris PeBenito 3f67f7
manage_files_pattern(xend_t, xend_var_lib_t, xend_var_lib_t)
Chris PeBenito 3f67f7
manage_sock_files_pattern(xend_t, xend_var_lib_t, xend_var_lib_t)
Chris PeBenito 3f67f7
manage_fifo_files_pattern(xend_t, xend_var_lib_t, xend_var_lib_t)
Chris PeBenito 3f67f7
files_var_lib_filetrans(xend_t, xend_var_lib_t,{ file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# transition to store
Chris PeBenito 0b36a2
domtrans_pattern(xend_t, xenstored_exec_t, xenstored_t)
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_bin(xend_t)
Chris PeBenito 17de1b
corecmd_exec_shell(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(xend_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(xend_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(xend_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(xend_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(xend_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(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 d6d16b
corenet_tcp_connect_xen_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 d6d16b
corenet_sendrecv_xen_client_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 d6d16b
dev_rw_xen(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 3f67f7
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 7f0897
storage_raw_write_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 d9845a
locallogin_dontaudit_use_fds(xend_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
logging_send_syslog_msg(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 7f0897
lvm_domtrans(xend_t)
Chris PeBenito 7f0897
Chris PeBenito 17de1b
miscfiles_read_localization(xend_t)
Chris PeBenito 17de1b
Chris PeBenito 7f0897
mount_domtrans(xend_t)
Chris PeBenito 7f0897
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 296273
userdom_dontaudit_search_user_home_dirs(xend_t)
Chris PeBenito 296273
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 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 0b36a2
allow xenconsoled_t self:fifo_file rw_fifo_file_perms;
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 3f67f7
manage_files_pattern(xenconsoled_t, xenconsoled_var_run_t, xenconsoled_var_run_t)
Chris PeBenito 3f67f7
manage_sock_files_pattern(xenconsoled_t, xenconsoled_var_run_t, xenconsoled_var_run_t)
Chris PeBenito 3f67f7
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 d6d16b
dev_manage_xen(xenconsoled_t)
Chris PeBenito d6d16b
dev_filetrans_xen(xenconsoled_t)
Chris PeBenito d6d16b
dev_rw_sysfs(xenconsoled_t)
Chris PeBenito d6d16b
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 3f67f7
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
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 3f67f7
manage_files_pattern(xenstored_t, xenstored_var_run_t, xenstored_var_run_t)
Chris PeBenito 3f67f7
manage_sock_files_pattern(xenstored_t, xenstored_var_run_t, xenstored_var_run_t)
Chris PeBenito 3f67f7
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 3f67f7
manage_dirs_pattern(xenstored_t, xenstored_var_lib_t, xenstored_var_lib_t)
Chris PeBenito 3f67f7
manage_files_pattern(xenstored_t, xenstored_var_lib_t, xenstored_var_lib_t)
Chris PeBenito 3f67f7
manage_sock_files_pattern(xenstored_t, xenstored_var_lib_t, xenstored_var_lib_t)
Chris PeBenito 3f67f7
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 7f0897
storage_raw_read_fixed_disk(xenstored_t)
Chris PeBenito 7f0897
storage_raw_write_fixed_disk(xenstored_t)
Chris PeBenito 7f0897
storage_raw_read_removable_device(xenstored_t)
Chris PeBenito 7f0897
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
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 0b36a2
allow xm_t self:fifo_file rw_fifo_file_perms;
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 3f67f7
manage_files_pattern(xm_t, xend_var_lib_t, xend_var_lib_t)
Chris PeBenito 3f67f7
manage_fifo_files_pattern(xm_t, xend_var_lib_t, xend_var_lib_t)
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 c0868a
allow xm_t xen_image_t:file read_file_perms;
Chris PeBenito 7f0897
allow xm_t xen_image_t:blk_file read_blk_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
Chris PeBenito d9845a
corenet_tcp_sendrecv_generic_if(xm_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(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 7f0897
storage_raw_read_fixed_disk(xm_t)
Chris PeBenito 7f0897
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
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)