Re: [Exim] Evil hack for the cookbook - DNS-based virtual do…

Góra strony
Delete this message
Reply to this message
Autor: David Woodhouse
Data:  
Dla: exim-users
Temat: Re: [Exim] Evil hack for the cookbook - DNS-based virtual domains.
On Tue, 2003-12-16 at 09:49 +0000, Philip Hazel wrote:
> On Mon, 15 Dec 2003, David Woodhouse wrote:
>
> > The following routers use it to implement a virtual domain. You could of
> > course omit the first and just make sure you have postmaster in all the
> > zones you use this way...
>
> I've saved this to put in the config samples / FAQ when I next update them.


A slight update... rather than hardcoding the DNS domain to use in the
router, we can put it into a flat file with the list of domains for
which we should be doing this. So with the same DNS we had before...

$ORIGIN vdns.infradead.org.mailtarget.
fish            604800  IN      TXT     dwmw2@???
*               604800  IN      TXT     ":fail:Unknown recipient at DNS domain"


We put this into /etc/exim/dns-virtual-domains:

    vdns.infradead.org: vdns.infradead.org.mailtarget


In the main section of the configuration file we have:

domainlist dns_virtual_domains = lsearch;/etc/exim/dns-virtual-domains

And then use the amended routers as follows:

virtual_postmaster:
driver = redirect
domains = +dns_virtual_domains
local_parts = postmaster:root:abuse:mailer-daemon
data = postmaster@$primary_hostname

dns_virtual_domains:
driver = redirect
domains = +dns_virtual_domains
allow_defer
allow_fail
forbid_file
forbid_pipe
retry_use_local_part
data = ${lookup dnsdb{txt=$local_part.${lookup{$domain}lsearch{CONFDIR/dns-virtual-domains}}}{$value}fail}

# If it failed, it could be because it was an invalid DNS lookup
# We do this after the above because it's not the common case.

dns_virtual_invalid:
driver = redirect
domains = +dns_virtual_domains
local_parts = !\N^(?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$\N
allow_fail
data = :fail: Invalid local part

# If it failed but it wasn't invalid, then it's because our DNS server
# isn't talking to us. Defer.

dns_virtual_fallback:
driver = redirect
domains = +dns_virtual_domains
allow_defer
data = :defer: Temporary failure in DNS lookup for virtual domain
no_more


Now I just need to investigate DDNS and see if it'll let individual
users update the TXT records for their own aliases in the DNS... :)

--
dwmw2