Chris PeBenito e181fe
Chris PeBenito 960373
policy_module(logging,1.0)
Chris PeBenito 960373
Chris PeBenito b4cd15
attribute logfile;
Chris PeBenito b4cd15
Chris PeBenito 4ddc1a
type devlog_t;
Chris PeBenito 4ddc1a
files_make_file(devlog_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
type klogd_t;
Chris PeBenito 4ddc1a
type klogd_exec_t;
Chris PeBenito ff3138
init_make_daemon_domain(klogd_t,klogd_exec_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
type klogd_tmp_t;
Chris PeBenito 38e24a
files_make_temporary_file(klogd_tmp_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
type klogd_var_run_t;
Chris PeBenito d25dd9
files_make_daemon_runtime_file(klogd_var_run_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
type syslogd_t;
Chris PeBenito 4ddc1a
type syslogd_exec_t;
Chris PeBenito ff3138
init_make_daemon_domain(syslogd_t,syslogd_exec_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
type syslogd_tmp_t;
Chris PeBenito 38e24a
files_make_temporary_file(syslogd_tmp_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
type syslogd_var_run_t;
Chris PeBenito d25dd9
files_make_daemon_runtime_file(syslogd_var_run_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
type var_log_t, logfile;
Chris PeBenito b4cd15
files_make_file(var_log_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
########################################
Chris PeBenito 4ddc1a
#
Chris PeBenito 4ddc1a
# klogd local policy
Chris PeBenito 4ddc1a
#
Chris PeBenito 4ddc1a
Chris PeBenito 3b857e
allow klogd_t klogd_tmp_t:file create_file_perms;
Chris PeBenito daa0e0
files_create_private_tmp_data(klogd_t,klogd_tmp_t)
Chris PeBenito daa0e0
Chris PeBenito 3b857e
allow klogd_t klogd_var_run_t:file create_file_perms;
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
allow klogd_t self:capability sys_admin;
Chris PeBenito 4ddc1a
dontaudit klogd_t self:capability sys_resource;
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
kernel_read_system_state(klogd_t)
Chris PeBenito 219bcf
kernel_read_messages(klogd_t)
Chris PeBenito 219bcf
# Control syslog and console logging
Chris PeBenito 219bcf
kernel_clear_ring_buffer(klogd_t)
Chris PeBenito 219bcf
kernel_change_ring_buffer_level(klogd_t)
Chris PeBenito 219bcf
Chris PeBenito 219bcf
bootloader_read_kernel_symbol_table(klogd_t)
Chris PeBenito 4ddc1a
Chris PeBenito daa0e0
devices_raw_read_memory(klogd_t)
Chris PeBenito 4ddc1a
Chris PeBenito daa0e0
filesystem_get_all_filesystems_attributes(klogd_t)
Chris PeBenito 4ddc1a
Chris PeBenito daa0e0
files_create_daemon_runtime_data(klogd_t,klogd_var_run_t)
Chris PeBenito daa0e0
files_read_runtime_system_config(klogd_t)
Chris PeBenito 4ddc1a
# read /etc/nsswitch.conf
Chris PeBenito 4ddc1a
files_read_general_system_config(klogd_t)
Chris PeBenito 4ddc1a
Chris PeBenito 3b857e
init_use_file_descriptors(klogd_t)
Chris PeBenito 3b857e
Chris PeBenito daa0e0
libraries_use_dynamic_loader(klogd_t)
Chris PeBenito daa0e0
libraries_use_shared_libraries(klogd_t)
Chris PeBenito 4ddc1a
Chris PeBenito 4ddc1a
logging_send_system_log_message(klogd_t)
Chris PeBenito 4ddc1a
Chris PeBenito daa0e0
miscfiles_read_localization(klogd_t)
Chris PeBenito daa0e0
Chris PeBenito 4ddc1a
########################################
Chris PeBenito 4ddc1a
#
Chris PeBenito 4ddc1a
# syslogd local policy
Chris PeBenito 4ddc1a
#
Chris PeBenito 219bcf
Chris PeBenito 219bcf
allow syslogd_t self:capability { dac_override net_bind_service sys_resource sys_tty_config };
Chris PeBenito 55f456
dontaudit syslogd_t self:capability sys_tty_config;
Chris PeBenito d115b2
allow syslogd_t self:process signal_perms;
Chris PeBenito d115b2
Chris PeBenito d115b2
# receive messages to be logged
Chris PeBenito d115b2
allow syslogd_t self:unix_dgram_socket { create read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito d115b2
allow syslogd_t self:unix_stream_socket { create read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito d115b2
allow syslogd_t self:unix_dgram_socket sendto;
Chris PeBenito d115b2
allow syslogd_t self:fifo_file { getattr read write ioctl lock };
Chris PeBenito d115b2
allow syslogd_t self:udp_socket { create ioctl read getattr write setattr append bind getopt setopt shutdown connect };
Chris PeBenito 219bcf
Chris PeBenito 55f456
# create/append log files.
Chris PeBenito 3b857e
allow syslogd_t var_log_t:dir rw_dir_perms;
Chris PeBenito 3b857e
allow syslogd_t var_log_t:file create_file_perms;
Chris PeBenito 4ddc1a
Chris PeBenito 55f456
# manage temporary files
Chris PeBenito 3b857e
allow syslogd_t syslogd_tmp_t:file create_file_perms;
Chris PeBenito 3b857e
files_create_private_tmp_data(syslogd_t,syslogd_tmp_t)
Chris PeBenito 3b857e
Chris PeBenito 3b857e
allow syslogd_t syslogd_var_run_t:file create_file_perms;
Chris PeBenito 3b857e
files_create_daemon_runtime_data(syslogd_t,syslogd_var_run_t,file)
Chris PeBenito 219bcf
Chris PeBenito 219bcf
# Create and bind to /dev/log or /var/run/log.
Chris PeBenito 219bcf
allow syslogd_t devlog_t:sock_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 3b857e
files_create_daemon_runtime_data(syslogd_t,devlog_t,sock_file)
Chris PeBenito d115b2
# I belive these are not needed:
Chris PeBenito d115b2
allow syslogd_t devlog_t:unix_stream_socket name_bind;
Chris PeBenito d115b2
allow syslogd_t devlog_t:unix_dgram_socket name_bind;
Chris PeBenito 219bcf
Chris PeBenito 55f456
# manage pid file
Chris PeBenito 55f456
allow syslogd_t syslogd_var_run_t:file { getattr create read write append setattr unlink };
Chris PeBenito 55f456
files_create_daemon_runtime_data(syslogd_t,syslogd_var_run_t)
Chris PeBenito 55f456
Chris PeBenito 219bcf
kernel_read_hardware_state(syslogd_t)
Chris PeBenito 55f456
kernel_read_kernel_sysctl(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito 219bcf
devices_create_dev_entry(syslogd_t,devlog_t,sock_file)
Chris PeBenito 55f456
Chris PeBenito 55f456
terminal_ignore_use_console(syslogd_t)
Chris PeBenito daa0e0
# Allow syslog to a terminal
Chris PeBenito daa0e0
terminal_write_general_physical_terminal(syslogd_t)
Chris PeBenito daa0e0
Chris PeBenito daa0e0
# for sending messages to logged in users
Chris PeBenito daa0e0
init_script_read_runtime_data(syslogd_t)
Chris PeBenito daa0e0
init_script_ignore_write_runtime_data(syslogd_t)
Chris PeBenito daa0e0
terminal_write_all_private_physical_terminals(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito 219bcf
corenetwork_network_raw_on_all_interfaces(syslogd_t)
Chris PeBenito 219bcf
corenetwork_network_udp_on_all_interfaces(syslogd_t)
Chris PeBenito 219bcf
corenetwork_network_raw_on_all_nodes(syslogd_t)
Chris PeBenito 219bcf
corenetwork_network_udp_on_all_nodes(syslogd_t)
Chris PeBenito 219bcf
corenetwork_network_udp_on_all_ports(syslogd_t)
Chris PeBenito 219bcf
corenetwork_bind_udp_on_all_nodes(syslogd_t)
Chris PeBenito 219bcf
corenetwork_bind_udp_on_syslogd_port(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito 219bcf
filesystem_get_all_filesystems_attributes(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito 55f456
init_use_file_descriptors(syslogd_t)
Chris PeBenito 55f456
init_script_use_pseudoterminal(syslogd_t)
Chris PeBenito 55f456
Chris PeBenito 25baab
domain_use_widely_inheritable_file_descriptors(syslogd_t)
Chris PeBenito 25baab
Chris PeBenito 219bcf
files_read_general_system_config(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito 219bcf
libraries_use_dynamic_loader(syslogd_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito 91a7ab
sysnetwork_read_network_config(syslogd_t)
Chris PeBenito 91a7ab
Chris PeBenito 219bcf
miscfiles_read_localization(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito daa0e0
userdomain_ignore_use_all_unprivileged_users_file_descriptors(syslogd_t)
Chris PeBenito daa0e0
Chris PeBenito 219bcf
#
Chris PeBenito 219bcf
# /initrd is not umounted before minilog starts
Chris PeBenito 219bcf
#
Chris PeBenito 3b857e
files_ignore_search_isid_type_dir(syslogd_t)
Chris PeBenito daa0e0
#allow syslogd_t tmpfs_t:dir search;
Chris PeBenito 219bcf
#dontaudit syslogd_t unlabeled_t:file read;
Chris PeBenito 219bcf
#dontaudit syslogd_t { userpty_type devpts_t }:chr_file getattr;
Chris PeBenito 219bcf
allow syslogd_t self:capability net_admin;
Chris PeBenito 219bcf
allow syslogd_t self:netlink_route_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown nlmsg_read };
Chris PeBenito 219bcf
Chris PeBenito 219bcf
ifdef(`klogd.te', `', `
Chris PeBenito 219bcf
# Allow access to /proc/kmsg for syslog-ng
Chris PeBenito 219bcf
kernel_read_messages(syslogd_t)
Chris PeBenito 219bcf
kernel_clear_ring_buffer(syslogd_t)
Chris PeBenito 219bcf
kernel_change_ring_buffer_level(syslogd_t)
Chris PeBenito 219bcf
')
Chris PeBenito 219bcf
Chris PeBenito 3b857e
tunable_policy(`targeted_policy', `
Chris PeBenito 3b857e
terminal_ignore_use_general_physical_terminal(syslogd_t)
Chris PeBenito 3b857e
terminal_ignore_use_general_pseudoterminal(syslogd_t)
Chris PeBenito 3b857e
files_ignore_read_rootfs_file(syslogd_t)
Chris PeBenito 3b857e
')
Chris PeBenito 3b857e
Chris PeBenito 25baab
optional_policy(`selinux.te',`
Chris PeBenito 25baab
selinux_newrole_sigchld(syslogd_t)
Chris PeBenito 25baab
')
Chris PeBenito 25baab
Chris PeBenito 300981
optional_policy(`udev.te', `
Chris PeBenito 55f456
udev_read_database(syslogd_t)
Chris PeBenito 25baab
')
Chris PeBenito 25baab
Chris PeBenito 3b857e
optional_policy(`cron.te',`
Chris PeBenito 3b857e
cron_modify_log(syslogd_t)
Chris PeBenito 25baab
')
Chris PeBenito 55f456
Chris PeBenito 219bcf
ifdef(`TODO',`
Chris PeBenito 55f456
allow syslogd_t proc_t:lnk_file read;
Chris PeBenito 55f456
allow syslogd_t autofs_t:dir { search getattr };
Chris PeBenito 55f456
dontaudit syslogd_t sysadm_home_dir_t:dir search;
Chris PeBenito 25baab
optional_policy(`rhgb.te', `
Chris PeBenito 55f456
allow syslogd_t rhgb_t:process sigchld;
Chris PeBenito 55f456
allow syslogd_t rhgb_t:fd use;
Chris PeBenito 55f456
allow syslogd_t rhgb_t:fifo_file { read write };
Chris PeBenito 55f456
')
Chris PeBenito 25baab
tunable_policy(`direct_sysadm_daemon',`
Chris PeBenito 55f456
dontaudit syslogd_t admin_tty_type:chr_file rw_file_perms;
Chris PeBenito 55f456
')
Chris PeBenito 219bcf
Chris PeBenito 1e5c2a
tunable_policy(`distro_suse', `
Chris PeBenito 1e5c2a
# suse creates a /dev/log under /var/lib/stunnel for chrooted stunnel
Chris PeBenito 1e5c2a
file_type_auto_trans(syslogd_t, var_lib_t, devlog_t, sock_file)
Chris PeBenito 1e5c2a
')
Chris PeBenito 1e5c2a
Chris PeBenito 219bcf
# can_network is for the UDP socket
Chris PeBenito 219bcf
can_ypbind(syslogd_t)
Chris PeBenito 219bcf
Chris PeBenito 219bcf
# log to the xconsole
Chris PeBenito 219bcf
allow syslogd_t xconsole_device_t:fifo_file { ioctl read write };
Chris PeBenito 219bcf
Chris PeBenito 219bcf
ifdef(`crond.te', `
Chris PeBenito 219bcf
# for daemon re-start
Chris PeBenito 219bcf
allow system_crond_t syslogd_t:lnk_file read;
Chris PeBenito 219bcf
')
Chris PeBenito 219bcf
Chris PeBenito 219bcf
ifdef(`logrotate.te', `
Chris PeBenito 219bcf
allow logrotate_t syslogd_exec_t:file r_file_perms;
Chris PeBenito 219bcf
')
Chris PeBenito 219bcf
Chris PeBenito 219bcf
#
Chris PeBenito 219bcf
# Special case to handle crashes
Chris PeBenito 219bcf
#
Chris PeBenito 219bcf
allow syslogd_t { device_t file_t }:sock_file unlink;
Chris PeBenito 219bcf
') dnl end TODO