如何正确地将 Dovecot 配额状态传达给消息?

如何正确地将 Dovecot 配额状态传达给消息?

我有一个运行 Ubuntu 的测试虚拟机,其中安装了 postfix、dovecot 和几个用户,使用 Roundcube 设置通过 SMTP 在本地发送邮件。

如果我将用户 A 的 Dovecot 配额设置为 20K,然后从用户 B 向他们发送大约 18K 的邮件,这将使他们的配额达到 90%。我可以看到这一点doveadm quota get -u usera(事实上我看到 Roundcube 在其 UI 中显示了这一点)。

但他们没有收到即将达到配额的通知。我还在通知脚本中加入了一行日志,但没有看到任何日志被写入。

如果我随后从用户 B 发送另一封电子邮件以使用户 A 超出配额,则用户 B 不会收到通知,用户 A 也不会收到通知。但我希望他们会收到。 (编辑:根据@anx 评论,这不一定是正确的期望

当用户 A 超出配额时回复用户 B,他们会收到 Roundcube 发送的消息,提示无法执行该操作,因为没有可用磁盘空间。但邮件发送成功。

我如何才能让配额正确传达其状态?


我的userdb文件中有以下条目:

usera:::::::userdb_quota_rule=*:bytes=20K

输出自doveconf -n

auth_debug = yes
auth_username_format = %n
mail_debug = yes
mail_location = maildir:~/Maildir
mail_plugins = " quota"
mail_privileged_group = mail
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 {
  driver = pam
}
plugin {
  quota = count:User quota
  quota_grace = 10%%
  quota_max_mail_size = 50M
  quota_rule = *:storage=5G
  quota_rule2 = Trash:storage=+100M
  quota_vsizes = yes
  quota_warning = storage=95%% quota-warning 95 %u
  quota_warning2 = storage=80%% quota-warning 80 %u
  quota_warning4 = -storage=100%% quota-warning -100 %u
}
protocols = " imap"
service quota-status {
  client_limit = 1
  executable = quota-status -p postfix
  inet_listener {
    port = 12340
  }
}
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
    user = mail
  }
  user = dovecot
}
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  driver = passwd
  result_internalfail = return-fail
  result_success = continue-ok
}
userdb {
  args = /etc/dovecot/quotas
  driver = passwd-file
  result_internalfail = return-fail
  result_success = continue
}
protocol !indexer-worker {
  mail_vsize_bg_after_count = 100
}
protocol imap {
  mail_plugins = " quota imap_quota"
}

后缀postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 3.6
default_transport = error
home_mailbox = Maildir/
inet_interfaces = loopback-only
inet_protocols = all
mailbox_size_limit = 0
mydestination = $myhostname, localhost.localdomain, localhost
myhostname = tester.localdomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relay_transport = error
relayhost =
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:12340
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level = may

后缀postconf -M

smtp       inet  n       -       y       -       -       smtpd
pickup     unix  n       -       y       60      1       pickup
cleanup    unix  n       -       y       -       0       cleanup
qmgr       unix  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       y       1000?   1       tlsmgr
rewrite    unix  -       -       y       -       -       trivial-rewrite
bounce     unix  -       -       y       -       0       bounce
defer      unix  -       -       y       -       0       bounce
trace      unix  -       -       y       -       0       bounce
verify     unix  -       -       y       -       1       verify
flush      unix  n       -       y       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
proxywrite unix  -       -       n       -       1       proxymap
smtp       unix  -       -       y       -       -       smtp
relay      unix  -       -       y       -       -       smtp -o syslog_name=postfix/$service_name
showq      unix  n       -       y       -       -       showq
error      unix  -       -       y       -       -       error
retry      unix  -       -       y       -       -       error
discard    unix  -       -       y       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       y       -       -       lmtp
anvil      unix  -       -       y       -       1       anvil
scache     unix  -       -       y       -       1       scache
postlog    unix-dgram n  -       n       -       1       postlogd
maildrop   unix  -       n       n       -       -       pipe flags=DRXhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp       unix  -       n       n       -       -       pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail     unix  -       n       n       -       -       pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp      unix  -       n       n       -       -       pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n       n       -       2       pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman    unix  -       n       n       -       -       pipe flags=FRX user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}

日志

journalctl当 usera 超出配额时发送:

https://pastebin.com/NyRL40nV

并且当 usera 超出配额时 userb 发送给 usera(此时,userb收到消息):

https://pastebin.com/Z7mQVd9H

相关内容