2006-03-23 19:19:38 +00:00
|
|
|
|
2007-03-20 18:47:18 +00:00
|
|
|
policy_module(xen,1.2.1)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
# console ptys
|
|
|
|
type xen_devpts_t;
|
|
|
|
term_pty(xen_devpts_t);
|
|
|
|
files_type(xen_devpts_t);
|
|
|
|
|
2006-06-07 17:43:10 +00:00
|
|
|
# Xen Image files
|
|
|
|
type xen_image_t; # customizable
|
|
|
|
files_type(xen_image_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
# xen_image_t can be assigned to blk devices
|
|
|
|
dev_node(xen_image_t)
|
|
|
|
|
|
|
|
type xenctl_t;
|
|
|
|
files_type(xenctl_t)
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
type xend_t;
|
|
|
|
type xend_exec_t;
|
|
|
|
domain_type(xend_t)
|
|
|
|
init_daemon_domain(xend_t, xend_exec_t)
|
|
|
|
|
|
|
|
# var/lib files
|
|
|
|
type xend_var_lib_t;
|
|
|
|
files_type(xend_var_lib_t)
|
2006-04-17 17:32:54 +00:00
|
|
|
# for mounting an NFS store
|
|
|
|
files_mountpoint(xend_var_lib_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
# log files
|
|
|
|
type xend_var_log_t;
|
|
|
|
logging_log_file(xend_var_log_t)
|
|
|
|
|
|
|
|
# pid files
|
|
|
|
type xend_var_run_t;
|
|
|
|
files_pid_file(xend_var_run_t)
|
|
|
|
|
|
|
|
type xenstored_t;
|
|
|
|
type xenstored_exec_t;
|
|
|
|
domain_type(xenstored_t)
|
|
|
|
domain_entry_file(xenstored_t,xenstored_exec_t)
|
|
|
|
role system_r types xenstored_t;
|
|
|
|
|
|
|
|
# var/lib files
|
|
|
|
type xenstored_var_lib_t;
|
|
|
|
files_type(xenstored_var_lib_t)
|
|
|
|
|
|
|
|
# pid files
|
|
|
|
type xenstored_var_run_t;
|
|
|
|
files_pid_file(xenstored_var_run_t)
|
|
|
|
|
|
|
|
type xenconsoled_t;
|
|
|
|
type xenconsoled_exec_t;
|
|
|
|
domain_type(xenconsoled_t)
|
|
|
|
domain_entry_file(xenconsoled_t,xenconsoled_exec_t)
|
|
|
|
role system_r types xenconsoled_t;
|
|
|
|
|
|
|
|
# pid files
|
|
|
|
type xenconsoled_var_run_t;
|
|
|
|
files_pid_file(xenconsoled_var_run_t)
|
|
|
|
|
2006-05-03 19:58:01 +00:00
|
|
|
type xm_t;
|
|
|
|
type xm_exec_t;
|
|
|
|
domain_type(xm_t)
|
|
|
|
init_daemon_domain(xm_t, xm_exec_t)
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# xend local policy
|
|
|
|
#
|
|
|
|
|
2006-10-31 21:01:48 +00:00
|
|
|
allow xend_t self:capability { mknod dac_override ipc_lock net_admin setuid sys_nice sys_ptrace sys_tty_config net_raw };
|
2006-08-29 02:41:00 +00:00
|
|
|
dontaudit xend_t self:capability { sys_ptrace };
|
2006-03-23 19:19:38 +00:00
|
|
|
allow xend_t self:process { signal sigkill };
|
2006-08-29 02:41:00 +00:00
|
|
|
dontaudit xend_t self:process ptrace;
|
2006-03-23 19:19:38 +00:00
|
|
|
# internal communication is often done using fifo and unix sockets.
|
2006-12-12 20:08:08 +00:00
|
|
|
allow xend_t self:fifo_file rw_fifo_file_perms;
|
2006-03-23 19:19:38 +00:00
|
|
|
allow xend_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow xend_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow xend_t self:netlink_route_socket r_netlink_socket_perms;
|
|
|
|
allow xend_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow xend_t self:packet_socket create_socket_perms;
|
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
allow xend_t xen_image_t:dir list_dir_perms;
|
|
|
|
manage_dirs_pattern(xend_t,xen_image_t,xen_image_t)
|
|
|
|
manage_files_pattern(xend_t,xen_image_t,xen_image_t)
|
|
|
|
rw_blk_files_pattern(xend_t,xen_image_t,xen_image_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
allow xend_t xenctl_t:fifo_file manage_file_perms;
|
2006-10-31 21:01:48 +00:00
|
|
|
dev_filetrans(xend_t, xenctl_t, fifo_file)
|
2006-06-07 17:43:10 +00:00
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
# pid file
|
2006-12-12 20:08:08 +00:00
|
|
|
allow xend_t xend_var_run_t:dir setattr;
|
|
|
|
manage_files_pattern(xend_t,xend_var_run_t,xend_var_run_t)
|
|
|
|
manage_sock_files_pattern(xend_t,xend_var_run_t,xend_var_run_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
files_pid_filetrans(xend_t,xend_var_run_t, { file sock_file })
|
|
|
|
|
|
|
|
# log files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow xend_t xend_var_log_t:dir setattr;
|
|
|
|
manage_files_pattern(xend_t,xend_var_log_t,xend_var_log_t)
|
|
|
|
manage_sock_files_pattern(xend_t,xend_var_log_t,xend_var_log_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
logging_log_filetrans(xend_t,xend_var_log_t,{ sock_file file dir })
|
|
|
|
|
|
|
|
# var/lib files for xend
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_dirs_pattern(xend_t,xend_var_lib_t,xend_var_lib_t)
|
|
|
|
manage_files_pattern(xend_t,xend_var_lib_t,xend_var_lib_t)
|
|
|
|
manage_sock_files_pattern(xend_t,xend_var_lib_t,xend_var_lib_t)
|
|
|
|
manage_fifo_files_pattern(xend_t,xend_var_lib_t,xend_var_lib_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
files_var_lib_filetrans(xend_t,xend_var_lib_t,{ file dir })
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
# transition to store
|
|
|
|
domain_auto_trans(xend_t, xenstored_exec_t, xenstored_t)
|
|
|
|
allow xenstored_t xend_t:fd use;
|
|
|
|
allow xenstored_t xend_t:process sigchld;
|
|
|
|
allow xenstored_t xend_t:fifo_file write;
|
|
|
|
|
|
|
|
# transition to console
|
|
|
|
domain_auto_trans(xend_t, xenconsoled_exec_t, xenconsoled_t)
|
|
|
|
allow xenconsoled_t xend_t:fd use;
|
|
|
|
|
|
|
|
kernel_read_kernel_sysctls(xend_t)
|
|
|
|
kernel_read_system_state(xend_t)
|
|
|
|
kernel_write_xen_state(xend_t)
|
|
|
|
kernel_read_xen_state(xend_t)
|
|
|
|
kernel_rw_net_sysctls(xend_t)
|
|
|
|
kernel_read_network_state(xend_t)
|
|
|
|
|
|
|
|
corecmd_exec_sbin(xend_t)
|
|
|
|
corecmd_exec_bin(xend_t)
|
|
|
|
corecmd_exec_shell(xend_t)
|
|
|
|
|
2006-05-29 15:04:49 +00:00
|
|
|
corenet_non_ipsec_sendrecv(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(xend_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(xend_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(xend_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
corenet_tcp_bind_all_nodes(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
corenet_tcp_bind_xen_port(xend_t)
|
|
|
|
corenet_tcp_bind_soundd_port(xend_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
corenet_tcp_bind_generic_port(xend_t)
|
2006-09-06 16:36:23 +00:00
|
|
|
corenet_tcp_bind_vnc_port(xend_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
corenet_tcp_connect_xserver_port(xend_t)
|
2006-12-04 20:10:56 +00:00
|
|
|
corenet_tcp_connect_xen_port(xend_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
corenet_sendrecv_xserver_client_packets(xend_t)
|
2006-05-29 15:04:49 +00:00
|
|
|
corenet_sendrecv_xen_server_packets(xend_t)
|
2006-12-04 20:10:56 +00:00
|
|
|
corenet_sendrecv_xen_client_packets(xend_t)
|
2006-05-29 15:04:49 +00:00
|
|
|
corenet_sendrecv_soundd_server_packets(xend_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
corenet_rw_tun_tap_dev(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
dev_read_urand(xend_t)
|
|
|
|
dev_manage_xen(xend_t)
|
|
|
|
dev_filetrans_xen(xend_t)
|
|
|
|
dev_rw_sysfs(xend_t)
|
2006-12-04 20:10:56 +00:00
|
|
|
dev_rw_xen(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
domain_read_all_domains_state(xend_t)
|
|
|
|
domain_dontaudit_read_all_domains_state(xend_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
domain_dontaudit_ptrace_all_domains(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
files_read_etc_files(xend_t)
|
2006-04-17 17:32:54 +00:00
|
|
|
files_read_kernel_symbol_table(xend_t)
|
2006-04-26 15:22:33 +00:00
|
|
|
files_read_kernel_img(xend_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
files_manage_etc_runtime_files(xend_t)
|
|
|
|
files_etc_filetrans_etc_runtime(xend_t,file)
|
2006-08-29 02:41:00 +00:00
|
|
|
files_read_usr_files(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
storage_raw_read_fixed_disk(xend_t)
|
2006-09-22 17:14:35 +00:00
|
|
|
storage_raw_read_removable_device(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
2006-08-29 02:41:00 +00:00
|
|
|
term_getattr_all_user_ptys(xend_t)
|
|
|
|
term_use_generic_ptys(xend_t)
|
|
|
|
term_use_ptmx(xend_t)
|
|
|
|
term_getattr_pty_fs(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
libs_use_ld_so(xend_t)
|
|
|
|
libs_use_shared_libs(xend_t)
|
|
|
|
|
2006-10-31 21:01:48 +00:00
|
|
|
locallogin_dontaudit_use_fds(xend_t)
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
logging_send_syslog_msg(xend_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(xend_t)
|
|
|
|
|
|
|
|
sysnet_domtrans_dhcpc(xend_t)
|
|
|
|
sysnet_signal_dhcpc(xend_t)
|
|
|
|
sysnet_domtrans_ifconfig(xend_t)
|
|
|
|
sysnet_dns_name_resolve(xend_t)
|
|
|
|
sysnet_delete_dhcpc_pid(xend_t)
|
|
|
|
sysnet_read_dhcpc_pid(xend_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
sysnet_rw_dhcp_config(xend_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
userdom_dontaudit_search_sysadm_home_dirs(xend_t)
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
xen_stream_connect_xenstore(xend_t)
|
|
|
|
|
2006-06-21 18:25:06 +00:00
|
|
|
netutils_domtrans(xend_t)
|
|
|
|
|
2006-05-19 14:02:24 +00:00
|
|
|
optional_policy(`
|
2006-07-28 15:13:58 +00:00
|
|
|
consoletype_exec(xend_t)
|
2006-05-19 14:02:24 +00:00
|
|
|
')
|
|
|
|
|
2006-10-31 21:01:48 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
term_dontaudit_use_unallocated_ttys(xend_t)
|
|
|
|
term_dontaudit_use_generic_ptys(xend_t)
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
unconfined_rw_pipes(xend_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Xen console local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow xenconsoled_t self:capability { dac_override fsetid ipc_lock };
|
|
|
|
allow xenconsoled_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow xenconsoled_t self:fifo_file { read write };
|
|
|
|
|
|
|
|
allow xenconsoled_t xen_devpts_t:chr_file rw_term_perms;
|
|
|
|
|
|
|
|
# pid file
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_files_pattern(xenconsoled_t,xenconsoled_var_run_t,xenconsoled_var_run_t)
|
|
|
|
manage_sock_files_pattern(xenconsoled_t,xenconsoled_var_run_t,xenconsoled_var_run_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
files_pid_filetrans(xenconsoled_t,xenconsoled_var_run_t, { file sock_file })
|
|
|
|
|
|
|
|
kernel_read_kernel_sysctls(xenconsoled_t)
|
|
|
|
kernel_write_xen_state(xenconsoled_t)
|
|
|
|
kernel_read_xen_state(xenconsoled_t)
|
|
|
|
|
2006-12-04 20:10:56 +00:00
|
|
|
dev_manage_xen(xenconsoled_t)
|
|
|
|
dev_filetrans_xen(xenconsoled_t)
|
|
|
|
dev_rw_sysfs(xenconsoled_t)
|
|
|
|
|
2006-08-29 02:41:00 +00:00
|
|
|
domain_dontaudit_ptrace_all_domains(xenconsoled_t)
|
|
|
|
|
2006-10-31 21:01:48 +00:00
|
|
|
files_read_usr_files(xenconsoled_t)
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
term_create_pty(xenconsoled_t,xen_devpts_t);
|
2006-08-29 02:41:00 +00:00
|
|
|
term_use_generic_ptys(xenconsoled_t)
|
2006-05-19 14:02:24 +00:00
|
|
|
term_use_console(xenconsoled_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
init_use_fds(xenconsoled_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
init_use_script_ptys(xenconsoled_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
libs_use_ld_so(xenconsoled_t)
|
|
|
|
libs_use_shared_libs(xenconsoled_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(xenconsoled_t)
|
|
|
|
|
|
|
|
xen_append_log(xenconsoled_t)
|
|
|
|
xen_stream_connect_xenstore(xenconsoled_t)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Xen store local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow xenstored_t self:capability { dac_override mknod ipc_lock };
|
|
|
|
allow xenstored_t self:unix_stream_socket create_stream_socket_perms;
|
2006-05-19 14:02:24 +00:00
|
|
|
allow xenstored_t self:unix_dgram_socket create_socket_perms;
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
# pid file
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_files_pattern(xenstored_t,xenstored_var_run_t,xenstored_var_run_t)
|
|
|
|
manage_sock_files_pattern(xenstored_t,xenstored_var_run_t,xenstored_var_run_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
files_pid_filetrans(xenstored_t,xenstored_var_run_t, { file sock_file })
|
|
|
|
|
|
|
|
# var/lib files for xenstored
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_dirs_pattern(xenstored_t,xenstored_var_lib_t,xenstored_var_lib_t)
|
|
|
|
manage_files_pattern(xenstored_t,xenstored_var_lib_t,xenstored_var_lib_t)
|
|
|
|
manage_sock_files_pattern(xenstored_t,xenstored_var_lib_t,xenstored_var_lib_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
files_var_lib_filetrans(xenstored_t,xenstored_var_lib_t,{ file dir sock_file })
|
|
|
|
|
|
|
|
kernel_write_xen_state(xenstored_t)
|
|
|
|
kernel_read_xen_state(xenstored_t)
|
|
|
|
|
|
|
|
dev_create_generic_dirs(xenstored_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
dev_manage_xen(xenstored_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
dev_filetrans_xen(xenstored_t)
|
2006-04-17 17:32:54 +00:00
|
|
|
dev_rw_xen(xenstored_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
dev_read_sysfs(xenstored_t)
|
|
|
|
|
|
|
|
files_read_usr_files(xenstored_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
2006-08-29 02:41:00 +00:00
|
|
|
term_use_generic_ptys(xenstored_t)
|
|
|
|
term_use_console(xenconsoled_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
init_use_fds(xenstored_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
init_use_script_ptys(xenstored_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
|
|
|
|
libs_use_ld_so(xenstored_t)
|
|
|
|
libs_use_shared_libs(xenstored_t)
|
|
|
|
|
2006-05-19 14:02:24 +00:00
|
|
|
logging_send_syslog_msg(xenstored_t)
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
miscfiles_read_localization(xenstored_t)
|
|
|
|
|
|
|
|
xen_append_log(xenstored_t)
|
2006-05-03 19:58:01 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# xm local policy
|
|
|
|
#
|
|
|
|
|
2006-06-21 18:25:06 +00:00
|
|
|
allow xm_t self:capability { dac_override ipc_lock sys_tty_config };
|
|
|
|
|
2006-05-03 19:58:01 +00:00
|
|
|
# internal communication is often done using fifo and unix sockets.
|
|
|
|
allow xm_t self:fifo_file { read write };
|
2006-10-31 21:01:48 +00:00
|
|
|
allow xm_t self:unix_stream_socket { create_stream_socket_perms connectto };
|
|
|
|
allow xm_t self:tcp_socket create_stream_socket_perms;
|
2006-05-03 19:58:01 +00:00
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_files_pattern(xm_t,xend_var_lib_t,xend_var_lib_t)
|
|
|
|
manage_fifo_files_pattern(xm_t,xend_var_lib_t,xend_var_lib_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
files_search_var_lib(xm_t)
|
|
|
|
|
2006-06-21 18:25:06 +00:00
|
|
|
allow xm_t xen_image_t:dir rw_dir_perms;
|
2006-12-12 20:08:08 +00:00
|
|
|
allow xm_t xen_image_t:file read_file_perms;
|
2006-06-21 18:25:06 +00:00
|
|
|
|
2006-05-03 19:58:01 +00:00
|
|
|
kernel_read_system_state(xm_t)
|
|
|
|
kernel_read_kernel_sysctls(xm_t)
|
|
|
|
kernel_read_xen_state(xm_t)
|
|
|
|
kernel_write_xen_state(xm_t)
|
|
|
|
|
|
|
|
corecmd_exec_bin(xm_t)
|
|
|
|
corecmd_exec_sbin(xm_t)
|
|
|
|
|
2006-10-31 21:01:48 +00:00
|
|
|
corenet_tcp_sendrecv_generic_if(xm_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(xm_t)
|
|
|
|
corenet_tcp_connect_soundd_port(xm_t)
|
|
|
|
|
2006-05-03 19:58:01 +00:00
|
|
|
dev_read_urand(xm_t)
|
|
|
|
|
2006-06-07 17:43:10 +00:00
|
|
|
files_read_etc_runtime_files(xm_t)
|
|
|
|
files_read_usr_files(xm_t)
|
|
|
|
files_list_mnt(xm_t)
|
2006-05-03 19:58:01 +00:00
|
|
|
# Some common macros (you might be able to remove some)
|
|
|
|
files_read_etc_files(xm_t)
|
|
|
|
|
|
|
|
term_use_all_terms(xm_t)
|
|
|
|
|
2006-06-07 17:43:10 +00:00
|
|
|
init_rw_script_stream_sockets(xm_t)
|
2006-06-21 18:25:06 +00:00
|
|
|
init_use_fds(xm_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
|
2006-05-03 19:58:01 +00:00
|
|
|
libs_use_ld_so(xm_t)
|
|
|
|
libs_use_shared_libs(xm_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(xm_t)
|
|
|
|
|
2006-10-31 21:01:48 +00:00
|
|
|
sysnet_read_config(xm_t)
|
|
|
|
|
2006-05-03 19:58:01 +00:00
|
|
|
xen_append_log(xm_t)
|
|
|
|
xen_stream_connect(xm_t)
|
|
|
|
xen_stream_connect_xenstore(xm_t)
|