[Exim] Problems with virtual domains

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Rick Morris
Date:  
À: exim-users
Sujet: [Exim] Problems with virtual domains
Hi,

I'm having small problem with virtual domains that I'm hoping someone has
an answer for.

local_domains = "dbm;/tmp/MAIL-DOMAINS"

I've created two directors to deal with the incoming mail.

virtual_rewrite:
        driver = smartuser
        new_address = ${local_part}@${lookup{$domain}dbm{/tmp/MAIL-DOMAINS}{$value}fail}


virtual:
        driver = aliasfile
        domains = dbm;/tmp/MAIL-DOMAINS
        include_domain
        no_more
        file = /tmp/MAIL-USERS
        search_type = dbm*@


The MAIL-DOMAINS db is in this format:

acolor.com: colorific.mydomain.com
outpost.com: outpost.mydomain.com

The MAIL-USERS db is in this format:

tking@???: tking@???
info@???: chris@???

For most cases, this works fine. When the message comes in, the
virtual_rewrite director rewrites the address to the local address
via a db lookup which in turn is passed on to the virtual director that
uses the local_part@domain to find the address to forward to and sends it
off.

The way these domains are stored in the remote MySQL database, there is
no easy way to seperate which ones are local and which one's have their
own MX record so we just pull them all down into the MAIL-DOMAINS
database (It is currently used this way with sendmail but the
sendmail.cf is very ugly).

This is where the problem comes in. This is what happens if a message were
to come in for tking@???.


$ /usr/lib/sendmail -bt -d8
Exim version 3.13 debug level 8 uid=53596 gid=50
probably ndbm
> tking@???

address tking@???
local_part=tking domain=acolor.com
domain is local
virtual_rewrite director called for tking@???
virtual_rewrite director generated tking@???
errors_to=NULL transport=NULL
uid=unset gid=unset home=NULL
virtual_rewrite director succeeded for tking
address tking@???
local_part=tking domain=colorific.mydomain.com
domain is local
virtual director: dbm* key=tking@???
file="/tmp/MAIL-USERS"
virtual director generated tking@???
errors_to=NULL transport=NULL
uid=unset gid=unset home=NULL
virtual director succeeded for tking
address tking@???
local_part=tking domain=outpost.com
domain is local
virtual_rewrite director called for tking@???
virtual_rewrite director generated tking@???
errors_to=NULL transport=NULL
uid=unset gid=unset home=NULL
virtual_rewrite director succeeded for tking
address tking@???
local_part=tking domain=outpost.mydomain.com
domain is local
virtual director: dbm* key=tking@???
file="/tmp/MAIL-USERS"
virtual director failed for tking:
tking@??? is undeliverable:
unknown local-part "tking" in domain "outpost.mydomain.com"


As you can see, after the first rewrite is done and the new address goes
through the directors, it is passed back through a second time. At
this point the message should preferably be sent off to the
appropriate MX record for outpost.com but because the new domain is in our
local domain database, it is rewritten again and causes the lookup
failure.

My question is this. Is there a way to force a DNS lookup on the
new_address the first time it is looked up so that the mail will be sent
on it's way? Or have I painted myself into a corner? I've tried numerous
config options and can't seem to figure it out.

Thanks much,

-Rick