policy_module(svnserve, 1.6.0)

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

type svnserve_t;
type svnserve_exec_t;
init_daemon_domain(svnserve_t, svnserve_exec_t)

type svnserve_initrc_exec_t;
init_script_file(svnserve_initrc_exec_t)

type svnserve_content_t;
files_type(svnserve_content_t)

type svnserve_runtime_t alias svnserve_var_run_t;
files_runtime_file(svnserve_runtime_t)

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

allow svnserve_t self:fifo_file rw_fifo_file_perms;
allow svnserve_t self:tcp_socket create_stream_socket_perms;
allow svnserve_t self:unix_stream_socket { listen accept };

manage_dirs_pattern(svnserve_t, svnserve_content_t, svnserve_content_t)
manage_files_pattern(svnserve_t, svnserve_content_t, svnserve_content_t)

manage_dirs_pattern(svnserve_t, svnserve_runtime_t, svnserve_runtime_t)
manage_files_pattern(svnserve_t, svnserve_runtime_t, svnserve_runtime_t)
files_runtime_filetrans(svnserve_t, svnserve_runtime_t, { dir file })

files_read_etc_files(svnserve_t)
files_read_usr_files(svnserve_t)

corenet_all_recvfrom_netlabel(svnserve_t)
corenet_tcp_sendrecv_generic_if(svnserve_t)
corenet_udp_sendrecv_generic_if(svnserve_t)
corenet_tcp_sendrecv_generic_node(svnserve_t)
corenet_udp_sendrecv_generic_node(svnserve_t)
corenet_tcp_bind_generic_node(svnserve_t)
corenet_udp_bind_generic_node(svnserve_t)

corenet_sendrecv_svn_server_packets(svnserve_t)
corenet_tcp_bind_svn_port(svnserve_t)
corenet_udp_bind_svn_port(svnserve_t)

logging_send_syslog_msg(svnserve_t)

miscfiles_read_localization(svnserve_t)

sysnet_dns_name_resolve(svnserve_t)
