policy_module(jockey, 1.0.0)

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

type jockey_t;
type jockey_exec_t;
init_daemon_domain(jockey_t, jockey_exec_t)

type jockey_cache_t;
files_type(jockey_cache_t)

type jockey_var_log_t;
logging_log_file(jockey_var_log_t)

type jockey_tmpfs_t;
files_tmpfs_file(jockey_tmpfs_t)

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

allow jockey_t self:fifo_file rw_fifo_file_perms;

manage_dirs_pattern(jockey_t, jockey_cache_t, jockey_cache_t)
manage_files_pattern(jockey_t, jockey_cache_t, jockey_cache_t)
manage_lnk_files_pattern(jockey_t, jockey_cache_t, jockey_cache_t)
files_var_filetrans(jockey_t, jockey_cache_t, { dir file })

manage_dirs_pattern(jockey_t, jockey_var_log_t, jockey_var_log_t)
append_files_pattern(jockey_t, jockey_var_log_t, jockey_var_log_t)
create_files_pattern(jockey_t, jockey_var_log_t, jockey_var_log_t)
setattr_files_pattern(jockey_t, jockey_var_log_t, jockey_var_log_t)
logging_log_filetrans(jockey_t, jockey_var_log_t, { file dir })

manage_dirs_pattern(jockey_t, jockey_tmpfs_t, jockey_tmpfs_t)
manage_files_pattern(jockey_t, jockey_tmpfs_t, jockey_tmpfs_t)
fs_tmpfs_filetrans(jockey_t, jockey_tmpfs_t, { dir file })

kernel_read_system_state(jockey_t)

corecmd_exec_bin(jockey_t)
corecmd_exec_shell(jockey_t)

dev_read_rand(jockey_t)
dev_read_sysfs(jockey_t)
dev_read_urand(jockey_t)

domain_use_interactive_fds(jockey_t)


auth_read_passwd(jockey_t)

optional_policy(`
	dbus_system_domain(jockey_t, jockey_exec_t)
')

optional_policy(`
	gnome_dontaudit_search_config(jockey_t)
')

optional_policy(`
	modutils_domtrans_kmod(jockey_t)
	modutils_read_module_config(jockey_t)
	modutils_list_module_config(jockey_t)
')
