Chris PeBenito 96ce00
Chris PeBenito 96ce00
policy_module(logrotate,1.0)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
########################################
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
# Declarations
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
Chris PeBenito 142e9f
type logrotate_t;
Chris PeBenito 96ce00
domain_type(logrotate_t)
Chris PeBenito 96ce00
domain_obj_id_change_exempt(logrotate_t)
Chris PeBenito 142e9f
domain_system_change_exempt(logrotate_t)
Chris PeBenito 96ce00
role system_r types logrotate_t;
Chris PeBenito 96ce00
Chris PeBenito 96ce00
type logrotate_exec_t;
Chris PeBenito 4483ee
domain_entry_file(logrotate_t,logrotate_exec_t)
Chris PeBenito 96ce00
Chris PeBenito 98a8ea
type logrotate_lock_t;
Chris PeBenito 98a8ea
files_lock_file(logrotate_lock_t)
Chris PeBenito 98a8ea
Chris PeBenito 96ce00
type logrotate_tmp_t;
Chris PeBenito 96ce00
files_tmp_file(logrotate_tmp_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
type logrotate_var_lib_t;
Chris PeBenito 8fd367
files_type(logrotate_var_lib_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
########################################
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
# Local policy
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
Chris PeBenito 96ce00
# Change ownership on log files.
Chris PeBenito 96ce00
allow logrotate_t self:capability { chown dac_override dac_read_search kill fsetid fowner sys_resource sys_nice };
Chris PeBenito 96ce00
# for mailx
Chris PeBenito 96ce00
dontaudit logrotate_t self:capability { setuid setgid };
Chris PeBenito 96ce00
Chris PeBenito 9d3bdc
allow logrotate_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 96ce00
Chris PeBenito 96ce00
# Set a context other than the default one for newly created files.
Chris PeBenito 96ce00
allow logrotate_t self:process setfscreate;
Chris PeBenito 96ce00
Chris PeBenito 96ce00
allow logrotate_t self:fd use;
Chris PeBenito 96ce00
allow logrotate_t self:fifo_file rw_file_perms;
Chris PeBenito 96ce00
allow logrotate_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 96ce00
allow logrotate_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 96ce00
allow logrotate_t self:unix_dgram_socket sendto;
Chris PeBenito 96ce00
allow logrotate_t self:unix_stream_socket connectto;
Chris PeBenito 96ce00
allow logrotate_t self:shm create_shm_perms;
Chris PeBenito 96ce00
allow logrotate_t self:sem create_sem_perms;
Chris PeBenito 96ce00
allow logrotate_t self:msgq create_msgq_perms;
Chris PeBenito 96ce00
allow logrotate_t self:msg { send receive };
Chris PeBenito 96ce00
Chris PeBenito 98a8ea
allow logrotate_t logrotate_lock_t:file create_file_perms;
Chris PeBenito 98a8ea
files_create_lock(logrotate_t,logrotate_lock_t)
Chris PeBenito 98a8ea
Chris PeBenito 96ce00
can_exec(logrotate_t, logrotate_tmp_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
allow logrotate_t logrotate_tmp_t:dir create_dir_perms;
Chris PeBenito 96ce00
allow logrotate_t logrotate_tmp_t:file create_file_perms;
Chris PeBenito 96ce00
files_create_tmp_files(logrotate_t, logrotate_tmp_t, { file dir })
Chris PeBenito 96ce00
Chris PeBenito 5a2649
# for /var/lib/logrotate.status and /var/lib/logcheck
Chris PeBenito 96ce00
allow logrotate_t logrotate_var_lib_t:dir { create rw_dir_perms };
Chris PeBenito 5a2649
allow logrotate_t logrotate_var_lib_t:file create_file_perms;
Chris PeBenito 5a2649
files_create_var_lib(logrotate_t, logrotate_var_lib_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
kernel_read_system_state(logrotate_t)
Chris PeBenito 96ce00
kernel_read_kernel_sysctl(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
dev_read_urand(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
fs_search_auto_mountpoints(logrotate_t)
Chris PeBenito 96ce00
fs_getattr_xattr_fs(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
selinux_get_fs_mount(logrotate_t)
Chris PeBenito a08248
selinux_get_enforce_mode(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
auth_manage_login_records(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
# Run helper programs.
Chris PeBenito 96ce00
corecmd_exec_bin(logrotate_t)
Chris PeBenito 96ce00
corecmd_exec_sbin(logrotate_t)
Chris PeBenito 96ce00
corecmd_exec_shell(logrotate_t)
Chris PeBenito 96ce00
corecmd_exec_ls(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
domain_signal_all_domains(logrotate_t)
Chris PeBenito 96ce00
domain_use_wide_inherit_fd(logrotate_t)
Chris PeBenito 5a2649
domain_getattr_all_entry_files(logrotate_t)
Chris PeBenito 3774e4
# Read /proc/PID directories for all domains.
Chris PeBenito 3774e4
domain_read_all_domains_state(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
files_read_usr_files(logrotate_t)
Chris PeBenito 8fd367
files_read_etc_files(logrotate_t)
Chris PeBenito 96ce00
files_read_etc_runtime_files(logrotate_t)
Chris PeBenito 96ce00
files_read_all_pids(logrotate_t)
Chris PeBenito 96ce00
# Write to /var/spool/slrnpull - should be moved into its own type.
Chris PeBenito 8fd367
files_manage_generic_spools(logrotate_t)
Chris PeBenito 8fd367
files_manage_generic_spool_dirs(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
# cjp: why is this needed?
Chris PeBenito 96ce00
init_domtrans_script(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
logging_manage_all_logs(logrotate_t)
Chris PeBenito 5a2649
logging_send_syslog_msg(logrotate_t)
Chris PeBenito 96ce00
# cjp: why is this needed?
Chris PeBenito 96ce00
logging_exec_all_logs(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
libs_use_ld_so(logrotate_t)
Chris PeBenito 96ce00
libs_use_shared_libs(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
miscfiles_read_localization(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito a08248
seutil_dontaudit_read_config(logrotate_t)
Chris PeBenito 5a2649
Chris PeBenito 96ce00
sysnet_read_config(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
userdom_use_unpriv_users_fd(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
cron_system_entry(logrotate_t, logrotate_exec_t)
Chris PeBenito 96ce00
cron_search_spool(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
mta_send_mail(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
ifdef(`distro_debian', `
Chris PeBenito 96ce00
	allow logrotate_t logrotate_tmp_t:file { relabelfrom relabelto };
Chris PeBenito 96ce00
	# for savelog
Chris PeBenito 96ce00
	can_exec(logrotate_t, logrotate_exec_t)
Chris PeBenito 142e9f
')
Chris PeBenito 142e9f
Chris PeBenito 142e9f
ifdef(`targeted_policy',`
Chris PeBenito 142e9f
	unconfined_domain_template(logrotate_t)
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 9a66d4
optional_policy(`acct.te',`
Chris PeBenito 9a66d4
	acct_domtrans(logrotate_t)
Chris PeBenito 9a66d4
	acct_manage_data(logrotate_t)
Chris PeBenito 9a66d4
	acct_exec_data(logrotate_t)
Chris PeBenito 9a66d4
')
Chris PeBenito 9a66d4
Chris PeBenito a996bd
optional_policy(`apache.te',`
Chris PeBenito a996bd
	apache_read_config(logrotate_t)
Chris PeBenito a996bd
	apache_domtrans(logrotate_t)
Chris PeBenito a996bd
	apache_signull(logrotate_t)
Chris PeBenito a996bd
')
Chris PeBenito a996bd
Chris PeBenito 96ce00
optional_policy(`consoletype.te',`
Chris PeBenito 96ce00
	consoletype_exec(logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 2705f9
optional_policy(`hostname.te',`
Chris PeBenito 2705f9
	hostname_exec(logrotate_t)
Chris PeBenito 2705f9
')
Chris PeBenito 2705f9
Chris PeBenito 84c922
optional_policy(`samba.te',`
Chris PeBenito 84c922
	samba_exec_log(logrotate_t)
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 799a0b
optional_policy(`mailman.te',`
Chris PeBenito 799a0b
	mailman_exec(logrotate_t)
Chris PeBenito 799a0b
	mailman_search_data(logrotate_t)
Chris PeBenito 799a0b
	mailman_manage_log(logrotate_t)
Chris PeBenito 799a0b
')
Chris PeBenito 799a0b
Chris PeBenito 42be7c
optional_policy(`mysql.te',`
Chris PeBenito 42be7c
	mysql_read_config(logrotate_t)
Chris PeBenito 42be7c
	mysql_search_db_dir(logrotate_t)
Chris PeBenito 42be7c
	mysql_stream_connect(logrotate_t)
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
Chris PeBenito 96ce00
optional_policy(`nis.te',`
Chris PeBenito 96ce00
	nis_use_ypbind(logrotate_t)
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 493d6c
optional_policy(`nscd.te',`
Chris PeBenito 493d6c
	nscd_use_socket(logrotate_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito 0f707d
optional_policy(`squid.te',`
Chris PeBenito 0f707d
	# cjp: why?
Chris PeBenito 0f707d
	squid_domtrans(logrotate_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 96ce00
ifdef(`TODO',`
Chris PeBenito 96ce00
ifdef(`gnome-pty-helper.te', `allow logrotate_t sysadm_gph_t:fd use;')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
# it should not require this
Chris PeBenito 96ce00
allow logrotate_t {staff_home_dir_t sysadm_home_dir_t}:dir { getattr read search };
Chris PeBenito 96ce00
Chris PeBenito 96ce00
# for /var/backups on Debian
Chris PeBenito 96ce00
ifdef(`backup.te', `
Chris PeBenito 96ce00
rw_dir_create_file(logrotate_t, backup_store_t)
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito ebdc3b
allow logrotate_t syslogd_exec_t:file r_file_perms;
Chris PeBenito 96ce00
') dnl end TODO