[Dovecot] Multiple use of the same LDAP attribute

Daniel L. Miller dmiller at amfes.com
Thu Apr 9 00:58:24 EEST 2009


Bernhard Schmidt wrote:
> On Wed, Apr 08, 2009 at 12:41:17PM -0400, Timo Sirainen wrote:
>
>   
>>> Of course there are several viable workarounds
>>> (base mail location on home directory, 
>>>       
> Come to think of it, any hint how I can implement the existing scheme?
>
> user_attrs =
>         xxxMailbox=mail=maildir:/home/mailstore/%U$/Maildir:INDEX=/home/mailstore/indexes/%1U$/%U$,
> 	xxxMailbox=home=/home/mailstore/%U$
>
> the maildir location is easy (mail=maildir:~/Maildir), but the index is
> hard, as I don't have the userid in any variable.
>
> The only thing I can come up with atm is
>
> user_attrs = 
> 	xxxMailbox=home=/home/mailstore/%U$,
> 	xxxMailbox=mail=maildir:~/Maildir:INDEX=/home/mailstore/indexes/%16.1h/%16.99h
>
> but I'm willing to bet that this is going to break at some point, the
> latest point being when someone changes the mailstore path and forgets
> to update the offset :-\
>
> What happens when the width is larger than the length of the string
> anyway?
>
> Bernhard
>   
I'll admit I don't understand what you're trying to do with the above 
parameters, but let me share what I'm using and see if it helps.  I 
happen to be using a pure virtual configuration, with my mail users 
logging in using their full email address as a username.  So all I need 
to store in LDAP is the email address and the password.

dovecot-ldap.conf
user_attrs = maildir:%d/%n/Maildir=mail,%d/%n=home
pass_attrs = mail=user,userPassword=password

dovecot.conf
[...]
mail_location = maildir:/var/mail/%d/%n/Maildir
[...]
userdb static {
  args = uid=vmail gid=vmail home=/var/mail/%d/%n 
mail=maildir:/var/mail/%d/%n allow_all_users=yes
}
[...]

This lets me store all mail under /var/mail/DOMAIN/USER/Maildir - with a 
home of /var/mail/DOMAIN/USER.

I'm pretty sure at least some of the parameters I'm using are redundant 
or unused, but thus far it works great.
-- 
Daniel


More information about the dovecot mailing list