[Dovecot] Custom Mail Directory for some users

Patrick Kranz patrick at ekits.de
Mon Mar 26 21:44:18 EEST 2007


Hi list,

I'm new on this mailing list and I'm kind of stucked at the moment.

I managed to get Postfix and Dovecot working together with Amavis, 
OpenLDAP und SASL on Ubuntu Linux Release "Dapper Drake". The Dovecot 
version shipped with Dapper is 1.0-beta3 (at least, that's what the 
package database tells me), I also tried this with a Debian Backport of 
version 1.0-rc15.

And here is my problem:
A customer of mine needs usernames different from the mail address for 
his third party software to work. In other words, I need the ability to 
login with the username foo to get access to the mailbox 
bar at example.com. So I tried to override the mail_location property for 
this user with a separate mailDirectory attribute in my LDAP tree.

Speaking in dovecot.conf words:

mail_location = maildir:/var/spool/dovecot/mail/%d/%n

auth default {
  machanisms = plain
  passdb ldap {
    args = /etc/dovecot/dovecot-ldap.com
  }

  userdb ldap {
    args = /etc/dovecot/dovecot-ldap.com
  }

  userdb static {
    args = uid=vmail gid=vmail

  user = dovecot
}

and dovecot-ldap.conf:

hosts = localhost
dn = cn=admin,dc=ekits,dc=de
dnpass = secret
auth_bind = yes

ldap_version = 3
base = ou=mailsystem,dc=ekits,dc=de
scope = subtree

user_attrs = mailDirectory=mail
user_filter = (&(objectClass=ekitsMailAccount)(uid=%u))
pass_attrs = uid=user,userPassword=password
pass_filter = (&(objectClass=ekitsMailAccount)(uid=%u))

user_global_uid = vmail
user_global_gid = vmail

a typical ldap entry looks something like this:

dn: cn=Patrick Kranz,o=EK IT-Solutions,ou=mailsystem,dc=ekits,dc=de
ekitsMailDestination: patrick at ekits.de
objectClass: ekitsMailAccount
objectClass: top
cn: Patrick Kranz
structuralObjectClass: ekitsMailAccount
entryUUID: b4ebb9e8-6d8d-102b-9dc9-9edb870845a4
creatorsName: cn=admin,dc=ekits,dc=de
createTimestamp: 20070323132526Z
userPassword:: YVBhc3M=
mailDirectory: maildir:/var/spool/dovecot/mail/ekits.de/blubb
uid: patrick

As far as I can interpret the log of slapd, dovecot doesn't even ask for 
the attribute "mailDirectory". I also tried this with userdb prefetch. 
With this it did actually ask for the attribute but it still had no 
effect. With this configuration dovecot creates the directory 
/var/spool/spool/dovecot/mail/patrick if I login with the uid patrick 
but I wanted access to /var/spool/dovecot/mail/ekits.de/blubb

If anybody has any clue what I did wrong or if I have a conceptional 
misunderstanding, I would appreciate every help.
Thanks in advance.

Greetings,
Patrick


More information about the dovecot mailing list