|
Chris PeBenito |
0fbfa5 |
#DESC Qmail - Mail server
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Author: Russell Coker <russell@coker.com.au>
|
|
Chris PeBenito |
0fbfa5 |
# X-Debian-Packages: qmail-src qmail
|
|
Chris PeBenito |
0fbfa5 |
# Depends: inetd.te mta.te
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Type for files created during execution of qmail.
|
|
Chris PeBenito |
0fbfa5 |
type qmail_var_run_t, file_type, sysadmfile, pidfile;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
type qmail_etc_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow inetd_t smtp_port_t:tcp_socket name_bind;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
type qmail_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
0fbfa5 |
type qmail_spool_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
type var_qmail_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
define(`qmaild_sub_domain', `
|
|
Chris PeBenito |
0fbfa5 |
daemon_sub_domain($1, $2, `$3')
|
|
Chris PeBenito |
0fbfa5 |
allow $2_t qmail_etc_t:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
allow $2_t qmail_etc_t:{ lnk_file file } { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow $2_t { var_t var_spool_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow $2_t console_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow $2_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#################################
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Rules for the qmail_$1_t domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# qmail_$1_exec_t is the type of the qmail_$1 executables.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
define(`qmail_daemon_domain', `
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(qmail_start_t, qmail_$1, `$2')
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_$1_t qmail_start_t:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
')dnl
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
daemon_base_domain(qmail_start)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_start_t self:capability { setgid setuid };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_start_t { bin_t sbin_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_start_t qmail_etc_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_start_t qmail_etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
can_exec(qmail_start_t, qmail_start_exec_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_start_t self:fifo_file { getattr read write };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmail_daemon_domain(lspawn, `, mta_delivery_agent')
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t self:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t self:capability { setuid setgid };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t sbin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
can_exec(qmail_lspawn_t, qmail_exec_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t self:unix_stream_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t qmail_spool_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t qmail_spool_t:file { read getattr };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_lspawn_t tmp_t:dir getattr;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit qmail_lspawn_t user_home_dir_type:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmail_daemon_domain(send, `, mail_server_sender')
|
|
Chris PeBenito |
0fbfa5 |
rw_dir_create_file(qmail_send_t, qmail_spool_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_send_t qmail_spool_t:fifo_file read;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_send_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_send_t self:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(qmail_send_t, qmail_queue_exec_t, qmail_queue_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_send_t sbin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmail_daemon_domain(splogger)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_splogger_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_splogger_t etc_t:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit qmail_splogger_t initrc_t:fd use;
|
|
Chris PeBenito |
0fbfa5 |
read_locale(qmail_splogger_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmail_daemon_domain(rspawn)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_rspawn_t qmail_spool_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_rspawn_t qmail_spool_t:file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_rspawn_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_rspawn_t self:fifo_file read;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_rspawn_t { bin_t sbin_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(qmail_rspawn_t, qmail_remote)
|
|
Chris PeBenito |
2705f9 |
allow qmail_rspawn_t qmail_remote_exec_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
can_network_server(qmail_remote_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(qmail_remote_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_remote_t qmail_spool_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_remote_t qmail_spool_t:file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_remote_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_remote_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmail_daemon_domain(clean)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_clean_t qmail_spool_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_clean_t qmail_spool_t:file { unlink read getattr };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# privhome will do until we get a separate maildir type
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(qmail_lspawn_t, qmail_local, `, privhome, mta_delivery_agent')
|
|
Chris PeBenito |
2705f9 |
allow qmail_lspawn_t qmail_local_exec_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(qmail_local_t, qmail_queue_exec_t, qmail_queue_t)
|
|
Chris PeBenito |
2705f9 |
allow qmail_local_t qmail_queue_exec_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t qmail_spool_t:file { ioctl read };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t self:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t sbin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for piping mail to a command
|
|
Chris PeBenito |
0fbfa5 |
can_exec(qmail_local_t, shell_exec_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t bin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t bin_t:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t devtty_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_local_t { etc_runtime_t proc_t }:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`tcpd.te', `
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(tcpd_t, qmail_tcp_env)
|
|
Chris PeBenito |
0fbfa5 |
# bug
|
|
Chris PeBenito |
0fbfa5 |
can_exec(tcpd_t, tcpd_exec_t)
|
|
Chris PeBenito |
0fbfa5 |
', `
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(inetd_t, qmail_tcp_env)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_tcp_env_t inetd_t:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_tcp_env_t inetd_t:tcp_socket { read write getattr };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_tcp_env_t inetd_t:process sigchld;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_tcp_env_t sbin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
can_network_server(qmail_tcp_env_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(qmail_tcp_env_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(qmail_tcp_env_t, qmail_smtpd)
|
|
Chris PeBenito |
2705f9 |
allow qmail_tcp_env_t qmail_smtpd_exec_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
can_network_server(qmail_smtpd_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(qmail_smtpd_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_smtpd_t inetd_t:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_smtpd_t inetd_t:tcp_socket { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_smtpd_t inetd_t:process sigchld;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_smtpd_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_smtpd_t self:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_smtpd_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_smtpd_t sbin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(qmail_smtpd_t, qmail_queue_exec_t, qmail_queue_t)
|
|
Chris PeBenito |
2705f9 |
allow qmail_smtpd_t qmail_queue_exec_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(user_mail_domain, qmail_inject, `, mta_user_agent')
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_inject_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_inject_t self:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_inject_t sbin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
role sysadm_r types qmail_inject_t;
|
|
Chris PeBenito |
0fbfa5 |
in_user_role(qmail_inject_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(userdomain, qmail_qread, `, mta_user_agent')
|
|
Chris PeBenito |
0fbfa5 |
in_user_role(qmail_qread_t)
|
|
Chris PeBenito |
0fbfa5 |
role sysadm_r types qmail_qread_t;
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file(qmail_qread_t, qmail_spool_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_qread_t self:capability dac_override;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_qread_t privfd:fd use;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
qmaild_sub_domain(qmail_inject_t, qmail_queue, `, mta_user_agent')
|
|
Chris PeBenito |
0fbfa5 |
role sysadm_r types qmail_queue_t;
|
|
Chris PeBenito |
0fbfa5 |
in_user_role(qmail_queue_t)
|
|
Chris PeBenito |
2705f9 |
allow qmail_inject_t qmail_queue_exec_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
rw_dir_create_file(qmail_queue_t, qmail_spool_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t qmail_spool_t:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t { qmail_start_t qmail_lspawn_t }:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t qmail_lspawn_t:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t qmail_start_t:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t privfd:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t crond_t:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t inetd_t:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t inetd_t:tcp_socket { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t sysadm_t:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_queue_t sysadm_t:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
2705f9 |
allow user_crond_domain qmail_etc_t:dir search;
|
|
Chris PeBenito |
2705f9 |
allow user_crond_domain qmail_etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
2705f9 |
qmaild_sub_domain(user_crond_domain, qmail_serialmail)
|
|
Chris PeBenito |
0fbfa5 |
in_user_role(qmail_serialmail_t)
|
|
Chris PeBenito |
0fbfa5 |
can_network_server(qmail_serialmail_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(qmail_serialmail_t)
|
|
Chris PeBenito |
0fbfa5 |
can_exec(qmail_serialmail_t, qmail_serialmail_exec_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t proc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t etc_runtime_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t home_root_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t user_home_dir_type:dir { search read getattr };
|
|
Chris PeBenito |
0fbfa5 |
rw_dir_create_file(qmail_serialmail_t, user_home_type)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t self:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t privfd:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t crond_t:fifo_file { read write ioctl };
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t devtty_t:chr_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for tcpclient
|
|
Chris PeBenito |
0fbfa5 |
can_exec(qmail_serialmail_t, bin_t)
|
|
Chris PeBenito |
0fbfa5 |
allow qmail_serialmail_t bin_t:dir search;
|