Re: [EXIM] Multiple Mail directories for multiple domains.

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: joe vaughan
CC: exim-users
Tárgy: Re: [EXIM] Multiple Mail directories for multiple domains.
On Thu, 3 Sep 1998, joe vaughan wrote:

> I chose exim as the smtp transport because I reckon it's likely to be
> the only mailer that will allow me to easily deliver mail into
> different directories for each domain... However, I want it to do the
> user lookups (finding the local user) not against /etc/passwd but
> against /etc/passwd.domain because the pseudo users will not exist in
> /etc/passwd in any form. Couple that with the fact that there will
> also probably be seperate alias files for each domain, and it makes
> for a horrific mess!


You are born under a lucky star. I have just pulled my head out from
another session working on the "Introductory Book", and the very words I
have been writing this afternoon are relevant. I quote them below.

> The problem of course is that my director for local mail is as
> follows:
>
> localuser:
>    driver = localuser
>    transport = local_delivery

>
>
> Now, my guess is that I'll probably have to re-write the localuser
> lookup code to handle multiple passwd files using a modified getpwnam()
> that I wrote for the pop server...


No need. You can do it with a smartuser director, coupled with a
"local_parts" option that looks up valid local parts in a file. The file
name can depend on the domain. Then you can use lookups + extractions
for "user" on the appendfile transport in order to find the uid/gid/home
directory/whatever for delivery.

Is this enough to get you going? If not, ask for more details.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.


--------------------------------------------------------------------


.section Expansion by data extraction
Suppose you want to do local deliveries on a host where the users do not have
login accounts, but where their home directories are accessible. Exim needs to
be able to find out the uid and gid for each local user, in order to run
local delivery processes for them, and it also needs to know the home
directories. You could have the data in a file containing lines like this:

alice: uid=1984 gid=2001 home=/home/alice

or you might prefer to use the tradional \passwd\ file format:

alice:x:1984:2001:alice:/home/alice:/bin/bash

Either of these forms could be converted into a DBM file or some other type of
lookup for efficiency, and Exim provides an expansion item for
extracting individual data fields of each type. The expansion item

${extract{uid}{uid=1984 gid=2001 home=/home/alice}}

yields `1984', so, combining this with a DBM file lookup, an option setting
for the uid for a given local part could be

user = "${lookup{$local_part}dbm{/usr/data}\
        {${extract{uid}{$value}}}fail}"


This is a `keyed' form of the \extract\ expansion item; an alternative form
extracts fields by counting separator characters. For example,

user = "${extract{3}{:}\
        {alice:x:1984:2001:alice:/home/alice:/bin/bash}}"


also yields `1984' when expanded. In this case the first argument of \extract\
is the number of the field, counting from one, and the second is a list of
field separators, in this case, just a colon.

Chapter XXX discusses ways in which these kinds of expansion lookup can be
used. In many cases several similar lookups are required (for example, for a
uid, a gid, and a home directory). This does not normally result in multiple
file accesses, because Exim keeps a cache containing the last record looked up
from each file or query mechanism.



--
*** Exim information can be found at http://www.exim.org/ ***