Re: [Dovecot] dovecot-lda - dovecot: quota-warning: Error: lda: Fatal: Unknown argument
On 6/24/2013 11:59 AM, Ben Johnson wrote: Hi, everyone, I'm attempting to configure automated quota warnings for users and have hit a snag. The script I'm using is as follows: - #!/bin/sh PERCENT=$1 MAILBOX=$2 DOMAIN=$3 cat EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o plugin/quota=dict:user::file:/var/vmail/%d/%n/.quotausage From: postmaster@$DOMAIN Subject: Email quota warning - mailbox over $PERCENT% full [...] - When the script is triggered, here's what appears in the log: - Jun 24 11:16:53 host dovecot: quota-warning: Error: lda: Fatal: Unknown argument: plugin/quota=dict:user::noenforcing:file:/var/vmail/%d/%n/.quotausage Jun 24 11:16:53 host dovecot: master: Error: service(quota-warning): child 22415 returned error 64 - If I paste the same on the command line, the message is delivered, as expected: /usr/lib/dovecot/dovecot-lda -d u...@example.com -o plugin/quota=dict:user::noenforcing:file:/var/vmail/%d/%n/.quotausage -p /tmp/test.txt The problem seems to be that the -o switch isn't being interpreted correctly when dovecot-lda is called from within the script. -o is the correct switch, yes? From the manual at http://wiki2.dovecot.org/LDA : -o name=value: Override a setting from dovecot.conf. You can give this parameter multiple times. What am I missing here? Is some shell script escaping or similar required? Thanks for any tips! -Ben I figured it out; I had copy/pasted part of the line cat EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o \ plugin/quota=dict:user::file:/var/vmail/%d/%n/.quotausage from the documentation example and in so doing I neglected to use the correct variable name for the user/mailbox. In the documentation example, the variable is $USER, whereas I had named it $MAILBOX. This was causing the mailbox/user to be evaluated as an empty string (or null). Everything works as expected using the correct variable name. Oops! -Ben
Re: [Dovecot] dovecot-lda setting quota rules
it works great. thank You again Regards, Michal Grzedzicki 2012/8/3, Timo Sirainen t...@iki.fi: On 3.8.2012, at 2.13, Lazy wrote: dovecot-lda -o plugin/quota_rule=*:storage=1G thank You ! This is simple and elegant. Sill I need this to be taken from environment, I produced a simple patch adding one '-o' from an environment variable. You can also set environment: PLUGIN/QUOTA_RULE=*:storage=1G and then use dovecot-lda -k parameter. And if even that doesn't work, you could simply create a wrapper script. If You consider this useful I can try and make it more generic, enable multiple option overriding. You can also give -o parameter multiple times.
Re: [Dovecot] dovecot-lda setting quota rules
2012/7/31 Timo Sirainen t...@iki.fi: On 18.7.2012, at 4.33, Lazy wrote: I wan't it to stay that way. The problem is that it dosn't update the quota rules in Maildir when quota is changed in userdb. I have the rules avaiable in qmail-lda's environment, but I need an idea on how to feed the quota rule string to quota plugin without doing userdb lookup. What whould be the best way to do this, maybe in plugins/quota/quota.c:quota_root_add_rules() ? dovecot-lda -o plugin/quota_rule=*:storage=1G thank You ! This is simple and elegant. Sill I need this to be taken from environment, I produced a simple patch adding one '-o' from an environment variable. If You consider this useful I can try and make it more generic, enable multiple option overriding. Regards, Michal Grzedzicki
Re: [Dovecot] dovecot-lda setting quota rules
On 3.8.2012, at 2.13, Lazy wrote: dovecot-lda -o plugin/quota_rule=*:storage=1G thank You ! This is simple and elegant. Sill I need this to be taken from environment, I produced a simple patch adding one '-o' from an environment variable. You can also set environment: PLUGIN/QUOTA_RULE=*:storage=1G and then use dovecot-lda -k parameter. And if even that doesn't work, you could simply create a wrapper script. If You consider this useful I can try and make it more generic, enable multiple option overriding. You can also give -o parameter multiple times.
Re: [Dovecot] dovecot-lda setting quota rules
On 18.7.2012, at 4.33, Lazy wrote: I wan't it to stay that way. The problem is that it dosn't update the quota rules in Maildir when quota is changed in userdb. I have the rules avaiable in qmail-lda's environment, but I need an idea on how to feed the quota rule string to quota plugin without doing userdb lookup. What whould be the best way to do this, maybe in plugins/quota/quota.c:quota_root_add_rules() ? dovecot-lda -o plugin/quota_rule=*:storage=1G
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
Timo Sirainen schrieb: On Tue, 2008-09-16 at 17:54 +0200, Jonas Christian wrote: which I changed to quota_rule=*:bytes: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
Timo Sirainen schrieb: On Sep 23, 2008, at 1:07 PM, Jonas Christian wrote: quota_rule=*:bytes: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}password: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=private ip rip=public ip 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: CONThidden Sep 23 12:18:25 mailserver dovecot: auth(default): passwd-file([EMAIL PROTECTED],public ip): 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],public ip): 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=public ip, lip=private ip 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
Re: [Dovecot] Dovecot LDA and quota
Timo Sirainen schrieb: On Sep 23, 2008, at 1:28 PM, Jonas Christian wrote: [EMAIL PROTECTED]:{PLAIN}password: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
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
On Sep 23, 2008, at 1:07 PM, Jonas Christian wrote: quota_rule=*:bytes: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 Sep 23, 2008, at 1:28 PM, Jonas Christian wrote: [EMAIL PROTECTED]:{PLAIN}password: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 Tue, 2008-09-16 at 17:54 +0200, Jonas Christian wrote: which I changed to quota_rule=*:bytes: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