Chris PeBenito 31b7c0
#DESC Exim - Mail server
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Author:  David Hampton <hampton@employees.org>
Chris PeBenito 31b7c0
# From postfix.te by Russell Coker <russell@coker.com.au>
Chris PeBenito 31b7c0
# Depends: mta.te
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
##########
Chris PeBenito 31b7c0
# Permissions common to the exim daemon, and exim invoked by a user to
Chris PeBenito 31b7c0
# send a file
Chris PeBenito 31b7c0
##########
Chris PeBenito 31b7c0
define(`exim_common',`
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Networking - All instances need to talk to other mail hosts and
Chris PeBenito 31b7c0
# amavisd
Chris PeBenito 31b7c0
can_network_tcp($1_t);
Chris PeBenito 31b7c0
allow $1_t smtp_port_t:tcp_socket name_connect;
Chris PeBenito 31b7c0
##  can_network_client_tcp($1_t, smtp_port_t);
Chris PeBenito 31b7c0
##  ifdef(`amavis.te', `
Chris PeBenito 31b7c0
##  can_network_client_tcp($1_t, amavisd_recv_port_t);
Chris PeBenito 31b7c0
##  allow $1_t amavisd_recv_port_t:tcp_socket { recv_msg send_msg };
Chris PeBenito 31b7c0
##  ')
Chris PeBenito 31b7c0
can_resolve($1_t);
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Exim forks children to do its work.
Chris PeBenito 31b7c0
general_domain_access($1_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Certs and SSL
Chris PeBenito 31b7c0
r_dir_file($1_t, cert_t)
Chris PeBenito 31b7c0
allow $1_t { random_device_t urandom_device_t }:chr_file r_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
general_proc_read_access($1_t)
Chris PeBenito 31b7c0
read_locale($1_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow $1_t etc_t:file { getattr read };
Chris PeBenito 31b7c0
allow $1_t sbin_t:dir search;
Chris PeBenito 31b7c0
allow $1_t tmp_t:dir getattr;
Chris PeBenito 31b7c0
allow $1_t self:fifo_file { read write };
Chris PeBenito 31b7c0
can_exec($1_t, exim_exec_t)
Chris PeBenito 31b7c0
allow $1_t self:capability { chown fowner dac_override setgid setuid };
Chris PeBenito 31b7c0
allow $1_t self:process setrlimit;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Have to walk through /var/xxx to get to /var/xxx/exim
Chris PeBenito 31b7c0
allow $1_t var_log_t:dir search;
Chris PeBenito 31b7c0
allow $1_t var_spool_t:dir search;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Exim creates a spool file per message
Chris PeBenito 31b7c0
create_dir_file($1_t, exim_spool_t);
Chris PeBenito 31b7c0
# It also creates a log file per message
Chris PeBenito 31b7c0
create_dir_file($1_t, exim_log_t);
Chris PeBenito 31b7c0
# The database is modified by every message
Chris PeBenito 31b7c0
allow $1_t exim_spool_db_t:dir search;
Chris PeBenito 31b7c0
allow $1_t exim_spool_db_t:file rw_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Checking the existence of mailman lists
Chris PeBenito 31b7c0
allow $1_t mailman_data_t:file getattr;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Trying to read mtab
Chris PeBenito 31b7c0
dontaudit $1_t etc_runtime_t:file { getattr read };
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
define(`exim_user_domain',`
Chris PeBenito 31b7c0
########################################
Chris PeBenito 31b7c0
########################################
Chris PeBenito 31b7c0
application_domain(exim_$1, `, mta_delivery_agent, mail_server_domain, mail_server_sender, nscd_client_domain, privlog');
Chris PeBenito 31b7c0
in_user_role(exim_$1_t)
Chris PeBenito 31b7c0
domain_auto_trans($1_t, exim_exec_t, exim_$1_t)
Chris PeBenito 31b7c0
exim_common(exim_$1)
Chris PeBenito 31b7c0
role $1_r types exim_$1_t;
Chris PeBenito 31b7c0
allow exim_$1_t $1_tmp_t:file { getattr read };
Chris PeBenito 31b7c0
allow exim_$1_t $1_devpts_t:chr_file rw_file_perms;
Chris PeBenito 31b7c0
allow exim_$1_t sshd_t:fd use;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0