[Dovecot] Mixing LDAP and static
I want to read quota size from LDAP, but I have a static value for home. How can I mix these?
Right now, I have this LDAP configuration:
user_attrs = uid=home=/var/mail/vhosts/%d/%n,gosaMailQuota=quota_rule=*:bytes=%$M
which works fine, but looks up the uid attribute needlessly, and is not scalable: I have to pick a different, always-existing LDAP attribute for each static extra field that I want to set.
Is there some LDAP configuration syntax like the SQL "SELECT '/var/...' AS home" ?
Thanks, Anders.
On Sat, 2008-04-12 at 22:37 +0200, Anders wrote:
I want to read quota size from LDAP, but I have a static value for home. How can I mix these?
Right now, I have this LDAP configuration:
user_attrs = uid=home=/var/mail/vhosts/%d/%n,gosaMailQuota=quota_rule=*:bytes=%$M
which works fine, but looks up the uid attribute needlessly, and is not scalable: I have to pick a different, always-existing LDAP attribute for each static extra field that I want to set.
Is there some LDAP configuration syntax like the SQL "SELECT '/var/...' AS home" ?
Just drop the "uid", like: =home=/var/mail/..
Timo Sirainen wrote:
On Sat, 2008-04-12 at 22:37 +0200, Anders wrote:
user_attrs = uid=home=/var/mail/vhosts/%d/%n,gosaMailQuota=quota_rule=*:bytes=%$M
Just drop the "uid", like: =home=/var/mail/..
Hi.
This is not documented, I think?
Anyway, it does not really work, I guess it might be a bug. When I drop the attribute, the variables in the template are not interpolated, so I end up with home literally being "/var/mail/vhosts/%d/%n" for all lookups.
cheers, Anders.
On Fri, 2008-04-18 at 20:07 +0200, Anders wrote:
Timo Sirainen wrote:
On Sat, 2008-04-12 at 22:37 +0200, Anders wrote:
user_attrs = uid=home=/var/mail/vhosts/%d/%n,gosaMailQuota=quota_rule=*:bytes=%$M
Just drop the "uid", like: =home=/var/mail/..
Hi.
This is not documented, I think?
I've been a bit lazy updating the LDAP wiki page with new v1.1 features. Added it there now. Although I think the entire page is a bit too complex and could use a split into multiple subpages..
Anyway, it does not really work, I guess it might be a bug. When I drop the attribute, the variables in the template are not interpolated, so I end up with home literally being "/var/mail/vhosts/%d/%n" for all lookups.
This should fix it: http://hg.dovecot.org/dovecot-1.1/rev/0dbf10f4493a
Timo Sirainen wrote:
I've been a bit lazy updating the LDAP wiki page with new v1.1 features. Added it there now. Although I think the entire page is a bit too complex and could use a split into multiple subpages..
Absolutely, it took me forever to figure out how the LDAP stuff works :-).
This should fix it: http://hg.dovecot.org/dovecot-1.1/rev/0dbf10f4493a
Confirmed, that fix seems to work.
There still is one issue left, though. Using the same attribute for several variables:
user_attrs = uid=home=/home/%$,uid=sieve_dir=/var/sieves/%$
With this, the home variable is lost.
Cheers, Anders.
On Thu, 2008-04-24 at 15:57 +0200, Anders wrote:
There still is one issue left, though. Using the same attribute for several variables:
user_attrs = uid=home=/home/%$,uid=sieve_dir=/var/sieves/%$
With this, the home variable is lost.
That would require a bit larger changes than I'd want to do for v1.1, so maybe later.. I guess some day the entire configuration could be changed to something like:
user_attrs { home = /home/$uid sieve_dir = /var/sieves/$uid mail = $domainDirectory/$uid }
But anyway, can't you now just change user to "uid" with pass_attrs:
pass_attrs = uid=user, ..etc..
And then use:
user_attrs = =home=/home/%u,=sieve_dir=/var/sieves/%u
(or the same things added to plugin {} section)
Timo Sirainen wrote:
On Fri, 2008-04-18 at 20:07 +0200, Anders wrote:
Anyway, it does not really work, I guess it might be a bug. When I drop the attribute, the variables in the template are not interpolated, so I end up with home literally being "/var/mail/vhosts/%d/%n" for all lookups.
This should fix it: http://hg.dovecot.org/dovecot-1.1/rev/0dbf10f4493a
Now I found another problem.
If no attributes are read via LDAP, auth will segfault. So as I have the home and quota, with home being static, it will crash if the quota is not in LDAP for that user.
It will also crash if I have only static entries in the user_attrs, but I almost deserve that :-)
Anders.
On Fri, 2008-04-25 at 02:06 +0200, Anders wrote:
Timo Sirainen wrote:
On Fri, 2008-04-18 at 20:07 +0200, Anders wrote:
Anyway, it does not really work, I guess it might be a bug. When I drop the attribute, the variables in the template are not interpolated, so I end up with home literally being "/var/mail/vhosts/%d/%n" for all lookups.
This should fix it: http://hg.dovecot.org/dovecot-1.1/rev/0dbf10f4493a
Now I found another problem.
If no attributes are read via LDAP, auth will segfault. So as I have the home and quota, with home being static, it will crash if the quota is not in LDAP for that user.
I'm not exactly sure if this is the same problem as below since I couldn't reproduce it, but
It will also crash if I have only static entries in the user_attrs, but I almost deserve that :-)
Timo Sirainen wrote:
On Fri, 2008-04-25 at 02:06 +0200, Anders wrote:
If no attributes are read via LDAP, auth will segfault. So as I have the home and quota, with home being static, it will crash if the quota is not in LDAP for that user.
I'm not exactly sure if this is the same problem as below since I couldn't reproduce it, but
It will also crash if I have only static entries in the user_attrs, but I almost deserve that :-)
That patch fixes the first case for me as well.
Thanks, Anders.
participants (2)
-
Anders
-
Timo Sirainen