[Dovecot] 2 users database on same LDAP with different mail location
list at grootstyr.eu
list at grootstyr.eu
Tue Feb 25 12:29:37 UTC 2014
On Tue, Feb 25, 2014 at 11:42:33AM +0100, Francesco wrote:
> Hello,
> i know i know, i'm getting annoying but appearently i always come up
> with weird ideas and i cant seem to accomplish such a task.
>
> the scenario is that i have an LDAP server with a bunch of users.
> some of them are in a specific OU, and i'd like to define for all these
> users belonging to this OU an alternative mail location/storage.
>
> in details for all the users i'd like to use maildir storage in a
> directory, while for the users belonging to a specific OU i'd like to
> use dbox with an alternative storage attached.
>
> so i created 2 userdb like this:
>
> userdb {
> driver = ldap
> args = /etc/dovecot/dovecot-ldap-maildir.conf.ext
> }
>
> userdb {
> driver = ldap
> args = /etc/dovecot/dovecot-ldap-dbox.conf.ext
> }
>
> and then defined these 2 args files:
> maildir:
>
> hosts = localhost
> dn = CN=ldapadmin,OU=administrators,DC=plutone,DC=local
> dnpass = <password>
> auth_bind = yes
> ldap_version = 3
> base = DC=plutone,DC=local
> user_attrs = sAMAccountName=home=/var/vmail/%$
>
> dbox:
>
> hosts = localhost
> dn = CN=ldapadmin,OU=administrators,DC=plutone,DC=local
> dnpass = <password>
> auth_bind = yes
> ldap_version = 3
> base = OU=dboxusers,OU=lowpriority,DC=plutone,DC=local
> user_attrs = sAMAccountName=home=/var/local_dbox/%$,
> =mail=dbox:/var/local_dbox/%$:ALT=/var/iscsi_dbox/%$
> user_filter = (&(ObjectClass=person)(mail=%u))
>
>
> yet it doesn't matter how hard i try if i send an email to a user
> belonging to the dboxusers OU i still have the user to be addressed to
> the maildir storage in /var/vmail
>
> am i missing something?
>
> Thanks
> Francesco
You can use LDAP to search for an alternative mail attribute, and specify a default location using
mail_location. In your example; mail_location = /var/vmail/%u. Then use one LDAP config file to override the
mailbox location if the LDAP database specifies a maildir location.
By the way, aren't userdb's searched sequentially? Try switching those userdb's to make the one with the group
lookup go first. LDAP users will always match the userdb without group lookup.
Matthijs
More information about the dovecot
mailing list