policy_module(dirmngr, 1.0.0)

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

type dirmngr_t;
type dirmngr_exec_t;
init_daemon_domain(dirmngr_t, dirmngr_exec_t)

type dirmngr_conf_t;
files_config_file(dirmngr_conf_t)

type dirmngr_initrc_exec_t;
init_script_file(dirmngr_initrc_exec_t)

type dirmngr_log_t;
logging_log_file(dirmngr_log_t)

type dirmngr_var_lib_t;
files_type(dirmngr_var_lib_t)

type dirmngr_var_run_t;
files_pid_file(dirmngr_var_run_t)

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

allow dirmngr_t self:fifo_file rw_file_perms;

allow dirmngr_t dirmngr_conf_t:dir list_dir_perms;
allow dirmngr_t dirmngr_conf_t:file read_file_perms;
allow dirmngr_t dirmngr_conf_t:lnk_file read_lnk_file_perms;

manage_dirs_pattern(dirmngr_t, dirmngr_log_t, dirmngr_log_t)
append_files_pattern(dirmngr_t, dirmngr_log_t, dirmngr_log_t)
create_files_pattern(dirmngr_t, dirmngr_log_t, dirmngr_log_t)
setattr_files_pattern(dirmngr_t, dirmngr_log_t, dirmngr_log_t)
logging_log_filetrans(dirmngr_t, dirmngr_log_t, dir)

manage_dirs_pattern(dirmngr_t, dirmngr_var_lib_t, dirmngr_var_lib_t)
manage_files_pattern(dirmngr_t, dirmngr_var_lib_t, dirmngr_var_lib_t)
manage_lnk_files_pattern(dirmngr_t, dirmngr_var_lib_t, dirmngr_var_lib_t)
files_var_lib_filetrans(dirmngr_t, dirmngr_var_lib_t, dir)

manage_dirs_pattern(dirmngr_t, dirmngr_var_run_t, dirmngr_var_run_t)
manage_files_pattern(dirmngr_t, dirmngr_var_run_t, dirmngr_var_run_t)
manage_sock_files_pattern(dirmngr_t, dirmngr_var_run_t, dirmngr_var_run_t)
files_pid_filetrans(dirmngr_t, dirmngr_var_run_t, { dir file })

kernel_read_crypto_sysctls(dirmngr_t)


miscfiles_read_localization(dirmngr_t)
