policy_module(portreserve, 1.0.0)
########################################
#
# Declarations
#
type portreserve_t;
type portreserve_exec_t;
init_daemon_domain(portreserve_t, portreserve_exec_t)
type portreserve_etc_t;
files_type(portreserve_etc_t)
type portreserve_var_run_t;
files_pid_file(portreserve_var_run_t)
########################################
#
# Portreserve local policy
#
allow portreserve_t self:fifo_file rw_fifo_file_perms;
allow portreserve_t self:unix_stream_socket create_stream_socket_perms;
allow portreserve_t self:unix_dgram_socket { create_socket_perms sendto };
allow portreserve_t self:tcp_socket create_socket_perms;
allow portreserve_t self:udp_socket create_socket_perms;
# Read etc files
list_dirs_pattern(portreserve_t, portreserve_etc_t, portreserve_etc_t)
read_files_pattern(portreserve_t, portreserve_etc_t, portreserve_etc_t)
# Manage /var/run/portreserve/*
manage_dirs_pattern(portreserve_t, portreserve_var_run_t, portreserve_var_run_t)
manage_files_pattern(portreserve_t, portreserve_var_run_t, portreserve_var_run_t)
manage_sock_files_pattern(portreserve_t, portreserve_var_run_t, portreserve_var_run_t)
files_pid_filetrans(portreserve_t, portreserve_var_run_t, { file sock_file })
corenet_tcp_bind_generic_node(portreserve_t)
corenet_udp_bind_generic_node(portreserve_t)
corenet_tcp_bind_all_reserved_ports(portreserve_t)
corenet_udp_bind_all_reserved_ports(portreserve_t)
files_read_etc_files(portreserve_t)