policy_module(loadkeys, 1.9.0)

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

attribute_role loadkeys_roles;

type loadkeys_t;
type loadkeys_exec_t;
init_system_domain(loadkeys_t, loadkeys_exec_t)
role loadkeys_roles types loadkeys_t;

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

allow loadkeys_t self:capability {  dac_read_search setuid sys_tty_config };
allow loadkeys_t self:fifo_file rw_fifo_file_perms;

kernel_read_system_state(loadkeys_t)

corecmd_exec_bin(loadkeys_t)
corecmd_exec_shell(loadkeys_t)

files_read_etc_runtime_files(loadkeys_t)

term_dontaudit_use_console(loadkeys_t)
term_use_unallocated_ttys(loadkeys_t)

auth_read_passwd(loadkeys_t)

init_dontaudit_use_fds(loadkeys_t)
init_dontaudit_use_script_ptys(loadkeys_t)

locallogin_use_fds(loadkeys_t)

userdom_use_user_ttys(loadkeys_t)
userdom_list_user_home_content(loadkeys_t)

ifdef(`hide_broken_symptoms',`
	dev_dontaudit_rw_lvm_control(loadkeys_t)
')

optional_policy(`
	keyboardd_read_pipes(loadkeys_t)
')

optional_policy(`
	nscd_dontaudit_search_pid(loadkeys_t)
')

optional_policy(`
    sssd_read_public_files(loadkeys_t)
    sssd_stream_connect(loadkeys_t)
')
