policy_module(callweaver, 1.1.0)

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

type callweaver_t;
type callweaver_exec_t;
init_daemon_domain(callweaver_t, callweaver_exec_t)

type callweaver_initrc_exec_t;
init_script_file(callweaver_initrc_exec_t)

type callweaver_log_t;
logging_log_file(callweaver_log_t)

type callweaver_var_lib_t;
files_type(callweaver_var_lib_t)

type callweaver_var_run_t;
files_pid_file(callweaver_var_run_t)

type callweaver_spool_t;
files_type(callweaver_spool_t)

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

allow callweaver_t self:capability { setuid sys_nice setgid };
allow callweaver_t self:process { setsched signal };
allow callweaver_t self:fifo_file rw_fifo_file_perms;
allow callweaver_t self:tcp_socket { accept listen };
allow callweaver_t self:unix_stream_socket create_stream_socket_perms;

manage_dirs_pattern(callweaver_t, callweaver_log_t, callweaver_log_t)
append_files_pattern(callweaver_t, callweaver_log_t, callweaver_log_t)
create_files_pattern(callweaver_t, callweaver_log_t, callweaver_log_t)
setattr_files_pattern(callweaver_t, callweaver_log_t, callweaver_log_t)
logging_log_filetrans(callweaver_t, callweaver_log_t, { dir file })

manage_dirs_pattern(callweaver_t, callweaver_var_lib_t, callweaver_var_lib_t)
manage_files_pattern(callweaver_t, callweaver_var_lib_t, callweaver_var_lib_t)
files_var_lib_filetrans(callweaver_t, callweaver_var_lib_t, { dir file })

manage_dirs_pattern(callweaver_t, callweaver_var_run_t, callweaver_var_run_t)
manage_files_pattern(callweaver_t, callweaver_var_run_t, callweaver_var_run_t)
manage_sock_files_pattern(callweaver_t, callweaver_var_run_t, callweaver_var_run_t)
files_pid_filetrans(callweaver_t, callweaver_var_run_t, { dir file sock_file })

manage_dirs_pattern(callweaver_t, callweaver_spool_t, callweaver_spool_t)
manage_files_pattern(callweaver_t, callweaver_spool_t, callweaver_spool_t)
manage_lnk_files_pattern(callweaver_t, callweaver_spool_t, callweaver_spool_t)
files_spool_filetrans(callweaver_t, callweaver_spool_t, { dir file })

kernel_read_kernel_sysctls(callweaver_t)
kernel_read_sysctl(callweaver_t)

corenet_all_recvfrom_unlabeled(callweaver_t)
corenet_all_recvfrom_netlabel(callweaver_t)
corenet_udp_sendrecv_generic_if(callweaver_t)
corenet_udp_sendrecv_generic_node(callweaver_t)
corenet_udp_sendrecv_all_ports(callweaver_t)
corenet_udp_bind_generic_node(callweaver_t)

corenet_sendrecv_asterisk_server_packets(callweaver_t)
corenet_udp_bind_asterisk_port(callweaver_t)

corenet_sendrecv_generic_server_packets(callweaver_t)
corenet_udp_bind_generic_port(callweaver_t)

corenet_sendrecv_sip_server_packets(callweaver_t)
corenet_udp_bind_sip_port(callweaver_t)

dev_manage_generic_symlinks(callweaver_t)

domain_use_interactive_fds(callweaver_t)

term_getattr_pty_fs(callweaver_t)
term_use_generic_ptys(callweaver_t)
term_use_ptmx(callweaver_t)

auth_use_nsswitch(callweaver_t)

