exim 和 dovecot 用户超出配额:发送时被拒绝?

exim 和 dovecot 用户超出配额:发送时被拒绝?

我有一个 exim + dovecot 邮件服务器设置,并运行每个用户配额(通过 mysql 查找)。当目标本地邮箱超出配额时,服务器会拒绝来自非本地发件人的传入邮件。即使本地用户的邮箱超出配额,他也可以不受限制地发送邮件。

我希望在本地用户尝试发送电子邮件时检查配额并返回错误,例如“您的帐户已超出配额,请先删除一些邮件”。无论配额如何,都应该接受来自非本地发件人到本地邮箱的传入邮件。

有类似的配置描述“设置进出口银行”

acl_check_rcpt:
#...
  # Deny sending for local users if almost at quota
        # only run for local domains
  deny  sender_domains = +local_domains
        # list all addresses that are aliases
        # though people shouldn't be sending as
        # them, many scripts do
        !senders = ^postmaster@.*:\
                   ^root@.*:\
                   ^webmaster@.*:\
                   ^error-.*@.*:\
                   ^bounce-.*@.*
        # might need to exclude webmail server here
        # if it does not report the error message
        # note: squirrelmail tested ok for me
        hosts = +local_hosts
        # verify your email client expunges on emptying the trash
        message = You have too much email stored. Please delete some\n\
                  and empty the trash. Then you can send.
        log_message = $sender_address_local_part is over send quota
        condition = ${run{sudo -u root /etc/exim/check-sendquota.sh $sender_address_local_part}{no}{yes}}

它使用自定义脚本来检查邮箱大小 - 出于性能原因,我宁愿使用已经存在的配额文件/系统,但我无法找出正确的“条件”行。我无法从当前配置中看到 exim 实际检查邮箱大小的位置。当前配置包含以下内容:

exim4.conf:

local_delivery:
    driver = appendfile
    maildir_format
    user = mailserv
    group = mailserv
    mode = 0660
    mode_fail_narrower = false
    envelope_to_add = true
    return_path_add = true
    maildir_tag = ,S=$message_size
    quota_size_regex = ,S=(\d+)
    quota =  ${lookup mysql{SELECT CONCAT(quota, "M") FROM users WHERE account='${local_part}@${domain}'}{$value}{7M}}
    directory = ${lookup mysql{SELECT maildir FROM users WHERE account='${local_part}@${domain}'}}

dovecot.conf:

protocol imap {
    mail_plugins = quota imap_quota
}
plugin {
    quota = maildir:user
    quota_rule = *:storage=5GB
}

答案1

您需要向您的 acl_not_smtp acl 添加类似的配额检查,此 acl 用于本地用户/进程提交的所有非 smtp 邮件

http://www.exim.org/exim-html-current/doc/html/spec_html/ch40.html

相关内容