Re: [Dovecot] dovecot lda and quota plugin with mysql
On 01/17/2011 11:53 AM, J4 wrote: > On 01/16/2011 08:42 PM, Timo Sirainen wrote: >> On Thu, 2011-01-13 at 17:22 +0100, J4 wrote: >> >>> I have postfix delivering to dovecot lda (via spamassinassin). I >>> have configured the quota plugin, but it does not seem to respect the >>> details in the quota table in mysql. The query I have used looks >>> correct to me, and the user can connect to the database. >> .. >>> # Relevant portions of dovecot -n: >> This output doesn't show a quota_rule. If you don't have any, everyone >> has unlimited quota. >> >>> mysql> select * from quota; >>> +-+---+--+ >>> | username| bytes | messages | >>> +-+---+--+ >>> | r...@test.info | 19524 | 18 | >>> | b...@test.info | 9420 |6 | >>> | t...@klunky.co.uk | 4662 |4 | >>> | b...@test.info| 19284 | 13 | >>> | b...@test.info | 173906172 | 5702 | >>> | postmas...@test.info | 10587 |9 | >>> | b...@test.info | 3695 |2 | >>> +-+---+--+ >>> 7 rows in set (0.00 sec) >> Looks like it's counting the quota, so I guess you're just missing the >> limits. > Hi Timo, > Many thanks for getting back to me. This has led me to look more into > the mailbox and quota tables. > > I think the limits are inserted into the mailbox table, > mysql> select * from mailbox; > ++++-+--++--+-+-++ > | username | password | name > | maildir | quota| > local_part | domain | created | modified > | active | > ++++-+--++--+-+-++ > | t...@test.info| $1$1x | Fred TEST > | test.info/test/| 1024 | test | test.info | > 2011-01-07 17:47:25 | 2011-01-07 17:47:25 | 1 | > > ++++-+--++--+-+-++ > > ... while the actual usage is inserted into the quota table (as shown in > the original Email). I think that Dovecot should read the limits from > mailbox.quota and retrieve the usage from the quota.bytes and > quota.messages. > > Somehow, I have to tell Dovecot to use these values in mailbox.quota. I > think that I have to add a reference to the file in the dovecot.conf, > and add an entry into the appropriate sql.conf file. > > Regards, J. > I updated the /etc/dovecot/dovecot-sql.conf file to include this modifed query, that I hoped would check the quota, but this failed. I think dovecot simply ignored this. I wonder if the alias quota_rule makes any sence to Dovecot as I only see : quota = dict:user::proxy::quotadict defined in the dovecot.conf and not quota_rule. # cat /etc/dovecot/dovecot-sql.conf password_query = SELECT username as user, password FROM mailbox WHERE email='%u'; user_query = SELECT 5000 AS uid, 5000 AS gid,'/home/vmail/%d/%n' as home, concat('*:storage= ', quota) AS quota_rule FROM mailbox WHERE user = '%n';
Re: [Dovecot] dovecot lda and quota plugin with mysql
On Thu, 2011-01-13 at 17:22 +0100, J4 wrote: > I have postfix delivering to dovecot lda (via spamassinassin). I > have configured the quota plugin, but it does not seem to respect the > details in the quota table in mysql. The query I have used looks > correct to me, and the user can connect to the database. .. > # Relevant portions of dovecot -n: This output doesn't show a quota_rule. If you don't have any, everyone has unlimited quota. > mysql> select * from quota; > +-+---+--+ > | username| bytes | messages | > +-+---+--+ > | r...@test.info | 19524 | 18 | > | b...@test.info | 9420 |6 | > | t...@klunky.co.uk | 4662 |4 | > | b...@test.info| 19284 | 13 | > | b...@test.info | 173906172 | 5702 | > | postmas...@test.info | 10587 |9 | > | b...@test.info | 3695 |2 | > +-+---+--+ > 7 rows in set (0.00 sec) Looks like it's counting the quota, so I guess you're just missing the limits. signature.asc Description: This is a digitally signed message part
Re: [Dovecot] Dovecot LDA and quota
On 9/23/2008, Jonas Christian ([EMAIL PROTECTED]) wrote: > Wicked, that solved it! Do you mind if I add this to the Wiki? Thats what a wiki is for... :) -- Best regards, Charles
Re: [Dovecot] Dovecot LDA and quota
Timo Sirainen schrieb: > On Sep 23, 2008, at 1:28 PM, Jonas Christian wrote: >> [EMAIL PROTECTED]:{PLAIN}:1005:1005::/var/vmail/mailboxes/xxx.com/spam::quota_rule=*:bytes=20971520 >> > oh, right, userdb_quota_rule. Otherwise it's treated as a passdb field > and sent to imap-login. Wicked, that solved it! Do you mind if I add this to the Wiki? Cheers, Jonas
Re: [Dovecot] Dovecot LDA and quota
Timo Sirainen schrieb: On Sep 23, 2008, at 1:07 PM, Jonas Christian wrote: quota_rule=*:bytes: .. Sep 15 00:24:52 mailserver dovecot: auth(default): master out: USER 380864 [EMAIL PROTECTED] uid=100 5gid=1005home=/var/vmail/mailboxes/xxx.com/spam quota=maildir:bytes=2048 Says quota=maildir:bytes=2048 here, no quota_rule.. I'm sorry about that. I was sending the logs from last week when I was messing around with the configs quite a bit. This is the actual config from now: [EMAIL PROTECTED]:{PLAIN}:1005:1005::/var/vmail/mailboxes/xxx.com/spam::quota_rule=*:bytes=20971520 There is no file named "maildirsize" in the mail directory. Now, logging in by IMAP I get: Sep 23 12:18:24 mailserver dovecot: auth(default): client in: AUTH 1 CRAM-MD5service=imap lip= rip= lport=143 rport=34763 Sep 23 12:18:24 mailserver dovecot: auth(default): client out: CONT 1 PDYzOTE1OTM5OTczNDY4NjAuMTIyMjE 2NTEwNEB0ZG8tbWFpbDAyLmRtejExLmlzYy50b2RvLmRlPg== Sep 23 12:18:25 mailserver dovecot: auth(default): client in: CONT Sep 23 12:18:25 mailserver dovecot: auth(default): passwd-file([EMAIL PROTECTED],): lookup: [EMAIL PROTECTED] file=/var/vmail/config/passdb Sep 23 12:18:25 mailserver dovecot: auth(default): client out: OK 1 [EMAIL PROTECTED] quota_rule=*:bytes=20971520 Sep 23 12:18:25 mailserver dovecot: auth(default): master in: REQUEST 29 87401 Sep 23 12:18:25 mailserver dovecot: auth(default): passwd-file([EMAIL PROTECTED],): lookup: [EMAIL PROTECTED] file=/var/vmail/config/passdb Sep 23 12:18:25 mailserver dovecot: auth(default): master out: USER 29 [EMAIL PROTECTED]uid=1005gid=1005 home=/var/vmail/mailboxes/xxx.com/spam Sep 23 12:18:25 mailserver dovecot: imap-login: Login: user=<[EMAIL PROTECTED]>, method=CRAM-MD5, rip=, lip= Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): Loading modules from directory: /usr/local/lib/dovecot/imap Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): Module loaded: /usr/local/lib/dovecot/imap/lib10_quota_plugin.so Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): Module loaded: /usr/local/lib/dovecot/imap/lib11_imap_quota_plugin.so Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): Effective uid=1005, gid=1005, home=/var/vmail/mailboxes/xxx.com/spam Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): Quota root: name= backend=maildir args= Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): Namespace: type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): maildir: data=/var/vmail/mailboxes/xxx.com/spam Sep 23 12:18:25 mailserver dovecot: IMAP([EMAIL PROTECTED]): maildir++: root=/var/vmail/mailboxes/xxx.com/spam, index=, control=, inbox=/var/vmail/mailboxes/xxx.com/spam delivering a mail results in this Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): Loading modules from directory: /usr/local/lib/dovecot/lda Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): Module loaded: /usr/local/lib/dovecot/lda/lib10_quota_plugin.so Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): Module loaded: /usr/local/lib/dovecot/lda/lib90_cmusieve_plugin.so Sep 23 12:21:28 mailserver dovecot: auth(default): master in: USER 1 [EMAIL PROTECTED]service=deliver Sep 23 12:21:28 mailserver dovecot: auth(default): passwd-file([EMAIL PROTECTED]): lookup: [EMAIL PROTECTED] file=/var/vmail/config/passdb Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): auth input: [EMAIL PROTECTED] Sep 23 12:21:28 mailserver dovecot: auth(default): master out: USER 1 [EMAIL PROTECTED]uid=1005gid=1005 home=/var/vmail/mailboxes/xxx.com/spam Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): auth input: uid=1005 Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): auth input: gid=1005 Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): auth input: home=/var/vmail/mailboxes/xxx.com/spam Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): Quota root: name= backend=maildir args= Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): Namespace: type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): maildir: data=/var/vmail/mailboxes/xxx.com/spam Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): maildir++: root=/var/vmail/mailboxes/xxx.com/spam, index=, control=, inbox=/var/vmail/mailboxes/xxx.com/spam Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): cmusieve: /var/vmail/mailboxes/xxx.com/spam/.dovecot.sieve doesn't exist Sep 23 12:21:28 mailserver deliver([EMAIL PROTECTED]): msgid=<[EMAIL PROTECTED]>: saved mail to INBOX Interestingly, I can see nothing about the quota rule in the deliver log although it appears
Re: [Dovecot] Dovecot LDA and quota
Timo Sirainen schrieb: On Tue, 2008-09-16 at 17:54 +0200, Jonas Christian wrote: which I changed to quota_rule=*:bytes: I guess you really have bytes=, not bytes:? Otherwise it should have logged an error. Yeah, I put it correctly, sorry. Should have copied it straight from the file into the mail. What happens now is that deliver (the Dovecot LDA) only picks up the quotas set in the maildirsize file in the user's homedir. It doesn't pick up the quota set in the userdb. Also, when I delete the maildirsize file, I doesn't get recreated by the LDA and quotas don't get checked at all. Any ideas? I'd be very grateful for any pointers. Set mail_debug=yes. What does it log when logging in? Ok, here are some logs. The first one is an IMAP login, the second and third are delivery attempts by the Dovecot LDA (deliver): Sep 15 00:24:52 mailserver dovecot: auth(default): client in: AUTH 1 CRAM-MD5service=imap secured lip=10.1.1.1 rip=212.0.138.106 lport=143 rport=60658 Sep 15 00:24:52 mailserver dovecot: auth(default): client out: CONT 1 PDQ2NDIxNzQ3Mzc3NDAwNTQuMTIyMTQ zMTA5MkB0ZG8tbWFpbDAyLmRtejExLmlzYy50b2RvLmRlPg== Sep 15 00:24:52 mailserver dovecot: auth(default): client in: CONT 1 a2FyaW4uemVpbGluZ2VyQGRibC5kZSA wZmM4OGViYzY4YzU5ZWY0MDhlMTZkMTZjMzA5ZmE5NA== Sep 15 00:24:52 mailserver dovecot: auth(default): passwd-file([EMAIL PROTECTED],212.0.138.106): lookup: [EMAIL PROTECTED] file=/var/vmail/config/passdb Sep 15 00:24:52 mailserver dovecot: auth(default): password([EMAIL PROTECTED],212.0.138.106): Credential s: 23dfff7d8ebf062c839cc16a0cdded45785a804e988fdde376cd8608b8f72bfe Sep 15 00:24:52 mailserver dovecot: auth(default): client out: OK 1 [EMAIL PROTECTED] Sep 15 00:24:52 mailserver dovecot: auth(default): master in: REQUEST 380864 15886 1 Sep 15 00:24:52 mailserver dovecot: auth(default): passwd-file([EMAIL PROTECTED],212.0.138.106): lookup: [EMAIL PROTECTED] file=/var/vmail/config/passdb Sep 15 00:24:52 mailserver dovecot: auth(default): master out: USER 380864 [EMAIL PROTECTED] uid=100 5gid=1005home=/var/vmail/mailboxes/xxx.com/spam quota=maildir:bytes=2048 Sep 15 00:24:52 mailserver dovecot: imap-login: Login: user=<[EMAIL PROTECTED]>, method=CRAM-MD5, rip=212. 0.138.106, lip=10.1.1.1, TLS Sep 15 00:24:52 mailserver dovecot: IMAP([EMAIL PROTECTED]): Disconnected: Logged out bytes=34/330 Sep 15 00:13:47 mailserver dovecot: auth(default): master in: USER 1 [EMAIL PROTECTED]service=deliver Sep 15 00:13:47 mailserver dovecot: auth(default): passwd-file([EMAIL PROTECTED]): lookup: [EMAIL PROTECTED] file=/var/vmail/config/passdb Sep 15 00:13:47 mailserver dovecot: auth(default): master out: USER 1 [EMAIL PROTECTED]uid=1005gid=1005 home=/var/vmail/mailboxes/xxx.com/spam quota=maildir:bytes=2048 Sep 15 00:13:47 mailserver deliver([EMAIL PROTECTED]): msgid=<[EMAIL PROTECTED]>: save failed to INBOX: Quota exceeded Sep 15 00:13:47 mailserver deliver([EMAIL PROTECTED]): msgid=<[EMAIL PROTECTED]>: rejected: Quota exceeded Sep 15 00:13:47 mailserver postfix/pickup[13790]: 77971A6C6C: uid=1005 from=<> Sep 15 00:13:47 mailserver postfix/pipe[13842]: 4BD7BA6C65: to=<[EMAIL PROTECTED]>, relay=dovecot, delay=0.19, delays=0.12/0.01/0/0.06, dsn=2.0.0, status=sent (delivered via dovecot service) Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): Loading modules from directory: /usr/local/lib/dovecot/lda Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): Module loaded: /usr/local/lib/dovecot/lda/lib10_quota_plugin.so Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): Module loaded: /usr/local/lib/dovecot/lda/lib90_cmusieve_plugin.so Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): auth input: [EMAIL PROTECTED] Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): auth input: uid=1005 Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): auth input: gid=1005 Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): auth input: home=/var/vmail/mailboxes/xxx.com/spam Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): Quota root: name= backend=maildir args= Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): Namespace: type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): maildir: data=/var/vmail/mailboxes/xxx.com/spam Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): maildir++: root=/var/vmail/mailboxes/xxx.com/spam, index=, control=, inbox=/var/vmail/mailboxes/xxx.com/spam Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): cmusieve: /var/vmail/mailboxes/xxx.com/spam/.dovecot.sieve doesn't exist Sep 16 15:13:17 mailserver deliver([EMAIL PROTECTED]): msgid=<[EMAIL PROTECTED]>: saved mail to INBOX ---
Re: [Dovecot] Dovecot LDA and quota
On Sep 23, 2008, at 1:28 PM, Jonas Christian wrote: [EMAIL PROTECTED]:{PLAIN}:1005:1005::/var/vmail/mailboxes/ xxx.com/spam::quota_rule=*:bytes=20971520 oh, right, userdb_quota_rule. Otherwise it's treated as a passdb field and sent to imap-login. PGP.sig Description: This is a digitally signed message part
Re: [Dovecot] Dovecot LDA and quota
On Sep 23, 2008, at 1:07 PM, Jonas Christian wrote: quota_rule=*:bytes: .. Sep 15 00:24:52 mailserver dovecot: auth(default): master out: USER 380864 [EMAIL PROTECTED] uid=100 5gid=1005home=/var/vmail/mailboxes/xxx.com/ spamquota=maildir:bytes=2048 Says quota=maildir:bytes=2048 here, no quota_rule.. PGP.sig Description: This is a digitally signed message part
Re: [Dovecot] Dovecot LDA and quota
On Tue, 2008-09-16 at 17:54 +0200, Jonas Christian wrote: > which I changed to > >quota_rule=*:bytes: I guess you really have bytes=, not bytes:? Otherwise it should have logged an error. > What happens now is that deliver (the Dovecot LDA) only picks up the > quotas set in the maildirsize file in the user's homedir. It doesn't > pick up the quota set in the userdb. > > Also, when I delete the maildirsize file, I doesn't get recreated by the > LDA and quotas don't get checked at all. > > Any ideas? I'd be very grateful for any pointers. Set mail_debug=yes. What does it log when logging in? signature.asc Description: This is a digitally signed message part