Patrick Ben Koetter
2012-Apr-04 13:10 UTC
[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 at rick -- state of mind () Digitale Kommunikation http://www.state-of-mind.de Franziskanerstra?e 15 Telefon +49 89 3090 4664 81669 M?nchen Telefax +49 89 3090 4666 Amtsgericht M?nchen Partnerschaftsregister PR 563
Timo Sirainen
2012-Apr-04 13:16 UTC
[Dovecot] Modifying LDAP search results for user_attrs
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 at 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.
Christoph Bussenius
2012-Apr-04 21:32 UTC
[Dovecot] Modifying LDAP search results for user_attrs
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