SPF 应该添加到 smtpd_sender_restrictions 还是 smtpd_recipient_restrictions?

kit*_*irl 3 postfix

我在 centos 7 中使用 postfix+dovecot。
我使用

postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination,reject_invalid_hostname,reject_non_fqdn_hostname,reject_non_fqdn_sender,reject_non_fqdn_recipient'
postconf -e 'smtpd_sender_restrictions =reject_non_fqdn_sender,reject_unknown_sender_domain,reject_rbl_client sbl-xbl.spamhaus.org,check_policy_service unix:private/policy'
postconf -e 'policy_time_limit = 3600s'
postconf -e 'policy-spf_time_limit = 3600'  
Run Code Online (Sandbox Code Playgroud)

设置后缀 main.cf。
公告check_policy_service unix:private/policysmtpd_sender_restrictions,这意味着我证明我是正确使用邮件域来发送邮件。
我认为我postconf是完美的,但有人说smtpd_sender_restrictions应该在smtpd_recipient_restrictions
SPF 应该添加到 smtpd_sender_restrictions 还是 smtpd_recipient_restrictions?

Mic*_*ton 5

选项将在smtpd_sender_restrictions或 中正常运行smtpd_recipient_restrictions

您应该添加它们的原因smtpd_recipient_restrictions与 SMTP 协议本身有关。在协议的每个阶段,发送者首先使用 EHLO 或 HELO 标识自己,然后使用 MAIL FROM 发送发送者的电子邮件地址,然后使用 RCPT TO 发送接收者的地址。在每个阶段,Postfix 都可以采取行动,例如使用smtpd_helo_restrictions,smtpd_sender_restrictionssmtpd_recipient_restrictions。但是,如果您在 MAIL FROM 之后拒绝收到的邮件,则您不知道预期的收件人是谁。如果邮件是合法的并且收件人抱怨,您将无法在日志中找到它们。通过等到收件人地址发送之后,您可以记录有关消息的所有可用元数据,以备以后需要查找。