policy_module(qpid, 1.1.0)

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

type qpidd_t;
type qpidd_exec_t;
init_daemon_domain(qpidd_t, qpidd_exec_t)

type qpidd_initrc_exec_t;
init_script_file(qpidd_initrc_exec_t)

type qpidd_tmp_t;
files_tmp_file(qpidd_tmp_t)

type qpidd_tmpfs_t;
files_tmpfs_file(qpidd_tmpfs_t)

type qpidd_var_lib_t;
files_type(qpidd_var_lib_t)

type qpidd_var_run_t;
files_pid_file(qpidd_var_run_t)

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

allow qpidd_t self:process { setsched signull };
allow qpidd_t self:fifo_file rw_fifo_file_perms;
allow qpidd_t self:sem create_sem_perms;
allow qpidd_t self:shm create_shm_perms;
allow qpidd_t self:tcp_socket { accept listen };
allow qpidd_t self:unix_stream_socket { accept listen };

manage_dirs_pattern(qpidd_t, qpidd_tmp_t, qpidd_tmp_t)
manage_files_pattern(qpidd_t, qpidd_tmp_t, qpidd_tmp_t)
files_tmp_filetrans(qpidd_t, qpidd_tmp_t, { dir file })

manage_dirs_pattern(qpidd_t, qpidd_tmpfs_t, qpidd_tmpfs_t)
manage_files_pattern(qpidd_t, qpidd_tmpfs_t, qpidd_tmpfs_t)
fs_tmpfs_filetrans(qpidd_t, qpidd_tmpfs_t, { dir file })

manage_dirs_pattern(qpidd_t, qpidd_var_lib_t,  qpidd_var_lib_t)
manage_files_pattern(qpidd_t, qpidd_var_lib_t,  qpidd_var_lib_t)
manage_lnk_files_pattern(qpidd_t, qpidd_var_lib_t,  qpidd_var_lib_t)
files_var_lib_filetrans(qpidd_t, qpidd_var_lib_t, { file dir lnk_file })
allow qpidd_t qpidd_var_lib_t:file map;

manage_dirs_pattern(qpidd_t, qpidd_var_run_t,  qpidd_var_run_t)
manage_files_pattern(qpidd_t, qpidd_var_run_t,  qpidd_var_run_t)
files_pid_filetrans(qpidd_t, qpidd_var_run_t, { file dir })

kernel_read_system_state(qpidd_t)
kernel_read_network_state(qpidd_t)

auth_read_passwd(qpidd_t)

corenet_all_recvfrom_netlabel(qpidd_t)
corenet_tcp_bind_generic_node(qpidd_t)
corenet_tcp_sendrecv_generic_if(qpidd_t)
corenet_tcp_sendrecv_generic_node(qpidd_t)

corenet_sendrecv_amqp_server_packets(qpidd_t)
corenet_tcp_bind_amqp_port(qpidd_t)
corenet_tcp_sendrecv_amqp_port(qpidd_t)
corenet_tcp_connect_amqp_port(qpidd_t)

corenet_tcp_bind_matahari_port(qpidd_t)
corenet_tcp_connect_matahari_port(qpidd_t)

dev_read_sysfs(qpidd_t)
dev_read_urand(qpidd_t)
dev_read_rand(qpidd_t)

# needed by ssl
files_list_tmp(qpidd_t)

fs_getattr_all_fs(qpidd_t)

logging_send_syslog_msg(qpidd_t)

sysnet_dns_name_resolve(qpidd_t)

optional_policy(`
    kerberos_use(qpidd_t)
')

optional_policy(`
	rhcs_stream_connect_cluster(qpidd_t)
')

