Re: [exim] dnslookup + local_domains

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Bambero
Datum:  
To: Mike Brudenell, Exim Users
Betreff: Re: [exim] dnslookup + local_domains

Hi,

Thanks for the answer.

Please look a this scenario...

Users on the hosting system (exim is a part of this system) can add
their own domains without moderation.
These domains are also local_domains for exim.

If user will add a domain gmail.com, exim (with standard dnslookup) will
try to deliver all messages adressed to *@gmail.com locally.

dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
# if ipv6-enabled then instead use:
# ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1
no_more

So, i want to exim always first check MX for the domain. In default
dnslookup router exim check for MX but only for domains which are not
local domains.

So exim should deliver message localy by two conditions:
1) MX is set to local server
2) domain is in local_domains

I'm almost done with configration. I seems "self = pass" solves the problem:

dnslookup:
driver = dnslookup
## domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
# if ipv6-enabled then instead use:
# ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1
self = pass
no_more

What do you think?

Regards,
Bambero

On 27.05.2016 11:27, Mike Brudenell wrote:
> Hi, Bambero -
>
> At the moment your "dnslookup" router is doing this:
>
>  1. Look up the MX record for the domain of the recipient's address.
>  2. From the result discard the 0.0.0.0 IP address along with any in
>     the 127.0.0.8/8 <http://127.0.0.8/8> netblock.
>  3. Use the "remote_smtp" transport to transmit the message to one of
>     the remaining IP addresses (failing between them as necessary)
>     prioritised by MX value.

>
> You're seeing the error because the router is written to treat your
> own "mydomain.pl <http://mydomain.pl>" domain in the same way. So it
> looks up its MX record, removed any ignored IP addresses, and ends up
> with a prioritised list of IP addresses that your MX record points to.
>
> But that list has the highest priority (lowest numbered/"use this
> server as first choice") IP address identifying the machine your Exim
> is currently running on!
>
> Exim spots this and sees no point in transmitting messages to your
> domain back into itself, so logs the warning.
>
> *What to approach this…*
>
> Remember that you can have multiple routers, with different
> pre-conditions to select whether the router is chosen to handle the
> message or not.
>
> For example I have two routers in my Exim configuration where the
> first uses pre-conditions to identify a domain I need to deliver to
> using routing information in a text file (rather than looking up MX
> records) and then uses the "manualroute" driver to do this, with a
> second router that uses the "dnslookup" driver to handle mail to any
> other domain.
>
> You need to decide what criteria you need to decide whether a
> destination server is local or remote then, I'd suggest, write two
> routers: one to handle deliveries to local domains and the other to
> remote ones.
>
> If you're choosing between:
>
>   * transmitting over SMTP to a remote domain's server, or
>   * writing the message into a mailbox on your own machine for a local
>     user

>
> then you likely want the routers in that order. You'll find a good
> example in the standard Exim configuration file that first handles
> SMTP deliveries to elsewhere, before eventually realising that
> anything left is to a mailbox stored on the current server's disks and
> writing/delivering the message there.
>
> However if you're choosing between:
>
>   * transmitting over SMTP to machine's you own/are located on your
>     own site ("local"), and
>   * transmitting over SMTP to any other machine in the world

>
> then you probably want this order instead: it's easiest to have the
> first router identify "my local SMTP servers", then if that declines
> to handle the delivery the second router does a normal SMTP connection
> to the other site's server.
>
> It's difficult to help as you've not explained what it is you're
> actually trying to achieve, but instead have asked "how do I do X?"
>
> Cheers,
> Mike B-)
>
> On 25 May 2016 at 22:21, Bambero <bambero@???
> <mailto:bambero@gmail.com>> wrote:
>
>     Hi,

>
>     I need the following functionality of dnslookup router:

>
>     1. First always check for MX
>     2. If remote, deliver to remote server
>     3. If MX is local check in local_domains - deliver localy
>     4. Otherwise return error

>
>     This order is necesairy on shared hosting where, users can add any
>     domains.

>
>     Is it possible with Exim?

>
>     When I'm trying this configuration (with local_domains disabled)

>
>     dnslookup:
>       driver = dnslookup
>       transport = remote_smtp
>       ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 <http://127.0.0.0/8>
>       no_more

>
>     I got an error:

>
>     May 25 22:20:58 zeus exim[22707]: 2016-05-25 22:20:58 1b5fIY-0006Uq-5b
>     lowest numbered MX record points to local host: mydomain.pl
>     <http://mydomain.pl>
>     May 25 22:20:58 zeus exim[22707]: 2016-05-25 22:20:58
>     1b5fIY-0006Uq-5b ==
>     test@??? <mailto:test@mydomain.pl> R=dnslookup defer (-1):
>     lowest numbered MX record points
>     to local host
>     May 25 22:20:58 zeus exim[22707]: 2016-05-25 22:20:58 1b5fIY-0006Uq-5b
>     Frozen

>
>     Regards,
>     Bambero
>     --
>     ## List details at https://lists.exim.org/mailman/listinfo/exim-users
>     ## Exim details at http://www.exim.org/
>     ## Please use the Wiki with this list - http://wiki.exim.org/

>
>
>
>
> --
> Systems Administrator & Change Manager
> IT Services, University of York, Heslington, York YO10 5DD, UK
> Tel: +44-(0)1904-323811
>
> Web:www.york.ac.uk/it-services <http://www.york.ac.uk/it-services>
> Disclaimer:www.york.ac.uk/docs/disclaimer/email.htm
> <http://www.york.ac.uk/docs/disclaimer/email.htm>