File-dictionary based quotas and SETQUOTA
Ganael Laplanche
ganael.laplanche at centralesupelec.fr
Thu May 16 13:15:51 EEST 2019
Hello,
I am trying to set up file-dictionary based quotas while supporting the
SETQUOTA IMAP command.
I am using the following configuration :
----
plugin {
quota = dict:User quota::file:%h/Maildir/dovecot-quota
quota_set = dict:file:%h/Maildir/dovecot-quota
}
----
which enables correct quota accounting + setting through SETQUOTA.
A user's dovecot-quota file ends with the following contents :
----
priv/quota/limit/storage
5242880
priv/quota/limit/messages
20
priv/quota/messages
1
priv/quota/storage
8506282
----
which shows a correct accounting (1 mail received, ~8MB used) and correct
setting after having used the following IMAP command through a master user :
A2 SETQUOTA "User quota" (STORAGE 5242880 MESSAGE 20)
*But* the problem is that I am unable to fetch the limits and consume them
from userdb (as a consequence, the limits are never applied).
On the consuming side, I am using a dictionary userdb to try to fetch the
'priv/quota/limit/storage' value from the file but it does not work because
the key is never found.
Here is my configuration :
----
userdb {
driver = dict
args = /etc/dovecot/dovecot-dict-quota.conf.ext
}
----
and my dovecot-dict-quota.conf.ext file :
----
uri = file:%h/Maildir/dovecot-quota
iterate_disable = yes
key quota {
key = priv/quota/limit/storage
default_value = 100
}
userdb_fields {
quota_rule = *:storage=%{dict:quota}
}
----
If I try to fetch the quota for that user :
# doveadm quota get -u ganael.laplanche at centralesupelec.fr
Quota name Type Value Limit
%
User quota STORAGE 8307 100
8307
User quota MESSAGE 1 -
0
the default rule is returned (100). The logs show :
May 16 12:02:45 mailhost1-saclay dovecot: auth-worker(12899): Debug:
dict(Ganael.Laplanche at centralesupelec.fr): Lookup: shared/priv/quota/limit/
storage not found, using default value 100
We can see that the default quota rule has been applied because the key is not
found. The problem is that a "shared/" prefix is always prepended when looking
for the key I configured (priv/quota/limit/storage).
If I test the dictionary manually, the key is found :
# doveadm dict get -u ganael.laplanche at centralesupelec.fr "file:/var/vmail/l/
laplanche_gan/Maildir/dovecot-quota" priv/quota/limit/storage
5242880
Does anyone know how to prevent Dovecot from adding that prefix and make it
fetch the correct value from userdb ?
Best regards,
--
Ganael Laplanche <ganael.laplanche at centralesupelec.fr>
Unix Systems Engineer @CentraleSupelec Rennes
More information about the dovecot
mailing list