policy_module(rngd, 1.8.1)

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

type rngd_t;
type rngd_exec_t;
init_daemon_domain(rngd_t, rngd_exec_t)

type rngd_initrc_exec_t;
init_script_file(rngd_initrc_exec_t)

type rngd_runtime_t alias rngd_var_run_t;
files_runtime_file(rngd_runtime_t)

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

allow rngd_t self:capability { ipc_lock sys_admin };
allow rngd_t self:process { setsched getsched signal };
allow rngd_t self:fifo_file rw_fifo_file_perms;
allow rngd_t self:unix_stream_socket { accept listen };

allow rngd_t rngd_runtime_t:file manage_file_perms;
files_runtime_filetrans(rngd_t, rngd_runtime_t, file, "rngd.pid")

kernel_rw_kernel_sysctl(rngd_t)

dev_read_rand(rngd_t)
dev_read_urand(rngd_t)
dev_read_sysfs(rngd_t)
dev_rw_tpm(rngd_t)
dev_write_rand(rngd_t)

files_read_etc_files(rngd_t)

logging_send_syslog_msg(rngd_t)

miscfiles_read_localization(rngd_t)
miscfiles_read_generic_certs(rngd_t)
