|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Macros for spamassassin domains.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Author: Colin Walters <walters@verbum.org>
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# spamassassin_domain(domain_prefix)
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Define derived domains for various spamassassin tools when executed
|
|
Chris PeBenito |
0fbfa5 |
# by a user domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# The type declarations for the executable types of these programs are
|
|
Chris PeBenito |
0fbfa5 |
# provided separately in domains/program/spamassassin.te and
|
|
Chris PeBenito |
0fbfa5 |
# domains/program/spamc.te.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
undefine(`spamassassin_domain')
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`spamassassin.te', `define(`using_spamassassin', `')')
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`spamd.te', `define(`using_spamassassin', `')')
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`spamc.te', `define(`using_spamassassin', `')')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`using_spamassassin',`
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#######
|
|
Chris PeBenito |
0fbfa5 |
# Macros used internally in these spamassassin macros.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
###
|
|
Chris PeBenito |
0fbfa5 |
# Define a domain for a spamassassin-like program (spamc/spamassassin).
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Note: most of this should really be in a generic macro like
|
|
Chris PeBenito |
0fbfa5 |
# base_user_program($1, foo)
|
|
Chris PeBenito |
0fbfa5 |
define(`spamassassin_program_domain',`
|
|
Chris PeBenito |
0fbfa5 |
type $1_$2_t, domain, privlog;
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans($1_t, $2_exec_t, $1_$2_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
role $1_r types $1_$2_t;
|
|
Chris PeBenito |
0fbfa5 |
general_domain_access($1_$2_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
base_file_read_access($1_$2_t)
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_$2_t, etc_t)
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`sendmail.te', `
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_$2_t, etc_mail_t)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
allow $1_$2_t etc_runtime_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
uses_shlib($1_$2_t)
|
|
Chris PeBenito |
0fbfa5 |
read_locale($1_$2_t)
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_$2_t var_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_$2_t $1_home_dir_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
tmp_domain($1_$2)
|
|
Chris PeBenito |
0fbfa5 |
allow $1_$2_t privfd:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_$2_t userpty_type:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
') dnl end spamassassin_program_domain
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
###
|
|
Chris PeBenito |
0fbfa5 |
# Give privileges to a domain for accessing ~/.spamassassin
|
|
Chris PeBenito |
0fbfa5 |
# and a few other misc things like /dev/random.
|
|
Chris PeBenito |
0fbfa5 |
# This is granted to /usr/bin/spamassassin and
|
|
Chris PeBenito |
0fbfa5 |
# /usr/sbin/spamd, but NOT spamc (because it does not need it).
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
define(`spamassassin_agent_privs',`
|
|
Chris PeBenito |
0fbfa5 |
allow $1 home_root_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
file_type_auto_trans($1, $2_home_dir_t, $2_spamassassin_home_t)
|
|
Chris PeBenito |
0fbfa5 |
create_dir_file($1, $2_spamassassin_home_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow $1 urandom_device_t:chr_file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#######
|
|
Chris PeBenito |
0fbfa5 |
# Define the main spamassassin macro. This itself creates a
|
|
Chris PeBenito |
0fbfa5 |
# domain for /usr/bin/spamassassin, and also spamc/spamd if
|
|
Chris PeBenito |
0fbfa5 |
# applicable.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
define(`spamassassin_domain',`
|
|
Chris PeBenito |
0fbfa5 |
spamassassin_program_domain($1, spamassassin)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# For perl libraries.
|
|
Chris PeBenito |
0fbfa5 |
allow $1_spamassassin_t lib_t:file rx_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
# Ignore perl digging in /proc and /var.
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_spamassassin_t proc_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_spamassassin_t { sysctl_t sysctl_kernel_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# For ~/.spamassassin
|
|
Chris PeBenito |
0fbfa5 |
home_domain($1, spamassassin)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
spamassassin_agent_privs($1_spamassassin_t, $1)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# set tunable if you have spamassassin do DNS lookups
|
|
Chris PeBenito |
0fbfa5 |
if (spamassasin_can_network) {
|
|
Chris PeBenito |
0fbfa5 |
can_network($1_spamassassin_t)
|
|
Chris PeBenito |
0fbfa5 |
}
|
|
Chris PeBenito |
0fbfa5 |
if (spamassasin_can_network && allow_ypbind) {
|
|
Chris PeBenito |
0fbfa5 |
uncond_can_ypbind($1_spamassassin_t)
|
|
Chris PeBenito |
0fbfa5 |
}
|
|
Chris PeBenito |
0fbfa5 |
###
|
|
Chris PeBenito |
0fbfa5 |
# Define the domain for /usr/bin/spamc
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`spamc.te',`
|
|
Chris PeBenito |
0fbfa5 |
spamassassin_program_domain($1, spamc)
|
|
Chris PeBenito |
0fbfa5 |
can_network($1_spamc_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind($1_spamc_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Allow connecting to a local spamd
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`spamd.te',`
|
|
Chris PeBenito |
0fbfa5 |
can_tcp_connect($1_spamc_t, spamd_t)
|
|
Chris PeBenito |
0fbfa5 |
') dnl endif spamd.te
|
|
Chris PeBenito |
0fbfa5 |
') dnl endif spamc.te
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
###
|
|
Chris PeBenito |
0fbfa5 |
# Define the domain for /usr/sbin/spamd
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`spamd.te',`
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
spamassassin_agent_privs(spamd_t, $1)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
') dnl endif spamd.te
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
') dnl end spamassassin_domain
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
', `
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
define(`spamassassin_domain',`')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
')
|