[Dovecot] Modifying LDAP search results for user_attrs
I need to authenticate users via LDAP either by mailaddress or login name. In both cases the mailbox location is /src/mail/%d/%n. I can easily deduct that path from the mailaddress, but not so from the login name.
Can I get the mail address as part of fetching user_attrs and modify it on the fly? Something along the lines of this:
user_attrs = mail:/srv/mail/%d/%n=home,uidNumber=uid,gidNumber=gid
Or would I be able to modify this with a post-login script?
p@rick
-- state of mind () Digitale Kommunikation
Franziskanerstraße 15 Telefon +49 89 3090 4664 81669 München Telefax +49 89 3090 4666
Amtsgericht München Partnerschaftsregister PR 563
On 4.4.2012, at 16.10, Patrick Ben Koetter wrote:
I need to authenticate users via LDAP either by mailaddress or login name. In both cases the mailbox location is /src/mail/%d/%n. I can easily deduct that path from the mailaddress, but not so from the login name.
If you have something like mailAddress=user in your pass_attrs and user_attrs, so that the username gets translated to the mailaddress then you can use %n/%d in dovecot.conf.
Can I get the mail address as part of fetching user_attrs and modify it on the fly? Something along the lines of this:
user_attrs = mail:/srv/mail/%d/%n=home,uidNumber=uid,gidNumber=gid
Or would I be able to modify this with a post-login script?
The correct syntax is:
user_attrs = =home=mail:/srv/mail/%d/%n, ..
but this assumes that the login is user@domain.
Without changing the username to mail address you can't use %d/%n directly, and post-login script would be the only way to go.
On 2012-04-04 15:10, Patrick Ben Koetter wrote:
Or would I be able to modify this with a post-login script?
Just one note: as far as I know, if your mail directory depends on a post-login script, it might be tricky to get LMTP or doveadm commands to work properly.
Cheers, Christoph
participants (3)
-
Christoph Bussenius
-
Patrick Ben Koetter
-
Timo Sirainen