我正在尝试配置配额。我想设置一个默认配额(比如 10GB)并允许垃圾桶 +100MB。我还需要能够为用户设置自定义配额。我的用户来自 LDAP/AD。
我可以设置默认配额并为用户定义自定义配额。这个功能很棒。
现在,我正在尝试为垃圾箱留出更多 100MB 的空间。
为了测试这一点,我向我的测试帐户发送了几封电子邮件,并为该帐户定义了一个较低的配额(10MB)。我将配额设为超过 140%。然后,我将所有邮件移至垃圾文件夹。
由于我没有清空垃圾箱,因此我仍然超出配额,但是因为我有一个quota_rule2,它允许垃圾箱多出100MB,所以我希望仍然可以接收该帐户的邮件。
当帐户收到新邮件时,邮件会被退回,因为帐户超出配额,但情况不应该如此,因为所有邮件都在垃圾箱中,而所有其他文件夹都是空的。
# 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