|
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 |
96ce00 |
type logrotate_t; #, priv_system_role, nscd_client_domain;
|
|
Chris PeBenito |
96ce00 |
domain_type(logrotate_t)
|
|
Chris PeBenito |
96ce00 |
domain_obj_id_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 |
8fd367 |
files_type(logrotate_exec_t)
|
|
Chris PeBenito |
96ce00 |
|
|
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 |
96ce00 |
allow logrotate_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
|
|
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 |
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 |
96ce00 |
allow logrotate_t logrotate_var_lib_t:dir { create rw_dir_perms };
|
|
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 |
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 |
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 |
8fd367 |
files_manage_generic_locks(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 |
hostname_exec(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 |
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 |
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 |
96ce00 |
')
|
|
Chris PeBenito |
96ce00 |
|
|
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 |
96ce00 |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
96ce00 |
nis_use_ypbind(logrotate_t)
|
|
Chris PeBenito |
96ce00 |
')
|
|
Chris PeBenito |
96ce00 |
|
|
Chris PeBenito |
96ce00 |
ifdef(`TODO',`
|
|
Chris PeBenito |
96ce00 |
|
|
Chris PeBenito |
96ce00 |
#from privmail this needs more work:
|
|
Chris PeBenito |
96ce00 |
allow mta_user_agent logrotate_t:fd use;
|
|
Chris PeBenito |
96ce00 |
allow mta_user_agent logrotate_t:process sigchld;
|
|
Chris PeBenito |
96ce00 |
allow mta_user_agent logrotate_t:fifo_file { read write };
|
|
Chris PeBenito |
96ce00 |
|
|
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 |
# Read /proc/PID directories for all domains.
|
|
Chris PeBenito |
96ce00 |
allow logrotate_t domain:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
96ce00 |
allow logrotate_t domain:dir r_dir_perms;
|
|
Chris PeBenito |
96ce00 |
allow logrotate_t exec_type:file getattr;
|
|
Chris PeBenito |
96ce00 |
|
|
Chris PeBenito |
96ce00 |
#this should go to squid:
|
|
Chris PeBenito |
96ce00 |
ifdef(`squid.te', `
|
|
Chris PeBenito |
96ce00 |
allow squid_t { system_crond_t crond_t }:fd use;
|
|
Chris PeBenito |
96ce00 |
allow squid_t crond_t:fifo_file { read write };
|
|
Chris PeBenito |
96ce00 |
allow squid_t system_crond_t:fifo_file write;
|
|
Chris PeBenito |
96ce00 |
allow squid_t self:capability kill;
|
|
Chris PeBenito |
96ce00 |
')
|
|
Chris PeBenito |
96ce00 |
|
|
Chris PeBenito |
96ce00 |
# for /var/lib/logrotate.status and /var/lib/logcheck
|
|
Chris PeBenito |
96ce00 |
file_type_auto_trans(logrotate_t, var_lib_t, logrotate_var_lib_t, file)
|
|
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 |
96ce00 |
allow logrotate_t syslogd_t:unix_dgram_socket sendto;
|
|
Chris PeBenito |
ebdc3b |
allow logrotate_t syslogd_exec_t:file r_file_perms;
|
|
Chris PeBenito |
96ce00 |
|
|
Chris PeBenito |
96ce00 |
dontaudit logrotate_t selinux_config_t:dir search;
|
|
Chris PeBenito |
96ce00 |
') dnl end TODO
|