我管理基于 Postfix 的电子邮件服务器,该服务器包含过去和当前电子邮件的副本。一些用户已经离开,但他们的电子邮件历史需要保留和访问。在目前的情况下,发送给那些已经离开的用户的任何电子邮件仍会正常收到。我想阻止发送到这些帐户的任何新电子邮件。我可以看到一种使用 smtpd_restriction_classes 的方法。我是否必须将所有用户都包含在 check_recipient_access 哈希表中,还是可以只包含我想阻止的那些帐户?
smtpd_restriction_classes = restrictive, permissive
restrictive = DEFER
permissive = permit
check_recipient_access = hash:/etc/postfix/recipient_access
/etc/postfix/recipient_access:
joe@example.com restrictive
mary@example.com restrictive
Run Code Online (Sandbox Code Playgroud)
似乎这种阻止是永久性的。如果使用DEFER,Postfix 将发送临时错误代码450,导致发送 MTA 稍后重试。来自RFC 5321、4.2.1和 4.2.2:
4yz瞬态否定完成回复命令未被接受,请求的操作没有发生。但是,错误情况是暂时的,可能会再次请求操作。发送方应返回到命令序列的开头(如果有)。当两个不同的站点(接收方和发送方 SMTP 代理)必须就解释达成一致时,很难为“瞬态”赋予含义。此类别中的每个回复可能具有不同的时间值,但 SMTP 客户端应该再试一次。
Run Code Online (Sandbox Code Playgroud)450 Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily blocked for policy reasons) 550 Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)
我会使用错误代码550,默认为永久REJECT存在。access_map_reject_code= 554
然后,check_recipient_access不能单独工作,而是在smtpd_recipient_restrictions.
smtpd_recipient_restrictions =
permit_mynetworks,
. . .
check_recipient_access hash:/etc/postfix/recipient_access,
. . .
Run Code Online (Sandbox Code Playgroud)
除了错误代码,您还可以使用自定义的人类可读的信息性错误消息:
/etc/postfix/recipient_access:
joe@example.com 550 Mailbox doesn't exist. See https://example.com/contact
mary@example.com 550 Mary no longer works at Example Ltd. Contact Jason, instead.
Run Code Online (Sandbox Code Playgroud)
由于它是一个hash:数据库,因此请始终记住postmap /etc/postfix/recipient_access.
| 归档时间: |
|
| 查看次数: |
3136 次 |
| 最近记录: |