Hello all,
I have some troubles to make the quota_check working with dovecot 2.0.
My config is the following: postfix, dovecot as lda, mysql as virtual mailuser backend, and postfixadmin for the mailuser administration.
Previously i have a working setup with dovecot 1.x, now with the 2.0 something is wrong about the quota, but i don't know what...
Here is my config:
# 2.0.13: /etc/dovecot/dovecot.conf # OS: Linux 2.6.37.6-0.5-desktop x86_64 openSUSE 11.4 (x86_64) ext3 auth_mechanisms = plain login first_valid_gid = 51 first_valid_uid = 51 info_log_path = /var/log/dovecot-inf.log last_valid_gid = 51 last_valid_uid = 51 log_path = /var/log/dovecot-err.log mail_home = /var/mail/virtual/%d/%u/ mail_location = maildir:/var/mail/virtual/%d/%u managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date namespace { hidden = no inbox = yes list = yes location = prefix = INBOX. subscriptions = yes type = private } passdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } plugin { quota = maildir:User quota quota_warning = storage=80%% /usr/bin/quota_warning.sh 80 quota_warning2 = storage=90%% /usr/bin/quota_warning.sh 90 quota_warning3 = storage=99%% /usr/bin/quota_warning.sh 90 sieve = /var/mail/virtual/%d/%u/.dovecot.sieve sieve_storage = /var/mail/virtual/%d/%u/sieve } protocols = imap pop3 sieve service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-master { mode = 0600 } unix_listener auth-userdb { group = nobody mode = 0660 user = postfix } } service imap-login { inet_listener imap { address = 127.0.0.1 port = 143 } } service managesieve-login { executable = /usr/lib/dovecot/managesieve-login } service managesieve { executable = /usr/lib/dovecot/managesieve } service quota-warning { executable = script /usr/bin/quota_warning.sh user = postfix } ssl = no userdb { driver = passwd } userdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } protocol imap { imap_client_workarounds = mail_plugins = quota imap_quota } protocol sieve { managesieve_max_line_length = 65536 plugin { sieve = /var/mail/virtual/%d/%u/.dovecot.sieve sieve_storage = /var/mail/virtual/%d/%u/sieve } } protocol pop3 { mail_plugins = quota pop3_uidl_format = UID%u-%v } protocol lda { auth_socket_path = /var/run/dovecot/auth-master log_path = /var/log/dovecot-lda.log mail_debug = yes mail_plugins = quota sieve postmaster_address = postmaster@mediaservice.net }
My user query for mysql is the following:
user_query = SELECT maildir, 51 AS uid, 51 AS gid, CONCAT('*:bytes=', mailbox.quota ) AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'
I have made some test, with a test mailbox, with the quota setted to 1 Mb, in fact the maildirsize file contains:
1024000S
When i write a mail, something strange is happening: with the debug mail of dovecot active i see this:
Jun 29 17:42:19 lda: Debug: Loading modules from directory: /usr/lib64/dovecot/modules Jun 29 17:42:19 lda: Debug: Module loaded: /usr/lib64/dovecot/modules/lib10_quota_plugin.so Jun 29 17:42:19 lda: Debug: Module loaded: /usr/lib64/dovecot/modules/lib90_sieve_plugin.so Jun 29 17:42:19 auth: Info: mysql(127.0.0.1): Connected to database postfix Jun 29 17:42:19 lda: Debug: auth input: testquota@mediaservice.pri maildir=mediaservice.pri/testquota/ uid=51 gid=51 quota_rule=*:bytes=1024000 Jun 29 17:42:19 lda: Debug: Added userdb setting: plugin/maildir=mediaservice.pri/testquota/ Jun 29 17:42:19 lda: Debug: Added userdb setting: plugin/quota_rule=*:bytes=1024000 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Effective uid=51, gid=51, home=/var/mail/virtual/mediaservice.pri/testquota@mediaservice.pri/ Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota root: name=User quota backend=maildir args= Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota rule: root=User quota mailbox=* bytes=1024000 messages=0 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota warning: bytes=819200 (80%) messages=0 reverse=no command=/usr/bin/quota_warning.sh 80 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota warning: bytes=921600 (90%) messages=0 reverse=no command=/usr/bin/quota_warning.sh 90 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota warning: bytes=1013760 (99%) messages=0 reverse=no command=/usr/bin/quota_warning.sh 90 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Namespace : type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/virtual/mediaservice.pri/testquota@mediaservice.pri Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: maildir++: root=/var/mail/virtual/mediaservice.pri/testquota@mediaservice.pri, index=, control=, inbox=/var/mail/virtual/mediaservice.pri/testquota@mediaservice.pri Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota root: name=User quota backend=maildir args= Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota warning: bytes=0 (80%) messages=0 reverse=no command=/usr/bin/quota_warning.sh 80 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota warning: bytes=0 (90%) messages=0 reverse=no command=/usr/bin/quota_warning.sh 90 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Quota warning: bytes=0 (99%) messages=0 reverse=no command=/usr/bin/quota_warning.sh 90 Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: none: root=, index=, control=, inbox= Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: Destination address: testquota@mediaservice.pri (source: user@hostname) Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: sieve: user's script path /var/mail/virtual/mediaservice.pri/testquota@mediaservice.pri/.dovecot.sieve doesn't exist (using global script path in stead) Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: sieve: user has no valid personal script Jun 29 17:42:19 lda(testquota@mediaservice.pri): Debug: sieve: no scripts to execute: reverting to default delivery. Jun 29 17:42:19 lda(testquota@mediaservice.pri): Info: msgid=<4E0B47DA.9030607@atpss.net>: saved mail to INBOX
First question: why i see two times the quota warning check?
Anyway, if the 80% or 90% of the quota is fullfilled, no warning pops out....
I have also checked the query it does to mysql, is the following
SELECT maildir, 51 AS uid, 51 AS gid, CONCAT('*:bytes=', mailbox.quota ) AS quota_rule FROM mailbox WHERE username = 'testquota@mediaservice.pri' AND active = '1'
And the result, is the following:
+-----------------------------+-----+-----+-----------------+ | maildir | uid | gid | quota_rule | +-----------------------------+-----+-----+-----------------+ | mediaservice.pri/testquota/ | 51 | 51 | *:bytes=1024000 | +-----------------------------+-----+-----+-----------------+
Seems right to me...but it is not working.... why?
Ah, this is the content of the quota_warning.sh:
#!/bin/sh PERCENT=$1 USER=$2 cat << EOF | /usr/local/libexec/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing" From: postmaster@mediaservice.pri Subject: quota warning
Your mailbox is now $PERCENT% full. EOF
Any hint about what is not working?
Thanks,
Claudio Prono.
--
Claudio Prono OPST
System Developer
Gsm: +39-349-54.33.258
@PSS Srl Tel: +39-011-32.72.100
Via San Bernardino, 17 Fax: +39-011-32.46.497
10141 Torino - ITALY http://atpss.net/disclaimer
PGP Key - http://keys.atpss.net/c_prono.asc