Chris PeBenito 31b7c0
#DESC Postfix - Mail server
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito 31b7c0
# X-Debian-Packages: postfix
Chris PeBenito 31b7c0
# Depends: mta.te
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Type for files created during execution of postfix.
Chris PeBenito 31b7c0
type postfix_var_run_t, file_type, sysadmfile, pidfile;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
type postfix_etc_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
type postfix_exec_t, file_type, sysadmfile, exec_type;
Chris PeBenito 31b7c0
type postfix_public_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
type postfix_private_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
type postfix_spool_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
type postfix_spool_maildrop_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
type postfix_spool_flush_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
type postfix_prng_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# postfix needs this for newaliases
Chris PeBenito 31b7c0
allow { system_mail_t sysadm_mail_t } tmp_t:dir getattr;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#################################
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Rules for the postfix_$1_t domain.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# postfix_$1_exec_t is the type of the postfix_$1 executables.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
define(`postfix_domain', `
Chris PeBenito 31b7c0
daemon_core_rules(postfix_$1, `$2')
Chris PeBenito 31b7c0
allow postfix_$1_t self:process setpgid;
Chris PeBenito 31b7c0
allow postfix_$1_t postfix_master_t:process sigchld;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_$1_t:process signal;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow postfix_$1_t { etc_t postfix_etc_t postfix_spool_t }:dir r_dir_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t postfix_etc_t:file r_file_perms;
Chris PeBenito 31b7c0
read_locale(postfix_$1_t)
Chris PeBenito 31b7c0
allow postfix_$1_t etc_t:file { getattr read };
Chris PeBenito 31b7c0
allow postfix_$1_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t self:unix_stream_socket connectto;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow postfix_$1_t { sbin_t bin_t }:dir r_dir_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t { bin_t usr_t }:lnk_file { getattr read };
Chris PeBenito 31b7c0
allow postfix_$1_t shell_exec_t:file rx_file_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t { var_t var_spool_t }:dir { search getattr };
Chris PeBenito 31b7c0
allow postfix_$1_t postfix_exec_t:file rx_file_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t devtty_t:chr_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t etc_runtime_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t proc_t:dir r_dir_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t proc_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t postfix_exec_t:dir r_dir_perms;
Chris PeBenito 31b7c0
allow postfix_$1_t fs_t:filesystem getattr;
Chris PeBenito 31b7c0
allow postfix_$1_t proc_net_t:dir search;
Chris PeBenito 31b7c0
allow postfix_$1_t proc_net_t:file { getattr read };
Chris PeBenito 31b7c0
can_exec(postfix_$1_t, postfix_$1_exec_t)
Chris PeBenito 31b7c0
r_dir_file(postfix_$1_t, cert_t)
Chris PeBenito 31b7c0
allow postfix_$1_t { urandom_device_t random_device_t }:chr_file { read getattr };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow postfix_$1_t tmp_t:dir getattr;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
file_type_auto_trans(postfix_$1_t, var_run_t, postfix_var_run_t, file)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
read_sysctl(postfix_$1_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
')dnl end postfix_domain
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`crond.te',
Chris PeBenito 31b7c0
`allow system_mail_t crond_t:tcp_socket { read write create };')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_domain(master, `, mail_server_domain')
Chris PeBenito 31b7c0
rhgb_domain(postfix_master_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for a find command
Chris PeBenito 31b7c0
dontaudit postfix_master_t security_t:dir search;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
read_sysctl(postfix_master_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`targeted_policy', `
Chris PeBenito 31b7c0
bool postfix_disable_trans false;
Chris PeBenito 31b7c0
if (!postfix_disable_trans) {
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
domain_auto_trans(initrc_t, postfix_master_exec_t, postfix_master_t)
Chris PeBenito 31b7c0
allow initrc_t postfix_master_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
domain_auto_trans(sysadm_t, postfix_master_exec_t, postfix_master_t)
Chris PeBenito 31b7c0
allow sysadm_t postfix_master_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 31b7c0
ifdef(`targeted_policy', `', `
Chris PeBenito 31b7c0
role_transition sysadm_r postfix_master_exec_t system_r;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
allow postfix_master_t postfix_etc_t:file rw_file_perms;
Chris PeBenito 31b7c0
dontaudit postfix_master_t admin_tty_type:chr_file { read write };
Chris PeBenito 31b7c0
allow postfix_master_t devpts_t:dir search;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
domain_auto_trans(sysadm_mail_t, postfix_master_exec_t, system_mail_t)
Chris PeBenito 31b7c0
allow system_mail_t sysadm_t:process sigchld;
Chris PeBenito 31b7c0
allow system_mail_t privfd:fd use;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`pppd.te', `
Chris PeBenito 31b7c0
domain_auto_trans(pppd_t, postfix_master_exec_t, postfix_master_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`targeted_policy', `
Chris PeBenito 31b7c0
}
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow postfix_master_t privfd:fd use;
Chris PeBenito 31b7c0
ifdef(`newrole.te', `allow postfix_master_t newrole_t:process sigchld;')
Chris PeBenito 31b7c0
allow postfix_master_t initrc_devpts_t:chr_file rw_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# postfix does a "find" on startup for some reason - keep it quiet
Chris PeBenito 31b7c0
dontaudit postfix_master_t selinux_config_t:dir search;
Chris PeBenito 31b7c0
can_exec({ sysadm_mail_t system_mail_t }, postfix_master_exec_t)
Chris PeBenito 31b7c0
ifdef(`distro_redhat', `
Chris PeBenito 31b7c0
# compatability for old default main.cf
Chris PeBenito 31b7c0
file_type_auto_trans({ sysadm_mail_t system_mail_t postfix_master_t }, postfix_etc_t, etc_aliases_t)
Chris PeBenito 31b7c0
# for newer main.cf that uses /etc/aliases
Chris PeBenito 31b7c0
file_type_auto_trans(postfix_master_t, etc_t, etc_aliases_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
file_type_auto_trans({ sysadm_mail_t system_mail_t }, etc_t, etc_aliases_t)
Chris PeBenito 31b7c0
allow postfix_master_t sendmail_exec_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_master_t sbin_t:lnk_file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
can_exec(postfix_master_t, { ls_exec_t sbin_t })
Chris PeBenito 31b7c0
allow postfix_master_t self:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_master_t usr_t:file r_file_perms;
Chris PeBenito 31b7c0
can_exec(postfix_master_t, { shell_exec_t bin_t postfix_exec_t })
Chris PeBenito 31b7c0
# chown is to set the correct ownership of queue dirs
Chris PeBenito 31b7c0
allow postfix_master_t self:capability { chown dac_override kill setgid setuid net_bind_service sys_tty_config };
Chris PeBenito 31b7c0
allow postfix_master_t postfix_public_t:fifo_file create_file_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_public_t:sock_file create_file_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_public_t:dir rw_dir_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_private_t:dir rw_dir_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_private_t:sock_file create_file_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_private_t:fifo_file create_file_perms;
Chris PeBenito 31b7c0
can_network(postfix_master_t)
Chris PeBenito 31b7c0
allow postfix_master_t port_type:tcp_socket name_connect;
Chris PeBenito 31b7c0
can_ypbind(postfix_master_t)
Chris PeBenito 31b7c0
allow postfix_master_t { amavisd_send_port_t smtp_port_t }:tcp_socket name_bind;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_spool_maildrop_t:dir rw_dir_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_spool_maildrop_t:file { unlink rename getattr };
Chris PeBenito 31b7c0
allow postfix_master_t postfix_prng_t:file getattr;
Chris PeBenito 31b7c0
allow postfix_master_t privfd:fd use;
Chris PeBenito 31b7c0
allow postfix_master_t etc_aliases_t:file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_master_t var_lib_t:dir search;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`saslauthd.te',`
Chris PeBenito 31b7c0
allow postfix_smtpd_t saslauthd_var_run_t:dir { search getattr };
Chris PeBenito 31b7c0
allow postfix_smtpd_t saslauthd_var_run_t:sock_file { read write };
Chris PeBenito 31b7c0
can_unix_connect(postfix_smtpd_t,saslauthd_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
create_dir_file(postfix_master_t, postfix_spool_flush_t)
Chris PeBenito 31b7c0
allow postfix_master_t postfix_prng_t:file rw_file_perms;
Chris PeBenito 31b7c0
# for ls to get the current context
Chris PeBenito 31b7c0
allow postfix_master_t self:file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# allow access to deferred queue and allow removing bogus incoming entries
Chris PeBenito 31b7c0
allow postfix_master_t postfix_spool_t:dir create_dir_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_spool_t:file create_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
dontaudit postfix_master_t man_t:dir search;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
define(`postfix_server_domain', `
Chris PeBenito 31b7c0
postfix_domain($1, `$2')
Chris PeBenito 31b7c0
domain_auto_trans(postfix_master_t, postfix_$1_exec_t, postfix_$1_t)
Chris PeBenito 31b7c0
allow postfix_$1_t postfix_master_t:unix_stream_socket { connectto rw_stream_socket_perms };
Chris PeBenito 31b7c0
allow postfix_$1_t self:capability { setuid setgid dac_override };
Chris PeBenito 31b7c0
can_network_client(postfix_$1_t)
Chris PeBenito 31b7c0
allow postfix_$1_t port_type:tcp_socket name_connect;
Chris PeBenito 31b7c0
can_ypbind(postfix_$1_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_server_domain(smtp, `, mail_server_sender')
Chris PeBenito 31b7c0
allow postfix_smtp_t postfix_spool_t:file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_smtp_t { postfix_private_t postfix_public_t }:dir search;
Chris PeBenito 31b7c0
allow postfix_smtp_t { postfix_private_t postfix_public_t }:sock_file write;
Chris PeBenito 31b7c0
allow postfix_smtp_t postfix_master_t:unix_stream_socket connectto;
Chris PeBenito 31b7c0
# if you have two different mail servers on the same host let them talk via
Chris PeBenito 31b7c0
# SMTP, also if one mail server wants to talk to itself then allow it and let
Chris PeBenito 31b7c0
# the SMTP protocol sort it out (SE Linux is not to prevent mail server
Chris PeBenito 31b7c0
# misconfiguration)
Chris PeBenito 31b7c0
can_tcp_connect(postfix_smtp_t, mail_server_domain)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_server_domain(smtpd)
Chris PeBenito 31b7c0
allow postfix_smtpd_t postfix_master_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 31b7c0
allow postfix_smtpd_t { postfix_private_t postfix_public_t }:dir search;
Chris PeBenito 31b7c0
allow postfix_smtpd_t { postfix_private_t postfix_public_t }:sock_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_smtpd_t postfix_master_t:unix_stream_socket connectto;
Chris PeBenito 31b7c0
# for OpenSSL certificates
Chris PeBenito 31b7c0
r_dir_file(postfix_smtpd_t,usr_t)
Chris PeBenito 31b7c0
allow postfix_smtpd_t etc_aliases_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_smtpd_t self:file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for prng_exch
Chris PeBenito 31b7c0
allow postfix_smtpd_t postfix_spool_t:file rw_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow { postfix_smtp_t postfix_smtpd_t } postfix_prng_t:file rw_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_server_domain(local, `, mta_delivery_agent')
Chris PeBenito 31b7c0
ifdef(`procmail.te', `
Chris PeBenito 31b7c0
domain_auto_trans(postfix_local_t, procmail_exec_t, procmail_t)
Chris PeBenito 31b7c0
# for a bug in the postfix local program
Chris PeBenito 31b7c0
dontaudit procmail_t postfix_local_t:tcp_socket { read write };
Chris PeBenito 31b7c0
dontaudit procmail_t postfix_master_t:fd use;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
allow postfix_local_t etc_aliases_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_local_t self:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_local_t self:process { setsched setrlimit };
Chris PeBenito 31b7c0
allow postfix_local_t postfix_spool_t:file rw_file_perms;
Chris PeBenito 31b7c0
# for .forward - maybe we need a new type for it?
Chris PeBenito 31b7c0
allow postfix_local_t postfix_private_t:dir search;
Chris PeBenito 31b7c0
allow postfix_local_t postfix_private_t:sock_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_local_t postfix_master_t:unix_stream_socket connectto;
Chris PeBenito 31b7c0
allow postfix_local_t postfix_public_t:dir search;
Chris PeBenito 31b7c0
allow postfix_local_t postfix_public_t:sock_file write;
Chris PeBenito 31b7c0
tmp_domain(postfix_local)
Chris PeBenito 31b7c0
can_exec(postfix_local_t,{ shell_exec_t bin_t })
Chris PeBenito 31b7c0
ifdef(`spamc.te', `
Chris PeBenito 31b7c0
can_exec(postfix_local_t, spamc_exec_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
allow postfix_local_t mail_spool_t:dir { remove_name };
Chris PeBenito 31b7c0
allow postfix_local_t mail_spool_t:file { unlink };
Chris PeBenito 31b7c0
# For reading spamassasin
Chris PeBenito 31b7c0
r_dir_file(postfix_local_t, etc_mail_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
define(`postfix_public_domain',`
Chris PeBenito 31b7c0
postfix_server_domain($1)
Chris PeBenito 31b7c0
allow postfix_$1_t postfix_public_t:dir search;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_public_domain(cleanup)
Chris PeBenito 31b7c0
create_dir_file(postfix_cleanup_t, postfix_spool_t)
Chris PeBenito 31b7c0
allow postfix_cleanup_t postfix_public_t:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_cleanup_t postfix_public_t:sock_file { getattr write };
Chris PeBenito 31b7c0
allow postfix_cleanup_t postfix_private_t:dir search;
Chris PeBenito 31b7c0
allow postfix_cleanup_t postfix_private_t:sock_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_cleanup_t postfix_master_t:unix_stream_socket connectto;
Chris PeBenito 31b7c0
allow postfix_cleanup_t postfix_spool_bounce_t:dir r_dir_perms;
Chris PeBenito 31b7c0
allow postfix_cleanup_t self:process setrlimit;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow user_mail_domain postfix_spool_t:dir r_dir_perms;
Chris PeBenito 31b7c0
allow user_mail_domain postfix_etc_t:dir r_dir_perms;
Chris PeBenito 31b7c0
allow { user_mail_domain initrc_t } postfix_etc_t:file r_file_perms;
Chris PeBenito 31b7c0
allow user_mail_domain self:capability dac_override;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
define(`postfix_user_domain', `
Chris PeBenito 31b7c0
postfix_domain($1, `$2')
Chris PeBenito 31b7c0
domain_auto_trans(user_mail_domain, postfix_$1_exec_t, postfix_$1_t)
Chris PeBenito 31b7c0
in_user_role(postfix_$1_t)
Chris PeBenito 31b7c0
role sysadm_r types postfix_$1_t;
Chris PeBenito 31b7c0
allow postfix_$1_t userdomain:process sigchld;
Chris PeBenito 31b7c0
allow postfix_$1_t userdomain:fifo_file { write getattr };
Chris PeBenito 31b7c0
allow postfix_$1_t { userdomain privfd }:fd use;
Chris PeBenito 31b7c0
allow postfix_$1_t self:capability dac_override;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_user_domain(postqueue)
Chris PeBenito 31b7c0
allow postfix_postqueue_t postfix_public_t:dir search;
Chris PeBenito 31b7c0
allow postfix_postqueue_t postfix_public_t:fifo_file getattr;
Chris PeBenito 31b7c0
allow postfix_postqueue_t self:udp_socket { create ioctl };
Chris PeBenito 31b7c0
allow postfix_postqueue_t self:tcp_socket create;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_postqueue_exec_t:file getattr;
Chris PeBenito 31b7c0
domain_auto_trans(postfix_master_t, postfix_postqueue_exec_t, postfix_postqueue_t)
Chris PeBenito 31b7c0
allow postfix_postqueue_t initrc_t:process sigchld;
Chris PeBenito 31b7c0
allow postfix_postqueue_t initrc_t:fd use;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# to write the mailq output, it really should not need read access!
Chris PeBenito 31b7c0
allow postfix_postqueue_t { ptyfile ttyfile }:chr_file { read write getattr };
Chris PeBenito 31b7c0
ifdef(`gnome-pty-helper.te', `allow postfix_postqueue_t user_gph_t:fd use;')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# wants to write to /var/spool/postfix/public/showq
Chris PeBenito 31b7c0
allow postfix_postqueue_t postfix_public_t:sock_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_postqueue_t postfix_master_t:unix_stream_socket connectto;
Chris PeBenito 31b7c0
# write to /var/spool/postfix/public/qmgr
Chris PeBenito 31b7c0
allow postfix_postqueue_t postfix_public_t:fifo_file write;
Chris PeBenito 31b7c0
dontaudit postfix_postqueue_t net_conf_t:file r_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_user_domain(showq)
Chris PeBenito 31b7c0
# the following auto_trans is usually in postfix server domain
Chris PeBenito 31b7c0
domain_auto_trans(postfix_master_t, postfix_showq_exec_t, postfix_showq_t)
Chris PeBenito 31b7c0
can_resolve(postfix_showq_t)
Chris PeBenito 31b7c0
r_dir_file(postfix_showq_t, postfix_spool_maildrop_t)
Chris PeBenito 31b7c0
domain_auto_trans(postfix_postqueue_t, postfix_showq_exec_t, postfix_showq_t)
Chris PeBenito 31b7c0
allow postfix_showq_t self:capability { setuid setgid };
Chris PeBenito 31b7c0
allow postfix_showq_t postfix_master_t:unix_stream_socket { accept rw_socket_perms };
Chris PeBenito 31b7c0
allow postfix_showq_t postfix_spool_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_showq_t self:tcp_socket create_socket_perms;
Chris PeBenito 31b7c0
allow postfix_showq_t { ttyfile ptyfile }:chr_file { read write };
Chris PeBenito 31b7c0
dontaudit postfix_showq_t net_conf_t:file r_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_user_domain(postdrop, `, mta_user_agent')
Chris PeBenito 31b7c0
can_resolve(postfix_postdrop_t)
Chris PeBenito 31b7c0
allow postfix_postdrop_t postfix_spool_maildrop_t:dir rw_dir_perms;
Chris PeBenito 31b7c0
allow postfix_postdrop_t postfix_spool_maildrop_t:file create_file_perms;
Chris PeBenito 31b7c0
allow postfix_postdrop_t user_mail_domain:unix_stream_socket rw_socket_perms;
Chris PeBenito 31b7c0
allow postfix_postdrop_t postfix_public_t:dir search;
Chris PeBenito 31b7c0
allow postfix_postdrop_t postfix_public_t:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
dontaudit postfix_postdrop_t { ptyfile ttyfile }:chr_file { read write };
Chris PeBenito 31b7c0
dontaudit postfix_postdrop_t net_conf_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_postdrop_exec_t:file getattr;
Chris PeBenito 31b7c0
ifdef(`crond.te',
Chris PeBenito 31b7c0
`allow postfix_postdrop_t { crond_t system_crond_t }:fd use;
Chris PeBenito 31b7c0
allow postfix_postdrop_t { crond_t system_crond_t }:fifo_file rw_file_perms;')
Chris PeBenito 31b7c0
# usually it does not need a UDP socket
Chris PeBenito 31b7c0
allow postfix_postdrop_t self:udp_socket create_socket_perms;
Chris PeBenito 31b7c0
allow postfix_postdrop_t self:tcp_socket create;
Chris PeBenito 31b7c0
allow postfix_postdrop_t self:capability sys_resource;
Chris PeBenito 31b7c0
allow postfix_postdrop_t self:tcp_socket create;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_public_domain(pickup)
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_public_t:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_public_t:sock_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_private_t:dir search;
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_private_t:sock_file write;
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_master_t:unix_stream_socket connectto;
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_spool_maildrop_t:dir rw_dir_perms;
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_spool_maildrop_t:file r_file_perms;
Chris PeBenito 31b7c0
allow postfix_pickup_t postfix_spool_maildrop_t:file unlink;
Chris PeBenito 31b7c0
allow postfix_pickup_t self:tcp_socket create_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_public_domain(qmgr)
Chris PeBenito 31b7c0
allow postfix_qmgr_t postfix_public_t:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_qmgr_t postfix_public_t:sock_file write;
Chris PeBenito 31b7c0
allow postfix_qmgr_t postfix_private_t:dir search;
Chris PeBenito 31b7c0
allow postfix_qmgr_t postfix_private_t:sock_file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_qmgr_t postfix_master_t:unix_stream_socket connectto;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for /var/spool/postfix/active
Chris PeBenito 31b7c0
create_dir_file(postfix_qmgr_t, postfix_spool_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_public_domain(bounce)
Chris PeBenito 31b7c0
type postfix_spool_bounce_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
create_dir_file(postfix_bounce_t, postfix_spool_bounce_t)
Chris PeBenito 31b7c0
create_dir_file(postfix_bounce_t, postfix_spool_t)
Chris PeBenito 31b7c0
allow postfix_master_t postfix_spool_bounce_t:dir create_dir_perms;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_spool_bounce_t:file getattr;
Chris PeBenito 31b7c0
allow postfix_bounce_t self:capability dac_read_search;
Chris PeBenito 31b7c0
allow postfix_bounce_t postfix_public_t:sock_file write;
Chris PeBenito 31b7c0
allow postfix_bounce_t self:tcp_socket create_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
r_dir_file(postfix_qmgr_t, postfix_spool_bounce_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
postfix_public_domain(pipe)
Chris PeBenito 31b7c0
allow postfix_pipe_t postfix_spool_t:dir search;
Chris PeBenito 31b7c0
allow postfix_pipe_t postfix_spool_t:file rw_file_perms;
Chris PeBenito 31b7c0
allow postfix_pipe_t self:fifo_file { read write };
Chris PeBenito 31b7c0
allow postfix_pipe_t postfix_private_t:dir search;
Chris PeBenito 31b7c0
allow postfix_pipe_t postfix_private_t:sock_file write;
Chris PeBenito 31b7c0
ifdef(`procmail.te', `
Chris PeBenito 31b7c0
domain_auto_trans(postfix_pipe_t, procmail_exec_t, procmail_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
ifdef(`sendmail.te', `
Chris PeBenito 31b7c0
r_dir_file(sendmail_t, postfix_etc_t)
Chris PeBenito 31b7c0
allow sendmail_t postfix_spool_t:dir search;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Program for creating database files
Chris PeBenito 31b7c0
application_domain(postfix_map)
Chris PeBenito 31b7c0
base_file_read_access(postfix_map_t)
Chris PeBenito 31b7c0
allow postfix_map_t { etc_t etc_runtime_t }:{ file lnk_file } { getattr read };
Chris PeBenito 31b7c0
tmp_domain(postfix_map)
Chris PeBenito 31b7c0
create_dir_file(postfix_map_t, postfix_etc_t)
Chris PeBenito 31b7c0
allow postfix_map_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 31b7c0
dontaudit postfix_map_t proc_t:dir { getattr read search };
Chris PeBenito 31b7c0
dontaudit postfix_map_t local_login_t:fd use;
Chris PeBenito 31b7c0
allow postfix_master_t postfix_map_exec_t:file rx_file_perms;
Chris PeBenito 31b7c0
read_locale(postfix_map_t)
Chris PeBenito 31b7c0
allow postfix_map_t self:capability setgid;
Chris PeBenito 31b7c0
allow postfix_map_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 31b7c0
dontaudit postfix_map_t var_t:dir search;
Chris PeBenito 31b7c0
can_network_server(postfix_map_t)
Chris PeBenito 31b7c0
allow postfix_map_t port_type:tcp_socket name_connect;