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

330 lines
7.5 KiB
Plaintext
Raw Normal View History

2005-06-09 17:56:38 +00:00
## <module name="mta" layer="services">
## <summary>Policy common to all email tranfer agents.</summary>
2005-05-02 19:24:29 +00:00
#######################################
#
# Per user domain template for this module
#
# mta_per_userdomain_template(userdomain_prefix)
#
define(`mta_per_userdomain_template',`
requires_block_template(`$0'_depend)
2005-05-02 19:24:29 +00:00
type $1_mail_t; # , user_mail_domain, nscd_client_domain;
2005-06-13 17:35:46 +00:00
domain_type($1_mail_t)
role $1_r types $1_mail_t;
2005-05-02 19:24:29 +00:00
type $1_mail_tmp_t;
2005-06-13 17:35:46 +00:00
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 };
2005-05-12 20:50:09 +00:00
# tcp networking
2005-06-09 15:32:23 +00:00
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
# Transition from the user domain to the derived domain.
2005-06-09 15:32:23 +00:00
domain_auto_trans($1_t, sendmail_exec_t, $1_mail_t)
2005-06-10 01:01:13 +00:00
allow $1_t sendmail_exec_t:lnk_file { getattr read };
2005-05-12 20:50:09 +00:00
allow $1_t $1_mail_t:fd use;
allow $1_mail_t $1_t:fd use;
allow $1_mail_t $1_t:fifo_file rw_file_perms;
allow $1_mail_t $1_t:process sigchld;
2005-05-12 20:50:09 +00:00
kernel_read_kernel_sysctl($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)
corenet_tcp_bind_all_nodes($1_mail_t)
2005-05-12 20:50:09 +00:00
2005-06-13 17:35:46 +00:00
domain_use_wide_inherit_fd($1_mail_t)
2005-05-12 20:50:09 +00:00
2005-06-13 17:35:46 +00:00
libs_use_ld_so($1_mail_t)
libs_use_shared_libs($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-05-12 20:50:09 +00:00
2005-06-13 17:35:46 +00:00
files_read_generic_etc_files($1_mail_t)
2005-05-02 19:24:29 +00:00
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-05-12 20:50:09 +00:00
tunable_policy(`use_dns',`
2005-06-09 15:32:23 +00:00
allow $1_mail_t self:udp_socket create_socket_perms;
2005-06-10 01:01:13 +00:00
corenet_udp_sendrecv_all_if($1_mail_t)
corenet_udp_sendrecv_all_nodes($1_mail_t)
corenet_udp_bind_all_nodes($1_mail_t)
corenet_udp_sendrecv_dns_port($1_mail_t)
')
optional_policy(`procmail.te',`
procmail_execute($1_mail_t)
')
2005-05-12 20:50:09 +00:00
ifdef(`TODO',`
2005-05-12 20:50:09 +00:00
can_ypbind($1_mail_t)
2005-05-12 20:50:09 +00:00
allow $1_mail_t device_t:dir search;
allow $1_mail_t { var_t var_spool_t }:dir search;
allow $1_mail_t sbin_t:dir search;
2005-05-12 20:50:09 +00:00
# It wants to check for nscd
dontaudit $1_mail_t var_run_t:dir search;
2005-05-12 20:50:09 +00:00
# For when the user wants to send mail via port 25 localhost
can_tcp_connect($1_t, mail_server_domain)
2005-05-12 20:50:09 +00:00
# Read user temporary files.
allow $1_mail_t $1_tmp_t:file r_file_perms;
dontaudit $1_mail_t $1_tmp_t:file append;
ifdef(`postfix.te', `
# postfix seems to need write access if the file handle is opened read/write
allow $1_mail_t $1_tmp_t:file write;
')
2005-05-12 20:50:09 +00:00
2005-06-09 15:32:23 +00:00
allow mta_user_agent $1_tmp_t:file r_file_perms;
2005-05-12 20:50:09 +00:00
# Write to the user domain tty.
2005-06-09 15:32:23 +00:00
allow mta_user_agent $1_tty_device_t:chr_file rw_file_perms;
allow mta_user_agent devpts_t:dir r_dir_perms;
allow mta_user_agent $1_devpts_t:chr_file rw_file_perms;
2005-05-12 20:50:09 +00:00
2005-06-09 15:32:23 +00:00
allow $1_mail_t $1_tty_device_t:chr_file rw_file_perms;
allow $1_mail_t devpts_t:dir r_dir_perms;
allow $1_mail_t $1_devpts_t:chr_file rw_file_perms;
2005-05-12 20:50:09 +00:00
# Inherit and use descriptors from gnome-pty-helper.
ifdef(`gnome-pty-helper.te', `allow $1_mail_t $1_gph_t:fd use;')
2005-05-12 20:50:09 +00:00
# Create dead.letter in user home directories.
file_type_auto_trans($1_mail_t, $1_home_dir_t, $1_home_t, file)
2005-05-12 20:50:09 +00:00
if (use_samba_home_dirs) {
rw_dir_create_file($1_mail_t, cifs_t)
}
2005-05-12 20:50:09 +00:00
# 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;
2005-05-12 20:50:09 +00:00
# for reading .forward - maybe we need a new type for it?
# also for delivering mail to maildir
file_type_auto_trans(mta_delivery_agent, $1_home_dir_t, $1_home_t)
2005-05-12 20:50:09 +00:00
ifdef(`qmail.te', `
allow $1_mail_t qmail_etc_t:dir search;
allow $1_mail_t qmail_etc_t:{ file lnk_file } read;
')
2005-05-12 20:50:09 +00:00
') dnl end TODO
2005-05-02 19:24:29 +00:00
')
define(`mta_per_userdomain_template_depend',`
')
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
#
2005-06-13 17:35:46 +00:00
define(`mta_mailserver',`
requires_block_template(`$0'_depend)
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-06-13 17:35:46 +00:00
define(`mta_mailserver_depend',`
attribute mailserver_domain;
2005-05-12 20:50:09 +00:00
')
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_sendmail_mailserver(domain,entrypointtype)
2005-05-13 14:37:13 +00:00
#
2005-06-13 17:35:46 +00:00
define(`mta_sendmail_mailserver',`
requires_block_template(`$0'_depend)
2005-06-13 17:35:46 +00:00
mta_mailserver($1,sendmail_exec_t)
2005-05-13 14:37:13 +00:00
')
2005-06-13 17:35:46 +00:00
define(`mta_sendmail_mailserver_depend',`
type sendmail_exec_t;
2005-05-13 14:37:13 +00:00
')
#######################################
#
# mta_send_mail(domain)
2005-05-12 20:50:09 +00:00
#
define(`mta_send_mail',`
requires_block_template(`$0'_depend)
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-05-12 20:50:09 +00:00
')
define(`mta_send_mail_depend',`
type system_mail_t, sendmail_exec_t;
class file { getattr read execute };
2005-06-09 15:32:23 +00:00
class lnk_file r_file_perms;
class process { transition noatsecure siginh rlimitinh sigchld };
class fd use;
class fifo_file rw_file_perms;
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
#
2005-06-13 17:35:46 +00:00
define(`mta_exec',`
requires_block_template(`$0'_depend)
2005-06-09 15:32:23 +00:00
can_exec($1, sendmail_exec_t)
2005-05-12 20:50:09 +00:00
')
2005-06-13 17:35:46 +00:00
define(`mta_exec_depend',`
type sendmail_exec_t;
class file { getattr read execute execute_no_trans };
2005-05-12 20:50:09 +00:00
')
2005-05-13 14:37:13 +00:00
########################################
2005-06-13 17:35:46 +00:00
## <interface name="mta_read_aliases">
## <description>
## Read mail address aliases.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
2005-06-13 17:35:46 +00:00
define(`mta_read_aliases',`
requires_block_template(`$0'_depend)
2005-06-09 15:32:23 +00:00
allow $1 etc_aliases_t:file r_file_perms;
')
2005-06-13 17:35:46 +00:00
define(`mta_read_aliases_depend',`
type etc_aliases_t;
2005-06-09 15:32:23 +00:00
class file r_file_perms;
')
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
#
2005-06-13 17:35:46 +00:00
define(`mta_rw_aliases',`
requires_block_template(`$0'_depend)
2005-06-09 15:32:23 +00:00
allow sendmail_t etc_aliases_t:file { rw_file_perms setattr };
2005-05-13 14:37:13 +00:00
')
2005-06-13 17:35:46 +00:00
define(`mta_rw_aliases_depend',`
type etc_aliases_t;
2005-06-09 15:32:23 +00:00
class file { rw_file_perms setattr };
2005-05-13 14:37:13 +00:00
')
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_getattr_spool(domain)
#
2005-06-13 17:35:46 +00:00
define(`mta_getattr_spool',`
requires_block_template(`$0'_depend)
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;
')
2005-06-13 17:35:46 +00:00
define(`mta_getattr_spool_depend',`
type mail_spool_t;
class dir r_dir_perms;
class file getattr;
class lnk_file read;
')
#######################################
#
2005-06-13 17:35:46 +00:00
# mta_rw_spool(domain)
#
2005-06-13 17:35:46 +00:00
define(`mta_rw_spool',`
requires_block_template(`$0'_depend)
2005-06-13 17:35:46 +00:00
files_search_spool($1)
2005-06-09 15:32:23 +00:00
allow $1 mail_spool_t:dir rw_dir_perms;
allow $1 mail_spool_t:file { rw_file_perms setattr };
')
2005-06-13 17:35:46 +00:00
define(`mta_rw_spool_depend',`
type mail_spool_t;
2005-06-09 15:32:23 +00:00
class dir rw_dir_perms;
class file { rw_file_perms setattr };
')
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
#
2005-06-13 17:35:46 +00:00
define(`mta_manage_spool',`
requires_block_template(`$0'_depend)
2005-06-13 17:35:46 +00:00
files_search_spool($1)
2005-06-09 15:32:23 +00:00
allow $1 mail_spool_t:dir rw_dir_perms;
allow $1 mail_spool_t:file create_file_perms;
2005-05-13 14:37:13 +00:00
')
2005-06-13 17:35:46 +00:00
define(`mta_manage_spool_depend',`
type mail_spool_t;
2005-06-09 15:32:23 +00:00
class dir rw_dir_perms;
class file create_file_perms;
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
#
2005-06-13 17:35:46 +00:00
define(`mta_manage_queue',`
requires_block_template(`$0'_depend)
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-06-13 17:35:46 +00:00
define(`mta_manage_queue_depend',`
type mqueue_spool_t;
2005-06-09 15:32:23 +00:00
class dir rw_dir_perms;
class file create_file_perms;
2005-05-13 14:37:13 +00:00
')
## </module>