I'm trying to configure quotas. I want to set a default quota (say 10GB) and allow +100MB for the trash. I also need to be able to set a custom quota for an user. My users come from LDAP/AD.
I'm able to set the default quota and defining a custom one for an user. This work great.
Now, I'm trying to allow 100MB more for the trash.
To test that, I sent a couples emails to my test account and defined a low quota (10MB) for this account. I made my quota over 140%. I then moved all my mails to the trash folder.
I'm still over quota because I didn't emptied the trash, but because I have a quota_rule2 that say allow 100MB more for the trash, I expect to be able to still receive mail for this account.
When the account receive a new mail, it bounces because the account is over quota, but it shouldn't because all mails are in the trash and all the others folders are empty.
# doveconf -n
# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.15.0-43-generic x86_64 Ubuntu 18.04.1 LTS
auth_default_realm = example.com
doveadm_password = # hidden, use -P to show it
doveadm_port = 53683
first_valid_uid = 200
last_valid_uid = 200
mail_attachment_dir = /var/vmail/attachments
mail_attachment_hash = %{sha1}.%{size}
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_plugins = " notify replication zlib quota"
mail_privileged_group = mail
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 index ihave duplicate mime foreverypart extracttext
mdbox_rotate_interval = 1 days
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = /etc/dovecot/dovecot-ldap.conf.ext
driver = ldap
}
plugin {
mail_replica = tcp:mail2.example.com:53683
quota = count:User quota
quota_grace = 10%%
quota_rule = *:storage=10G
quota_rule2 = Trash:storage=+100M
quota_vsizes = yes
quota_warning = storage=95%% quota-warning 95 %u
quota_warning2 = storage=80%% quota-warning 80 %u
sieve = /var/vmail/%d/%n/.dovecot.sieve
sieve_before = /var/vmail/sieve/before.sieve
sieve_default = /var/vmail/sieve/default.sieve
sieve_global = /var/vmail/sieve/global
zlib_save = lz4
}
protocols = " imap lmtp sieve"
service aggregator {
fifo_listener replication-notify-fifo {
user = vmail
}
unix_listener replication-notify {
user = vmail
}
}
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0666
}
}
service doveadm {
inet_listener {
port = 53683
ssl = no
}
}
service imap-login {
inet_listener imap {
port = 0
}
process_min_avail = 10
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0660
user = postfix
}
}
service quota-warning {
executable = script /usr/local/bin/quota-warning.sh
unix_listener quota-warning {
user = vmail
}
user = dovecot
}
service replicator {
process_min_avail = 1
}
ssl = required
ssl_cert = </etc/ssl/example.com.crtbundle
ssl_client_ca_dir = /etc/ssl/certs
ssl_key = # hidden, use -P to show it
userdb {
args = /etc/dovecot/dovecot-ldap.conf.ext
driver = ldap
}
protocol lda {
mail_plugins = " notify replication zlib quota sieve"
postmaster_address = [email protected]
}
protocol imap {
mail_plugins = " notify replication zlib quota imap_quota"
}
protocol lmtp {
mail_plugins = " notify replication zlib quota sieve"
postmaster_address = [email protected]
}
# cat dovecot-ldap.conf.ext
uris = (redacted)
dn = (redacted)
dnpass = (redacted)
auth_bind = yes
base = (redacted)
scope = subtree
deref = never
user_filter = (&(mail=%u)(&(|(objectclass=person))(!(UserAccountControl:1.2.840.113556.1.4.803:=2))))
pass_filter = (&(mail=%u)(&(|(objectclass=person))(!(UserAccountControl:1.2.840.113556.1.4.803:=2))))
iterate_attrs = mail=user # Used primarily by "doveadm" needed to users
iterate_filter = (objectclass=person)
user_attrs = \
=quota_rule=*:storage=%{ldap:division:10G}, \
=quota_rule2=Trash:storage=+100M, \
=home=/var/vmail/%d/%{ldap:sAMAccountName}, \
=mail=mdbox:/var/vmail/%d/%{ldap:sAMAccountName}/mdbox, \
=uid=200, \
=gid=200
0 Answers