[Dovecot] default mail quota when using per user quota
Hello,
using dovecot 2.1 and per user mail quota via ldap is there a way to have a default quota which gets used, if the "quota" field in ldap is not set?
I tried with:
plugin { quota = maildir:User quota quota_rule = *:storage=3G }
userdb { args = /etc/dovecot/dovecot-ldap.conf driver = ldap }
and in dovecot-ldap.conf: user_attrs = dcMailQuota=quota_rule=*:storage=%$
but with this configuration the mail quota /allways/ gets loaded from ldap resulting in users without dcMailQuota attribute having no quota at all.
Greetings Andreas
On 20/4/2012 2:11 μμ, Andreas Helmcke wrote:
using dovecot 2.1 and per user mail quota via ldap is there a way to have a default quota which gets used, if the "quota" field in ldap is not set?
You may see: http://www.mail-archive.com/dovecot@dovecot.org/msg44010.html
Regards, Nick
Am 20.04.2012 14:26, schrieb Nikolaos Milas:
You may see: http://www.mail-archive.com/dovecot@dovecot.org/msg44010.html
I do not see any relevant differences to my setup. Do you /really/ have a default quota of 4G if roomNumber is empty or rather have unlimited quota then?
Greetings Andreas
On 20/4/2012 5:31 μμ, Andreas Helmcke wrote:
Do you/really/ have a default quota of 4G if roomNumber is empty or rather have unlimited quota then?
Yes, default quota is 4G for all mailboxes; if roomNumber is defined, then that value is used instead. In practice we are using non-default values for very few maiboxes.
We have a relatively small number of users/mailboxes (<300), so we have the luxury of enjoying relatively large mailboxes (with some "overbooking" - because most users rarely use more than 1G).
Nick
On 20.4.2012, at 14.11, Andreas Helmcke wrote:
using dovecot 2.1 and per user mail quota via ldap is there a way to have a default quota which gets used, if the "quota" field in ldap is not set?
By "not set" you mean it doesn't exist at all, or it exists but is empty?
I tried with:
plugin { quota = maildir:User quota quota_rule = *:storage=3G }
userdb { args = /etc/dovecot/dovecot-ldap.conf driver = ldap }
and in dovecot-ldap.conf: user_attrs = dcMailQuota=quota_rule=*:storage=%$
If dcMailQuota isn't returned, then the global quota_rule is used. If it is returned as empty, I guess it gets treated as unlimited quota. There's currently no easy way avoid this (a difficult way could be e.g. post-login scripting, but that works only for imap/pop3).
Am 20.04.2012 23:18, schrieb Timo Sirainen:
By "not set" you mean it doesn't exist at all, or it exists but is empty?
I tried both (at least I do think I tried both).
If dcMailQuota isn't returned, then the global quota_rule is used. If it is returned as empty, I guess it gets treated as unlimited quota. There's currently no easy way avoid this (a difficult way could be e.g. post-login scripting, but that works only for imap/pop3).
Maybe openldap does not distingish between this cases. I will try again on monday, when I am back at work.
On 21.4.2012, at 0.47, Andreas Helmcke wrote:
If dcMailQuota isn't returned, then the global quota_rule is used. If it is returned as empty, I guess it gets treated as unlimited quota. There's currently no easy way avoid this (a difficult way could be e.g. post-login scripting, but that works only for imap/pop3).
Maybe openldap does not distingish between this cases. I will try again on monday, when I am back at work.
Hm. Or maybe I broke it in v2.1 when I changed this code. I'll also check later. :)
On 21/4/2012 12:54 πμ, Timo Sirainen wrote:
Hm. Or maybe I broke it in v2.1 when I changed this code. I'll also check later.
I'm afraid that's possible. The same configuration in 2.0.13 produces (doveadm quota get -u tester):
Quota name Type Value Limit % User quota STORAGE 237803 4194304 5 User quota MESSAGE 531 - 0
and in 2.1.1:
Quota name Type Value Limit % User quota STORAGE 0 - 0 User quota MESSAGE 0 - 0
(In the latter test server value should be 0 - because there are no messages there - but limit should be as above. Things do not change after: doveadm quota recalc -u tester)
Regards, Nick
On 21.4.2012, at 13.53, Nikolaos Milas wrote:
On 21/4/2012 12:54 πμ, Timo Sirainen wrote:
Hm. Or maybe I broke it in v2.1 when I changed this code. I'll also check later.
Just tried, it works as expected.
I'm afraid that's possible. The same configuration in 2.0.13 produces (doveadm quota get -u tester):
Quota name Type Value Limit % User quota STORAGE 237803 4194304 5 User quota MESSAGE 531 - 0
and in 2.1.1:
Quota name Type Value Limit % User quota STORAGE 0 - 0 User quota MESSAGE 0 - 0
(In the latter test server value should be 0 - because there are no messages there - but limit should be as above. Things do not change after: doveadm quota recalc -u tester)
What do you get in logs with auth_debug=yes?
On 23/4/2012 1:34 μμ, Timo Sirainen wrote:
What do you get in logs with auth_debug=yes?
Sorry for being late in responding.
When I run:
# doveadm quota get -u tester1 Quota name Type Value Limit % User quota STORAGE 0 - 0 User quota MESSAGE 1 - 0
# doveadm quota get -u tester2 Quota name Type Value Limit % User quota STORAGE 0 20480 0 User quota MESSAGE 1 - 0
Then in the logs:
May 9 10:01:16 vdev dovecot: auth: Debug: master in: USER 1
tester1 service=doveadm
May 9 10:01:16 vdev dovecot: auth: Debug: ldap(tester1): user search:
base=ou=people, dc=noa, dc=gr scope=onelevel filter=(uid=tester1)
fields=roomNumber,uid
May 9 10:01:16 vdev dovecot: auth: Debug: ldap(tester1): result:
uid=tester1; roomNumber missing
May 9 10:01:16 vdev dovecot: auth: Debug: master out: USER 1
tester1 quota_rule=*:bytes= home=/home/vmail/tester1
May 9 10:01:29 vdev dovecot: auth: Debug: master in: USER 1
tester2 service=doveadm
May 9 10:01:29 vdev dovecot: auth: Debug: ldap(tester2): user search:
base=ou=people, dc=noa, dc=gr scope=onelevel filter=(uid=tester2)
fields=roomNumber,uid
May 9 10:01:29 vdev dovecot: auth: Debug: ldap(tester2): result:
uid=tester2 roomNumber=20M
May 9 10:01:29 vdev dovecot: auth: Debug: master out: USER 1
tester quota_rule=*:bytes=20M home=/home/vmail/tester2
So, in essence, when there is an explicitly defined quota for an account (as with tester2 above), doveadm returns the limit correctly; if not (as with tester1), it should get the default quota value, but it doesn't.
Nick
On Wed, 2012-05-09 at 10:28 +0300, Nikolaos Milas wrote:
May 9 10:01:16 vdev dovecot: auth: Debug: ldap(tester1): user search: base=ou=people, dc=noa, dc=gr scope=onelevel filter=(uid=tester1) fields=roomNumber,uid May 9 10:01:16 vdev dovecot: auth: Debug: ldap(tester1): result: uid=tester1; roomNumber missing May 9 10:01:16 vdev dovecot: auth: Debug: master out: USER 1 tester1 quota_rule=*:bytes= home=/home/vmail/tester1 .. So, in essence, when there is an explicitly defined quota for an account (as with tester2 above), doveadm returns the limit correctly; if not (as with tester1), it should get the default quota value, but it doesn't.
Fixed & added to regression tests: http://hg.dovecot.org/dovecot-2.1/rev/4bbc12a87a29
On 14/5/2012 7:31 μμ, Timo Sirainen wrote:
Fixed& added to regression tests: http://hg.dovecot.org/dovecot-2.1/rev/4bbc12a87a29
Thank you Timo.
Nick
participants (3)
-
Andreas Helmcke
-
Nikolaos Milas
-
Timo Sirainen