policy_module(pkcs, 1.7.0)

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

type pkcs_slotd_t;
type pkcs_slotd_exec_t;
init_daemon_domain(pkcs_slotd_t, pkcs_slotd_exec_t)

type pkcs_slotd_initrc_exec_t;
init_script_file(pkcs_slotd_initrc_exec_t)

type pkcs_slotd_runtime_t alias pkcs_slotd_var_run_t;
files_runtime_file(pkcs_slotd_runtime_t)

type pkcs_slotd_var_lib_t;
files_type(pkcs_slotd_var_lib_t)

type pkcs_slotd_tmp_t;
files_tmp_file(pkcs_slotd_tmp_t)

type pkcs_slotd_tmpfs_t;
files_tmpfs_file(pkcs_slotd_tmpfs_t)

type pkcs_slotd_unit_t;
init_unit_file(pkcs_slotd_unit_t)

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

allow pkcs_slotd_t self:capability { chown fsetid kill };
allow pkcs_slotd_t self:fifo_file rw_fifo_file_perms;
allow pkcs_slotd_t self:sem create_sem_perms;
allow pkcs_slotd_t self:shm create_shm_perms;
allow pkcs_slotd_t self:unix_stream_socket { accept listen };

manage_dirs_pattern(pkcs_slotd_t, pkcs_slotd_var_lib_t, pkcs_slotd_var_lib_t)
manage_files_pattern(pkcs_slotd_t, pkcs_slotd_var_lib_t, pkcs_slotd_var_lib_t)
manage_lnk_files_pattern(pkcs_slotd_t, pkcs_slotd_var_lib_t, pkcs_slotd_var_lib_t)
files_var_lib_filetrans(pkcs_slotd_t, pkcs_slotd_var_lib_t, dir)

manage_dirs_pattern(pkcs_slotd_t, pkcs_slotd_runtime_t, pkcs_slotd_runtime_t)
manage_files_pattern(pkcs_slotd_t, pkcs_slotd_runtime_t, pkcs_slotd_runtime_t)
manage_sock_files_pattern(pkcs_slotd_t, pkcs_slotd_runtime_t, pkcs_slotd_runtime_t)
files_runtime_filetrans(pkcs_slotd_t, pkcs_slotd_runtime_t, { sock_file file dir })

manage_dirs_pattern(pkcs_slotd_t, pkcs_slotd_tmp_t, pkcs_slotd_tmp_t)
manage_files_pattern(pkcs_slotd_t, pkcs_slotd_tmp_t, pkcs_slotd_tmp_t)
files_tmp_filetrans(pkcs_slotd_t, pkcs_slotd_tmp_t, dir)

manage_dirs_pattern(pkcs_slotd_t, pkcs_slotd_tmpfs_t, pkcs_slotd_tmpfs_t)
manage_files_pattern(pkcs_slotd_t, pkcs_slotd_tmpfs_t, pkcs_slotd_tmpfs_t)
fs_tmpfs_filetrans(pkcs_slotd_t, pkcs_slotd_tmpfs_t, { dir file })

files_read_etc_files(pkcs_slotd_t)

auth_use_nsswitch(pkcs_slotd_t)

logging_send_syslog_msg(pkcs_slotd_t)

miscfiles_read_localization(pkcs_slotd_t)
