Re: [Exim] how to check if domain doesn't point to local hos…

Pàgina inicial
Delete this message
Reply to this message
Autor: Arkadiusz Miskiewicz
Data:  
A: David Woodhouse
CC: exim-users
Assumptes vells: Re: [Exim] how to check if domain doesn't point to local host
Assumpte: Re: [Exim] how to check if domain doesn't point to local host
I've merged two quite old letters to refresh memory...

Dnia Monday 05 of January 2004 11:23, David Woodhouse napisał:

> On Sun, 2004-01-04 at 18:26 +0100, Arkadiusz Miskiewicz wrote:
> > Hi,
> >
> > I have
> > domainlist local_domains =      lsearch;/etc/mail/locals : \
> >                                 lsearch;/etc/mail/virtuals

> >
> > send_to_gateway:
> > driver = manualroute
> > domains = ! +local_domains
> > transport = remote_smtp
> > route_list = * mygw.pl
> > no_verify
> >
> > /etc/mail/virtuals is autogenerated and here is the problem that
> > sometimes this file contains domain which is not hosted on local host.
> >
> > The question is how to add condition based on no idea what (dnsdb?) that
> > will check real A and MX of that domain.
>
> One possibility is to have a router which will route mail away for
> domains which aren't really supposed to be on the local machine, before
> the router which handles the virtual domains:
>
> outgoing:
> domains = !+local_domains
> driver = dnslookup
> transport = remote_smtp
>
> # Get rid of those domains in /etc/mail/virtuals for which we're
> # not really the primary MX.
> fake_virtual:
> domains = lsearch;/etc/mail/virtuals
> driver = dnslookup
> transport = remote_smtp
> self = pass
>
> real_virtual:
> # .... whatever you had before...
>
> begin transports
>
> remote_smtp:
> driver = smtp
> hosts = mygw.pl
> hosts_override


Dnia Monday 05 of January 2004 14:34, napisał Pan/ napisała Pani:
> On Mon, 2004-01-05 at 13:42 +0100, Arkadiusz Miskiewicz wrote:
> > > fake_virtual:
> > > domains = lsearch;/etc/mail/virtuals
> > > driver = dnslookup
> > > transport = remote_smtp
> > > self = pass
> >
> > But this will cause that emails for my local domains which are really
> > hosted here will be routed to mygw.pl first, so that's not a working
> > solution unfortunately.
>
> A quick test seems to work for me, unless I'm misunderstanding your
> request. Have you tested it yourself?
>
> For local_domains which are really local, the primary MX is the same
> host -- which in conjunction with 'self = pass' in the above will cause
> the fake_virtual router to pass over those addresses, leaving them to
> other routers. These mails won't be sent to mygw.pl.
> See http://www.exim.org/exim-html-4.30/doc/html/spec_15.html#IX1542
>
> For domains in local_domains which are really on a remote host, the
> fake_virtual router will invoke the remote_smtp transport, which will
> send the mail to mygw.pl.
>
> Note that we're not using the manualroute router any more; we're using
> the dnslookup router, and forcing it to go to mygw.pl in the _transport_
> instead. This means that the list of remote hosts passed from the router
> to the transport is real, looked up from DNS, and that's why the 'self'
> option works as we desire, rather than always failing to trigger as it
> would if we had:
>
> fake_virtual:
> domains = lsearch:/etc/mail/virtuals
> driver = manualroute
> route_data = mygw.pl
> transport = remote_smtp
> self = pass


This would work fine with ONE mail server. Unfortunately right now my setup is
more complicated. Second machine is now primary MX and it forwards mails to
my old (primary) machine.

With old setup self = pass would work but not right now - now fake_virtual
will route each mail to mygw.pl because self = pass will never happen (and
mygw.pl will forward it back causing loop).

Any other ideas?

Maybe something like

fake_virtual:
driver = something
domains = lsearch:/etc/mail/virtuals
conditon = if MX for ${domain} will not resolve to xx.yy.0.0/24 or
qq.zz.0.0/24

(assume that xx.yy.0.0/24 and qq.zz.0.0/24 are my IP addresses)

--
Arkadiusz Miśkiewicz     CS at FoE, Wroclaw University of Technology
arekm.pld-linux.org, 1024/3DB19BBD, JID: arekm.jabber.org, PLD/Linux