policy_module(isns, 1.0.0)

########################################
#
# Declarations
#

type isnsd_t;
type isnsd_exec_t;
init_daemon_domain(isnsd_t, isnsd_exec_t)

type isnsd_initrc_exec_t;
init_script_file(isnsd_initrc_exec_t)

type isnsd_var_lib_t;
files_type(isnsd_var_lib_t)

type isnsd_var_run_t;
files_pid_file(isnsd_var_run_t)

########################################
#
# Local policy
#

allow isnsd_t self:capability kill;
allow isnsd_t self:process signal;
allow isnsd_t self:fifo_file rw_fifo_file_perms;
allow isnsd_t self:tcp_socket { listen accept };
allow isnsd_t self:udp_socket { accept listen };
allow isnsd_t self:unix_stream_socket { accept listen };

manage_dirs_pattern(isnsd_t, isnsd_var_lib_t, isnsd_var_lib_t)
manage_files_pattern(isnsd_t, isnsd_var_lib_t, isnsd_var_lib_t)
files_var_lib_filetrans(isnsd_t, isnsd_var_lib_t, dir)

manage_sock_files_pattern(isnsd_t, isnsd_var_run_t, isnsd_var_run_t)
manage_files_pattern(isnsd_t, isnsd_var_run_t, isnsd_var_run_t)
files_pid_filetrans(isnsd_t, isnsd_var_run_t, { file sock_file })

kernel_read_system_state(isnsd_t)
kernel_read_network_state(isnsd_t)

corenet_all_recvfrom_unlabeled(isnsd_t)
corenet_all_recvfrom_netlabel(isnsd_t)
corenet_tcp_sendrecv_generic_if(isnsd_t)
corenet_tcp_sendrecv_generic_node(isnsd_t)
corenet_tcp_sendrecv_isns_port(isnsd_t)
corenet_tcp_bind_generic_node(isnsd_t)
corenet_sendrecv_isns_server_packets(isnsd_t)
corenet_tcp_bind_isns_port(isnsd_t)
corenet_tcp_connect_isns_port(isnsd_t)

auth_use_nsswitch(isnsd_t)

logging_send_syslog_msg(isnsd_t)
