policy_module(shibboleth, 1.5.0)

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

type shibboleth_t;
type shibboleth_exec_t;
init_daemon_domain(shibboleth_t, shibboleth_exec_t)

type shibboleth_etc_t;
files_config_file(shibboleth_etc_t)

type shibboleth_log_t;
logging_log_file(shibboleth_log_t)

type shibboleth_runtime_t alias shibboleth_var_run_t;
files_runtime_file(shibboleth_runtime_t)
init_daemon_runtime_file(shibboleth_runtime_t, dir, "shibboleth")

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

allow shibboleth_t self:process { signal_perms };

# networking:
# shibboleth uses tcp sockets for connecting to central
# authentication server and unix stream sockets
# to exchange information with the apache module
allow shibboleth_t self:unix_stream_socket create_stream_socket_perms;
allow shibboleth_t self:tcp_socket create_stream_socket_perms;

read_files_pattern(shibboleth_t, shibboleth_etc_t, shibboleth_etc_t)
read_lnk_files_pattern(shibboleth_t, shibboleth_etc_t, shibboleth_etc_t)

manage_files_pattern(shibboleth_t, shibboleth_log_t, shibboleth_log_t)

manage_files_pattern(shibboleth_t, shibboleth_runtime_t, shibboleth_runtime_t)
manage_sock_files_pattern(shibboleth_t, shibboleth_runtime_t, shibboleth_runtime_t)

corenet_all_recvfrom_netlabel(shibboleth_t)
corenet_tcp_connect_http_port(shibboleth_t)
corenet_tcp_sendrecv_generic_if(shibboleth_t)
corenet_tcp_sendrecv_generic_node(shibboleth_t)

dev_read_urand(shibboleth_t)

domain_dontaudit_use_interactive_fds(shibboleth_t)

files_read_etc_files(shibboleth_t)
files_read_usr_files(shibboleth_t)
files_search_etc(shibboleth_t)

term_dontaudit_search_ptys(shibboleth_t)
term_dontaudit_use_all_ptys(shibboleth_t)
term_dontaudit_use_all_ttys(shibboleth_t)

logging_log_filetrans(shibboleth_t, shibboleth_log_t, { file dir })
logging_send_syslog_msg(shibboleth_t)

miscfiles_read_localization(shibboleth_t)

sysnet_dns_name_resolve(shibboleth_t)

# permissions for the configuration files
# there is shared information between apache and shibboleth, e.g., certificates
apache_read_config(shibboleth_t)
