[Exim] Virtual users and `prefixed lookups'

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Adam D. Barratt
Datum:  
To: exim-users
Betreff: [Exim] Virtual users and `prefixed lookups'
Hi,

I suspect there's something obvious staring me in the face here, but it's
the first day back after Christmas and I haven't had enough coffee yet. ;-)
Our Exim 4.30 setup is configured to deliver mail as either a local user, or
as the unprivileged account `mailuser' (to avoid having to create real local
users for everyone with a POP account). The decision as to which user to run
the delivery process as is controlled by a router of the form:

localuser_adamb:
driver = accept
domains = adam-barratt.org.uk
local_parts = "lsearch;/etc/exim/mailusers.adam-barratt"
retry_use_local_part
transport = local_delivery
user = ${lookup {$local_part} lsearch {/etc/exim/mailusers.adam-barratt}
{$value} }

where /etc/exim/mailusers.adam-barratt contains entries such as:

adam: adam
usenet: mailuser

and so on. There are a number of other such routers for other domains, each
with their own `mailusers' file. We're now trying to combine all of the
mailusers files into one, by adding prefixes to the local parts (mainly
because that's the way the POP server likes it). The theory is that we then
end up with a single `mailusers' file that contains entries such as:

ab-adam: adam
ab-usenet: mailuser

The problem we've got is making the `local_parts' clause work. Basically,
given a mailusers file containing:

fish-foo: mailuser
ab-adam: adam
ab-usenet: mailuser
tree-fir: mailuser
ab-foo: mailuser

we need the local_parts list to contain `adam : usenet : foo' (i.e. each
entry in the file beginning with the string `ab-', but with that string
removed).

Any suggestions gratefully accepted, especially if they don't involve
abandoning the whole idea. :-)

Seasons greetings,

Adam