policy_module(mirrormanager, 1.0.0)

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

type mirrormanager_t;
type mirrormanager_exec_t;
application_domain(mirrormanager_t, mirrormanager_exec_t)

type mirrormanager_log_t;
logging_log_file(mirrormanager_log_t)

type mirrormanager_var_lib_t;
files_type(mirrormanager_var_lib_t)

type mirrormanager_var_run_t;
files_pid_file(mirrormanager_var_run_t)

########################################
#
# mirrormanager local policy
#

allow mirrormanager_t self:fifo_file rw_fifo_file_perms;
allow mirrormanager_t self:unix_stream_socket create_stream_socket_perms;

manage_dirs_pattern(mirrormanager_t, mirrormanager_log_t, mirrormanager_log_t)
manage_files_pattern(mirrormanager_t, mirrormanager_log_t, mirrormanager_log_t)
manage_lnk_files_pattern(mirrormanager_t, mirrormanager_log_t, mirrormanager_log_t)
logging_log_filetrans(mirrormanager_t, mirrormanager_log_t, { dir })

manage_dirs_pattern(mirrormanager_t, mirrormanager_var_lib_t, mirrormanager_var_lib_t)
manage_files_pattern(mirrormanager_t, mirrormanager_var_lib_t, mirrormanager_var_lib_t)
manage_lnk_files_pattern(mirrormanager_t, mirrormanager_var_lib_t, mirrormanager_var_lib_t)
files_var_lib_filetrans(mirrormanager_t, mirrormanager_var_lib_t, { dir })

manage_dirs_pattern(mirrormanager_t, mirrormanager_var_run_t, mirrormanager_var_run_t)
manage_files_pattern(mirrormanager_t, mirrormanager_var_run_t, mirrormanager_var_run_t)
manage_lnk_files_pattern(mirrormanager_t, mirrormanager_var_run_t, mirrormanager_var_run_t)
files_pid_filetrans(mirrormanager_t, mirrormanager_var_run_t, { dir })

optional_policy(`
    cron_system_entry(mirrormanager_t, mirrormanager_exec_t)
')
