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