|
Chris PeBenito |
4bf4ed |
## <summary>Policy common to all email tranfer agents.</summary>
|
|
Chris PeBenito |
6b9383 |
|
|
Chris PeBenito |
6b9383 |
#######################################
|
|
Chris PeBenito |
6b9383 |
#
|
|
Chris PeBenito |
6b9383 |
# Per user domain template for this module
|
|
Chris PeBenito |
6b9383 |
#
|
|
Chris PeBenito |
6b9383 |
# mta_per_userdomain_template(userdomain_prefix)
|
|
Chris PeBenito |
6b9383 |
#
|
|
Chris PeBenito |
199895 |
template(`mta_per_userdomain_template',`
|
|
Chris PeBenito |
0c73cd |
type $1_mail_t; # , user_mail_domain, nscd_client_domain;
|
|
Chris PeBenito |
c9428d |
domain_type($1_mail_t)
|
|
Chris PeBenito |
0c73cd |
role $1_r types $1_mail_t;
|
|
Chris PeBenito |
6b9383 |
|
|
Chris PeBenito |
0c73cd |
type $1_mail_tmp_t;
|
|
Chris PeBenito |
c9428d |
files_tmp_file($1_mail_tmp_t)
|
|
Chris PeBenito |
6b9383 |
|
|
Chris PeBenito |
0c73cd |
##############################
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# $1_mail_t local policy
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t self:capability { setuid setgid chown };
|
|
Chris PeBenito |
0a10b1 |
allow $1_mail_t self:process { signal_perms setrlimit };
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# tcp networking
|
|
Chris PeBenito |
0a10b1 |
allow $1_mail_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# re-exec itself
|
|
Chris PeBenito |
0a10b1 |
can_exec($1_mail_t, sendmail_exec_t)
|
|
Chris PeBenito |
0a10b1 |
allow $1_mail_t sendmail_exec_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# Transition from the user domain to the derived domain.
|
|
Chris PeBenito |
0a10b1 |
domain_auto_trans($1_t, sendmail_exec_t, $1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
allow $1_t sendmail_exec_t:lnk_file { getattr read };
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
allow $1_t $1_mail_t:fd use;
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t $1_t:fd use;
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t $1_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t $1_t:process sigchld;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
kernel_read_kernel_sysctl($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_if($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_raw_sendrecv_all_if($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_nodes($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_raw_sendrecv_all_nodes($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_ports($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_bind_all_nodes($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so($1_mail_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
corecmd_exec_bin($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
8fd367 |
files_read_etc_files($1_mail_t)
|
|
Chris PeBenito |
6b9383 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
miscfiles_read_localization($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
sysnet_read_config($1_mail_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
tunable_policy(`use_dns',`
|
|
Chris PeBenito |
0a10b1 |
allow $1_mail_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_if($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_nodes($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_bind_all_nodes($1_mail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_dns_port($1_mail_t)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
ab940a |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
ab940a |
nis_use_ypbind($1_mail_t)
|
|
Chris PeBenito |
ab940a |
')
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
0c73cd |
optional_policy(`procmail.te',`
|
|
Chris PeBenito |
0c73cd |
procmail_execute($1_mail_t)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
ifdef(`TODO',`
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t device_t:dir search;
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t { var_t var_spool_t }:dir search;
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t sbin_t:dir search;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# It wants to check for nscd
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_mail_t var_run_t:dir search;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# For when the user wants to send mail via port 25 localhost
|
|
Chris PeBenito |
0c73cd |
can_tcp_connect($1_t, mail_server_domain)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# Read user temporary files.
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t $1_tmp_t:file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_mail_t $1_tmp_t:file append;
|
|
Chris PeBenito |
0c73cd |
ifdef(`postfix.te', `
|
|
Chris PeBenito |
0c73cd |
# postfix seems to need write access if the file handle is opened read/write
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t $1_tmp_t:file write;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0a10b1 |
allow mta_user_agent $1_tmp_t:file r_file_perms;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# Write to the user domain tty.
|
|
Chris PeBenito |
0a10b1 |
allow mta_user_agent $1_tty_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0a10b1 |
allow mta_user_agent devpts_t:dir r_dir_perms;
|
|
Chris PeBenito |
0a10b1 |
allow mta_user_agent $1_devpts_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0a10b1 |
allow $1_mail_t $1_tty_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0a10b1 |
allow $1_mail_t devpts_t:dir r_dir_perms;
|
|
Chris PeBenito |
0a10b1 |
allow $1_mail_t $1_devpts_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# Inherit and use descriptors from gnome-pty-helper.
|
|
Chris PeBenito |
0c73cd |
ifdef(`gnome-pty-helper.te', `allow $1_mail_t $1_gph_t:fd use;')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# Create dead.letter in user home directories.
|
|
Chris PeBenito |
0c73cd |
file_type_auto_trans($1_mail_t, $1_home_dir_t, $1_home_t, file)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`use_samba_home_dirs',`
|
|
Chris PeBenito |
0c73cd |
rw_dir_create_file($1_mail_t, cifs_t)
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# if you do not want to allow dead.letter then use the following instead
|
|
Chris PeBenito |
0c73cd |
#allow $1_mail_t { $1_home_dir_t $1_home_t }:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
#allow $1_mail_t $1_home_t:file r_file_perms;
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
# for reading .forward - maybe we need a new type for it?
|
|
Chris PeBenito |
0c73cd |
# also for delivering mail to maildir
|
|
Chris PeBenito |
0c73cd |
file_type_auto_trans(mta_delivery_agent, $1_home_dir_t, $1_home_t)
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
ifdef(`qmail.te', `
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t qmail_etc_t:dir search;
|
|
Chris PeBenito |
0c73cd |
allow $1_mail_t qmail_etc_t:{ file lnk_file } read;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
0c73cd |
') dnl end TODO
|
|
Chris PeBenito |
6b9383 |
')
|
|
Chris PeBenito |
6b9383 |
|
|
Chris PeBenito |
075c4f |
#######################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# mta_mailserver(domain,entrypointtype)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_mailserver',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
attribute mailserver_domain;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
init_daemon_domain($1,$2)
|
|
Chris PeBenito |
0c73cd |
typeattribute $1 mailserver_domain;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
#######################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# mta_sendmail_mailserver(domain,entrypointtype)
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_sendmail_mailserver',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type sendmail_exec_t;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
mta_mailserver($1,sendmail_exec_t)
|
|
Chris PeBenito |
7bba9d |
')
|
|
Chris PeBenito |
7bba9d |
|
|
Chris PeBenito |
7bba9d |
#######################################
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
c6a3a2 |
# mta_send_mail(domain)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_send_mail',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type system_mail_t, sendmail_exec_t;
|
|
Chris PeBenito |
5e6f9e |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
5e6f9e |
class process sigchld;
|
|
Chris PeBenito |
5e6f9e |
class fd use;
|
|
Chris PeBenito |
5e6f9e |
class fifo_file rw_file_perms;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0a10b1 |
allow $1 sendmail_exec_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
0a10b1 |
domain_auto_trans($1, sendmail_exec_t, system_mail_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 system_mail_t:fd use;
|
|
Chris PeBenito |
0c73cd |
allow system_mail_t $1:fd use;
|
|
Chris PeBenito |
0c73cd |
allow system_mail_t $1:fifo_file rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow system_mail_t $1:process sigchld;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
#######################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# mta_exec(domain)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_exec',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type sendmail_exec_t;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0a10b1 |
can_exec($1, sendmail_exec_t)
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
daa0e0 |
########################################
|
|
Chris PeBenito |
414e41 |
## <desc>
|
|
Chris PeBenito |
414e41 |
## Read mail address aliases.
|
|
Chris PeBenito |
414e41 |
## </desc>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
daa0e0 |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_read_aliases',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type etc_aliases_t;
|
|
Chris PeBenito |
5e6f9e |
class file r_file_perms;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
5e6f9e |
files_search_etc($1)
|
|
Chris PeBenito |
0a10b1 |
allow $1 etc_aliases_t:file r_file_perms;
|
|
Chris PeBenito |
daa0e0 |
')
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
7bba9d |
#######################################
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
c9428d |
# mta_rw_aliases(domain)
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_rw_aliases',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type etc_aliases_t;
|
|
Chris PeBenito |
5e6f9e |
class file { rw_file_perms setattr };
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
5e6f9e |
files_search_etc($1)
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t etc_aliases_t:file { rw_file_perms setattr };
|
|
Chris PeBenito |
7bba9d |
')
|
|
Chris PeBenito |
7bba9d |
|
|
Chris PeBenito |
7bba9d |
#######################################
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
c9428d |
# mta_getattr_spool(domain)
|
|
Chris PeBenito |
4bf4ed |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_getattr_spool',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type mail_spool_t;
|
|
Chris PeBenito |
5e6f9e |
class dir r_dir_perms;
|
|
Chris PeBenito |
5e6f9e |
class file getattr;
|
|
Chris PeBenito |
5e6f9e |
class lnk_file read;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
files_search_spool($1)
|
|
Chris PeBenito |
0c73cd |
allow $1 mail_spool_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1 mail_spool_t:lnk_file read;
|
|
Chris PeBenito |
0c73cd |
allow $1 mail_spool_t:file getattr;
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
4bf4ed |
#######################################
|
|
Chris PeBenito |
4bf4ed |
#
|
|
Chris PeBenito |
c9428d |
# mta_rw_spool(domain)
|
|
Chris PeBenito |
b16c6b |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_rw_spool',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type mail_spool_t;
|
|
Chris PeBenito |
5e6f9e |
class dir r_dir_perms;
|
|
Chris PeBenito |
5e6f9e |
class file { rw_file_perms setattr };
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
files_search_spool($1)
|
|
Chris PeBenito |
5e6f9e |
allow $1 mail_spool_t:dir r_dir_perms;
|
|
Chris PeBenito |
0a10b1 |
allow $1 mail_spool_t:file { rw_file_perms setattr };
|
|
Chris PeBenito |
b16c6b |
')
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
b16c6b |
#######################################
|
|
Chris PeBenito |
b16c6b |
#
|
|
Chris PeBenito |
c9428d |
# mta_manage_spool(domain)
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_manage_spool',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type mail_spool_t;
|
|
Chris PeBenito |
5e6f9e |
class dir rw_dir_perms;
|
|
Chris PeBenito |
5e6f9e |
class file create_file_perms;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
files_search_spool($1)
|
|
Chris PeBenito |
0a10b1 |
allow $1 mail_spool_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0a10b1 |
allow $1 mail_spool_t:file create_file_perms;
|
|
Chris PeBenito |
7bba9d |
')
|
|
Chris PeBenito |
7bba9d |
|
|
Chris PeBenito |
7bba9d |
#######################################
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
c9428d |
# mta_manage_queue(domain)
|
|
Chris PeBenito |
7bba9d |
#
|
|
Chris PeBenito |
199895 |
interface(`mta_manage_queue',`
|
|
Chris PeBenito |
5e6f9e |
gen_require(`
|
|
Chris PeBenito |
5e6f9e |
type mqueue_spool_t;
|
|
Chris PeBenito |
5e6f9e |
class dir rw_dir_perms;
|
|
Chris PeBenito |
5e6f9e |
class file create_file_perms;
|
|
Chris PeBenito |
5e6f9e |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
5e6f9e |
# FIXME: search /var/spool dir
|
|
Chris PeBenito |
0a10b1 |
allow $1 mqueue_spool_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0a10b1 |
allow $1 mqueue_spool_t:file create_file_perms;
|
|
Chris PeBenito |
7bba9d |
')
|
|
Chris PeBenito |
7bba9d |
|