smtpd_client_restrictions 中的 postfix permit_sasl_authenticated 用于 587 上的提交

smtpd_client_restrictions 中的 postfix permit_sasl_authenticated 用于 587 上的提交

首先让我解释一下我的设置。我在 Debian Wheezy 上使用 postfix 2.9.6。我不允许在端口 25 上进行 AUTH,而是强制 MUA 使用端口 587 上的提交服务。Debian 在 master.cf 中附带以下配置(默认注释):

submission inet n       -       -       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING

我不明白为什么 permit_sasl_authenticated 位于 smtpd_client_restrictions 中。要允许中继访问,还必须将其添加到 smtpd_recipient_restrictions(或 smtpd_relay_restrictions,对于 postfix >= 2.10),要么在 main.cf 中,要么最好在 master.cf 中提交服务的附加覆盖中:

  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject

无论哪种方式都会导致两次身份验证检查,并且由于限制列表的延迟评估,两次检查都在 RCPT TO 阶段完成。如果没有中继访问,AUTH 客户端可以发送到 $mydestination,但端口 25 上的 MTA 无论如何都允许这样做。如果没有延迟评估,smtpd 在进行客户端检查时甚至还没有关于 AUTH 的信息。

在 smtpd_client_restrictions 中使用 permit_sasl_authenticated 是否有任何好处?它的用例是什么?

答案1

这只是一种覆盖 main.cf 的干净方法,因为通常不使用 main.cf 中的 smtpd_client_restrictions,这与默认设置为 smtpd_client_restrictions = permit 相同。

您可以通过覆盖 smtpd_recipient_restrictions 来实现相同的结果,正如您在问题中所说的那样,在这种情况下,您不需要 smtpd_client_restrictions 语句,也许这可能会带来不明显的性能优势,但如果 main.cf 中的 smtpd_recipient_restrictions 中存在与经过身份验证的客户端相关的其他限制,您还必须将它们添加到 master.cf 中,并记住让它们与未来的编辑保持同步。

此外,从 debian 打包程序的角度来看,覆盖 smtpd_client_restrictions 是一个更安全的选择,因为与 smtpd_recipient_restrictions 相比,它在 main.cf 中执行任何操作的可能性要小得多。

答案2

Postfix 开始支持混合限制列表。相关内容来自:Postfix 文档

Around the time that smtpd_delay_reject was introduced, Postfix was also changed 
to support mixed restriction lists that combine information about the client, 
helo, sender and recipient or etrn command. 

Mixing is needed for complex whitelisting policies. For example, in order to 
reject local sender addresses in mail from non-local clients, you need to be 
able to mix restrictions on client information with restrictions on sender 
information in the same restriction list. Without this ability, many per-user
access restrictions would be impossible to express. 

以上段落清楚地解释了为什么支持和要求混合限制。

就您而言,您不希望在经过身份验证后对(连接 IP/主机)实施任何限制client。假设您有这样的要求:“即使用户通过身份验证,他们也不应该能够发送电子邮件[email protected]”,那么您的smtpd_recipient_restrictions应该是

#/etc/postfix/main.cf
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/blocked_rcptto
             permit_sasl_authenticated
#/etc/postfix/blocked_rcptto
[email protected] REJECT No mails can reach this user from us

希望有所帮助。

答案3

回答我自己的问题,但我想一个可能的用例是这样的:

如果我稍后将 smtpd_client_restrictions 添加到 main.cf(默认情况下为空)以阻止垃圾邮件或其他内容,那么 master.cf 中已存在的提交覆盖将允许 AUTH 客户端跳过这些限制。不覆盖 smtpd_client_restrictions 可能会让某些人感到惊讶,因为 AUTH 客户端会受到垃圾邮件检查。当然,这可能不一定是坏事。

相关内容