Hi.
I have Dovecot + Postfix + MySQL. Version of Postix: postfix_2.11.3-1ubuntu1_amd64 Version of Dovecot: 2.2.9 Operations system is: Ubuntu 15.04 x64
Postfix have patched (patch VDA - http://vda.sourceforge.net) for using with quota, it means that file "maildirsize" in mail directory already exists and changed when add/delete mail.
Quota for virtual box take in MySQL db.
##########################
Problem:
Dovecot does not send the information on ending the quota to user.
##########################
# dovecot -n # 2.2.9: /etc/dovecot/dovecot.conf # OS: Linux 2.6.32-042stab112.15 x86_64 Ubuntu 15.04 ext4 auth_debug = yes auth_default_realm = mydomain.ru auth_mechanisms = plain login auth_realms = znak-corp.ru debug_log_path = /var/log/dovecot-debug.log info_log_path = /var/log/dovecot.log lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes log_path = /var/log/dovecot.log login_greeting = Welcome to OOO "Corporation ZNAK" mail_gid = 1000 mail_location = maildir:/var/vmail/%n@%d mail_plugins = " quota" mail_uid = 1000 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 ihave passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { autocreate = INBOX autosubscribe = INBOX quota = maildir:User quota quota_rule = *:storage=10M #(this derective takes from mysql, but i wrote it just in case) quota_warning = storage=90%% quota-warning 90 %u quota_warning2 = storage=80%% quota-warning 80 %u } protocols = pop3 imap quota_full_tempfail = yes service auth { unix_listener /var/spool/postfix/private/dovecot-smtp-auth { group = postfix mode = 0666 user = postfix } unix_listener auth-userdb { group = vmail mode = 0600 user = vmail } } service imap-login { inet_listener imap { port = 143 } inet_listener imaps { port = 993 ssl = yes } } service pop3-login { inet_listener pop3 { port = 110 } inet_listener pop3s { port = 995 ssl = yes } } service quota-status { client_limit = 1 executable = /usr/lib/dovecot/quota-status -p postfix inet_listener { port = 12340 } } service quota-warning { executable = script /usr/local/bin/quota-warning.sh unix_listener quota-warning { user = vmail } user = vmail } ssl_cert =
##### quota-warning.sh #####
#!/bin/sh PERCENT=$1 USER=$2 cat << EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing" From: aaa@mydomain.ru Subject: Quota warning $PERCENT%
Your mailbox is now $PERCENT% full. Please remove unnecessary emails to avoid new mail loosing. EOF
##### Script has chmod 777 #####
root@mx:~# ls -la /usr/local/bin/quota-warning.sh -rwxrwxrwx 1 vmail vmail 285 Dec 17 11:09 /usr/local/bin/quota-warning.sh
Check the script this command is successful: # /usr/local/bin/quota-warning.sh 82 rrr@mydomain.ru
(a letter is sent to rrr@mydomain.ru that box is filled to 82%)
##### dovecot-sql.conf.ext #####
driver = mysql connect = host=localhost dbname=postfix user=postfix password=xxxxxxx
default_pass_scheme = MD5-CRYPT
user_query = SELECT '/var/vmail/%n@%d' as home, 'maildir:/var/vmail/%n@%d'as mail, 1000 AS uid, 1000 AS gid, concat('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'
password_query = SELECT username as user, password, '/var/vmail/%n@%d' as userdb_home, 'maildir:/var/vmail/%n@%d' as userdb_mail, 1000 as userdb_uid, 1000 as userdb_gid, concat('*:bytes=', quota) AS userdb_quota_rule FROM mailbox WHERE username = '%u' AND active = '1'
##### Check that the socket has a quota-warning: # lsof |grep quota-warning dovecot 17277 root 57u unix 0xffff8802d7845b80 0t0 62354154 /var/run/dovecot/quota-warning
##### Verify that the plugin quota is running I doing like this: # doveadm -D -v quota get -u rrr@mydomain.ru
Conclusion:
doveadm(root): Debug: Loading modules from directory: /usr/lib/dovecot/modules doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/lib10_quota_plugin.so doveadm(root): Debug: Loading modules from directory: /usr/lib/dovecot/modules/doveadm doveadm(root): Debug: Skipping module doveadm_acl_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_acl_plugin.so: undefined symbol: acl_user_module (this is usually intentional, so just ignore this message) doveadm(root): Debug: Skipping module doveadm_expire_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_expire_plugin.so: undefined symbol: expire_set_deinit (this is usually intentional, so just ignore this message) doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_quota_plugin.so doveadm(root): Debug: Module loaded: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_sieve_plugin.so doveadm(root): Debug: Skipping module doveadm_fts_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib20_doveadm_fts_plugin.so: undefined symbol: fts_backend_rescan (this is usually intentional, so just ignore this message) doveadm(rrr@mydomain.ru): Debug: Added userdb setting: mail=maildir:/var/vmail/rrr@mydomain.ru doveadm(rrr@mydomain.ru): Debug: Added userdb setting: plugin/quota_rule=*:bytes=10240000 doveadm(rrr@mydomain.ru): Debug: Effective uid=1000, gid=1000, home=/var/vmail/rrr@mydomain.ru doveadm(rrr@mydomain.ru): Debug: Quota root: name=User quota backend=maildir args= doveadm(rrr@mydomain.ru): Debug: Quota rule: root=User quota mailbox=* bytes=10240000 messages=0 doveadm(rrr@mydomain.ru): Debug: Quota rule: root=User quota mailbox=Trash bytes=+104857600 messages=0 doveadm(rrr@mydomain.ru): Debug: Quota rule: root=User quota mailbox=SPAM ignored doveadm(rrr@mydomain.ru): Debug: Quota warning: bytes=9216000 (90%) messages=0 reverse=no command=quota-warning 90 rrr@mydomain.ru doveadm(rrr@mydomain.ru): Debug: Quota warning: bytes=8192000 (80%) messages=0 reverse=no command=quota-warning 80 rrr@mydomain.ru doveadm(rrr@mydomain.ru): Debug: Quota grace: root=User quota bytes=1024000 (10%) doveadm(rrr@mydomain.ru): Debug: maildir++: root=/var/vmail/rrr@mydomain.ru, index=, indexpvt=, control=, inbox=/var/vmail/rrr@mydomain.ru, alt= Quota name Type Value Limit % User quota STORAGE 9008 10000 90 User quota MESSAGE 6 - 0
#####
Those plugin is successfully loaded and checked. When removing/receiving emails percent of employment, respectively changes. I read in dovecot manual, that the notification send only when the quota border crossing - then I tested like this: Clears the box up to 60% and then send letters, which occupy about 5% more of allocated quota. And so the lead up to 95%. But reports of ending the quota not be sent.
In what may be another problem?
Thanks.
Serge