|
Chris PeBenito |
0fbfa5 |
#DESC Logrotate - Rotate log files
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Authors: Stephen Smalley <sds@epoch.ncsc.mil> Timothy Fraser
|
|
Chris PeBenito |
0fbfa5 |
# Russell Coker <rcoker@redhat.com>
|
|
Chris PeBenito |
0fbfa5 |
# X-Debian-Packages: logrotate
|
|
Chris PeBenito |
0fbfa5 |
# Depends: crond.te
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#################################
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Rules for the logrotate_t domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# logrotate_t is the domain for the logrotate program.
|
|
Chris PeBenito |
0fbfa5 |
# logrotate_exec_t is the type of the corresponding program.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
type logrotate_t, domain, privowner, privmail, priv_system_role, nscd_client_domain;
|
|
Chris PeBenito |
0fbfa5 |
role system_r types logrotate_t;
|
|
Chris PeBenito |
0fbfa5 |
role sysadm_r types logrotate_t;
|
|
Chris PeBenito |
0fbfa5 |
uses_shlib(logrotate_t)
|
|
Chris PeBenito |
0fbfa5 |
general_domain_access(logrotate_t)
|
|
Chris PeBenito |
0fbfa5 |
type logrotate_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
system_crond_entry(logrotate_exec_t, logrotate_t)
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t cron_spool_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow crond_t logrotate_var_lib_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(sysadm_t, logrotate_exec_t, logrotate_t)
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t self:unix_stream_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t devtty_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`distro_debian', `
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t logrotate_tmp_t:file { relabelfrom relabelto };
|
|
Chris PeBenito |
0fbfa5 |
# for savelog
|
|
Chris PeBenito |
0fbfa5 |
can_exec(logrotate_t, logrotate_exec_t)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for perl
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t usr_t:file { getattr read ioctl };
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t usr_t:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# access files in /etc
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t etc_t:file { getattr read ioctl };
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t etc_t:lnk_file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t etc_runtime_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# it should not require this
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t {staff_home_dir_t sysadm_home_dir_t}:dir { getattr read search };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# create lock files
|
|
Chris PeBenito |
5493c2 |
lock_domain(logrotate)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Create temporary files.
|
|
Chris PeBenito |
0fbfa5 |
tmp_domain(logrotate)
|
|
Chris PeBenito |
0fbfa5 |
can_exec(logrotate_t, logrotate_tmp_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Run helper programs.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t { bin_t sbin_t }:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t { bin_t sbin_t }:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
can_exec(logrotate_t, { bin_t sbin_t shell_exec_t ls_exec_t })
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Read PID files.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t pidfile:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Read /proc/PID directories for all domains.
|
|
Chris PeBenito |
0fbfa5 |
read_sysctl(logrotate_t)
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t proc_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t proc_t:{ file lnk_file } r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t domain:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t domain:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t exec_type:file getattr;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Read /dev directories and any symbolic links.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t device_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t device_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Signal processes.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t domain:process signal;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Modify /var/log and other log dirs.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t var_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t logfile:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t logfile:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Create, rename, and truncate log files.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t logfile:file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t wtmp_t:file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`squid.te', `
|
|
Chris PeBenito |
0fbfa5 |
allow squid_t { system_crond_t crond_t }:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow squid_t crond_t:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow squid_t system_crond_t:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
allow squid_t self:capability kill;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Set a context other than the default one for newly created files.
|
|
Chris PeBenito |
0fbfa5 |
can_setfscreate(logrotate_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Change ownership on log files.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t self:capability { chown dac_override dac_read_search kill fsetid fowner sys_resource sys_nice };
|
|
Chris PeBenito |
0fbfa5 |
# for mailx
|
|
Chris PeBenito |
0fbfa5 |
dontaudit logrotate_t self:capability { setuid setgid };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`mta.te', `
|
|
Chris PeBenito |
0fbfa5 |
allow { system_mail_t mta_user_agent } logrotate_tmp_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Access /var/run
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t var_run_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for /var/lib/logrotate.status and /var/lib/logcheck
|
|
Chris PeBenito |
0fbfa5 |
var_lib_domain(logrotate)
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t logrotate_var_lib_t:dir create;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Write to /var/spool/slrnpull - should be moved into its own type.
|
|
Chris PeBenito |
0fbfa5 |
create_dir_file(logrotate_t, var_spool_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t urandom_device_t:chr_file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Access terminals.
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t admin_tty_type:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`gnome-pty-helper.te', `allow logrotate_t sysadm_gph_t:fd use;')
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t privfd:fd use;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for /var/backups on Debian
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`backup.te', `
|
|
Chris PeBenito |
0fbfa5 |
rw_dir_create_file(logrotate_t, backup_store_t)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
read_locale(logrotate_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
0fbfa5 |
can_exec(logrotate_t, shell_exec_t)
|
|
Chris PeBenito |
2705f9 |
ifdef(`hostname.te', `can_exec(logrotate_t, hostname_exec_t)')
|
|
Chris PeBenito |
0fbfa5 |
can_exec(logrotate_t,logfile)
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t net_conf_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`consoletype.te', `
|
|
Chris PeBenito |
0fbfa5 |
can_exec(logrotate_t, consoletype_exec_t)
|
|
Chris PeBenito |
0fbfa5 |
dontaudit consoletype_t logrotate_t:fd use;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t syslogd_t:unix_dgram_socket sendto;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(logrotate_t, initrc_exec_t, initrc_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
a08248 |
# Supress libselinux initialization denials
|
|
Chris PeBenito |
0fbfa5 |
dontaudit logrotate_t selinux_config_t:dir search;
|
|
Chris PeBenito |
a08248 |
dontaudit logrotate_t selinux_config_t:file { read getattr };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
a08248 |
# Allow selinux_getenforce
|
|
Chris PeBenito |
a08248 |
allow logrotate_t security_t:dir search;
|
|
Chris PeBenito |
a08248 |
allow logrotate_t security_t:file { getattr read };
|