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