[Dovecot] Dovecot 2.0, mysql and quota
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
On Wed, 2011-06-29 at 18:02 +0200, Claudio Prono wrote:
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
Looks ok.
First question: why i see two times the quota warning check?
The second one is for an "internal storage". You can ignore it.
Anyway, if the 80% or 90% of the quota is fullfilled, no warning pops out....
Are you sure you tested it correctly? It is executed only when a mail is delivered across the 79% -> 80% quota boundary.
I don't see any error in your config.
Il 30/06/2011 6.56, Timo Sirainen ha scritto:
On Wed, 2011-06-29 at 18:02 +0200, Claudio Prono wrote: Are you sure you tested it correctly? It is executed only when a mail is delivered across the 79% -> 80% quota boundary.
I don't see any error in your config.
Ok, fixing some things, the script is going to be executed:
Jun 30 10:44:07 lda(testquota@mediaservice.pri): Debug: quota: Executing warning: quota-warning 80 testquota@mediaservice.pri
But, i have an error anyway. After is executed, i found an error on dovecot-err.log:
Jun 30 10:44:07 quota-warning: Error: /usr/bin/quota_warning.sh: line 4: /usr/lib/dovecot/dovecot-lda: Permission denied Jun 30 10:44:07 quota-warning: Error: cat: write error: Broken pipe Jun 30 10:44:07 master: Error: service(quota-warning): child 5627 returned error 126
That are the permissions of /usr/lib/dovecot-lda:
-rwsr-s--- 1 root nobody 23560 May 25 13:13 /usr/lib/dovecot/dovecot-lda
I report another time my dovecot -n, because i have made some changes..
dovecot -n # 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=95%% quota-warning 95 %u quota_warning2 = storage=80%% quota-warning 80 %u quota_warning3 = storage=70%% quota-warning 99 %u 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 unix_listener quota-warning { group = postfix mode = 0660 user = postfix } 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 }
Where is the problem?
Cordially,
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
Il 30/06/2011 10.51, Claudio Prono ha scritto:
Il 30/06/2011 6.56, Timo Sirainen ha scritto:
On Wed, 2011-06-29 at 18:02 +0200, Claudio Prono wrote: Are you sure you tested it correctly? It is executed only when a mail is delivered across the 79% -> 80% quota boundary.
I don't see any error in your config.
Ok, fixing some things, the script is going to be executed:
Jun 30 10:44:07 lda(testquota@mediaservice.pri): Debug: quota: Executing warning: quota-warning 80 testquota@mediaservice.pri
But, i have an error anyway. After is executed, i found an error on dovecot-err.log:
Jun 30 10:44:07 quota-warning: Error: /usr/bin/quota_warning.sh: line 4: /usr/lib/dovecot/dovecot-lda: Permission denied Jun 30 10:44:07 quota-warning: Error: cat: write error: Broken pipe Jun 30 10:44:07 master: Error: service(quota-warning): child 5627 returned error 126
That are the permissions of /usr/lib/dovecot-lda:
-rwsr-s--- 1 root nobody 23560 May 25 13:13 /usr/lib/dovecot/dovecot-lda
I report another time my dovecot -n, because i have made some changes..
dovecot -n # 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=95%% quota-warning 95 %u quota_warning2 = storage=80%% quota-warning 80 %u quota_warning3 = storage=70%% quota-warning 99 %u 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 unix_listener quota-warning { group = postfix mode = 0660 user = postfix } 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 }
Where is the problem?
Cordially,
Claudio Prono
Up...anyone have a similar problem?
Cordially,
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
participants (2)
-
Claudio Prono
-
Timo Sirainen