policy_module(tmpreaper)

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

type tmpreaper_t;
type tmpreaper_exec_t;
init_system_domain(tmpreaper_t, tmpreaper_exec_t)

########################################
#
# Local Policy
#

allow tmpreaper_t self:capability { dac_override dac_read_search fowner };
allow tmpreaper_t self:fifo_file rw_fifo_file_perms;

kernel_list_unlabeled(tmpreaper_t)
kernel_read_system_state(tmpreaper_t)

dev_read_urand(tmpreaper_t)

corecmd_exec_bin(tmpreaper_t)
corecmd_exec_shell(tmpreaper_t)

fs_getattr_xattr_fs(tmpreaper_t)
fs_list_all(tmpreaper_t)

files_getattr_all_dirs(tmpreaper_t)
files_getattr_all_files(tmpreaper_t)
files_read_var_lib_files(tmpreaper_t)
files_purge_tmp(tmpreaper_t)
files_setattr_all_tmp_dirs(tmpreaper_t)

mls_file_read_all_levels(tmpreaper_t)
mls_file_write_all_levels(tmpreaper_t)

auth_use_nsswitch(tmpreaper_t)

init_use_inherited_script_ptys(tmpreaper_t)

logging_send_syslog_msg(tmpreaper_t)

miscfiles_read_localization(tmpreaper_t)
miscfiles_delete_man_pages(tmpreaper_t)

ifdef(`distro_debian',`
	term_dontaudit_use_unallocated_ttys(tmpreaper_t)
')

ifdef(`distro_redhat',`
	userdom_list_all_user_home_content(tmpreaper_t)
	userdom_delete_all_user_home_content_dirs(tmpreaper_t)
	userdom_delete_all_user_home_content_files(tmpreaper_t)
	userdom_delete_all_user_home_content_symlinks(tmpreaper_t)
')

optional_policy(`
	amavis_manage_spool_files(tmpreaper_t)
')

optional_policy(`
	apache_list_cache(tmpreaper_t)
	apache_delete_cache_dirs(tmpreaper_t)
	apache_delete_cache_files(tmpreaper_t)
	apache_setattr_cache_dirs(tmpreaper_t)
')

optional_policy(`
	cron_system_entry(tmpreaper_t, tmpreaper_exec_t)
')

optional_policy(`
	kismet_manage_log(tmpreaper_t)
')

optional_policy(`
	lpd_manage_spool(tmpreaper_t)
')

optional_policy(`
	plymouthd_exec_plymouth(tmpreaper_t)
')

optional_policy(`
	rpm_manage_cache(tmpreaper_t)
')
