|
Dan Walsh |
3eaa99 |
policy_module(piranha,1.0.0)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
########################################
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
# Declarations
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
## <desc>
|
|
Dan Walsh |
3eaa99 |
##
|
|
Dan Walsh |
3eaa99 |
## Allow piranha-lvs domain to connect to the network using TCP.
|
|
Dan Walsh |
3eaa99 |
##
|
|
Dan Walsh |
3eaa99 |
## </desc>
|
|
Dan Walsh |
3eaa99 |
gen_tunable(piranha_lvs_can_network_connect, false)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
attribute piranha_domain;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
piranha_domain_template(fos)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
piranha_domain_template(lvs)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
piranha_domain_template(pulse)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
type piranha_pulse_initrc_exec_t;
|
|
Dan Walsh |
3eaa99 |
init_script_file(piranha_pulse_initrc_exec_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
piranha_domain_template(web)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
type piranha_web_tmpfs_t;
|
|
Dan Walsh |
3eaa99 |
files_tmpfs_file(piranha_web_tmpfs_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
type piranha_web_conf_t;
|
|
Dan Walsh |
3eaa99 |
files_type(piranha_web_conf_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
type piranha_web_data_t;
|
|
Dan Walsh |
3eaa99 |
files_type(piranha_web_data_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
type piranha_web_tmp_t;
|
|
Dan Walsh |
3eaa99 |
files_tmp_file(piranha_web_tmp_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
type piranha_etc_rw_t;
|
|
Dan Walsh |
3eaa99 |
files_type(piranha_etc_rw_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
type piranha_log_t;
|
|
Dan Walsh |
3eaa99 |
logging_log_file(piranha_log_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
#######################################
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
# piranha-fos local policy
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
kernel_read_kernel_sysctls(piranha_fos_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
domain_read_all_domains_state(piranha_fos_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
consoletype_exec(piranha_fos_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
# start and stop services
|
|
Dan Walsh |
3eaa99 |
init_domtrans_script(piranha_fos_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
########################################
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
# piranha-gui local policy
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
allow piranha_web_t self:capability { setuid sys_nice kill setgid };
|
|
Dan Walsh |
3eaa99 |
allow piranha_web_t self:process { getsched setsched signal signull ptrace };
|
|
Dan Walsh |
3eaa99 |
allow piranha_web_t self:rawip_socket create_socket_perms;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
allow piranha_web_t self:netlink_route_socket r_netlink_socket_perms;
|
|
Dan Walsh |
3eaa99 |
allow piranha_web_t self:sem create_sem_perms;
|
|
Dan Walsh |
3eaa99 |
allow piranha_web_t self:shm create_shm_perms;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
manage_files_pattern(piranha_web_t, piranha_web_data_t, piranha_web_data_t)
|
|
Dan Walsh |
3eaa99 |
manage_dirs_pattern(piranha_web_t, piranha_web_data_t, piranha_web_data_t)
|
|
Dan Walsh |
3eaa99 |
files_var_lib_filetrans(piranha_web_t, piranha_web_data_t, file)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
read_files_pattern(piranha_web_t, piranha_web_conf_t, piranha_web_conf_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
rw_files_pattern(piranha_web_t, piranha_etc_rw_t, piranha_etc_rw_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
manage_dirs_pattern(piranha_web_t, piranha_log_t, piranha_log_t)
|
|
Dan Walsh |
3eaa99 |
manage_files_pattern(piranha_web_t, piranha_log_t, piranha_log_t)
|
|
Dan Walsh |
3eaa99 |
logging_log_filetrans(piranha_web_t, piranha_log_t, { dir file } )
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
can_exec(piranha_web_t, piranha_web_tmp_t)
|
|
Dan Walsh |
3eaa99 |
manage_dirs_pattern(piranha_web_t, piranha_web_tmp_t, piranha_web_tmp_t)
|
|
Dan Walsh |
3eaa99 |
manage_files_pattern(piranha_web_t, piranha_web_tmp_t, piranha_web_tmp_t)
|
|
Dan Walsh |
3eaa99 |
files_tmp_filetrans(piranha_web_t, piranha_web_tmp_t, { file dir })
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
manage_dirs_pattern(piranha_web_t, piranha_web_tmpfs_t, piranha_web_tmpfs_t)
|
|
Dan Walsh |
3eaa99 |
manage_files_pattern(piranha_web_t, piranha_web_tmpfs_t, piranha_web_tmpfs_t)
|
|
Dan Walsh |
3eaa99 |
fs_tmpfs_filetrans(piranha_web_t, piranha_web_tmpfs_t, { dir file })
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
piranha_pulse_initrc_domtrans(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
kernel_read_kernel_sysctls(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_bind_http_cache_port(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_bind_luci_port(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_bind_piranha_port(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_connect_ricci_port(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
dev_read_urand(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
domain_read_all_domains_state(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
files_read_usr_files(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
consoletype_exec(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
optional_policy(`
|
|
Dan Walsh |
3eaa99 |
apache_read_config(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
apache_exec_modules(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
apache_exec(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
')
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
optional_policy(`
|
|
Dan Walsh |
f5b49a |
gnome_dontaudit_search_config(piranha_web_t)
|
|
Dan Walsh |
f5b49a |
')
|
|
Dan Walsh |
f5b49a |
|
|
Dan Walsh |
f5b49a |
optional_policy(`
|
|
Dan Walsh |
3eaa99 |
sasl_connect(piranha_web_t)
|
|
Dan Walsh |
3eaa99 |
')
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
######################################
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
# piranha-lvs local policy
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
# neede by nanny
|
|
Dan Walsh |
3eaa99 |
allow piranha_lvs_t self:capability { net_raw sys_nice };
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
allow piranha_lvs_t self:process signal;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
allow piranha_lvs_t self:unix_dgram_socket create_socket_perms;
|
|
Dan Walsh |
3eaa99 |
allow piranha_lvs_t self:rawip_socket create_socket_perms;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
kernel_read_kernel_sysctls(piranha_lvs_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
# needed by nanny
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_connect_ftp_port(piranha_lvs_t)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_connect_http_port(piranha_lvs_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
sysnet_dns_name_resolve(piranha_lvs_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
# needed by nanny
|
|
Dan Walsh |
3eaa99 |
tunable_policy(`piranha_lvs_can_network_connect',`
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_connect_all_ports(piranha_lvs_t)
|
|
Dan Walsh |
3eaa99 |
')
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
# needed by ipvsadm
|
|
Dan Walsh |
3eaa99 |
optional_policy(`
|
|
Dan Walsh |
3eaa99 |
iptables_domtrans(piranha_lvs_t)
|
|
Dan Walsh |
3eaa99 |
')
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
#######################################
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
# piranha-pulse local policy
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
allow piranha_pulse_t self:packet_socket create_socket_perms;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
# pulse starts fos and lvs daemon
|
|
Dan Walsh |
3eaa99 |
domtrans_pattern(piranha_fos_t, piranha_fos_exec_t, piranha_fos_t)
|
|
Dan Walsh |
3eaa99 |
allow piranha_pulse_t piranha_fos_t:process signal;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
domtrans_pattern(piranha_pulse_t, piranha_lvs_exec_t, piranha_lvs_t)
|
|
Dan Walsh |
3eaa99 |
allow piranha_pulse_t piranha_lvs_t:process signal;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
corenet_udp_bind_apertus_ldp_port(piranha_pulse_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
sysnet_dns_name_resolve(piranha_pulse_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
optional_policy(`
|
|
Dan Walsh |
3eaa99 |
netutils_domtrans_ping(piranha_pulse_t)
|
|
Dan Walsh |
3eaa99 |
')
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
optional_policy(`
|
|
Dan Walsh |
3eaa99 |
sysnet_domtrans_ifconfig(piranha_pulse_t)
|
|
Dan Walsh |
3eaa99 |
')
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
####################################
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
# piranha domains common policy
|
|
Dan Walsh |
3eaa99 |
#
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
allow piranha_domain self:fifo_file rw_fifo_file_perms;
|
|
Dan Walsh |
3eaa99 |
allow piranha_domain self:tcp_socket create_stream_socket_perms;
|
|
Dan Walsh |
3eaa99 |
allow piranha_domain self:udp_socket create_socket_perms;
|
|
Dan Walsh |
3eaa99 |
allow piranha_domain self:unix_stream_socket create_stream_socket_perms;
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
read_files_pattern(piranha_domain, piranha_etc_rw_t, piranha_etc_rw_t)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
kernel_read_system_state(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
kernel_read_network_state(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
corenet_all_recvfrom_unlabeled(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_all_recvfrom_netlabel(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_sendrecv_generic_if(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_udp_sendrecv_generic_if(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_sendrecv_generic_node(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_udp_sendrecv_generic_node(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_sendrecv_all_ports(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_udp_sendrecv_all_ports(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_tcp_bind_generic_node(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corenet_udp_bind_generic_node(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
files_read_etc_files(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
corecmd_exec_bin(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
corecmd_exec_shell(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
libs_use_ld_so(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
libs_use_shared_libs(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
logging_send_syslog_msg(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
miscfiles_read_localization(piranha_domain)
|
|
Dan Walsh |
3eaa99 |
|
|
Dan Walsh |
3eaa99 |
sysnet_read_config(piranha_domain)
|