Dovecot domain quota

Filip Bartmann filbar at centrum.cz
Sun Oct 12 17:28:06 UTC 2014


I have dovecot version 2.1.7 and I have quota configured as:
-----------------------------------
dict {
  quota_domain = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
mail_plugins = quota
protocol imap {
  mail_plugins = quota quota imap_quota
}
plugin {
  quota = dict:domain:%d:proxy::quota_domain
  quota_rule = *:storage=1M
  quota_rule2 = Trash:storage=+100M
}
-----------------------------------
/etc/dovecot/dovecot-dict-sql.conf.ext:
-----------------------------------
map {
  pattern = priv/quota/storage
  table = quota_dict
  username_field = domain
  value_field = bytes
}
map {
  pattern = priv/quota/messages
  table = quota_dict
  username_field = domain
  value_field = messages
}
map {
  pattern = shared/expire/$user/$mailbox
  table = expires
  value_field = expire_stamp
  fields {
    username = $user
    mailbox = $mailbox
  }
}
-----------------------------------
But the problem is that quota table created as:
-----------------------------------
 CREATE TABLE `quota_dict` (
  `domain` varchar(255) NOT NULL,
  `bytes` bigint(20) NOT NULL DEFAULT '0',
  `messages` int(5) NOT NULL DEFAULT '0',
  PRIMARY KEY (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-----------------------------------
counts quota only for last user as defined /etc/dovecot/users or in database table.
So if I have in /etc/dovecot/users (the contents is from testing VPS):
-----------------------------------
test at debian.jd:{plain}radegast:8:8::/srv/mail/debian.jd/::userdb_quota_rule=*:storage=500k
bartmann at debian.jd:{plain}radegast:8:8::/srv/mail/debian.jd/::userdb_quota_rule=*:storage=500k
-----------------------------------
After running `doveadm quota recalc -A` I have in my db:
-----------------------------------
+-----------+--------+----------+
| domain    | bytes  | messages |
+-----------+--------+----------+
| debian.jd | 505758 |       81 |
+-----------+--------+----------+
-----------------------------------
whith is from account bartmann at debian.jd not both accounts at testing VPS domain debian.jd. The same is with quota enforcing - quota if enforced on the latter of the accounts in /etc/dovecot/users on testing machine or database in production machine.

What I do wrong?
Thanks
Filip Bartmann


More information about the dovecot mailing list