[Exim] Evil hack for the cookbook - DNS-based virtual domain…

Top Page
Delete this message
Reply to this message
Author: David Woodhouse
Date:  
To: exim-users
Subject: [Exim] Evil hack for the cookbook - DNS-based virtual domains.
Given a domain in DNS of the form...

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


(It doesn't _have_ to be in private namespace; you can put it anywhere
but I prefer to have it private)

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...

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

# For virtual domains, look up the target in DNS and rewrite...

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.$domain.mailtarget}{$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




--
dwmw2