RE: [Exim] Problems with hosts_treat_as_local in exim 4.12

Top Page
Delete this message
Reply to this message
Author: Kai Risku
Date:  
To: 'exim-users@exim.org'
Subject: RE: [Exim] Problems with hosts_treat_as_local in exim 4.12
> > It seems like hosts_treat_as_local is not able to reference
> > named lists correctly, because I tried to be smart in
> > our Exim 4.12 setup and set:
> >
> >    hosts_treat_as_local = +local_domains

> >
> > referencing the domain list which includes some virtual
> > domains and wildcard patterns. This resulted in a problem
> > where the exim server was a secondary MX and the primary
> > MX was down (it continuously delivered the mail to itself
> > until it detected the loop and bounced the mail).
> >
> > When setting the same domainlist directly as an argument
> > to hosts_treat_as_local everything worked properly.
> >
> > Is this a bug or simply undocumented behaviour?
>
> A. Could it be this bug, which is fixed in 4.20?
>
>  7. If a domain list contained @mx_any, or @mx_secondary, and
> the DNS contained
>     secondary MX records for a domain, but all the other MX
> (higher priority)
>     records pointed to non-existent hosts, Exim was behaving
> as if the domain
>     did not match the list item. This has been fixed.

>
> That doesn't sound very likely, given that inserting the domain list
> directly worked, but you never know.


No, the local_domains did not contain any @mx.. constructs.

> B. If not, please provide some -d debugging output that shows the
>    problem. You should be able to generate this using -d -bt.


For those of you loving to read lots of debugging output, here goes:

When trying to send a mail to krisku@???, the MX records
point to raingod.arrak.fi (MX=1) and mail.arrak.fi (MX=10). The
latter host is the externally accessible Exim-based server, while
the raingod is an internal exchange server. The buggy scenario
goes like this:

In exim.conf:
    domainlist local_domains = !zaphod.arrak.fi : !raingod.arrak.fi : \
            arrak.fi : *.arrak.fi : \
            partial-lsearch;/etc/exim/virtuals
    hosts_treat_as_local = +local_domains


And running "exim -d -bv krisku@???" on mail.arrak.fi gives

--------> dnslookup router <--------
local_part=krisku domain=raingod.arrak.fi
checking domains
raingod.arrak.fi in "!zaphod.arrak.fi : !raingod.arrak.fi : arrak.fi :
*.arrak.fi : partial-lsearch;/etc/exim/virtuals"? no (matched
"!raingod.arrak.fi")
raingod.arrak.fi in "! +local_domains"? yes (end of list)
cached lookup data = NULL
calling dnslookup router
dnslookup router called for krisku@???
  domain = raingod.arrak.fi
DNS lookup of raingod.arrak.fi (MX) succeeded
raingod.arrak.fi in hosts_treat_as_local? no (end of list)
mail.arrak.fi in hosts_treat_as_local? no (end of list)
mail.digemo.fi in hosts_treat_as_local? no (end of list)
fully qualified name = raingod.arrak.fi
host_find_bydns yield = HOST_FOUND (2); returned hosts:
  raingod.arrak.fi 195.163.186.76 1
  mail.arrak.fi 195.163.186.67 10
  mail.digemo.fi 194.100.79.129 20
set transport remote_smtp
queued for remote_smtp transport: local_part = krisku
domain = raingod.arrak.fi
  errors_to=NULL
  domain_data=NULL localpart_data=NULL
routed by dnslookup router
  envelope to: krisku@???
  transport: remote_smtp
  host raingod.arrak.fi [195.163.186.76] MX=1
  host mail.arrak.fi [195.163.186.67] MX=10
  host mail.digemo.fi [194.100.79.129] MX=20
krisku@???
    <-- krisku@???
  router = dnslookup, transport = remote_smtp
  host raingod.arrak.fi [195.163.186.76] MX=1
  host mail.arrak.fi    [195.163.186.67] MX=10
  host mail.digemo.fi   [194.100.79.129] MX=20
======================================================================


This results in the mail being delivered over and over to
mail.arrak.fi if raingod is down.

Changing the exim.conf as follows:

    hosts_treat_as_local = !zaphod.arrak.fi : !raingod.arrak.fi : \
            arrak.fi : *.arrak.fi : \
            partial-lsearch;/etc/exim/virtuals


results in the following correct behaviour:

--------> dnslookup router <--------
local_part=krisku domain=raingod.arrak.fi
checking domains
raingod.arrak.fi in "!zaphod.arrak.fi : !raingod.arrak.fi : arrak.fi :
*.arrak.fi : partial-lsearch;/etc/exim/virtuals"? no (matched
"!raingod.arrak.fi")
raingod.arrak.fi in "! +local_domains"? yes (end of list)
cached lookup data = NULL
calling dnslookup router
dnslookup router called for krisku@???
  domain = raingod.arrak.fi
DNS lookup of raingod.arrak.fi (MX) succeeded
raingod.arrak.fi in hosts_treat_as_local? no (matched "!raingod.arrak.fi")
mail.arrak.fi in hosts_treat_as_local? yes (matched "*.arrak.fi")
local host in host list - removed hosts:
  mail.arrak.fi 195.163.186.67 10
  mail.digemo.fi 194.100.79.129 20
fully qualified name = raingod.arrak.fi
host_find_bydns yield = HOST_FOUND (2); returned hosts:
  raingod.arrak.fi 195.163.186.76 1
set transport remote_smtp
queued for remote_smtp transport: local_part = krisku
domain = raingod.arrak.fi
  errors_to=NULL
  domain_data=NULL localpart_data=NULL
routed by dnslookup router
  envelope to: krisku@???
  transport: remote_smtp
  host raingod.arrak.fi [195.163.186.76] MX=1
krisku@???
    <-- krisku@???
  router = dnslookup, transport = remote_smtp
  host raingod.arrak.fi [195.163.186.76] MX=1
======================================================================


Unfortunately I have not been able to test this with a newer
version of Exim (yet), so it is possible the problem has already
been fixed. My apologies if the problem has already been fixed
in later versions.

Best regards,
    Kai


--
Kai.Risku@???     GSM  +358-40-767 8282
Oy Arrak Software Ab   http://www.arrak.fi