X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-puppet.git;a=blobdiff_plain;f=modules%2Fexim%2Ftemplates%2Feximconf.erb;h=a11e8d5de99b7f628ef9971ceafd8dcca8d973b7;hp=b95cd8387c81754f2009890202dba0cb89cbfe4d;hb=b245fb07a6f516d223dd5285e4e650224267b760;hpb=a5dad1d1925409a441d2d8635b4d533e149be0b4 diff --git a/modules/exim/templates/eximconf.erb b/modules/exim/templates/eximconf.erb index b95cd8387..a11e8d5de 100644 --- a/modules/exim/templates/eximconf.erb +++ b/modules/exim/templates/eximconf.erb @@ -303,6 +303,12 @@ GREYLIST_LOCAL_PARTS = ${if match_domain{$domain}{+virtual_domains}\ {${lookup{$local_part}lsearch{/etc/exim4/grey_users}{$local_part}{}}}} : \ ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-greylist}{$local_part}{}} <%- 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 -%> @@ -449,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} @@ -469,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} @@ -856,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}\ @@ -866,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}\ @@ -920,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 /scan// 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 -%> @@ -1367,7 +1397,7 @@ rt_force_new_verbose: pipe_transport = rt_pipe data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}" headers_remove = Subject - headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nSubject: ${if and {{first_delivery}{match {$h_subject:}{\N(?is)(.*?)\[?debian rt\]?[:\s]*(.*)\N}}} {$1$2}{$h_subject:}}" + headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nRT_SUBJECT" # FIXME: figure out how to generalize this approach so that all of the following would work # - rt+NNNN@rt.debian.org : attach correspondence to ticket (verbose) @@ -1384,7 +1414,7 @@ rt_force_new_quiesce: pipe_transport = rt_pipe data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-comment}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --action ${if match{$local_part}{.*-comment.*}{comment}{correspond}}" headers_remove = Subject - headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce\nSubject: ${if and {{first_delivery}{match {$h_subject:}{\N(?is)(.*?)\[?debian rt\]?[:\s]*(.*)\N}}} {$1$2}{$h_subject:}}" + headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nX-RT-Mode: quiesce\nRT_SUBJECT" rt_otherwise: debug_print = "R: rt for $local_part@$domain" @@ -1397,7 +1427,7 @@ rt_otherwise: pipe_transport = rt_pipe data = "|/usr/bin/rt-mailgate --queue '${lookup{${sg{$local_part}{-(comment|done)}{}}}lsearch{RT_QUEUE_MAP}}' --url https://rt.debian.org/ --ca-file /etc/ssl/ca-debian/ca-certificates.crt --extension ticket --action ${if match{$local_part}{.*-comment.*}{comment}{${if match{$local_part}{.*-done.*}{correspond-resolve}{correspond}}}}" headers_remove = Subject - headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nSubject: ${if and {{first_delivery}{match {$h_subject:}{\N(?i)(.*?)\[?debian rt\]?[:\s]*(.*)\N}}} {$1$2}{$h_subject:}}" + headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}\nRT_SUBJECT" <%- end -%> # Exim fails the router if it can't change to the user/group for delivery