[Dovecot] Postfixadmin/MySQL/Dovecot 2 and quota

Matt dovecot at mygaia.org
Sun Sep 8 18:32:52 EEST 2013


Hi Daniel,

Thanks for your quick feedback.

I've installed the Quota Display Extension in my Thunderbird (thanks for
the plugin) and the progress bar remains desperately empty but it works
with my Gmail account.

Sorry, I forgot the send my docevot -n previously:
# 2.0.9: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-358.el6.x86_64 x86_64 CentOS release 6.4 (Final) ext4
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
dict {
  quotadict = mysql:/etc/dovecot/dovecot-dict-quota.conf
}
mail_debug = yes
mail_location = maildir:/var/mail/vmail/%d/%n
mail_plugins = " quota"
mail_privileged_group = mail
mbox_write_locks = fcntl
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  quota = dict:user::proxy::quotadict
  quota_rule2 = Trash:storage=+10%%
}
postmaster_address = test at test.com
quota_full_tempfail = yes
service dict {
  unix_listener dict {
    group = mail
    mode = 0660
    user = vmail
  }
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
}
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
    user = vmail
  }
  user = dovecot
}
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vmail/%d/%n
  driver = static
}
protocol lda {
  mail_plugins = " quota quota"
}
protocol imap {
  mail_plugins = " quota imap_quota"
}
protocol pop3 {
  mail_plugins = " quota quota"
}


And here an extract of the log:
Sep  8 23:22:54 my_server dovecot: auth: Debug: auth client connected
(pid=12146)
Sep  8 23:22:54 my_server dovecot: auth: Debug: client in:
AUTH#0111#011PLAIN#011service=imap#011secured#011lip=::1#011rip=::1#011lport=993#011rport=39055#011resp=<hidden>
Sep  8 23:22:54 my_server dovecot: auth: Debug: sql(test at test.com,::1):
query: SELECT username AS user, password, CONCAT('*:storage=',
CAST(quota AS CHAR), 'b') AS quota_rule FROM mailbox WHERE username =
'test at test.com' AND active='1'
Sep  8 23:22:54 my_server dovecot: auth: Debug: client out:
OK#0111#011user=test at test.com#011quota_rule=*:storage=30720000b
Sep  8 23:22:54 my_server dovecot: auth: Debug: master in:
REQUEST#011317980673#01112146#0111#0110725da6b7ab19fc4fac7f0cf54764b18
Sep  8 23:22:54 my_server dovecot: auth: Debug: master out:
USER#011317980673#011test at test.com#011uid=5000#011gid=5000#011home=/var/mail/vmail/test.com/test
Sep  8 23:22:54 my_server dovecot: imap-login: Login:
user=<test at test.com>, method=PLAIN, rip=::1, lip=::1, mpid=12147, TLS
Sep  8 23:22:54 my_server dovecot: imap: Debug: Loading modules from
directory: /usr/lib64/dovecot
Sep  8 23:22:54 my_server dovecot: imap: Debug: Module loaded:
/usr/lib64/dovecot/lib10_quota_plugin.so
Sep  8 23:22:54 my_server dovecot: imap: Debug: Module loaded:
/usr/lib64/dovecot/lib11_imap_quota_plugin.so
Sep  8 23:22:54 my_server dovecot: imap(test at test.com): Debug: Effective
uid=5000, gid=5000, home=/var/mail/vmail/test.com/test
Sep  8 23:22:54 my_server dovecot: imap(test at test.com): Debug: Quota
root: name=user backend=dict args=:proxy::quotadict
Sep  8 23:22:54 my_server dovecot: imap(test at test.com): Debug: dict
quota: user=test at test.com, uri=proxy::quotadict, noenforcing=0
Sep  8 23:22:54 my_server dovecot: imap(test at test.com): Debug:
maildir++: root=/var/mail/vmail/test.com/test, index=, control=,
inbox=/var/mail/vmail/test.com/test
Sep  8 23:22:54 my_server dovecot: dict: mysql: Connected to localhost
(postfix)
Sep  8 23:22:54 my_server dovecot: imap(test at ecritel.cn): Disconnected:
Logged out bytes=70/529
Sep  8 23:22:57 my_server dovecot: auth: Debug: auth client connected
(pid=12150)
Sep  8 23:22:57 my_server dovecot: auth: Debug: client in:
AUTH#0111#011PLAIN#011service=imap#011secured#011lip=::1#011rip=::1#011lport=993#011rport=39056#011resp=<hidden>
Sep  8 23:22:57 my_server dovecot: auth: Debug: sql(test at test.com,::1):
query: SELECT username AS user, password, CONCAT('*:storage=',
CAST(quota AS CHAR), 'b') AS quota_rule FROM mailbox WHERE username =
'test at test.com' AND active='1'
Sep  8 23:22:57 my_server dovecot: auth: Debug: client out:
OK#0111#011user=test at test.com#011quota_rule=*:storage=30720000b
Sep  8 23:22:57 my_server dovecot: auth: Debug: master in:
REQUEST#0111253179393#01112150#0111#0117aeb8af5e5292a96188f20b12f455c7c
Sep  8 23:22:57 my_server dovecot: auth: Debug: master out:
USER#0111253179393#011test at test.com#011uid=5000#011gid=5000#011home=/var/mail/vmail/test.com/test
Sep  8 23:22:57 my_server dovecot: imap-login: Login:
user=<test at test.com>, method=PLAIN, rip=::1, lip=::1, mpid=12152, TLS
Sep  8 23:22:57 my_server dovecot: imap: Debug: Loading modules from
directory: /usr/lib64/dovecot
Sep  8 23:22:57 my_server dovecot: imap: Debug: Module loaded:
/usr/lib64/dovecot/lib10_quota_plugin.so
Sep  8 23:22:57 my_server dovecot: imap: Debug: Module loaded:
/usr/lib64/dovecot/lib11_imap_quota_plugin.so
Sep  8 23:22:57 my_server dovecot: imap(test at test.com): Debug: Effective
uid=5000, gid=5000, home=/var/mail/vmail/test.com/test
Sep  8 23:22:57 my_server dovecot: imap(test at test.com): Debug: Quota
root: name=user backend=dict args=:proxy::quotadict
Sep  8 23:22:57 my_server dovecot: imap(test at test.com): Debug: dict
quota: user=test at test.com, uri=proxy::quotadict, noenforcing=0
Sep  8 23:22:57 my_server dovecot: imap(test at test.com): Debug:
maildir++: root=/var/mail/vmail/test.com/test, index=, control=,
inbox=/var/mail/vmail/test.com/test
Sep  8 23:22:57 my_server dovecot: imap(test at test.com): Disconnected:
Logged out bytes=305/1700
Sep  8 23:22:57 my_server dovecot: auth: Debug: auth client connected
(pid=12153)
Sep  8 23:22:57 my_server dovecot: auth: Debug: client in:
AUTH#0111#011PLAIN#011service=imap#011secured#011lip=::1#011rip=::1#011lport=993#011rport=39057#011resp=<hidden>
Sep  8 23:22:57 my_server dovecot: auth: Debug: sql(test at test.com,::1):
query: SELECT username AS user, password, CONCAT('*:storage=',
CAST(quota AS CHAR), 'b') AS quota_rule FROM mailbox WHERE username =
'test.com' AND active='1'
[...]

About quota_rule, I thought that quota_rule gotten from the MySQL query
had its importance... that's why I've kept quota_rule2, etc...

Matt
> Hi Matt,
>
> sounds like the quota is correctly updated in MySQL, but your
> roundcube isn't able to fetch quota information via IMAP.
>
> Can you reproduce this via telnet or another IMAP client (e.g.
> Thunderbird with Quota Display Extension)?
>
> Can you be so kind and post your whole dovecot config (doveconf -n)?
>
> Are there any error messages in your dovecot logs regarding quota?
>
> I think that quota_rule, quota_rule2, quota_rule3 etc. are applied in
> sequence, so if you only need one quota_rule, then it should be named
> quota_rule.
>
> Regards
> Daniel
>
>
>
> Matt <dovecot at mygaia.org> schrieb:
>
>     Hi all,
>
>     I'm setting up a new email server based on the softwares list below:
>
>     * Postfix
>     * Dovecot 2.0.9
>     * MySQL
>     * Postfixadmin 2.3.6
>
>     My current problem is I'm unsure whether quota feature is well
>     configured or not.
>     In order to test and validate, I use Roundcubemail GUI which provides
>     percentage of the space used by the mailbox (quota should be applied per
>     mailbox).
>
>     Here, my dovecot configuration:
>     dovecot.conf:
>     dict {
>     quotadict = mysql:/etc/dovecot/dovecot-dict-quota.conf
>     }
>
>     dovecot-dict-quota.conf:
>     connect = host=localhost dbname=postfix user=postfix password=postfix
>     map {
>     pattern = priv/quota/storage
>     table = quota2
>     username_field = username
>     value_field = bytes
>     }
>     map {
>     pattern = priv/quota/messages
>     table = quota2
>     username_field = username
>     value_field = messages
>     }
>
>     dovecot-sql.conf.ext:
>     driver = mysql
>     connect = host=localhost dbname=postfix user=postfix password=postfix
>     default_pass_scheme = PLAIN-MD5
>     password_query = SELECT username AS user, password, \
>     CONCAT('*:storage=', CAST(quota AS CHAR), 'b') AS quota_rule \
>     FROM mailbox WHERE username = '%u' AND active='1'
>     user_query = SELECT maildir, 89 AS uid, 12 AS gid, \
>     concat('dict:storage=',floor(quota/1000),'::proxy::quotadict') AS
>     quota, \
>     CONCAT('*:storage=', CAST(quota AS CHAR), 'b') AS quota_rule \
>     FROM mailbox WHERE username = '%u' AND active='1'
>
>     conf.d/90-quota.conf:
>     plugin {
>     quota = dict:user::proxy::quotadict
>     quota_rule2 = Trash:storage=+10%%
>     }
>
>     conf.d/20-imap.conf:
>     protocol imap {
>     mail_plugins = $mail_plugins imap_quota
>     }
>
>     When I check postfixadmin GUI, I can see that quota in realtime in
>     quota2 table, no problem.
>
>     But Roundcubemail cannot ge
>      t this
>     information and shows a unknown quota.
>     If I add this line:
>     quota_rule = *:storage=1G
>     in conf.d/90-quota.conf file, it works, I mean roundcubemail gets and
>     shows information (but not the one stored in db of course).
>
>     I think I'm close to the right configuration but I need your help to
>     complete this setup.
>
>     Thank you in advance for your help.
>
>     Best,
>     Matt
>



More information about the dovecot mailing list