Chris PeBenito ed3a1f
policy_module(cron, 2.2.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
gen_require(`
Chris PeBenito 17de1b
	class passwd rootok;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Allow system cron jobs to relabel filesystem
Chris PeBenito 56e1b3
## for restoring file contexts.
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(cron_can_relabel, false)
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Enable extra rules in the cron domain
Chris PeBenito 56e1b3
## to support fcron.
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(fcron_crond, false)
Chris PeBenito 56e1b3
Chris PeBenito 17de1b
attribute cron_spool_type;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type anacron_exec_t;
Chris PeBenito d46cfe
application_executable_file(anacron_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type cron_spool_t;
Chris PeBenito 17de1b
files_type(cron_spool_t)
Chris PeBenito 17de1b
Chris PeBenito e2b84e
# var/lib files
Chris PeBenito e2b84e
type cron_var_lib_t;
Chris PeBenito e2b84e
files_type(cron_var_lib_t)
Chris PeBenito e2b84e
Chris PeBenito c61b35
type cron_var_run_t;
Chris PeBenito c61b35
files_type(cron_var_run_t)
Chris PeBenito c61b35
Chris PeBenito e2b84e
# var/log files
Chris PeBenito e2b84e
type cron_log_t;
Chris PeBenito e2b84e
logging_log_file(cron_log_t)
Chris PeBenito e2b84e
Chris PeBenito 296273
type cronjob_t;
Chris PeBenito 296273
typealias cronjob_t alias { user_crond_t staff_crond_t sysadm_crond_t };
Chris PeBenito 296273
typealias cronjob_t alias { auditadm_crond_t secadm_crond_t };
Chris PeBenito 296273
domain_type(cronjob_t)
Chris PeBenito 296273
domain_cron_exemption_target(cronjob_t)
Chris PeBenito 296273
corecmd_shell_entry_type(cronjob_t)
Chris PeBenito 296273
ubac_constrained(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 17de1b
type crond_t;
Chris PeBenito e070dd
type crond_exec_t;
Chris PeBenito 0bfccd
init_daemon_domain(crond_t, crond_exec_t)
Chris PeBenito 17de1b
domain_interactive_fd(crond_t)
Chris PeBenito 17de1b
domain_cron_exemption_source(crond_t)
Chris PeBenito 17de1b
Chris PeBenito c61b35
type crond_initrc_exec_t;
Chris PeBenito c61b35
init_script_file(crond_initrc_exec_t)
Chris PeBenito c61b35
Chris PeBenito 17de1b
type crond_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(crond_tmp_t)
Dan Walsh 3eaa99
files_poly_parent(crond_tmp_t)
Dan Walsh 3eaa99
mta_system_content(crond_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type crond_var_run_t;
Chris PeBenito 17de1b
files_pid_file(crond_var_run_t)
Dan Walsh 3eaa99
mta_system_content(crond_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type crontab_exec_t;
Chris PeBenito d46cfe
application_executable_file(crontab_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
cron_common_crontab_template(admin_crontab)
Chris PeBenito 296273
typealias admin_crontab_t alias sysadm_crontab_t;
Chris PeBenito 296273
typealias admin_crontab_tmp_t alias sysadm_crontab_tmp_t;
Chris PeBenito 296273
Chris PeBenito 296273
cron_common_crontab_template(crontab)
Chris PeBenito 296273
typealias crontab_t alias { user_crontab_t staff_crontab_t };
Chris PeBenito 296273
typealias crontab_t alias { auditadm_crontab_t secadm_crontab_t };
Chris PeBenito 296273
typealias crontab_tmp_t alias { user_crontab_tmp_t staff_crontab_tmp_t };
Chris PeBenito 296273
typealias crontab_tmp_t alias { auditadm_crontab_tmp_t secadm_crontab_tmp_t };
Dan Walsh 3eaa99
allow admin_crontab_t crond_t:process signal;
Chris PeBenito 296273
Chris PeBenito 17de1b
type system_cron_spool_t, cron_spool_type;
Chris PeBenito 17de1b
files_type(system_cron_spool_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
type system_cronjob_t alias system_crond_t;
Chris PeBenito 296273
init_daemon_domain(system_cronjob_t, anacron_exec_t)
Chris PeBenito 296273
corecmd_shell_entry_type(system_cronjob_t)
Chris PeBenito 296273
role system_r types system_cronjob_t;
Dan Walsh 3eaa99
domtrans_pattern(crond_t, anacron_exec_t, system_cronjob_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
type system_cronjob_lock_t alias system_crond_lock_t;
Chris PeBenito 296273
files_lock_file(system_cronjob_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
type system_cronjob_tmp_t alias system_crond_tmp_t;
Chris PeBenito 296273
files_tmp_file(system_cronjob_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito e070dd
ifdef(`enable_mcs',`
Chris PeBenito 3f67f7
	init_ranged_daemon_domain(crond_t, crond_exec_t, s0 - mcs_systemhigh)
Chris PeBenito e070dd
')
Chris PeBenito e070dd
Chris PeBenito 296273
type unconfined_cronjob_t;
Chris PeBenito 296273
domain_type(unconfined_cronjob_t)
Chris PeBenito 2a7773
domain_cron_exemption_target(unconfined_cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
# Type of user crontabs once moved to cron spool.
Chris PeBenito 296273
type user_cron_spool_t, cron_spool_type;
Chris PeBenito c61b35
typealias user_cron_spool_t alias { staff_cron_spool_t sysadm_cron_spool_t unconfined_cron_spool_t };
Chris PeBenito 296273
typealias user_cron_spool_t alias { auditadm_cron_spool_t secadm_cron_spool_t };
Chris PeBenito 296273
files_type(user_cron_spool_t)
Chris PeBenito 296273
ubac_constrained(user_cron_spool_t)
Dan Walsh 3eaa99
mta_system_content(user_cron_spool_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type system_cronjob_var_lib_t;
Dan Walsh 3eaa99
files_type(system_cronjob_var_lib_t)
Dan Walsh 3eaa99
typealias system_cronjob_var_lib_t alias system_crond_var_lib_t;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type system_cronjob_var_run_t;
Dan Walsh 3eaa99
files_pid_file(system_cronjob_var_run_t)
Chris PeBenito 296273
Chris PeBenito 296273
########################################
Chris PeBenito 296273
#
Chris PeBenito 296273
# Admin crontab local policy
Chris PeBenito 296273
#
Chris PeBenito 296273
Chris PeBenito 296273
# Allow our crontab domain to unlink a user cron spool file.
Chris PeBenito 296273
allow admin_crontab_t user_cron_spool_t:file { getattr read unlink };
Chris PeBenito 296273
Chris PeBenito 296273
# Manipulate other users crontab.
Chris PeBenito 296273
selinux_get_fs_mount(admin_crontab_t)
Chris PeBenito 296273
selinux_validate_context(admin_crontab_t)
Chris PeBenito 296273
selinux_compute_access_vector(admin_crontab_t)
Chris PeBenito 296273
selinux_compute_create_context(admin_crontab_t)
Chris PeBenito 296273
selinux_compute_relabel_context(admin_crontab_t)
Chris PeBenito 296273
selinux_compute_user_contexts(admin_crontab_t)
Chris PeBenito 296273
Chris PeBenito 296273
tunable_policy(`fcron_crond', `
Chris PeBenito 296273
	# fcron wants an instant update of a crontab change for the administrator
Chris PeBenito 296273
	# also crontab does a security check for crontab -u
Chris PeBenito 296273
	allow admin_crontab_t self:process setfscreate;
Chris PeBenito 296273
')
Chris PeBenito 296273
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 296273
# Cron daemon local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito c61b35
allow crond_t self:capability { dac_override setgid setuid sys_nice dac_read_search };
Chris PeBenito 17de1b
dontaudit crond_t self:capability { sys_resource sys_tty_config };
Dan Walsh 3eaa99
allow crond_t self:process ~{ ptrace setcurrent setexec setfscreate execmem execstack execheap };
Chris PeBenito 17de1b
allow crond_t self:process { setexec setfscreate };
Chris PeBenito 17de1b
allow crond_t self:fd use;
Chris PeBenito c0868a
allow crond_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow crond_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow crond_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow crond_t self:unix_dgram_socket sendto;
Chris PeBenito 17de1b
allow crond_t self:unix_stream_socket connectto;
Chris PeBenito 17de1b
allow crond_t self:shm create_shm_perms;
Chris PeBenito 17de1b
allow crond_t self:sem create_sem_perms;
Chris PeBenito 17de1b
allow crond_t self:msgq create_msgq_perms;
Chris PeBenito 17de1b
allow crond_t self:msg { send receive };
Chris PeBenito d6d16b
allow crond_t self:key { search write link };
Chris PeBenito 17de1b
Chris PeBenito c61b35
manage_files_pattern(crond_t, cron_log_t, cron_log_t)
Chris PeBenito c61b35
logging_log_filetrans(crond_t, cron_log_t, file)
Chris PeBenito c61b35
Chris PeBenito c61b35
manage_files_pattern(crond_t, crond_var_run_t, crond_var_run_t)
Chris PeBenito 3f67f7
files_pid_filetrans(crond_t, crond_var_run_t, file)
Chris PeBenito 17de1b
Chris PeBenito c61b35
manage_files_pattern(crond_t, cron_spool_t, cron_spool_t)
Chris PeBenito c0868a
Chris PeBenito 0bfccd
manage_dirs_pattern(crond_t, crond_tmp_t, crond_tmp_t)
Chris PeBenito 0bfccd
manage_files_pattern(crond_t, crond_tmp_t, crond_tmp_t)
Chris PeBenito 0bfccd
files_tmp_filetrans(crond_t, crond_tmp_t, { file dir })
Chris PeBenito 350b6a
Chris PeBenito c61b35
list_dirs_pattern(crond_t, system_cron_spool_t, system_cron_spool_t)
Chris PeBenito c61b35
read_files_pattern(crond_t, system_cron_spool_t, system_cron_spool_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(crond_t)
Chris PeBenito c61b35
kernel_read_fs_sysctls(crond_t)
Chris PeBenito d9845a
kernel_search_key(crond_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
dev_read_sysfs(crond_t)
Chris PeBenito 17de1b
selinux_get_fs_mount(crond_t)
Chris PeBenito 17de1b
selinux_validate_context(crond_t)
Chris PeBenito 17de1b
selinux_compute_access_vector(crond_t)
Chris PeBenito 17de1b
selinux_compute_create_context(crond_t)
Chris PeBenito 17de1b
selinux_compute_relabel_context(crond_t)
Chris PeBenito 17de1b
selinux_compute_user_contexts(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_urand(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(crond_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(crond_t)
Chris PeBenito c61b35
fs_list_inotifyfs(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# need auth_chkpwd to check for locked accounts.
Chris PeBenito 17de1b
auth_domtrans_chk_passwd(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_shell(crond_t)
Chris PeBenito 8021cb
corecmd_list_bin(crond_t)
Chris PeBenito 8021cb
corecmd_read_bin_symlinks(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(crond_t)
Dan Walsh 3eaa99
domain_subj_id_change_exemption(crond_t)
Dan Walsh 3eaa99
domain_role_change_exemption(crond_t)
Chris PeBenito 17de1b
Chris PeBenito c61b35
files_read_usr_files(crond_t)
Chris PeBenito c61b35
files_read_etc_runtime_files(crond_t)
Chris PeBenito 17de1b
files_read_etc_files(crond_t)
Chris PeBenito 17de1b
files_read_generic_spool(crond_t)
Chris PeBenito 17de1b
files_list_usr(crond_t)
Chris PeBenito 17de1b
# Read from /var/spool/cron.
Chris PeBenito 17de1b
files_search_var_lib(crond_t)
Chris PeBenito 17de1b
files_search_default(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_rw_utmp(crond_t)
Chris PeBenito c61b35
init_spec_domtrans_script(crond_t)
Chris PeBenito 17de1b
Chris PeBenito c0cf6e
auth_use_nsswitch(crond_t)
Chris PeBenito c0cf6e
Dan Walsh 3eaa99
logging_send_audit_msgs(crond_t)
Chris PeBenito 17de1b
logging_send_syslog_msg(crond_t)
Dan Walsh 3eaa99
logging_set_loginuid(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_read_config(crond_t)
Chris PeBenito 17de1b
seutil_read_default_contexts(crond_t)
Chris PeBenito 17de1b
seutil_sigchld_newrole(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(crond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_unpriv_users_fds(crond_t)
Chris PeBenito 17de1b
# Not sure why this is needed
Chris PeBenito 296273
userdom_list_user_home_dirs(crond_t)
Dan Walsh 3eaa99
userdom_create_all_users_keys(crond_t)
Chris PeBenito 17de1b
Chris PeBenito a5e213
mta_send_mail(crond_t)
Dan Walsh 3eaa99
mta_system_content(cron_spool_t)
Chris PeBenito a5e213
Chris PeBenito 73ca55
ifdef(`distro_debian',`
Chris PeBenito 74d920
	# pam_limits is used
Chris PeBenito 74d920
	allow crond_t self:process setrlimit;
Chris PeBenito 74d920
Chris PeBenito 73ca55
	optional_policy(`
Chris PeBenito 73ca55
		# Debian logcheck has the home dir set to its cache
Chris PeBenito 73ca55
		logwatch_search_cache_dir(crond_t)
Chris PeBenito 73ca55
	')
Chris PeBenito 73ca55
')
Chris PeBenito 73ca55
Chris PeBenito 17de1b
ifdef(`distro_redhat', `
Chris PeBenito 17de1b
	# Run the rpm program in the rpm_t domain. Allow creation of RPM log files
Chris PeBenito 17de1b
	# via redirection of standard out.
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		rpm_manage_log(crond_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Dan Walsh 3eaa99
tunable_policy(`allow_polyinstantiation',`
Dan Walsh 3eaa99
	files_polyinstantiate_all(crond_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	apache_search_sys_content(crond_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
    djbdns_search_tinydns_keys(crond_t)
Dan Walsh 3eaa99
    djbdns_link_tinydns_keys(crond_t)
Chris PeBenito c61b35
')
Chris PeBenito c61b35
Chris PeBenito d6d16b
optional_policy(`
Chris PeBenito d6d16b
	locallogin_search_keys(crond_t)
Chris PeBenito d6d16b
	locallogin_link_keys(crond_t)
Chris PeBenito d6d16b
')
Chris PeBenito d6d16b
Chris PeBenito c61b35
optional_policy(`
Dan Walsh 3eaa99
	# these should probably be unconfined_crond_t
Dan Walsh 3eaa99
	dbus_system_bus_client(crond_t)
Dan Walsh 3eaa99
	init_dbus_send_script(crond_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	mono_domtrans(crond_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
tunable_policy(`fcron_crond', `
Dan Walsh 3eaa99
	allow crond_t system_cron_spool_t:file manage_file_perms;
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Chris PeBenito c61b35
	amanda_search_var_lib(crond_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	amavis_search_lib(crond_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito c61b35
	hal_dbus_chat(crond_t)
Dan Walsh 3eaa99
	hal_write_log(crond_t)
Dan Walsh 3eaa99
	hal_dbus_chat(system_cronjob_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	# cjp: why?
Chris PeBenito 17de1b
	munin_search_lib(crond_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito c61b35
	rpc_search_nfs_state_data(crond_t)
Chris PeBenito c61b35
')
Chris PeBenito c61b35
Chris PeBenito c61b35
optional_policy(`
Chris PeBenito 17de1b
	# Commonly used from postinst scripts
Chris PeBenito 17de1b
	rpm_read_pipes(crond_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	# allow crond to find /usr/lib/postgresql/bin/do.maintenance
Chris PeBenito 17de1b
	postgresql_search_db(crond_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(crond_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Dan Walsh 0a394b
optional_policy(`
Dan Walsh 0a394b
	vnstatd_search_lib(crond_t)
Dan Walsh 0a394b
')
Dan Walsh 0a394b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# System cron process domain
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito c61b35
allow system_cronjob_t self:capability { dac_override dac_read_search chown setgid setuid fowner net_bind_service fsetid sys_nice };
Dan Walsh 3eaa99
dontaudit system_cronjob_t self:capability sys_ptrace;
Dan Walsh 3eaa99
Chris PeBenito c61b35
allow system_cronjob_t self:process { signal_perms getsched setsched };
Chris PeBenito 296273
allow system_cronjob_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 296273
allow system_cronjob_t self:passwd rootok;
Chris PeBenito 350b6a
Chris PeBenito e2b84e
# This is to handle creation of files in /var/log directory.
Chris PeBenito e2b84e
#  Used currently by rpm script log files
Chris PeBenito 296273
allow system_cronjob_t cron_log_t:file manage_file_perms;
Chris PeBenito 296273
logging_log_filetrans(system_cronjob_t, cron_log_t, file)
Chris PeBenito e2b84e
Chris PeBenito e2b84e
# This is to handle /var/lib/misc directory.  Used currently
Chris PeBenito e2b84e
# by prelink var/lib files for cron 
Dan Walsh 3eaa99
allow system_cronjob_t cron_var_lib_t:file { manage_file_perms relabelfrom relabelto };
Chris PeBenito 296273
files_var_lib_filetrans(system_cronjob_t, cron_var_lib_t, file)
Chris PeBenito e2b84e
Dan Walsh 3eaa99
allow system_cronjob_t cron_var_run_t:file manage_file_perms;
Dan Walsh 3eaa99
files_pid_filetrans(system_cronjob_t, cron_var_run_t, file)
Dan Walsh 3eaa99
Chris PeBenito 296273
allow system_cronjob_t system_cron_spool_t:file read_file_perms;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
# anacron forces the following
Dan Walsh 3eaa99
manage_files_pattern(system_cronjob_t, system_cron_spool_t, system_cron_spool_t)
Dan Walsh 3eaa99
Chris PeBenito 350b6a
# The entrypoint interface is not used as this is not
Chris PeBenito 350b6a
# a regular entrypoint.  Since crontab files are
Chris PeBenito 350b6a
# not directly executed, crond must ensure that
Chris PeBenito 350b6a
# the crontab file has a type that is appropriate
Chris PeBenito 350b6a
# for the domain of the user cron job.  It
Chris PeBenito 350b6a
# performs an entrypoint permission check
Chris PeBenito 350b6a
# for this purpose.
Chris PeBenito 296273
allow system_cronjob_t system_cron_spool_t:file entrypoint;
Chris PeBenito 350b6a
Chris PeBenito 350b6a
# Permit a transition from the crond_t domain to this domain.
Chris PeBenito 350b6a
# The transition is requested explicitly by the modified crond 
Chris PeBenito 350b6a
# via setexeccon.  There is no way to set up an automatic
Chris PeBenito 350b6a
# transition, since crontabs are configuration files, not executables.
Chris PeBenito 296273
allow crond_t system_cronjob_t:process transition;
Chris PeBenito 296273
dontaudit crond_t system_cronjob_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 296273
allow crond_t system_cronjob_t:fd use;
Chris PeBenito 296273
allow system_cronjob_t crond_t:fd use;
Chris PeBenito 296273
allow system_cronjob_t crond_t:fifo_file rw_file_perms;
Chris PeBenito 296273
allow system_cronjob_t crond_t:process sigchld;
Dan Walsh 3eaa99
allow crond_t system_cronjob_t:key manage_key_perms;
Chris PeBenito 350b6a
Chris PeBenito 350b6a
# Write /var/lock/makewhatis.lock.
Chris PeBenito 296273
allow system_cronjob_t system_cronjob_lock_t:file manage_file_perms;
Chris PeBenito 3f67f7
files_lock_filetrans(system_cronjob_t, system_cronjob_lock_t, file)
Chris PeBenito 350b6a
Chris PeBenito 350b6a
# write temporary files
Chris PeBenito 296273
manage_files_pattern(system_cronjob_t, crond_tmp_t, system_cronjob_tmp_t)
Chris PeBenito 296273
manage_lnk_files_pattern(system_cronjob_t, crond_tmp_t, system_cronjob_tmp_t)
Chris PeBenito 296273
filetrans_pattern(system_cronjob_t, crond_tmp_t, system_cronjob_tmp_t, { file lnk_file })
Chris PeBenito 296273
files_tmp_filetrans(system_cronjob_t, system_cronjob_tmp_t, file)
Chris PeBenito 17de1b
Dan Walsh 3eaa99
# var/lib files for system_crond
Dan Walsh 3eaa99
files_search_var_lib(system_cronjob_t)
Dan Walsh 3eaa99
manage_files_pattern(system_cronjob_t, system_cronjob_var_lib_t, system_cronjob_var_lib_t)
Dan Walsh 3eaa99
Chris PeBenito 350b6a
# Read from /var/spool/cron.
Chris PeBenito 296273
allow system_cronjob_t cron_spool_t:dir list_dir_perms;
Dan Walsh 3eaa99
allow system_cronjob_t cron_spool_t:file rw_file_perms;
Chris PeBenito 350b6a
Chris PeBenito 296273
kernel_read_kernel_sysctls(system_cronjob_t)
Chris PeBenito 296273
kernel_read_system_state(system_cronjob_t)
Chris PeBenito 296273
kernel_read_software_raid_state(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 350b6a
# ps does not need to access /boot when run from cron
Chris PeBenito 296273
files_dontaudit_search_boot(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
corecmd_exec_all_executables(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
corenet_all_recvfrom_unlabeled(system_cronjob_t)
Chris PeBenito 296273
corenet_all_recvfrom_netlabel(system_cronjob_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(system_cronjob_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(system_cronjob_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(system_cronjob_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(system_cronjob_t)
Chris PeBenito 296273
corenet_tcp_sendrecv_all_ports(system_cronjob_t)
Chris PeBenito 296273
corenet_udp_sendrecv_all_ports(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
dev_getattr_all_blk_files(system_cronjob_t)
Chris PeBenito 296273
dev_getattr_all_chr_files(system_cronjob_t)
Chris PeBenito 296273
dev_read_urand(system_cronjob_t)
Dan Walsh 3eaa99
dev_read_sysfs(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
fs_getattr_all_fs(system_cronjob_t)
Chris PeBenito 296273
fs_getattr_all_files(system_cronjob_t)
Chris PeBenito 296273
fs_getattr_all_symlinks(system_cronjob_t)
Chris PeBenito 296273
fs_getattr_all_pipes(system_cronjob_t)
Chris PeBenito 296273
fs_getattr_all_sockets(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 350b6a
# quiet other ps operations
Chris PeBenito 296273
domain_dontaudit_read_all_domains_state(system_cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
files_exec_etc_files(system_cronjob_t)
Chris PeBenito 296273
files_read_etc_files(system_cronjob_t)
Chris PeBenito 296273
files_read_etc_runtime_files(system_cronjob_t)
Chris PeBenito 296273
files_list_all(system_cronjob_t)
Chris PeBenito 296273
files_getattr_all_dirs(system_cronjob_t)
Chris PeBenito 296273
files_getattr_all_files(system_cronjob_t)
Chris PeBenito 296273
files_getattr_all_symlinks(system_cronjob_t)
Chris PeBenito 296273
files_getattr_all_pipes(system_cronjob_t)
Chris PeBenito 296273
files_getattr_all_sockets(system_cronjob_t)
Chris PeBenito 296273
files_read_usr_files(system_cronjob_t)
Chris PeBenito 296273
files_read_var_files(system_cronjob_t)
Chris PeBenito 350b6a
# for nscd:
Chris PeBenito 296273
files_dontaudit_search_pids(system_cronjob_t)
Chris PeBenito 350b6a
# Access other spool directories like
Chris PeBenito 350b6a
# /var/spool/anacron and /var/spool/slrnpull.
Chris PeBenito 296273
files_manage_generic_spool(system_cronjob_t)
Dan Walsh 3eaa99
files_create_boot_flag(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
init_use_script_fds(system_cronjob_t)
Chris PeBenito 296273
init_read_utmp(system_cronjob_t)
Chris PeBenito 296273
init_dontaudit_rw_utmp(system_cronjob_t)
Chris PeBenito 350b6a
# prelink tells init to restart it self, we either need to allow or dontaudit
Chris PeBenito c61b35
init_telinit(system_cronjob_t)
Chris PeBenito c61b35
init_domtrans_script(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
auth_use_nsswitch(system_cronjob_t)
Chris PeBenito c0cf6e
Chris PeBenito 296273
libs_exec_lib_files(system_cronjob_t)
Chris PeBenito 296273
libs_exec_ld_so(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
logging_read_generic_logs(system_cronjob_t)
Chris PeBenito c61b35
logging_send_audit_msgs(system_cronjob_t)
Chris PeBenito 296273
logging_send_syslog_msg(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
miscfiles_read_localization(system_cronjob_t)
Chris PeBenito 296273
miscfiles_manage_man_pages(system_cronjob_t)
Chris PeBenito 350b6a
Chris PeBenito 296273
seutil_read_config(system_cronjob_t)
Chris PeBenito 17de1b
Chris PeBenito 350b6a
ifdef(`distro_redhat', `
Chris PeBenito 350b6a
	# Run the rpm program in the rpm_t domain. Allow creation of RPM log files
Dan Walsh 3eaa99
	allow crond_t system_cron_spool_t:file manage_file_perms;
Dan Walsh 3eaa99
Chris PeBenito 350b6a
	# via redirection of standard out.
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 296273
		rpm_manage_log(system_cronjob_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
tunable_policy(`cron_can_relabel',`
Chris PeBenito 296273
	seutil_domtrans_setfiles(system_cronjob_t)
Chris PeBenito 350b6a
',`
Chris PeBenito 296273
	selinux_get_fs_mount(system_cronjob_t)
Chris PeBenito 296273
	selinux_validate_context(system_cronjob_t)
Chris PeBenito 296273
	selinux_compute_access_vector(system_cronjob_t)
Chris PeBenito 296273
	selinux_compute_create_context(system_cronjob_t)
Chris PeBenito 296273
	selinux_compute_relabel_context(system_cronjob_t)
Chris PeBenito 296273
	selinux_compute_user_contexts(system_cronjob_t)
Chris PeBenito 296273
	seutil_read_file_contexts(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 350b6a
	# Needed for certwatch
Chris PeBenito 296273
	apache_exec_modules(system_cronjob_t)
Chris PeBenito 296273
	apache_read_config(system_cronjob_t)
Chris PeBenito 296273
	apache_read_log(system_cronjob_t)
Chris PeBenito 296273
	apache_read_sys_content(system_cronjob_t)
Dan Walsh 3eaa99
	apache_delete_cache_dirs(system_cronjob_t)
Dan Walsh 3eaa99
	apache_delete_cache_files(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	cyrus_manage_data(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Dan Walsh 3eaa99
	dbus_system_bus_client(system_cronjob_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	exim_read_spool_files(system_cronjob_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Chris PeBenito 296273
	ftp_read_log(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	inn_manage_log(system_cronjob_t)
Chris PeBenito 296273
	inn_manage_pid(system_cronjob_t)
Chris PeBenito 296273
	inn_read_config(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Dan Walsh 3eaa99
	livecd_read_tmp_files(system_cronjob_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Chris PeBenito c61b35
	lpd_list_spool(system_cronjob_t)
Chris PeBenito c61b35
')
Chris PeBenito c61b35
Chris PeBenito c61b35
optional_policy(`
Dan Walsh 3eaa99
	mono_domtrans(system_cronjob_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Chris PeBenito 296273
	mrtg_append_create_logs(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	mta_send_mail(system_cronjob_t)
Dan Walsh 3eaa99
	mta_system_content(system_cron_spool_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	mysql_read_config(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	postfix_read_config(system_cronjob_t)
Chris PeBenito 350b6a
')	
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	prelink_delete_cache(system_cronjob_t)
Chris PeBenito c61b35
	prelink_manage_lib(system_cronjob_t)
Chris PeBenito c61b35
	prelink_manage_log(system_cronjob_t)
Chris PeBenito c61b35
	prelink_read_cache(system_cronjob_t)
Dan Walsh 3eaa99
	prelink_relabel_lib(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	samba_read_config(system_cronjob_t)
Chris PeBenito 296273
	samba_read_log(system_cronjob_t)
Chris PeBenito 296273
	#samba_read_secrets(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 350b6a
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	slocate_create_append_log(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito c61b35
	spamassassin_manage_lib_files(system_cronjob_t)
Dan Walsh 3eaa99
	spamassassin_manage_home_client(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 296273
	sysstat_manage_log(system_cronjob_t)
Chris PeBenito 350b6a
')
Chris PeBenito 17de1b
Chris PeBenito 350b6a
optional_policy(`
Dan Walsh 3eaa99
	unconfined_domain(crond_t)
Chris PeBenito 296273
	unconfined_domain(system_cronjob_t)
Dan Walsh 9461b6
')
Dan Walsh 9461b6
Dan Walsh 9461b6
optional_policy(`
Dan Walsh 9461b6
	unconfined_shell_domtrans(crond_t)
Dan Walsh 9461b6
	unconfined_dbus_send(crond_t)
Chris PeBenito 296273
	userdom_user_home_dir_filetrans_user_home_content(system_cronjob_t, { dir file lnk_file fifo_file sock_file })
Chris PeBenito 350b6a
')
Chris PeBenito 350b6a
Chris PeBenito 296273
########################################
Chris PeBenito 296273
#
Chris PeBenito 296273
# User cronjobs local policy
Chris PeBenito 296273
#
Chris PeBenito 296273
Chris PeBenito 296273
allow cronjob_t self:process { signal_perms setsched };
Chris PeBenito 296273
allow cronjob_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 296273
allow cronjob_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 296273
allow cronjob_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 296273
Chris PeBenito 296273
# The entrypoint interface is not used as this is not
Chris PeBenito 296273
# a regular entrypoint.  Since crontab files are
Chris PeBenito 296273
# not directly executed, crond must ensure that
Chris PeBenito 296273
# the crontab file has a type that is appropriate
Chris PeBenito 296273
# for the domain of the user cron job.  It
Chris PeBenito 296273
# performs an entrypoint permission check
Chris PeBenito 296273
# for this purpose.
Chris PeBenito 296273
allow cronjob_t user_cron_spool_t:file entrypoint;
Chris PeBenito 296273
Chris PeBenito 296273
# Permit a transition from the crond_t domain to this domain.
Chris PeBenito 296273
# The transition is requested explicitly by the modified crond 
Chris PeBenito 296273
# via setexeccon.  There is no way to set up an automatic
Chris PeBenito 296273
# transition, since crontabs are configuration files, not executables.
Chris PeBenito 296273
allow crond_t cronjob_t:process transition;
Chris PeBenito 296273
dontaudit crond_t cronjob_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 296273
allow crond_t cronjob_t:fd use;
Chris PeBenito 296273
allow cronjob_t crond_t:fd use;
Chris PeBenito 296273
allow cronjob_t crond_t:fifo_file rw_file_perms;
Chris PeBenito 296273
allow cronjob_t crond_t:process sigchld;
Chris PeBenito 296273
Chris PeBenito 296273
kernel_read_system_state(cronjob_t)
Chris PeBenito 296273
kernel_read_kernel_sysctls(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
# ps does not need to access /boot when run from cron
Chris PeBenito 296273
files_dontaudit_search_boot(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
corenet_all_recvfrom_unlabeled(cronjob_t)
Chris PeBenito 296273
corenet_all_recvfrom_netlabel(cronjob_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(cronjob_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(cronjob_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(cronjob_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(cronjob_t)
Chris PeBenito 296273
corenet_tcp_sendrecv_all_ports(cronjob_t)
Chris PeBenito 296273
corenet_udp_sendrecv_all_ports(cronjob_t)
Chris PeBenito 296273
corenet_tcp_connect_all_ports(cronjob_t)
Chris PeBenito 296273
corenet_sendrecv_all_client_packets(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
dev_read_urand(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
fs_getattr_all_fs(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
corecmd_exec_all_executables(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
# quiet other ps operations
Chris PeBenito 296273
domain_dontaudit_read_all_domains_state(cronjob_t)
Chris PeBenito 296273
domain_dontaudit_getattr_all_domains(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
files_read_usr_files(cronjob_t)
Chris PeBenito 296273
files_exec_etc_files(cronjob_t)
Chris PeBenito 296273
# for nscd:
Chris PeBenito 296273
files_dontaudit_search_pids(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
libs_exec_lib_files(cronjob_t)
Chris PeBenito 296273
libs_exec_ld_so(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
files_read_etc_runtime_files(cronjob_t)
Chris PeBenito 296273
files_read_var_files(cronjob_t)
Chris PeBenito 296273
files_search_spool(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
logging_search_logs(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
seutil_read_config(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
miscfiles_read_localization(cronjob_t)
Chris PeBenito 296273
Chris PeBenito 296273
userdom_manage_user_tmp_files(cronjob_t)
Chris PeBenito 296273
userdom_manage_user_tmp_symlinks(cronjob_t)
Chris PeBenito 296273
userdom_manage_user_tmp_pipes(cronjob_t)
Chris PeBenito 296273
userdom_manage_user_tmp_sockets(cronjob_t)
Chris PeBenito 296273
# Run scripts in user home directory and access shared libs.
Chris PeBenito 296273
userdom_exec_user_home_content_files(cronjob_t)
Chris PeBenito 296273
# Access user files and dirs.
Chris PeBenito 296273
userdom_manage_user_home_content_files(cronjob_t)
Chris PeBenito 296273
userdom_manage_user_home_content_symlinks(cronjob_t)
Chris PeBenito 296273
userdom_manage_user_home_content_pipes(cronjob_t)
Chris PeBenito 296273
userdom_manage_user_home_content_sockets(cronjob_t)
Chris PeBenito 296273
#userdom_user_home_dir_filetrans_user_home_content(cronjob_t, notdevfile_class_set)
Chris PeBenito 296273
Chris PeBenito c61b35
list_dirs_pattern(crond_t, user_cron_spool_t, user_cron_spool_t)
Dan Walsh 3eaa99
rw_dirs_pattern(crond_t, user_cron_spool_t, user_cron_spool_t)
Chris PeBenito c61b35
read_files_pattern(crond_t, user_cron_spool_t, user_cron_spool_t)
Dan Walsh 3eaa99
read_lnk_files_pattern(crond_t, user_cron_spool_t, user_cron_spool_t)
Dan Walsh ee4b1e
allow crond_t user_cron_spool_t:file manage_lnk_file_perms;
Chris PeBenito c61b35
Chris PeBenito 296273
tunable_policy(`fcron_crond', `
Chris PeBenito 296273
	allow crond_t user_cron_spool_t:file manage_file_perms;
Chris PeBenito 296273
')
Chris PeBenito 296273
Chris PeBenito 296273
# need a per-role version of this:
Chris PeBenito 296273
#optional_policy(`
Chris PeBenito 296273
#	mono_domtrans(cronjob_t)
Chris PeBenito 296273
#')
Chris PeBenito 296273
Chris PeBenito 296273
optional_policy(`
Chris PeBenito 296273
	nis_use_ypbind(cronjob_t)
Chris PeBenito 296273
')
Chris PeBenito 296273
Chris PeBenito 296273
########################################
Chris PeBenito 296273
#
Chris PeBenito 296273
# Unconfined cronjobs local policy
Chris PeBenito 296273
#
Chris PeBenito 296273
Chris PeBenito 296273
optional_policy(`
Chris PeBenito 2a7773
	# Permit a transition from the crond_t domain to this domain.
Chris PeBenito 2a7773
	# The transition is requested explicitly by the modified crond 
Chris PeBenito 2a7773
	# via setexeccon.  There is no way to set up an automatic
Chris PeBenito 2a7773
	# transition, since crontabs are configuration files, not executables.
Chris PeBenito 2a7773
	allow crond_t unconfined_cronjob_t:process transition;
Chris PeBenito 2a7773
	dontaudit crond_t unconfined_cronjob_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 2a7773
	allow crond_t unconfined_cronjob_t:fd use;
Chris PeBenito 2a7773
Chris PeBenito 296273
	unconfined_domain(unconfined_cronjob_t)
Chris PeBenito 296273
')