Chris PeBenito 0fbfa5
#DESC Mailman - GNU Mailman mailing list manager
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Author: Russell Coker <russell@coker.com.au>
Chris PeBenito 0fbfa5
# X-Debian-Packages: mailman
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
type mailman_data_t, file_type, sysadmfile;
Chris PeBenito 0fbfa5
type mailman_archive_t, file_type, sysadmfile;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
type mailman_log_t, file_type, sysadmfile, logfile;
Chris PeBenito 0fbfa5
type mailman_lock_t, file_type, sysadmfile, lockfile;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
define(`mailman_domain', `
Chris PeBenito 0fbfa5
type mailman_$1_t, domain, privlog $2;
Chris PeBenito 0fbfa5
type mailman_$1_exec_t, file_type, sysadmfile, exec_type;
Chris PeBenito 0fbfa5
role system_r types mailman_$1_t;
Chris PeBenito 0fbfa5
file_type_auto_trans(mailman_$1_t, var_log_t, mailman_log_t, file)
Chris PeBenito 0fbfa5
allow mailman_$1_t mailman_log_t:dir rw_dir_perms;
Chris PeBenito 0fbfa5
create_dir_file(mailman_$1_t, mailman_data_t)
Chris PeBenito 0fbfa5
uses_shlib(mailman_$1_t)
Chris PeBenito 0fbfa5
can_exec_any(mailman_$1_t)
Chris PeBenito 0fbfa5
read_sysctl(mailman_$1_t)
Chris PeBenito 0fbfa5
allow mailman_$1_t proc_t:dir search;
Chris PeBenito 0fbfa5
allow mailman_$1_t proc_t:file { read getattr };
Chris PeBenito 0fbfa5
allow mailman_$1_t var_lib_t:dir r_dir_perms;
Chris PeBenito 0fbfa5
allow mailman_$1_t var_lib_t:lnk_file read;
Chris PeBenito 0fbfa5
allow mailman_$1_t device_t:dir search;
Chris PeBenito 0fbfa5
allow mailman_$1_t etc_runtime_t:file { read getattr };
Chris PeBenito 0fbfa5
read_locale(mailman_$1_t)
Chris PeBenito 0fbfa5
file_type_auto_trans(mailman_$1_t, var_lock_t, mailman_lock_t, file)
Chris PeBenito 0fbfa5
allow mailman_$1_t mailman_lock_t:dir rw_dir_perms;
Chris PeBenito 0fbfa5
allow mailman_$1_t fs_t:filesystem getattr;
Chris PeBenito 0fbfa5
can_network(mailman_$1_t)
Chris PeBenito 0fbfa5
can_ypbind(mailman_$1_t)
Chris PeBenito 0fbfa5
allow mailman_$1_t self:{ unix_stream_socket unix_dgram_socket } create_socket_perms;
Chris PeBenito 0fbfa5
allow mailman_$1_t var_t:dir r_dir_perms;
Chris PeBenito 0fbfa5
tmp_domain(mailman_$1)
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
mailman_domain(queue, `, auth_chkpwd, nscd_client_domain')
Chris PeBenito 0fbfa5
can_tcp_connect(mailman_queue_t, mail_server_domain)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
can_exec(mailman_queue_t, su_exec_t)
Chris PeBenito 0fbfa5
allow mailman_queue_t self:capability { setgid setuid };
Chris PeBenito 0fbfa5
allow mailman_queue_t self:fifo_file rw_file_perms;
Chris PeBenito 0fbfa5
dontaudit mailman_queue_t var_run_t:dir search;
Chris PeBenito 0fbfa5
allow mailman_queue_t proc_t:lnk_file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for su
Chris PeBenito 0fbfa5
dontaudit mailman_queue_t selinux_config_t:dir search;
Chris PeBenito 0fbfa5
allow mailman_queue_t self:dir search;
Chris PeBenito 0fbfa5
allow mailman_queue_t self:file { getattr read };
Chris PeBenito 0fbfa5
allow mailman_queue_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0fbfa5
allow mailman_queue_t self:lnk_file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# some of the following could probably be changed to dontaudit, someone who
Chris PeBenito 0fbfa5
# knows mailman well should test this out and send the changes
Chris PeBenito 0fbfa5
allow mailman_queue_t sysadm_home_dir_t:dir { getattr search };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
mailman_domain(mail)
Chris PeBenito 0fbfa5
dontaudit mailman_mail_t mta_delivery_agent:tcp_socket { read write };
Chris PeBenito 0fbfa5
allow mailman_mail_t mta_delivery_agent:fd use;
Chris PeBenito 0fbfa5
ifdef(`qmail.te', `
Chris PeBenito 0fbfa5
allow mailman_mail_t qmail_spool_t:file { read ioctl getattr };
Chris PeBenito 0fbfa5
# do we really need this?
Chris PeBenito 0fbfa5
allow mailman_mail_t qmail_lspawn_t:fifo_file write;
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
create_dir_file(mailman_queue_t, mailman_archive_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
ifdef(`apache.te', `
Chris PeBenito 0fbfa5
mailman_domain(cgi)
Chris PeBenito 0fbfa5
can_tcp_connect(mailman_cgi_t, mail_server_domain)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
domain_auto_trans({ httpd_t httpd_suexec_t }, mailman_cgi_exec_t, mailman_cgi_t)
Chris PeBenito 0fbfa5
# should have separate types for public and private archives
Chris PeBenito 0fbfa5
r_dir_file(httpd_t, mailman_archive_t)
Chris PeBenito 0fbfa5
create_dir_file(mailman_cgi_t, mailman_archive_t)
Chris PeBenito 0fbfa5
allow httpd_t mailman_data_t:dir { getattr search };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
dontaudit mailman_cgi_t httpd_log_t:file append;
Chris PeBenito 0fbfa5
allow httpd_t mailman_cgi_t:process signal;
Chris PeBenito 0fbfa5
allow mailman_cgi_t httpd_t:process sigchld;
Chris PeBenito 0fbfa5
allow mailman_cgi_t httpd_t:fd use;
Chris PeBenito 0fbfa5
allow mailman_cgi_t httpd_t:fifo_file { getattr read write ioctl };
Chris PeBenito 0fbfa5
allow mailman_cgi_t httpd_sys_script_t:dir search;
Chris PeBenito 0fbfa5
allow mailman_cgi_t devtty_t:chr_file { read write };
Chris PeBenito 0fbfa5
allow mailman_cgi_t self:process { fork sigchld };
Chris PeBenito 0fbfa5
allow mailman_cgi_t var_spool_t:dir search;
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow mta_delivery_agent mailman_data_t:dir search;
Chris PeBenito 0fbfa5
allow mta_delivery_agent mailman_data_t:lnk_file read;
Chris PeBenito 0fbfa5
domain_auto_trans({ mta_delivery_agent initrc_t }, mailman_mail_exec_t, mailman_mail_t)
Chris PeBenito 0fbfa5
ifdef(`direct_sysadm_daemon', `
Chris PeBenito 0fbfa5
domain_auto_trans(sysadm_t, mailman_mail_exec_t, mailman_mail_t)
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
allow mailman_mail_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
system_crond_entry(mailman_queue_exec_t, mailman_queue_t)
Chris PeBenito 0fbfa5
allow mailman_queue_t devtty_t:chr_file { read write };
Chris PeBenito 0fbfa5
allow mailman_queue_t self:process { fork signal sigchld };
Chris PeBenito 0fbfa5
allow mailman_queue_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# so MTA can access /var/lib/mailman/mail/wrapper
Chris PeBenito 0fbfa5
allow mta_delivery_agent var_lib_t:dir search;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Handle mailman log files
Chris PeBenito 0fbfa5
rw_dir_create_file(logrotate_t, mailman_log_t)
Chris PeBenito 0fbfa5
allow logrotate_t mailman_data_t:dir search;
Chris PeBenito 0fbfa5
can_exec(logrotate_t, mailman_mail_exec_t)