policy_module(speech-dispatcher, 1.0.0)

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

type speech_dispatcher_t;
type speech_dispatcher_exec_t;
typealias speech_dispatcher_t alias speech-dispatcher_t;
typealias speech_dispatcher_exec_t alias speech-dispatcher_exec_t;
init_daemon_domain(speech_dispatcher_t, speech_dispatcher_exec_t)
application_executable_file(speech_dispatcher_exec_t)

type speech_dispatcher_home_t;
typealias speech_dispatcher_home_t alias speech-dispatcher_home_t;
userdom_user_home_content(speech_dispatcher_home_t)

type speech_dispatcher_log_t;
typealias speech_dispatcher_log_t alias speech-dispatcher_log_t;
logging_log_file(speech_dispatcher_log_t)

type speech_dispatcher_unit_file_t;
typealias speech_dispatcher_unit_file_t alias speech-dispatcher_unit_file_t;
systemd_unit_file(speech_dispatcher_unit_file_t)

type speech_dispatcher_tmp_t;
typealias speech_dispatcher_tmp_t alias speech-dispatcher_tmp_t;
files_tmp_file(speech_dispatcher_tmp_t)

type speech_dispatcher_tmpfs_t;
typealias speech_dispatcher_tmpfs_t alias speech-dispatcher_tmpfs_t;
files_tmpfs_file(speech_dispatcher_tmpfs_t)

########################################
#
# speech-dispatcher local policy
#

allow speech_dispatcher_t self:process signal_perms;

allow speech_dispatcher_t self:fifo_file rw_fifo_file_perms;
allow speech_dispatcher_t self:unix_stream_socket create_stream_socket_perms;
allow speech_dispatcher_t self:tcp_socket create_socket_perms;

manage_dirs_pattern(speech_dispatcher_t, speech_dispatcher_log_t, speech_dispatcher_log_t)
manage_files_pattern(speech_dispatcher_t, speech_dispatcher_log_t, speech_dispatcher_log_t)
logging_log_filetrans(speech_dispatcher_t, speech_dispatcher_log_t, { dir })

manage_files_pattern(speech_dispatcher_t, speech_dispatcher_tmp_t, speech_dispatcher_tmp_t)
files_tmp_filetrans(speech_dispatcher_t, speech_dispatcher_tmp_t, { file })

manage_files_pattern(speech_dispatcher_t, speech_dispatcher_tmpfs_t, speech_dispatcher_tmpfs_t)
fs_tmpfs_filetrans(speech_dispatcher_t, speech_dispatcher_tmpfs_t, { file })

manage_files_pattern(speech_dispatcher_t, speech_dispatcher_home_t, speech_dispatcher_home_t)
manage_dirs_pattern(speech_dispatcher_t, speech_dispatcher_home_t, speech_dispatcher_home_t)
manage_fifo_files_pattern(speech_dispatcher_t, speech_dispatcher_home_t, speech_dispatcher_home_t)
userdom_filetrans_home_content(speech_dispatcher_t,speech_dispatcher_home_t, dir, ".speech-dispatcher")

kernel_read_system_state(speech_dispatcher_t)

auth_read_passwd(speech_dispatcher_t)

corenet_tcp_connect_pdps_port(speech_dispatcher_t)

dev_read_urand(speech_dispatcher_t)

