policy_module(pesign, 1.0.0)

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

type pesign_t;
type pesign_exec_t;
init_daemon_domain(pesign_t, pesign_exec_t)

type pesign_var_run_t;
files_pid_file(pesign_var_run_t)

type pesign_unit_file_t;
systemd_unit_file(pesign_unit_file_t)

type pesign_tmp_t;
files_tmp_file(pesign_tmp_t)

########################################
#
# pesign local policy
#

allow pesign_t self:capability { dac_read_search dac_override setgid setuid };
allow pesign_t self:process setsched;
allow pesign_t self:fifo_file rw_fifo_file_perms;
allow pesign_t self:unix_stream_socket create_stream_socket_perms;
allow pesign_t self:netlink_kobject_uevent_socket create_socket_perms;

manage_dirs_pattern(pesign_t, pesign_var_run_t, pesign_var_run_t)
manage_files_pattern(pesign_t, pesign_var_run_t, pesign_var_run_t)
manage_lnk_files_pattern(pesign_t, pesign_var_run_t, pesign_var_run_t)
manage_sock_files_pattern(pesign_t, pesign_var_run_t, pesign_var_run_t)
files_pid_filetrans(pesign_t, pesign_var_run_t, { file dir })

manage_dirs_pattern(pesign_t, pesign_tmp_t, pesign_tmp_t)
manage_files_pattern(pesign_t, pesign_tmp_t, pesign_tmp_t)
files_tmp_filetrans(pesign_t, pesign_tmp_t, { file dir })

dev_read_urand(pesign_t)
dev_read_rand(pesign_t)

files_dontaudit_list_tmp(pesign_t)

fs_getattr_all_fs(pesign_t)

auth_use_nsswitch(pesign_t)

logging_send_syslog_msg(pesign_t)

miscfiles_read_certs(pesign_t)
miscfiles_read_localization(pesign_t)

optional_policy(`
    bind_rw_cache(pesign_t)
')

optional_policy(`
    gnome_list_home_config(pesign_t)
')
