Chris PeBenito 31b7c0
#DESC Sxid - SUID/SGID program monitoring
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito 31b7c0
# X-Debian-Packages: sxid
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#################################
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Rules for the sxid_t domain.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# sxid_exec_t is the type of the sxid executable.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
daemon_base_domain(sxid, `, privmail')
Chris PeBenito 31b7c0
tmp_domain(sxid)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow sxid_t fs_t:filesystem getattr;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`crond.te', `
Chris PeBenito 31b7c0
system_crond_entry(sxid_exec_t, sxid_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
#allow system_crond_t sxid_log_t:file create_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
read_locale(sxid_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
can_exec(sxid_t, { shell_exec_t bin_t sbin_t mount_exec_t })
Chris PeBenito 31b7c0
allow sxid_t bin_t:lnk_file read;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
log_domain(sxid)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow sxid_t file_type:notdevfile_class_set getattr;
Chris PeBenito 31b7c0
allow sxid_t { device_t device_type }:{ chr_file blk_file } getattr;
Chris PeBenito 31b7c0
allow sxid_t ttyfile:chr_file getattr;
Chris PeBenito 31b7c0
allow sxid_t file_type:dir { getattr read search };
Chris PeBenito 31b7c0
allow sxid_t sysadmfile:file { getattr read };
Chris PeBenito 31b7c0
dontaudit sxid_t devpts_t:dir r_dir_perms;
Chris PeBenito 31b7c0
allow sxid_t fs_type:dir { getattr read search };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Use the network.
Chris PeBenito 31b7c0
can_network_server(sxid_t)
Chris PeBenito 31b7c0
allow sxid_t self:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow sxid_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow sxid_t { proc_t self }:{ file lnk_file } { read getattr };
Chris PeBenito 31b7c0
read_sysctl(sxid_t)
Chris PeBenito 31b7c0
allow sxid_t devtty_t:chr_file rw_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow sxid_t self:capability { dac_override dac_read_search fsetid };
Chris PeBenito 31b7c0
dontaudit sxid_t self:capability { setuid setgid };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`mta.te', `
Chris PeBenito 31b7c0
# sxid leaves an open file handle to /proc/mounts
Chris PeBenito 31b7c0
dontaudit { system_mail_t mta_user_agent } sxid_t:file { read getattr };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# allow mta to read the log files
Chris PeBenito 31b7c0
allow { system_mail_t mta_user_agent } { sxid_tmp_t sxid_log_t }:file { getattr read };
Chris PeBenito 31b7c0
# stop warnings if mailx is passed a read/write file handle
Chris PeBenito 31b7c0
dontaudit { system_mail_t mta_user_agent } { sxid_tmp_t sxid_log_t }:file write;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow logrotate_t sxid_t:file { getattr write };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
dontaudit sxid_t security_t:dir { getattr read search };