[Dovecot] imap-quota not working
Hello,
imap-quota plugin always returns empty quota: a1 GETQUOTA "" * QUOTA "" () a1 OK Getquota completed. a2 GETQUOTAROOT INBOX * QUOTAROOT "INBOX" a2 OK Getquotaroot completed.
quota_rule and quota_rule2 for this user are defined in db as following: '*:storage=5000000' '*:messages=50000' Quota for LDA is working OK. I am using dovecot-1.1.3 with quotadict.
Here is my dovecot -n output: # 1.1.3: /usr/local/dovecot/etc/dovecot.conf base_dir: /var/run/dovecot/ syslog_facility: local7 protocols: pop3 imap ssl_cert_file: /etc/postfix/host-cert.pem ssl_key_file: /etc/postfix/host-key.pem disable_plaintext_auth: no verbose_ssl: yes login_dir: /var/run/dovecot/login login_executable(default): /usr/local/dovecot/libexec/dovecot/imap-login login_executable(imap): /usr/local/dovecot/libexec/dovecot/imap-login login_executable(pop3): /usr/local/dovecot/libexec/dovecot/pop3-login login_greeting: Server. login_process_per_connection: no login_processes_count: 5 login_max_processes_count: 32 verbose_proctitle: yes first_valid_uid: 95 first_valid_gid: 95 mail_uid: 95 mail_gid: 95 mail_location: maildir:~/Maildir fsync_disable: yes mail_executable(default): /usr/local/dovecot/libexec/dovecot/imap mail_executable(imap): /usr/local/dovecot/libexec/dovecot/imap mail_executable(pop3): /usr/local/dovecot/libexec/dovecot/pop3 mail_plugins(default): quota imap_quota mail_plugins(imap): quota imap_quota mail_plugins(pop3): quota mail_plugin_dir(default): /usr/local/dovecot/lib/dovecot/imap mail_plugin_dir(imap): /usr/local/dovecot/lib/dovecot/imap mail_plugin_dir(pop3): /usr/local/dovecot/lib/dovecot/pop3 imap_client_workarounds(default): delay-newmail imap_client_workarounds(imap): delay-newmail imap_client_workarounds(pop3): pop3_enable_last(default): no pop3_enable_last(imap): no pop3_enable_last(pop3): yes pop3_client_workarounds(default): pop3_client_workarounds(imap): pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh namespace: type: private separator: . inbox: yes list: yes subscriptions: yes auth default: mechanisms: plain login digest-md5 cram-md5 apop cache_size: 1024 cache_ttl: 600 cache_negative_ttl: 60 user: doveauth verbose: yes passdb: driver: sql args: /usr/local/dovecot/etc/dovecot-sql.conf userdb: driver: prefetch userdb: driver: sql args: /usr/local/dovecot/etc/dovecot-sql.conf socket: type: listen client: path: /var/spool/postfix/private/auth mode: 432 user: postfix group: postfix master: path: /var/run/dovecot/auth-master mode: 384 user: vmail group: vmail plugin: quota: dict:::proxy:/var/run/dovecot/dict-server:quotadict dict: quotadict: mysql:/usr/local/dovecot/etc/dovecot-sql-dict-quota.conf
Regards, Arvids
On Fri, 2008-09-26 at 11:43 +0300, arvids wrote:
Hello,
imap-quota plugin always returns empty quota: a1 GETQUOTA ""
- QUOTA "" () a1 OK Getquota completed. a2 GETQUOTAROOT INBOX
- QUOTAROOT "INBOX" a2 OK Getquotaroot completed.
quota_rule and quota_rule2 for this user are defined in db as following: '*:storage=5000000' '*:messages=50000'
You should have only one quota_rule that's '*:storage=5000000:messages=50000'
I'm not sure what it does with your configuration. I suppose it's also possible that it works as intended..
Anyway, set mail_debug=yes and show what the logs say when logging in. That'll describe what it really sees in the quota settings.
On Sunday 05 October 2008 15:15:49 Timo Sirainen wrote:
You should have only one quota_rule that's '*:storage=5000000:messages=50000'
I'm not sure what it does with your configuration. I suppose it's also possible that it works as intended..
Anyway, set mail_debug=yes and show what the logs say when logging in. That'll describe what it really sees in the quota settings.
with mail_debug=yes the log says : Oct 5 16:23:01 host dovecot: IMAP(testuser): Loading modules from directory: /usr/local/dovecot/lib/dovecot/imap Oct 5 16:23:01 host dovecot: IMAP(testuser): Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so Oct 5 16:23:01 host dovecot: IMAP(testuser): Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib11_imap_quota_plugin.so Oct 5 16:23:01 host dovecot: IMAP(testuser): Effective uid=95, gid=95, home=/var/vmail/testuser Oct 5 16:23:01 host dovecot: IMAP(testuser): Quota root: name= backend=dict args=:proxy:/var/run/dovecot/dict-server:quotadict Oct 5 16:23:01 host dovecot: IMAP(testuser): dict quota: user=testuser, uri=proxy:/var/run/dovecot/dict-server:quotadict, enforcing=0 Oct 5 16:23:01 host dovecot: IMAP(testuser): Namespace: type=private, prefix=, sep=., inbox=yes, hidden=no, list=yes, subscriptions=yes Oct 5 16:23:01 host dovecot: IMAP(testuser): maildir: data=/var/vmail/testuser/Maildir Oct 5 16:23:01 host dovecot: IMAP(testuser): maildir++: root=/var/vmail/testuser/Maildir, index=, control=, inbox=/var/vmail/testuser/Maildir Oct 5 16:23:01 host dovecot: imap-login: Login: user=<testuser>, method=PLAIN, rip=x.x.x.x, lip=x.x.x.x
exactly the same result with quota_rule='*:storage=5000000:messages=50000'.
Regards, Arvids
On Sun, 2008-10-05 at 16:42 +0300, arvids wrote:
On Sunday 05 October 2008 15:15:49 Timo Sirainen wrote:
You should have only one quota_rule that's '*:storage=5000000:messages=50000'
I'm not sure what it does with your configuration. I suppose it's also possible that it works as intended..
Anyway, set mail_debug=yes and show what the logs say when logging in. That'll describe what it really sees in the quota settings.
with mail_debug=yes the log says : Oct 5 16:23:01 host dovecot: IMAP(testuser): Loading modules from directory: /usr/local/dovecot/lib/dovecot/imap Oct 5 16:23:01 host dovecot: IMAP(testuser): Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so Oct 5 16:23:01 host dovecot: IMAP(testuser): Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib11_imap_quota_plugin.so Oct 5 16:23:01 host dovecot: IMAP(testuser): Effective uid=95, gid=95, home=/var/vmail/testuser Oct 5 16:23:01 host dovecot: IMAP(testuser): Quota root: name= backend=dict args=:proxy:/var/run/dovecot/dict-server:quotadict Oct 5 16:23:01 host dovecot: IMAP(testuser): dict quota: user=testuser, uri=proxy:/var/run/dovecot/dict-server:quotadict, enforcing=0 Oct 5 16:23:01 host dovecot: IMAP(testuser): Namespace: type=private, prefix=, sep=., inbox=yes, hidden=no, list=yes, subscriptions=yes Oct 5 16:23:01 host dovecot: IMAP(testuser): maildir: data=/var/vmail/testuser/Maildir Oct 5 16:23:01 host dovecot: IMAP(testuser): maildir++: root=/var/vmail/testuser/Maildir, index=, control=, inbox=/var/vmail/testuser/Maildir Oct 5 16:23:01 host dovecot: imap-login: Login: user=<testuser>, method=PLAIN, rip=x.x.x.x, lip=x.x.x.x
exactly the same result with quota_rule='*:storage=5000000:messages=50000'.
It doesn't show anything about quota rules, so the quota_rule isn't being specified correctly by your userdb. Show your dovecot-sql.conf, enable auth_debug=yes and show what the logs say when logging in.
On Sunday 05 October 2008 16:47:26 Timo Sirainen wrote:
It doesn't show anything about quota rules, so the quota_rule isn't being specified correctly by your userdb. Show your dovecot-sql.conf, enable auth_debug=yes and show what the logs say when logging in.
the log says: Oct 5 16:55:44 host dovecot: auth(default): client in: AUTH^I1^IPLAIN^Iservice=imap^Ilip=x.x.x.x^Irip=x.x.x.x^Ilport=143^Irport=49910^Iresp=<hidden> Oct 5 16:55:44 host dovecot: auth(default): cache(testuser,x.x.x.x): miss Oct 5 16:55:44 host dovecot: auth-worker(default): sql(testuser,x.x.x.x): query: SELECT user, clear as password, home as userdb_home, uid as userdb_uid, gid as userdb_gid FROM users WHERE user = 'testuser' Oct 5 16:55:44 host dovecot: auth(default): client out: OK^I1^Iuser=testuser Oct 5 16:55:44 host dovecot: auth(default): master in: REQUEST^I1^I19559^I1 Oct 5 16:55:44 host dovecot: auth(default): prefetch(testuser,x.x.x.x): success Oct 5 16:55:44 host dovecot: auth(default): master out: USER^I1^Itestuser^Ihome=/var/vmail/testuser^Iuid=95^Igid=95 Oct 5 16:55:44 host dovecot: imap-login: Login: user=<testuser>, method=PLAIN, rip=x.x.x.x, lip=x.x.x.x Oct 5 16:55:44 host dovecot: auth(default): new auth connection: pid=19559 Oct 5 16:55:44 host dovecot: IMAP(testuser): Loading modules from directory: /usr/local/dovecot/lib/dovecot/imap Oct 5 16:55:44 host dovecot: IMAP(testuser): Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so Oct 5 16:55:44 host dovecot: IMAP(testuser): Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib11_imap_quota_plugin.so Oct 5 16:55:44 host dovecot: IMAP(testuser): Effective uid=95, gid=95, home=/var/vmail/testuser Oct 5 16:55:44 host dovecot: IMAP(testuser): Quota root: name= backend=dict args=:proxy:/var/run/dovecot/dict-server:quotadict Oct 5 16:55:44 host dovecot: IMAP(testuser): dict quota: user=testuser, uri=proxy:/var/run/dovecot/dict-server:quotadict, enforcing=0 Oct 5 16:55:44 host dovecot: IMAP(testuser): Namespace: type=private, prefix=, sep=., inbox=yes, hidden=no, list=yes, subscriptions=yes Oct 5 16:55:44 host dovecot: IMAP(testuser): maildir: data=/var/vmail/testuser/Maildir Oct 5 16:55:44 host dovecot: IMAP(testuser): maildir++: root=/var/vmail/testuser/Maildir, index=, control=, inbox=/var/vmail/testuser/Maildir Oct 5 16:55:47 host dovecot: dict: mysql: Connected to /tmp/mysql.sock (mail) Oct 5 16:55:53 host dovecot: IMAP(testuser): Disconnected: Logged out bytes=24/85
For some reason the user_query is not executed, only password_query.
Here is my dovecot-sql.conf:
driver = mysql connect = host=/tmp/mysql.sock dbname=mail user=dovecot password=xxx default_pass_scheme = PLAIN
password_query = SELECT user, clear as password, home as userdb_home, uid as userdb_uid, gid as userdb_gid
FROM users WHERE user = '%u'
user_query = SELECT home, uid, gid,
concat('*:storage=',quota_kb,':messages=',quota_num) AS quota_rule,
concat('storage=',round(quota_kb*0.90),' /etc/postfix/quotawarn.sh storage 90') AS quota_warning,
concat('messages=',round(quota_num*0.90),' /etc/postfix/quotawarn.sh messages 90') AS quota_warning2
FROM users WHERE user = '%u'
Regards, Arvids
On Sunday 05 October 2008 17:15:45 Timo Sirainen wrote:
That's the point of using prefetch userdb. Either don't use it, or copy all the quota_* fields to password_query as well (with userdb_ prefix).
Thank you very much for pointing it out, I forgot about this prefetch thing. Now imap quota is working, but there is some problem:
Oct 5 17:44:09 host dovecot: Panic: IMAP(testuser): file mail-index-sync.c: line 411 (mail_index_sync_begin_to): assertion failed: (!index->syncing) Oct 5 17:44:09 host dovecot: IMAP(testuser): Raw backtrace: imap [0x80cbdcc] -> imap [0x80cc582] -> imap [0x80cbf28] -> imap [0x80ad33c] -> imap(mail_index_sync_begin+0x24) [0x80acfb4] -> imap(maildir_sync_index_begin+0x3f) [0x807021f] -> imap [0x806fc03] -> imap(maildir_storage_sync_init+0x57) [0x806fd97] -> imap(mailbox_sync_init+0x11) [0x809e421] -> imap(mailbox_sync+0x16 ) [0x809e496] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so [0xb7dfbe89] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so [0xb7dfc011] -> /usr/local/dovecot/lib/d ovecot/imap/lib10_quota_plugin.so(quota_count+0x78) [0xb7dfc0b8] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so [0xb7dfd0eb] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota _plugin.so [0xb7dfd29e] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so(quota_get_resource+0x4c) [0xb7dfb4bc] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so [0xb7 dfb8ff] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so(quota_tr Oct 5 17:44:09 host dovecot: IMAP(testuser): ocal/dovecot/lib/dovecot/imap/lib10_quota_plugin.so [0xb7dffb18] -> /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so [0xb7dffbc9] -> i map(maildir_sync_index+0x767) [0x8070bf7] -> imap [0x806fba0] -> imap(maildir_storage_sync_init+0x57) [0x806fd97] -> imap(mailbox_sync_init+0x11) [0x809e421] -> imap(imap_sync_init+0x41) [0 x80659a1] -> imap [0x8066090] -> imap(cmd_sync_delayed+0x8d) [0x806638d] -> imap [0x806047f] Oct 5 17:44:09 host dovecot: child 21618 (imap) killed with signal 6
This crash happens every time, when message count quota is reached and I am trying to delete all messages.
Regards, Arvids
On Sun, 2008-10-05 at 17:55 +0300, arvids wrote:
On Sunday 05 October 2008 17:15:45 Timo Sirainen wrote:
That's the point of using prefetch userdb. Either don't use it, or copy all the quota_* fields to password_query as well (with userdb_ prefix).
Thank you very much for pointing it out, I forgot about this prefetch thing. Now imap quota is working, but there is some problem:
Hmm. I'll have to think about how to fix this. The problem is that mailbox syncing triggers quota recalculation because the quota isn't in the database yet. The quota recalculation then traverses all mailboxes and syncs them. Eventually it reaches the mailbox that triggered the quota recalculation and then it crashes (so it wouldn't go to infinite loop)..
On Sun, 2008-10-05 at 17:55 +0300, arvids wrote:
On Sunday 05 October 2008 17:15:45 Timo Sirainen wrote:
That's the point of using prefetch userdb. Either don't use it, or copy all the quota_* fields to password_query as well (with userdb_ prefix).
Thank you very much for pointing it out, I forgot about this prefetch thing. Now imap quota is working, but there is some problem:
Oct 5 17:44:09 host dovecot: Panic: IMAP(testuser): file mail-index-sync.c: line 411 (mail_index_sync_begin_to): assertion failed: (!index->syncing)
participants (2)
-
arvids
-
Timo Sirainen