eximconf: re-order checks to avoid unnecessary DNS lookups
authorAdam D. Barratt <adam@adam-barratt.org.uk>
Sun, 27 Oct 2019 20:53:42 +0000 (20:53 +0000)
committerAdam D. Barratt <adam@adam-barratt.org.uk>
Sun, 27 Oct 2019 20:53:42 +0000 (20:53 +0000)
If the result of the DNS lookup is not going to be used, then we may as
well not perform the lokup at all

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
modules/exim/templates/eximconf.erb

index da1b73f..922ffa8 100644 (file)
@@ -901,45 +901,45 @@ check_recipient:
 
 <%- unless @use_smarthost -%>
   deny    message  = host $sender_host_address is listed in $dnslist_domain ($dnslist_value)${if >{${strlen:${dnslist_text}}}{0}{; see $dnslist_text}}
+          domains  = +handled_domains
+          !hosts   = +debianhosts : WHITELIST
           dnslists = ${if match_domain{$domain}{+virtual_domains}\
                     {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}\
                     {${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rbllist}}}{$value}{}}}{}}}\
                     {${lookup{$local_part}lsearch{/etc/exim4/rbllist}{$value}{}}}} : \
                     ${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rbl}{$value}{}}
-         domains       = +handled_domains
-         !hosts        = +debianhosts : WHITELIST
 
   deny    message  = host $sender_host_address is listed in $dnslist_domain ($dnslist_value)${if >{${strlen:${dnslist_text}}}{0}{; see $dnslist_text}}
-          dnslists = noserver.dnsbl.sorbs.net
           domains  = +handled_domains
           !hosts   = +debianhosts : WHITELIST
+          dnslists = noserver.dnsbl.sorbs.net
 
   deny    message   = host $sender_host_address is listed in $dnslist_domain ($dnslist_value)${if >{${strlen:${dnslist_text}}}{0}{; see $dnslist_text}}
           condition = ${if bool_lax{$acl_m_defopt}}
-          dnslists  = relays.dnsbl.sorbs.net : xbl.spamhaus.org
           domains   = +handled_domains
           !hosts    = +debianhosts : WHITELIST
+          dnslists  = relays.dnsbl.sorbs.net : xbl.spamhaus.org
 
 <%- end -%>
   deny    message  = domain $sender_address_domain is listed in $dnslist_domain ($dnslist_value)${if >{${strlen:${dnslist_text}}}{0}{; see $dnslist_text}}
+          domains  = +handled_domains
+          !hosts   = +debianhosts : WHITELIST
           dnslists = ${if match_domain{$domain}{+virtual_domains}\
                     {${if exists {${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}\
                     {${expand:${lookup{$local_part}lsearch*{${extract{directory}{VDOMAINDATA}{${value}/rhsbllist}}}{$value}{}}}}{}}}\
                     {${expand:${lookup{$local_part}lsearch{/etc/exim4/rhsbllist}{$value}{}}}}} : \
                     ${expand:${lookup{$local_part}lsearch{/var/lib/misc/$primary_hostname/mail-rhsbl}{$value}{}}}
-         domains       = +handled_domains
-         !hosts        = +debianhosts : WHITELIST
 
   deny    message  = domain $sender_address_domain is listed in $dnslist_domain ($dnslist_value)${if >{${strlen:${dnslist_text}}}{0}{; see $dnslist_text}}
-          dnslists = nomail.rhsbl.sorbs.net/$sender_address_domain
           domains  = +handled_domains
           !hosts   = +debianhosts : WHITELIST
+          dnslists = nomail.rhsbl.sorbs.net/$sender_address_domain
 
   deny    message   = domain $sender_address_domain is listed in $dnslist_domain ($dnslist_value)${if >{${strlen:${dnslist_text}}}{0}{; see $dnslist_text}}
           condition = ${if bool_lax{$acl_m_defopt}}
-          dnslists  = dbl.spamhaus.org/$sender_address_domain
           domains   = +handled_domains
           !hosts    = +debianhosts : WHITELIST
+          dnslists  = dbl.spamhaus.org/$sender_address_domain
 
 <%- unless @use_smarthost -%>
   deny    domains  = +handled_domains