Re: [Exim] Virtual users and `prefixed lookups'

Top Page
Delete this message
Reply to this message
Author: Adam D. Barratt
Date:  
To: exim-users
Subject: Re: [Exim] Virtual users and `prefixed lookups'
Andreas J Mueller wrote, Tuesday, December 30, 2003 9:19 AM

> Monday, December 29, 2003, 12:56:23 PM, you wrote:
>
> > localuser_adamb:
> > driver = accept
> > domains = adam-barratt.org.uk

[...]
> First of all, the idea of having a separate router for each domain is
> not very appealing to me. It might me feasible for a few domains
> which rarely change, but in other cases it's a maintainance headache.


I know, believe me. ;-) I inherited the setup about 18 months ago when it
was still running on Exim3 and there were only two domains with POP boxes
(the rest being aliased either to users within those two domains, or off the
box). We've since migrated to Exim4, but most of my time (when I get a mo to
spend tending the mail server) has been concentrated on making it work the
way we want, particularly in relation to virus / spam checking, blocking
senders / domains, etc.

Now I'm trying to tidy up some of the historical cruft. :-) The idea, once
it works with a single user lookup file, is to compress it all into a single
router which operates on a domain -> user prefix mapping list.

> > The problem we've got is making the `local_parts' clause work.

Basically,
> > given a mailusers file containing:
>
> > fish-foo: mailuser

[...]
> You cannot make the local_parts clause work using this file. lsearch
> is designed to look up single keys, whereas you are trying to look up
> multiple keys (e.g., all entries starting with "ab-").


That's what I thought, but I couldn't immediately see an alternative way of
doing it (the lsearch for local_parts is part of the historic setup, from
when our mail setup was /much/ simpler).

> What you *can*
> do is replace the local_parts clause with a general condition, and
> modify the user option accordingly, like this:
>
>     condition = ${lookup {ab-$local_part} lsearch {/etc/exim/mailusers} \
>                   {yes}{no}}
>     user = ${lookup {ab-$local_part} lsearch {/etc/exim/mailusers} \
>              {$value} }

>
> Do this for every router, replacing the prefix for each domain, and
> you're basically done.


Cheers. As I mentioned above, my ultimate aim, once the above works for each
domain, is to combine the whole lot into a single router, which looks up the
domains and prefixes from an additional lookup file, e.g.

adam-barratt.org.uk: ab
fish.invalid: fish

That's a job for another day though. :)

> One remaining problem would be to deliver
> mail into mailboxes that also have the domain prefix (which I assume
> you are going to do).


That bit's already set up and working, ta (it had to be done before the POP
server would use the single user lookup file, which is already working
happily).

Cheers for the suggestions,

Adam