policy_module(aide, 1.7.1)

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

attribute_role aide_roles;

type aide_t;
type aide_exec_t;
application_domain(aide_t, aide_exec_t)
cron_system_entry(aide_t, aide_exec_t)
init_daemon_domain(aide_t, aide_exec_t)
role aide_roles types aide_t;

type aide_log_t;
logging_log_file(aide_log_t)

type aide_db_t;
files_type(aide_db_t)

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

allow aide_t self:capability { dac_read_search  fowner ipc_lock sys_admin };
allow aide_t self:process signal;

manage_files_pattern(aide_t, aide_db_t, aide_db_t)
files_var_lib_filetrans(aide_t, aide_db_t, { dir file })

manage_files_pattern(aide_t, aide_log_t, aide_log_t)
logging_log_filetrans(aide_t, aide_log_t, file)

dev_getattr_all_blk_files(aide_t)
dev_getattr_all_chr_files(aide_t)
dev_read_rand(aide_t)
dev_read_urand(aide_t)

files_read_all_files(aide_t)
files_mmap_all_files(aide_t)
files_read_all_symlinks(aide_t)
files_getattr_all_pipes(aide_t)
files_getattr_all_sockets(aide_t)

init_stream_connectto(aide_t)

mls_file_read_to_clearance(aide_t)
mls_file_write_to_clearance(aide_t)

logging_send_audit_msgs(aide_t)
logging_send_syslog_msg(aide_t)

userdom_use_inherited_user_terminals(aide_t)

optional_policy(`
	prelink_domtrans(aide_t)
')

optional_policy(`
	seutil_use_newrole_fds(aide_t)
')

optional_policy(`
	systemd_userdbd_stream_connect(aide_t)
')

optional_policy(`
    sssd_stream_connect(aide_t)
')

optional_policy(`
    udev_getattr_rules_chr_files(aide_t)
')
