Re: [exim] check local parts for specific domain

Etusivu
Poista viesti
Vastaa
Lähettäjä: Tim Jackson
Päiväys:  
Vastaanottaja: exim-users
Aihe: Re: [exim] check local parts for specific domain
Hi Peter, on Fri, 10 Sep 2004 14:41:46 +0100 you wrote:

[checking localparts against a list in a file]
> Trouble is, I'm a bit unsure as to how I could go about getting
> that check done for that one domain, leaving all the other checks for my
> other domains intact.
> If anyone could give me a steer on this I'd most appreciate it


Let's assume that the one domain you want to check a static user list for
is called "example.com" and the list is a linear text file in
/etc/exim/users

If you just want a quick and dirty way to do it from an ACL you can
probably do something like this (untested):

deny message = Unknown user
     domains = example.com
     !local_parts = /etc/exim/users


This should only kick in for example.com.

Howver, doing it with an ACL is probably not the best/most elegant way -
consider other (non-SMTP) inputs for a start, and the results you would
get from "exim -bt" etc. So the alternative is to use a router. I've used
something like this in the past; if anyone has any more elegant
suggestions then I'd be interested to see them:

userlist_domains:
driver = redirect
allow_fail
domains = example.com
data =
${lookup{$local_part}lsearch{/etc/exim/users}{$local_part@$domain}{:fail:
Unknown user}}

You need to put this router near the top of your routers, before any other
routers which would otherwise handle the mail for example.com. What it
does is effectively redirect the address to itself if it exist (otherwise
failing the address with "Unknown user"); it doesn't get into an infinite
loop thanks to Exim's internal checking which means that the router is
skipped on the second pass through (after redirection).

This latter method also has the bonus that you shouldn't need to modify
your ACLs at all, as long as you have a "verify=recipient" somewhere. It
should Just Work. And it will work wherever routing is calculated whether
it's in a verify ACL rule, or via exim -bt or whatever.

Hope that helps,

Tim