selinux-policy/refpolicy/policy/modules/services/mta.if

820 lines
18 KiB
Plaintext
Raw Normal View History

## <summary>Policy common to all email tranfer agents.</summary>
2005-05-02 19:24:29 +00:00
2005-10-18 18:25:33 +00:00
########################################
## <summary>
## MTA stub interface. No access allowed.
## </summary>
## <param name="domain" optional="true">
## <summary>
2005-10-18 18:25:33 +00:00
## N/A
## </summary>
2005-10-18 18:25:33 +00:00
## </param>
#
interface(`mta_stub',`
gen_require(`
type sendmail_exec_t;
')
')
2005-05-02 19:24:29 +00:00
#######################################
## <summary>
2005-11-28 20:25:36 +00:00
## Basic mail transfer agent domain template.
## </summary>
## <desc>
## <p>
## This template creates a derived domain which is
## a email transfer agent, which sends mail on
## behalf of the user.
## </p>
## <p>
2005-11-28 20:25:36 +00:00
## This is the basic types and rules, common
2005-11-28 22:19:08 +00:00
## to the system agent and user agents.
## </p>
## </desc>
2005-11-28 20:25:36 +00:00
## <param name="domain_prefix">
## <summary>
2005-11-28 20:25:36 +00:00
## The prefix of the domain (e.g., user
## is the prefix for user_t).
## </summary>
## </param>
2005-05-02 19:24:29 +00:00
#
2005-11-28 20:25:36 +00:00
template(`mta_base_mail_template',`
##############################
#
# $1_mail_t declarations
#
2005-10-19 14:36:04 +00:00
2005-10-23 20:18:36 +00:00
type $1_mail_t, user_mail_domain;
2005-06-13 17:35:46 +00:00
domain_type($1_mail_t)
2005-11-28 20:25:36 +00:00
domain_entry_file($1_mail_t,sendmail_exec_t)
2005-05-02 19:24:29 +00:00
2005-11-29 21:27:15 +00:00
type $1_mail_tmp_t;
files_tmp_file($1_mail_tmp_t)
2005-05-02 19:24:29 +00:00
##############################
#
# $1_mail_t local policy
#
2005-05-12 20:50:09 +00:00
allow $1_mail_t self:capability { setuid setgid chown };
2005-06-09 15:32:23 +00:00
allow $1_mail_t self:process { signal_perms setrlimit };
allow $1_mail_t self:tcp_socket create_socket_perms;
2005-05-12 20:50:09 +00:00
# re-exec itself
2005-06-09 15:32:23 +00:00
can_exec($1_mail_t, sendmail_exec_t)
allow $1_mail_t sendmail_exec_t:lnk_file r_file_perms;
2005-05-12 20:50:09 +00:00
kernel_read_kernel_sysctls($1_mail_t)
2005-05-12 20:50:09 +00:00
2005-06-10 01:01:13 +00:00
corenet_tcp_sendrecv_all_if($1_mail_t)
corenet_raw_sendrecv_all_if($1_mail_t)
corenet_tcp_sendrecv_all_nodes($1_mail_t)
corenet_raw_sendrecv_all_nodes($1_mail_t)
corenet_tcp_sendrecv_all_ports($1_mail_t)
2005-12-06 19:59:50 +00:00
corenet_non_ipsec_sendrecv($1_mail_t)
2005-06-10 01:01:13 +00:00
corenet_tcp_bind_all_nodes($1_mail_t)
2005-09-16 19:36:10 +00:00
corenet_tcp_connect_all_ports($1_mail_t)
2005-11-28 20:25:36 +00:00
corenet_tcp_connect_smtp_port($1_mail_t)
2005-05-12 20:50:09 +00:00
2005-06-13 17:35:46 +00:00
corecmd_exec_bin($1_mail_t)
2005-07-12 20:34:24 +00:00
corecmd_search_sbin($1_mail_t)
2005-05-12 20:50:09 +00:00
files_read_etc_files($1_mail_t)
2005-07-12 20:34:24 +00:00
files_search_spool($1_mail_t)
2005-08-30 20:47:41 +00:00
# It wants to check for nscd
files_dontaudit_search_pids($1_mail_t)
2005-05-02 19:24:29 +00:00
2005-11-28 20:25:36 +00:00
libs_use_ld_so($1_mail_t)
libs_use_shared_libs($1_mail_t)
2005-06-13 17:35:46 +00:00
logging_send_syslog_msg($1_mail_t)
2005-05-12 20:50:09 +00:00
miscfiles_read_localization($1_mail_t)
2005-05-12 20:50:09 +00:00
2005-06-13 17:35:46 +00:00
sysnet_read_config($1_mail_t)
2005-09-15 21:03:29 +00:00
sysnet_dns_name_resolve($1_mail_t)
2005-05-12 20:50:09 +00:00
2005-11-28 20:25:36 +00:00
optional_policy(`nis',`
nis_use_ypbind($1_mail_t)
')
optional_policy(`nscd',`
2006-02-02 21:08:12 +00:00
nscd_socket_use($1_mail_t)
2005-11-28 20:25:36 +00:00
')
2005-12-05 20:18:20 +00:00
optional_policy(`postfix',`
postfix_domtrans_user_mail_handler($1_mail_t)
')
2005-11-28 20:25:36 +00:00
optional_policy(`procmail',`
procmail_exec($1_mail_t)
')
optional_policy(`sendmail',`
2005-11-29 21:27:15 +00:00
gen_require(`
type etc_mail_t, mail_spool_t, mqueue_spool_t;
')
2005-11-28 20:25:36 +00:00
allow $1_mail_t $1_mail_tmp_t:dir create_dir_perms;
allow $1_mail_t $1_mail_tmp_t:file create_file_perms;
files_filetrans_tmp($1_mail_t, $1_mail_tmp_t, { file dir })
2005-11-28 20:25:36 +00:00
allow $1_mail_t etc_mail_t:dir { getattr search };
# Write to /var/spool/mail and /var/spool/mqueue.
allow $1_mail_t mail_spool_t:dir rw_dir_perms;
allow $1_mail_t mail_spool_t:file create_file_perms;
allow $1_mail_t mqueue_spool_t:dir rw_dir_perms;
allow $1_mail_t mqueue_spool_t:file create_file_perms;
# Check available space.
fs_getattr_xattr_fs($1_mail_t)
files_read_etc_runtime_files($1_mail_t)
# Write to /var/log/sendmail.st
sendmail_manage_log($1_mail_t)
sendmail_create_log($1_mail_t)
')
ifdef(`TODO',`
ifdef(`qmail.te', `
allow $1_mail_t qmail_etc_t:dir search;
allow $1_mail_t qmail_etc_t:{ file lnk_file } read;
')
') dnl end TODO
')
#######################################
## <summary>
## The per user domain template for the mta module.
## </summary>
## <desc>
## <p>
## This template creates a derived domain which is
## a email transfer agent, which sends mail on
## behalf of the user.
## </p>
## <p>
## This template is invoked automatically for each user, and
## generally does not need to be invoked directly
## by policy writers.
## </p>
## </desc>
## <param name="userdomain_prefix">
## <summary>
2005-11-28 20:25:36 +00:00
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </summary>
2005-11-28 20:25:36 +00:00
## </param>
## <param name="user_domain">
## <summary>
2005-11-28 20:25:36 +00:00
## The type of the user domain.
## </summary>
2005-11-28 20:25:36 +00:00
## </param>
## <param name="user_role">
## <summary>
2005-11-28 20:25:36 +00:00
## The role associated with the user domain.
## </summary>
2005-11-28 20:25:36 +00:00
## </param>
#
template(`mta_per_userdomain_template',`
2006-02-03 16:13:15 +00:00
##############################
#
# Declarations
#
2005-11-28 20:25:36 +00:00
mta_base_mail_template($1)
role $3 types $1_mail_t;
##############################
#
# $1_mail_t local policy
#
# Transition from the user domain to the derived domain.
domain_auto_trans($2, sendmail_exec_t, $1_mail_t)
allow $2 sendmail_exec_t:lnk_file { getattr read };
allow $2 $1_mail_t:fd use;
allow $1_mail_t $2:fd use;
allow $1_mail_t $2:fifo_file rw_file_perms;
allow $1_mail_t $2:process sigchld;
# For when the user wants to send mail via port 25 localhost
kernel_tcp_recvfrom($2)
allow $2 mailserver_domain:tcp_socket { connectto recvfrom };
allow mailserver_domain $2:tcp_socket { acceptfrom recvfrom };
domain_use_wide_inherit_fd($1_mail_t)
userdom_use_user_terminals($1,$1_mail_t)
2005-08-30 20:47:41 +00:00
# Write to the user domain tty. cjp: why?
userdom_use_user_terminals($1,mta_user_agent)
2005-10-25 00:00:50 +00:00
# Create dead.letter in user home directories.
2006-02-20 15:04:32 +00:00
userdom_manage_user_home_files($1,$1_mail_t)
2006-02-03 16:13:15 +00:00
userdom_filetrans_user_home($1,$1_mail_t,file)
2005-10-25 00:00:50 +00:00
# for reading .forward - maybe we need a new type for it?
# also for delivering mail to maildir
userdom_manage_user_home_subdirs($1,mailserver_delivery)
2006-02-20 15:04:32 +00:00
userdom_manage_user_home_files($1,mailserver_delivery)
userdom_manage_user_home_symlinks($1,mailserver_delivery)
userdom_manage_user_home_pipes($1,mailserver_delivery)
userdom_manage_user_home_sockets($1,mailserver_delivery)
2006-02-03 16:13:15 +00:00
userdom_filetrans_user_home($1,mailserver_delivery,{ dir file lnk_file fifo_file sock_file })
# Read user temporary files.
userdom_read_user_tmp_files($1,$1_mail_t)
userdom_dontaudit_append_user_tmp_files($1,$1_mail_t)
# cjp: this should probably be read all user tmp
# files in an appropriate place for mta_user_agent
userdom_read_user_tmp_files($1,mta_user_agent)
2005-07-12 20:34:24 +00:00
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_files($1_mail_t)
fs_manage_cifs_symlinks($1_mail_t)
')
optional_policy(`postfix',`
2005-10-23 20:18:36 +00:00
allow $1_mail_t self:capability dac_override;
# Read user temporary files.
# postfix seems to need write access if the file handle is opened read/write
userdom_rw_user_tmp_files($1,$1_mail_t)
postfix_read_config($1_mail_t)
postfix_list_spool($1_mail_t)
')
2005-05-12 20:50:09 +00:00
ifdef(`TODO',`
# if you do not want to allow dead.letter then use the following instead
#allow $1_mail_t { $1_home_dir_t $1_home_t }:dir r_dir_perms;
#allow $1_mail_t $1_home_t:file r_file_perms;
') dnl end TODO
2005-05-02 19:24:29 +00:00
')
2005-11-28 22:19:08 +00:00
########################################
## <summary>
## Provide extra permissions for admin users
## mail domain.
## </summary>
## <param name="userdomain_prefix">
## <summary>
2005-11-28 22:19:08 +00:00
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </summary>
2005-11-28 22:19:08 +00:00
## </param>
## <param name="user_domain">
## <summary>
2005-11-28 22:19:08 +00:00
## The type of the user domain.
## </summary>
2005-11-28 22:19:08 +00:00
## </param>
#
template(`mta_admin_template',`
gen_require(`
type $1_mail_t;
')
2005-11-28 22:19:08 +00:00
ifdef(`strict_policy',`
# allow the sysadmin to do "mail someone < /home/user/whatever"
userdom_read_unpriv_user_home_files($1_mail_t)
')
optional_policy(`postfix',`
gen_require(`
attribute mta_user_agent;
type etc_aliases_t;
')
allow mta_user_agent $2:fifo_file { read write };
allow $1_mail_t etc_aliases_t:dir create_dir_perms;
allow $1_mail_t etc_aliases_t:file create_file_perms;
allow $1_mail_t etc_aliases_t:lnk_file create_lnk_perms;
allow $1_mail_t etc_aliases_t:sock_file create_file_perms;
allow $1_mail_t etc_aliases_t:fifo_file create_file_perms;
files_filetrans_etc($1_mail_t,etc_aliases_t,{ file lnk_file sock_file fifo_file })
2005-11-28 22:19:08 +00:00
# postfix needs this for newaliases
files_getattr_tmp_dirs($1_mail_t)
2005-11-28 22:19:08 +00:00
postfix_exec_master($1_mail_t)
ifdef(`distro_redhat',`
# compatability for old default main.cf
postfix_filetrans_config($1_mail_t,etc_aliases_t,{ dir file lnk_file sock_file fifo_file })
2005-11-28 22:19:08 +00:00
')
')
')
2005-05-12 20:50:09 +00:00
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_mailserver(domain,entrypointtype)
2005-05-12 20:50:09 +00:00
#
interface(`mta_mailserver',`
2005-06-17 18:41:07 +00:00
gen_require(`
attribute mailserver_domain;
')
2005-08-30 20:47:41 +00:00
# For when the user wants to send mail via port 25 localhost
kernel_tcp_recvfrom($1)
2005-06-13 17:35:46 +00:00
init_daemon_domain($1,$2)
typeattribute $1 mailserver_domain;
2005-05-12 20:50:09 +00:00
')
2005-07-07 15:25:28 +00:00
########################################
## <summary>
## Modified mailserver interface for
## sendmail daemon use.
## </summary>
## <desc>
## <p>
## A modified MTA mail server interface for
## the sendmail program. It's design does
## not fit well with policy, and using the
## regular interface causes a type_transition
## conflict if direct running of init scripts
## is enabled.
## </p>
## <p>
## This interface should most likely only be used
## by the sendmail policy.
## </p>
## </desc>
## <param name="domain">
## <summary>
2005-07-07 15:25:28 +00:00
## The type to be used for the mail server.
## </summary>
2005-07-07 15:25:28 +00:00
## </param>
## <param name="entry_point">
## <summary>
2005-07-07 15:25:28 +00:00
## The type to be used for the domain entry point program.
## </summary>
2005-07-07 15:25:28 +00:00
## </param>
interface(`mta_sendmail_mailserver',`
2005-06-17 18:41:07 +00:00
gen_require(`
2005-07-07 15:25:28 +00:00
attribute mailserver_domain;
2005-06-17 18:41:07 +00:00
type sendmail_exec_t;
')
2005-08-30 20:47:41 +00:00
# For when the user wants to send mail via port 25 localhost
kernel_tcp_recvfrom($1)
2005-07-07 15:25:28 +00:00
init_system_domain($1,sendmail_exec_t)
typeattribute $1 mailserver_domain;
2005-05-13 14:37:13 +00:00
')
2005-08-30 20:47:41 +00:00
#######################################
## <summary>
## Make a type a mailserver type used
## for sending mail.
## </summary>
## <param name="domain">
## <summary>
2005-08-30 20:47:41 +00:00
## Mail server domain type used for sending mail.
## </summary>
2005-08-30 20:47:41 +00:00
## </param>
#
interface(`mta_mailserver_sender',`
gen_require(`
attribute mailserver_sender;
')
typeattribute $1 mailserver_sender;
')
#######################################
## <summary>
## Make a type a mailserver type used
## for delivering mail to local users.
## </summary>
## <param name="domain">
## <summary>
2005-08-30 20:47:41 +00:00
## Mail server domain type used for delivering mail.
## </summary>
2005-08-30 20:47:41 +00:00
## </param>
#
interface(`mta_mailserver_delivery',`
gen_require(`
attribute mailserver_delivery;
2005-10-25 00:00:50 +00:00
type mail_spool_t;
2005-08-30 20:47:41 +00:00
')
typeattribute $1 mailserver_delivery;
2005-10-11 15:36:53 +00:00
2005-10-25 00:00:50 +00:00
allow $1 mail_spool_t:dir ra_dir_perms;
allow $1 mail_spool_t:file { create ioctl read getattr lock append };
allow $1 mail_spool_t:lnk_file { create read getattr };
optional_policy(`dovecot',`
2005-10-21 15:38:22 +00:00
dovecot_manage_spool($1)
')
optional_policy(`mailman',`
2005-10-11 15:36:53 +00:00
# so MTA can access /var/lib/mailman/mail/wrapper
files_search_var_lib($1)
mailman_domtrans($1)
mailman_read_data_symlinks($1)
')
2005-08-30 20:47:41 +00:00
')
#######################################
## <summary>
## Make a type a mailserver type used
## for sending mail on behalf of local
## users to the local mail spool.
## </summary>
## <param name="domain">
## <summary>
2005-08-30 20:47:41 +00:00
## Mail server domain type used for sending local mail.
## </summary>
2005-08-30 20:47:41 +00:00
## </param>
#
interface(`mta_mailserver_user_agent',`
gen_require(`
2005-10-17 17:55:38 +00:00
attribute mta_user_agent;
2005-08-30 20:47:41 +00:00
')
2005-10-17 17:55:38 +00:00
typeattribute $1 mta_user_agent;
optional_policy(`apache',`
2005-10-17 17:55:38 +00:00
# apache should set close-on-exec
2006-02-02 21:08:12 +00:00
apache_dontaudit_rw_stream_sockets($1)
apache_dontaudit_rw_sys_script_stream_sockets($1)
2005-10-17 17:55:38 +00:00
')
2005-08-30 20:47:41 +00:00
')
2005-05-13 14:37:13 +00:00
#######################################
#
# mta_send_mail(domain)
2005-05-12 20:50:09 +00:00
#
interface(`mta_send_mail',`
2005-06-17 18:41:07 +00:00
gen_require(`
2005-10-25 00:00:50 +00:00
attribute mta_user_agent;
2005-06-17 18:41:07 +00:00
type system_mail_t, sendmail_exec_t;
')
2005-06-09 15:32:23 +00:00
allow $1 sendmail_exec_t:lnk_file r_file_perms;
domain_auto_trans($1, sendmail_exec_t, system_mail_t)
allow $1 system_mail_t:fd use;
allow system_mail_t $1:fd use;
allow system_mail_t $1:fifo_file rw_file_perms;
allow system_mail_t $1:process sigchld;
2005-07-21 20:34:57 +00:00
allow mta_user_agent $1:fd use;
allow mta_user_agent $1:process sigchld;
allow mta_user_agent $1:fifo_file { read write };
2005-05-12 20:50:09 +00:00
')
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_exec(domain)
2005-05-12 20:50:09 +00:00
#
interface(`mta_exec',`
2005-06-17 18:41:07 +00:00
gen_require(`
type sendmail_exec_t;
')
2005-06-09 15:32:23 +00:00
can_exec($1, sendmail_exec_t)
2005-05-12 20:50:09 +00:00
')
2005-10-22 23:50:23 +00:00
########################################
## <summary>
## Read mail server configuration.
## </summary>
## <param name="domain">
## <summary>
2006-01-16 22:03:38 +00:00
## Domain allowed access.
## </summary>
2005-10-22 23:50:23 +00:00
## </param>
#
interface(`mta_read_config',`
gen_require(`
type etc_mail_t;
')
files_search_etc($1)
2005-10-24 19:50:21 +00:00
allow $1 etc_mail_t:dir list_dir_perms;
allow $1 etc_mail_t:file r_file_perms;
allow $1 etc_mail_t:lnk_file { getattr read };
2005-10-22 23:50:23 +00:00
')
########################################
2005-08-11 17:46:39 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Read mail address aliases.
2005-08-11 17:46:39 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
## <summary>
2006-01-16 22:03:38 +00:00
## Domain allowed access.
## </summary>
2005-06-23 21:30:57 +00:00
## </param>
#
interface(`mta_read_aliases',`
2005-06-17 18:41:07 +00:00
gen_require(`
type etc_aliases_t;
')
2005-06-17 18:41:07 +00:00
files_search_etc($1)
2005-06-09 15:32:23 +00:00
allow $1 etc_aliases_t:file r_file_perms;
')
2006-01-16 22:03:38 +00:00
########################################
## <summary>
## Type transition files created in /etc
## to the mail address aliases type.
## </summary>
## <param name="domain">
## <summary>
2006-01-16 22:03:38 +00:00
## Domain allowed access.
## </summary>
2006-01-16 22:03:38 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`mta_filetrans_aliases',`
2006-01-16 22:03:38 +00:00
gen_require(`
type etc_aliases_t;
')
files_filetrans_etc($1,etc_aliases_t, file)
')
2005-05-13 14:37:13 +00:00
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_rw_aliases(domain)
2005-05-13 14:37:13 +00:00
#
interface(`mta_rw_aliases',`
2005-06-17 18:41:07 +00:00
gen_require(`
type etc_aliases_t;
')
2005-06-17 18:41:07 +00:00
files_search_etc($1)
2005-10-23 20:18:36 +00:00
allow $1 etc_aliases_t:file { rw_file_perms setattr };
2005-05-13 14:37:13 +00:00
')
2005-10-11 15:36:53 +00:00
#######################################
## <summary>
## Do not audit attempts to read and write TCP
## sockets of mail delivery domains.
## </summary>
## <param name="domain">
## <summary>
2005-10-11 15:36:53 +00:00
## Mail server domain.
## </summary>
2005-10-11 15:36:53 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`mta_dontaudit_rw_delivery_tcp_sockets',`
2005-10-11 15:36:53 +00:00
gen_require(`
attribute mailserver_delivery;
2005-10-11 15:36:53 +00:00
')
dontaudit $1 mailserver_delivery:tcp_socket { read write };
')
#######################################
## <summary>
## Connect to all mail servers over TCP.
## </summary>
## <param name="domain">
## <summary>
2005-10-11 15:36:53 +00:00
## Mail server domain.
## </summary>
2005-10-11 15:36:53 +00:00
## </param>
#
interface(`mta_tcp_connect_all_mailservers',`
gen_require(`
attribute mailserver_domain;
')
allow $1 mailserver_domain:tcp_socket { connectto recvfrom };
allow mailserver_domain $1:tcp_socket { acceptfrom recvfrom };
kernel_tcp_recvfrom($1)
')
2005-07-08 20:44:57 +00:00
#######################################
## <summary>
## Do not audit attempts to read a symlink
## in the mail spool.
## </summary>
## <param name="domain">
## <summary>
2005-07-08 20:44:57 +00:00
## Domain allowed access.
## </summary>
2005-07-08 20:44:57 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`mta_dontaudit_read_spool_symlinks',`
2005-07-08 20:44:57 +00:00
gen_require(`
type mail_spool_t;
')
dontaudit $1 mail_spool_t:lnk_file read;
')
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_getattr_spool(domain)
#
interface(`mta_getattr_spool',`
2005-06-17 18:41:07 +00:00
gen_require(`
type mail_spool_t;
')
2005-06-13 17:35:46 +00:00
files_search_spool($1)
allow $1 mail_spool_t:dir r_dir_perms;
allow $1 mail_spool_t:lnk_file read;
allow $1 mail_spool_t:file getattr;
')
2006-02-02 21:08:12 +00:00
interface(`mta_dontaudit_getattr_spool_files',`
2006-01-30 22:51:35 +00:00
gen_require(`
type mail_spool_t;
')
files_dontaudit_search_spool($1)
dontaudit $1 mail_spool_t:dir search;
dontaudit $1 mail_spool_t:lnk_file read;
dontaudit $1 mail_spool_t:file getattr;
')
2005-12-08 15:58:12 +00:00
#######################################
## <summary>
## Create private objects in the
## mail spool directory.
## </summary>
## <param name="domain">
## <summary>
2005-12-08 15:58:12 +00:00
## Domain allowed access.
## </summary>
2005-12-08 15:58:12 +00:00
## </param>
## <param name="private type">
## <summary>
2005-12-08 15:58:12 +00:00
## The type of the object to be created.
## </summary>
2005-12-08 15:58:12 +00:00
## </param>
## <param name="object" optional="true">
## <summary>
2005-12-08 15:58:12 +00:00
## The object class of the object being created. If
## no class is specified, file will be used.
## </summary>
2005-12-08 15:58:12 +00:00
## </param>
#
interface(`mta_filetrans_spool',`
2005-12-08 15:58:12 +00:00
gen_require(`
type mail_spool_t;
')
files_search_spool($1)
allow $1 mail_spool_t:dir rw_dir_perms;
ifelse(`$3',`',`
type_transition $1 mail_spool_t:file $2;
',`
type_transition $1 mail_spool_t:$3 $2;
')
')
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_rw_spool(domain)
#
interface(`mta_rw_spool',`
2005-06-17 18:41:07 +00:00
gen_require(`
type mail_spool_t;
')
2005-06-13 17:35:46 +00:00
files_search_spool($1)
2005-06-17 18:41:07 +00:00
allow $1 mail_spool_t:dir r_dir_perms;
2005-07-12 20:34:24 +00:00
allow $1 mail_spool_t:lnk_file { getattr read };
2005-06-09 15:32:23 +00:00
allow $1 mail_spool_t:file { rw_file_perms setattr };
')
2005-08-30 20:47:41 +00:00
#######################################
## <summary>
## Create, read, and write the mail spool.
## </summary>
## <param name="domain">
## <summary>
2005-08-30 20:47:41 +00:00
## Domain allowed access.
## </summary>
2005-08-30 20:47:41 +00:00
## </param>
#
interface(`mta_append_spool',`
gen_require(`
type mail_spool_t;
')
files_search_spool($1)
allow $1 mail_spool_t:dir ra_dir_perms;
allow $1 mail_spool_t:lnk_file { getattr read };
allow $1 mail_spool_t:file create_file_perms;
')
2005-10-23 20:18:36 +00:00
#######################################
## <summary>
## Delete from the mail spool.
## </summary>
## <param name="domain">
## <summary>
2005-10-23 20:18:36 +00:00
## Domain allowed access.
## </summary>
2005-10-23 20:18:36 +00:00
## </param>
#
interface(`mta_delete_spool',`
gen_require(`
type mail_spool_t;
')
files_search_spool($1)
allow $1 mail_spool_t:dir { list_dir_perms write remove_name };
allow $1 mail_spool_t:file unlink;
')
2005-05-13 14:37:13 +00:00
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_manage_spool(domain)
2005-05-13 14:37:13 +00:00
#
interface(`mta_manage_spool',`
2005-06-17 18:41:07 +00:00
gen_require(`
type mail_spool_t;
')
2005-06-13 17:35:46 +00:00
files_search_spool($1)
2005-10-24 18:40:24 +00:00
allow $1 mail_spool_t:dir manage_dir_perms;
allow $1 mail_spool_t:lnk_file create_lnk_perms;
allow $1 mail_spool_t:file manage_file_perms;
2005-05-13 14:37:13 +00:00
')
2005-11-15 20:17:18 +00:00
#######################################
## <summary>
## Do not audit attempts to read and
## write the mail queue.
## </summary>
## <param name="domain">
## <summary>
2005-11-15 20:17:18 +00:00
## Domain to not audit.
## </summary>
2005-11-15 20:17:18 +00:00
## </param>
#
interface(`mta_dontaudit_rw_queue',`
gen_require(`
type mqueue_spool_t;
')
dontaudit $1 mqueue_spool_t:file { getattr read write };
')
2005-05-13 14:37:13 +00:00
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_manage_queue(domain)
2005-05-13 14:37:13 +00:00
#
interface(`mta_manage_queue',`
2005-06-17 18:41:07 +00:00
gen_require(`
type mqueue_spool_t;
')
2005-07-12 20:34:24 +00:00
files_search_spool($1)
2005-06-09 15:32:23 +00:00
allow $1 mqueue_spool_t:dir rw_dir_perms;
allow $1 mqueue_spool_t:file create_file_perms;
2005-05-13 14:37:13 +00:00
')
2005-10-23 20:18:36 +00:00
#######################################
## <summary>
## Read sendmail binary.
2005-10-23 22:10:59 +00:00
## </summary>
2005-10-23 20:18:36 +00:00
## <param name="domain">
## <summary>
2005-10-23 20:18:36 +00:00
## Domain allowed access.
## </summary>
2005-10-23 20:18:36 +00:00
## </param>
#
# cjp: added for postfix
interface(`mta_read_sendmail_bin',`
gen_require(`
2005-10-25 02:51:07 +00:00
type sendmail_exec_t;
2005-10-23 20:18:36 +00:00
')
allow $1 sendmail_exec_t:file r_file_perms;
')
#######################################
## <summary>
## Read and write unix domain stream sockets
## of user mail domains.
## </summary>
## <param name="domain">
## <summary>
2005-10-23 20:18:36 +00:00
## Domain allowed access.
## </summary>
2005-10-23 20:18:36 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`mta_rw_user_mail_stream_sockets',`
2005-10-23 20:18:36 +00:00
gen_require(`
attribute user_mail_domain;
')
allow $1 user_mail_domain:unix_stream_socket rw_socket_perms;
')