Re: [exim] localdomains file for non-authenticated, dns for …

Top Page
Delete this message
Reply to this message
Author: Todd Lyons
Date:  
To: krzf83@gmail.com
CC: exim-users
Subject: Re: [exim] localdomains file for non-authenticated, dns for rest
On Sat, Oct 5, 2013 at 12:24 PM, krzf83@??? <krzf83@???> wrote:
> begin routers
> lookuphost:
>     driver = dnslookup
>     #domains = ! +local_domains
>     ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
>     transport = remote_smtp
>     self = pass

>
> I would like to change this so that emails from authenticated smtp
> users always use dns for loockup and emails from non-authenticated
> (remote mail servers) always use local_domains list. Anyone has idea
> how to do it?


The way I would do this:
1) In an ACL, it could be the MAIL, RCPT, or DATA acl, doesn't really matter:
  warn  set acl_m_authed=0
  warn  authenticated = *
           set acl_m_authed=1


2) Then make a copy of the router above. In the first router,
configure it to use the dns and add this:
condition = ${if eq {$acl_m_authed}{1} {yes}{no}}

3) In the copy router, configure it to use the local_domains list.
You can assume that $acl_m_authed is 0 since it passed through the
other router, but to be thorough, I explicitly add the condition check
so that it's readable/understandable for someone who might be looking
at it later:
condition = ${if eq {$acl_m_authed}{0} {yes}{no}}
Note that this also covers the case where it's not set to 0 or 1, i.e.
something in the ACL that you put the set statements in #1 accepted
the email BEFORE it actually got to those set statements. The easy
fix for that is to put it before the first accept statement in
whatever ACL you put them.

...Todd
--
The total budget at all receivers for solving senders' problems is $0.
If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine