Hello,

I've set up user quota and domain quota for dict SQL and all seems OK.

New mail for user increase the user quota and the domain quota.

Deleting email count down user quota and domain quota.

But in case of SQL failure, I'm trying to rebuild the user quota and domain quota with doveadm quota recalc.

The problem is that the command :

'doveadm quota recalc -u foo@bar' sets the domain quota only with user foo@bar

even when I try a domain quota recalc :

doveadm quota recalc -A

or

doveadm quota recalc -u *@bar (only one user is taken in account for the domain quota and not all the user).

The domain SQL database is broken with value of only one user for the whole domain quota.

So how to achieve rebuild domain quota correctly with doveadm ?

Thanks a lot.

Samuel.

Debian Jessie
Dovecot : 2.2.13
custom grsec kernel :Linux postfix 3.14.50-grsec-1

##########################
dovecot -n :

# 2.2.13: /etc/dovecot/dovecot.conf
# OS: Linux 3.14.50-grsec-1 x86_64 Debian 8.1 nfs4
auth_mechanisms = plain login
auth_verbose = yes
dict {
  quota = mysql:/etc/dovecot/dovecot-dict-sql-user.conf
  quota_domain = mysql:/etc/dovecot/dovecot-dict-sql-domain.conf
}
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
login_trusted_networks = XXXXXX/24
mail_location = maildir:/maildir/%d/%n/Maildir
mail_plugins = " quota"
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 {
  inbox = yes
  location =
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix =
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  quota = dict:user::proxy::quota
  quota2 = dict:domain:%d:proxy::quota_domain
  quota_grace = 10M
  quota_status_nouser = DUNNO
  quota_status_overquota = 552 5.2.2 Mailbox is full
  quota_status_success = DUNNO
  quota_warning = storage=100%% quota-warning 100 %u
  quota_warning2 = storage=95%% quota-warning 95 %u
  quota_warning3 = storage=80%% quota-warning 80 %u
  quota_warning4 = -storage=100%% quota-warning below %u
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
}
protocols = imap pop3 sieve lmtp
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
service dict {
  unix_listener dict {
    mode = 0666
    user = dovecot
  }
}
service quota-status {
  executable = quota-status -p postfix
  inet_listener {
    port = 12340
  }
}
service quota-warning {
  client_limit = 1
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
    mode = 0666
    user = vmail
  }
  user = vmail
}
ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocol lda {
  mail_plugins = " quota sieve"
}
protocol imap {
  mail_plugins = " quota imap_quota"
}

################
root@postfix:/etc/dovecot# cat dovecot-dict-sql-domain.conf |grep -v "#"

connect = host=XXXXX dbname=mail user=test password=test

map {
  pattern = priv/quota/storage
  table = domains
  username_field = domain
  value_field = quota
}
map {
  pattern = priv/quota/messages
  table = domains
  username_field = domain
  value_field = quota_messages
}

map {
  pattern = shared/expire/$user/$mailbox
  table = expires
  value_field = expire_stamp

  fields {
    username = $user
    mailbox = $mailbox
  }
}

###################

root@postfix:/etc/dovecot# cat dovecot-dict-sql-user.conf |grep -v "#"

connect = host=XXXXXXXX dbname=mail user=test password=test

map {
  pattern = priv/quota/storage
  table = quota
  username_field = email
  value_field = bytes
}
map {
  pattern = priv/quota/messages
  table = quota
  username_field = email
  value_field = messages
}

map {
  pattern = shared/expire/$user/$mailbox
  table = expires
  value_field = expire_stamp

  fields {
    username = $user
    mailbox = $mailbox
  }
}
############################

Reply via email to