eximconf: log information about MIME parts
[mirror/dsa-puppet.git] / modules / exim / templates / eximconf.erb
index 0fd6ee5..a11e8d5 100644 (file)
@@ -302,8 +302,13 @@ GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\
                        {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/grey_users}}}{$local_part}{}}}{}}}\
                        {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}}}} : \
                        ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}}
-RT_SUBJECT = Subject: ${if and {{first_delivery}{match {${sg {$rh_Subject:}{\N\n\s+\N}{ }}}{\N(?is)(.*?)\[?debian rt\]?[:\s]*(.*)\N}}} {$1$2}{$h_subject:}}
 <%- if @is_rtmaster -%>
+# This subject rewrite is embedded in double-quoted strings. As such, some of
+# the items need more escaping than usual, otherwise \N becomes simply "N" and
+# the following "\[" a literal "[".
+# Note that the lack of space in "Subject:${" is intentional, as the raw Subject
+# header will include the leading space, if present.
+RT_SUBJECT = Subject:${if and {{first_delivery}{match {${sg {$rh_Subject:}{\\n([ \\t])}{ }}}{\\N(?i)(.*?)\\[?debian rt\\]?[:\\t ]*(.*)\\N}}}{$1$2}{$h_subject:}}
 RT_QUEUE_MAP = /srv/rt.debian.org/mail/rt_queue_map
 <%- end -%>
 
@@ -450,14 +455,17 @@ check_helo:
   # These are in HELO acl so that they are only run once.  They increment a counter,
   # so we don't want it to increment per rcpt to.
 
+  # high trust
   warn    dnslists       = list.dnswl.org&0.0.0.3
           log_message    = Hit on list.dnswl.org for $sender_host_address
           set acl_c_scr  = ${eval:$acl_c_scr-30}
 
+  # >= medium trust
   warn    dnslists       = list.dnswl.org&0.0.0.2
           log_message    = Hit on list.dnswl.org for $sender_host_address
           set acl_c_scr  = ${eval:$acl_c_scr-20}
 
+  # any form of listing
   warn    dnslists       = list.dnswl.org
           log_message    = Hit on list.dnswl.org for $sender_host_address
           set acl_c_scr  = ${eval:$acl_c_scr-10}
@@ -470,15 +478,18 @@ check_helo:
           condition      = ${if eq{$host_lookup_failed}{1}}
           set acl_c_scr  = ${eval:$acl_c_scr+20}
 
+  # HELO looks like a dynamic address (with RDNS match)
   warn    !hosts         = +debianhosts
           condition      = ${if eq{$host_lookup_failed}{0}}
           condition      = ${if match{$sender_host_name}{\N(^[^\.]*[0-9]\-+[0-9]|^[^\.]*[0-9]{5,}[^\.]|^([^\.]+\.)?[0-9][^ \.]*\.[^\.]+\..+\.[a-z]|^[^\.]*[0-9]\.[^\.]*[0-9]-[0-9]|^(dyn|cable|dhcp|dialup|ppp|adsl)[^\.]*[0-9])\N}}
           set acl_c_scr  = ${eval:$acl_c_scr+20}
 
+  # HELO looks like a dynamic address
   warn    !hosts         = +debianhosts
           condition      = ${if match{$sender_helo_name}{\N(^[^\.]*[0-9]\-+[0-9]|^[^\.]*[0-9]{5,}[^\.]|^([^\.]+\.)?[0-9][^ \.]*\.[^\.]+\..+\.[a-z]|^[^\.]*[0-9]\.[^\.]*[0-9]-[0-9]|^(dyn|cable|dhcp|dialup|ppp|adsl)[^\.]*[0-9])\N}}
           set acl_c_scr  = ${eval:$acl_c_scr+20}
 
+  # mail from a dynamic IP address range
   warn    !hosts         = +debianhosts
           dnslists       = dul.dnsbl.sorbs.net
           set acl_c_scr  = ${eval:$acl_c_scr+15}
@@ -857,6 +868,11 @@ check_recipient:
          domains       = +handled_domains
          !hosts        = +debianhosts : WHITELIST
 
+  deny    message  = host $sender_host_address is listed in $dnslist_domain; see $dnslist_text
+          dnslists = noserver.dnsbl.sorbs.net
+          domains  = +handled_domains
+          !hosts   = +debianhosts : WHITELIST
+
 <%- end -%>
   deny    message  = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
           dnslists = ${if match_domain{$domain}{+virtual_domains}\
@@ -867,6 +883,11 @@ check_recipient:
          domains       = +handled_domains
          !hosts        = +debianhosts : WHITELIST
 
+  deny    message  = domain $sender_address_domain is listed in $dnslist_domain; see $dnslist_text
+          dnslists = nomail.rhsbl.sorbs.net/$sender_address_domain
+          domains  = +handled_domains
+          !hosts   = +debianhosts : WHITELIST
+
 <%- unless @use_smarthost -%>
   deny    domains  = +handled_domains
           local_parts = ${if match_domain{$domain}{+virtual_domains}\
@@ -921,6 +942,14 @@ acl_check_mime:
          condition     = ${if !eq{$acl_m_srb}{false}}
          message       = X-Surbl-Hit: $primary_hostname: $acl_m_srb
 
+  # Dump MIME parts to disk. "default" creates sequentially-named files
+  # in <spool_directory>/scan/<message_id>/ which should then be
+  # automagically unlinked after processing.
+  warn   decode        = default
+
+  # Log some information about attachments for debugging
+  warn   log_message   = MIME part [$mime_part_count] -> [${extract{-1}{.}{${lc:$mime_filename}}}] [$mime_content_type]
+
   accept
 
 <%- end -%>