Re: [exim] hubbed_hosts + SMTP AUTH (was: Different local do…

Top Page
Delete this message
Reply to this message
Author: Chris Knadle
Date:  
To: exim-users
CC: George
Old-Topics: Re: [exim] Different local domain for bounces
Subject: Re: [exim] hubbed_hosts + SMTP AUTH (was: Different local domain for bounces)
On Wednesday, February 05, 2014 20:30:49 George wrote:
> Hi Chris, thanks again for the info.
>
> It would be great to configure some sort of automatic smarthost failover.


Turns out I needed something similar for myself, and ended up figuring out how
to do this. You mentioned you were running Debian Wheezy. Debian's Exim4
setup already comes with a "hubbed_hosts" router which checks for a file,
/etc/exim4/hubbed_hosts -- if it exists and the destination domain is listed
in the file, then it uses the line listed as a manualroute -- and /several/
destination hosts can be listed, along with destination ports. Such as this:

domain.example.net: "dest-2.example.net::587 : mail-2.ref.example"

To understand this better, see 'man 5 exim4_hubbed_hosts', as well as chapter
20.3 through 20.7 in the Exim 4.80 specification. This same man page explains
the format of the passwd.client file used to do SMTP AUTH with a remote
server.

The hubbed_hosts router normally uses the remote_smtp transport which doesn't
check for SMTP AUTH login information, but switching this to the
remote_smtp_smarthost router then does. ;-)


begin routers
[...]
hubbed_hosts:
  debug_print = "R: hubbed_hosts for $domain"
  driver = manualroute   
  domains = "${if exists{CONFDIR/hubbed_hosts}\
                   {partial-lsearch;CONFDIR/hubbed_hosts}\
              fail}"
  same_domain_copy_routing = yes
  route_data = ${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}}
  ## Chris: changed transport to remote_smtp_smarthost to use SMTP AUTH
  transport = remote_smtp_smarthost




The important difference in this case is that the remote_smtp_smarthost
transport checks /etc/exim4/passwd.client for SMTP AUTH login information for
particular servers.



begin transports
[...]
remote_smtp_smarthost:
  debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
  driver = smtp
  hosts_try_auth = <; ${if exists{CONFDIR/passwd.client} \
        {\  
        ${lookup{$host}nwildlsearch{CONFDIR/passwd.client}{$host_address}}\
        }\
        {} \
      }
[...]




So from the hubbed_hosts entries we had this:

domain.example.net: "dest-2.example.net::587 : mail-2.ref.example"

And now in the passwd.client file you can make entries for each of the
smarthosts:

### target.mail.server.example:login:password
dest-2.example.net:login1:password1
mail-2.ref.example:login2:password2



So between hubbed_hosts and passwd.client you should be able to do manual
routing of mail for particular destination domains (including "*" for all
domains) using multiple smarthosts such that if one is down another is used
automatically.

-- Chris

--
Chris Knadle
Chris.Knadle@???