# Copyright (C) 2005 Tresys Technology, LLC ######################################## # # cron_per_userdomain_template(domain) # define(`cron_per_userdomain_template',` # Type of user crontabs once moved to cron spool. type $1_cron_spool_t; files_make_file($1_cron_spool_t) type $1_crond_t; # user_crond_domain; domain_make_domain($1_crond_t); corecommands_make_shell_entrypoint($1_crond_t) role $1_r types $1_crond_t; allow $1_crond_t self:capability dac_override; allow $1_crond_t self:process { sigkill sigstop signull signal setsched }; allow $1_crond_t self:fifo_file { read getattr write append }; allow $1_crond_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept }; allow $1_crond_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown }; # The entrypoint interface is not used as this is not # a regular entrypoint. Since crontab files are # not directly executed, crond must ensure that # the crontab file has a type that is appropriate # for the domain of the user cron job. It # performs an entrypoint permission check # for this purpose. allow $1_crond_t $1_cron_spool_t:file entrypoint; ifdef(`fcron.te', ` allow crond_t $1_cron_spool_t:file { create ioctl read getattr lock write setattr append link unlink rename }; ') kernel_read_system_state($1_crond_t) kernel_read_kernel_sysctl($1_crond_t) corenetwork_network_tcp_on_all_interfaces($1_crond_t) corenetwork_network_raw_on_all_interfaces($1_crond_t) corenetwork_network_udp_on_all_interfaces($1_crond_t) corenetwork_network_tcp_on_all_nodes($1_crond_t) corenetwork_network_raw_on_all_nodes($1_crond_t) corenetwork_network_udp_on_all_nodes($1_crond_t) corenetwork_network_tcp_on_all_ports($1_crond_t) corenetwork_network_udp_on_all_ports($1_crond_t) corenetwork_bind_tcp_on_all_nodes($1_crond_t) corenetwork_bind_udp_on_all_nodes($1_crond_t) devices_get_pseudorandom_data($1_crond_t) filesystem_get_all_filesystems_attributes($1_crond_t) domain_execute_all_entrypoint_programs($1_crond_t) files_read_general_application_resources($1_crond_t) files_execute_system_config_script($1_crond_t) corecommands_execute_general_programs($1_crond_t) corecommands_execute_system_programs($1_crond_t) libraries_use_dynamic_loader($1_crond_t) libraries_read_shared_libraries($1_crond_t) libraries_execute_library_scripts($1_crond_t) files_read_runtime_system_config($1_crond_t) selinux_read_config($1_crond_t) miscfiles_read_localization($1_crond_t) ifdef(`TODO',` # Access user files and dirs. allow $1_crond_t home_root_t:dir search; file_type_auto_trans($1_crond_t, $1_home_dir_t, $1_home_t) # Run scripts in user home directory and access shared libs. can_exec($1_crond_t, $1_home_t) file_type_auto_trans($1_crond_t, tmp_t, $1_tmp_t) # Permit a transition from the crond_t domain to this domain. # The transition is requested explicitly by the modified crond # via execve_secure. There is no way to set up an automatic # transition, since crontabs are configuration files, not executables. domain_trans(crond_t, shell_exec_t, $1_crond_t) ifdef(`mta.te', ` domain_auto_trans($1_crond_t, sendmail_exec_t, $1_mail_t) allow $1_crond_t sendmail_exec_t:lnk_file { getattr read }; # $1_mail_t should only be reading from the cron fifo not needing to write dontaudit $1_mail_t crond_t:fifo_file write; allow mta_user_agent $1_crond_t:fd use; ') # This domain is granted permissions common to most domains. can_ypbind($1_crond_t) allow $1_crond_t var_spool_t:dir search; allow $1_crond_t var_t:dir r_dir_perms; allow $1_crond_t var_t:file { getattr read ioctl }; allow $1_crond_t var_log_t:dir search; can_exec($1_crond_t, ld_so_t) # ps does not need to access /boot when run from cron dontaudit $1_crond_t boot_t:dir search; # quiet other ps operations dontaudit $1_crond_t domain:dir { getattr search }; # for nscd dontaudit $1_crond_t var_run_t:dir search; ') dnl endif TODO ')