1

Topic: User mailbox quotas do not update after doveadm-expunge

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.8.3 with iRedAdminPro 1.8.1
- Linux/BSD distribution name and version: Ubuntu 12.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? Yes
- Related log if you're reporting an issue:
====

I don't know if this is a problem with iRedAdminPro admin panel, or with the actual mail server, so forgive me if I post this to the wrong section of the forum.

I have some users with large amounts of mail in the Sent, Trash and Junk mailbox folders and they need to be expunged. They are using Thunderbird, and do not have the "Expunge Inbox on exit" setting set in their client, and I cannot easiliy control this setting for each one of them (and I am not sure if it actually handles Trash and Junk as well?)

I can however, easily expunge mails centrally from the server with commands such as:

doveadm expunge -A mailbox Sent savedbefore 60d
doveadm expunge -A mailbox Junk savedbefore 60d
doveadm expunge -A mailbox Trash savedbefore 60d

which does this for all users, and that is working completely fine.

However, the iRedAdminPro admin panel quota display still shows exactly the same figures as before that expunge. Restarted the server, no change still.
How do I rerfresh it? Why doesn't it do it automatically? Any better way to do that expunge?

Peter

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: User mailbox quotas do not update after doveadm-expunge

we have a document for you:
http://www.iredmail.org/docs/recalculat … quota.html

3

Re: User mailbox quotas do not update after doveadm-expunge

Thank you for the link to the doc.
The first method described in the doc (doveadm quota) does not work, it throws
an error:

   "Fatal: Unknown command 'quota', but plugin quota exists. Try to set mail_plugins=quota"

with the 2nd method (delete records from the database table used_quota) is more successful.

However, now it shows the used_quota as zero, until the user logs into his e-mail. That's not ideal either - I cannot control when they will log in, and so it reports a false figure of zero for maybe a long time.

I would like to have a simple way that actually shows the present quota usage. The "doveadm quota" seems to be better, but I don't find a way on how to make it work.In dovecot.conf there is already lines with "mail_plugins = quota". If anything is known on that already please let me know.

4

Re: User mailbox quotas do not update after doveadm-expunge

pschulz wrote:

However, now it shows the used_quota as zero, until the user logs into his e-mail. That's not ideal either - I cannot control when they will log in, and so it reports a false figure of zero for maybe a long time.

May i know how you use the records in `used_quota` table? Why is it so important?

pschulz wrote:

I would like to have a simple way that actually shows the present quota usage. The "doveadm quota" seems to be better, but I don't find a way on how to make it work.In dovecot.conf there is already lines with "mail_plugins = quota".

Please show us output of command "dovecot -n".

5

Re: User mailbox quotas do not update after doveadm-expunge

It's not about how I use these records, it is how the mail system, and the Thunderbird clients, use this.
When a user is above quota (and that "above quota" decision comes from that figure in the used_quota table), then the user cannot send and receive mail. And it is a complete pain to get a user back down - you can literally delete ALL the mails on a Thunderbird client, and still get "mailbox is 100% full". No amount of restart and compacting folders help.
So the solution is to increase the quota of the user ... which soon ends up everybody having monstruous quotas. When I now used your suggestion above from the doc (deleting the records in used_quota table) the quota percentages dropped from 95% down to 10% for many users.

That's the background. I am not saying it's a bug in iRedMail, I may have outdated Thunderbird clients, too, etc, I I just ask for data if that is a known problem in the dovecot quota system.

Regarding the dovecot config - it is the default config from iRedMail.

Here is the output of dovecot -n

# 2.0.19: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-38-generic-pae i686 Ubuntu 12.04.4 LTS
auth_mechanisms = PLAIN LOGIN
default_process_limit = 1024
dict {
  acl = mysql:/etc/dovecot/dovecot-share-folder.conf
  expire = db:/var/lib/dovecot/expire/expire.db
  quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
}
disable_plaintext_auth = no
first_valid_uid = 1001
last_valid_uid = 1001
listen = *
log_path = /var/log/dovecot.log
mail_gid = 1001
mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/
mail_uid = 1001
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
namespace {
  inbox = yes
  location =
  prefix =
  separator = /
  type = private
}
namespace {
  list = children
  location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
  prefix = Shared/%%u/
  separator = /
  subscriptions = yes
  type = shared
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf
  driver = ldap
}
plugin {
  acl = vfile
  acl_shared_dict = proxy::acl
  auth_socket_path = /var/run/dovecot/auth-master
  autocreate = INBOX
  autocreate2 = Sent
  autocreate3 = Trash
  autocreate4 = Drafts
  autocreate5 = Junk
  autosubscribe = INBOX
  autosubscribe2 = Sent
  autosubscribe3 = Trash
  autosubscribe4 = Drafts
  autosubscribe5 = Junk
  expire = Trash 7 Trash/* 7 Junk 30
  expire_dict = proxy::expire
  quota = dict:user::proxy::quotadict
  quota_rule = *:storage=1G
  quota_warning = storage=85%% quota-warning 85 %u
  quota_warning2 = storage=90%% quota-warning 90 %u
  quota_warning3 = storage=95%% quota-warning 95 %u
  sieve = /%Lh/sieve/dovecot.sieve
  sieve_dir = /%Lh/sieve
  sieve_global_dir = /maildisk/sieve
  sieve_global_path = /maildisk/sieve/dovecot.sieve
}
protocols = pop3 imap sieve
service auth {
  unix_listener /var/spool/postfix/dovecot-auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-master {
    group = vmail
    mode = 0666
    user = vmail
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service dict {
  unix_listener dict {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service imap-login {
  process_limit = 1024
  service_count = 1
}
service pop3-login {
  process_limit = 1024
  service_count = 1
}
service quota-warning {
  executable = script /usr/local/bin/dovecot-quota-warning.sh
  unix_listener quota-warning {
    group = vmail
    mode = 0660
    user = vmail
  }
}
ssl_cert = </etc/ssl/certs/iRedMail_CA.pem
ssl_key = </etc/ssl/private/iRedMail.key
userdb {
  args = /etc/dovecot/dovecot-ldap.conf
  driver = ldap
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  lda_mailbox_autocreate = yes
  log_path = /var/log/sieve.log
  mail_plugins = quota sieve autocreate
  postmaster_address = root
}
protocol imap {
  imap_client_workarounds = tb-extra-mailbox-sep
  mail_max_userip_connections = 100
  mail_plugins = quota imap_quota autocreate
}
protocol pop3 {
  mail_max_userip_connections = 100
  mail_plugins = quota
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
  pop3_uidl_format = %08Xu%08Xv
}

6

Re: User mailbox quotas do not update after doveadm-expunge

If there's no record for user `user@domain.com` in `used_quota` table, when `user@domain.com` logs in via IMAP/POP3, Dovecot will create a new record with correct quota info for this user. So it won't show you mailbox over quota.

I checked your "dovecot -n", you should add one line at the beginning of dovecot.conf, then restart dovecot service. After this, try again with `doveadm quota` command, it should work for you now.

mail_plugins = quota

Note: Do NOT remove 'quota' in other `{}` setting blocks (e.g. protocol pop3 {}).

7

Re: User mailbox quotas do not update after doveadm-expunge

Thank you - this worked.