postfix-policyd-spf-python-欺骗保护-spf 检查失败但未采取任何措施-为什么?

postfix-policyd-spf-python-欺骗保护-spf 检查失败但未采取任何措施-为什么?

我已经根据文档 安装postfix-policyd-spf-python并配置了集成。postfix

这是我的policyd-spf.conf配置文件:

debugLevel = 1 
TestOnly = 0

HELO_reject = SPF_Not_Pass
Mail_From_reject = Fail

PermError_reject = False
TempError_Defer = False

skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1

来自国外邮件服务器的邮件会被正确检查和标记。但当我检查防欺骗保护时,邮件却莫名其妙地通过了:

$ telnet mail.example.com 25

Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix
helo asd.somedomain.com
250 mail.example.com
mail from: [email protected]
250 2.1.0 Ok
rcpt to: [email protected]
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
from: "ME" <[email protected]>
to: "test" <[email protected]>
subject: test

asdasd klajsdlaksjd 

thanks!
.

250 2.0.0 Ok: queued as 8C9EC1260E1

在我看来,这封电子邮件不应该被发送。

以下是调试输出postfix-policyd-spf-python

policyd-spf[34414]: Found the end of entry
policyd-spf[34414]: Config: {'debugLevel': 5, 'HELO_reject': 'SPF_Not_Pass', 'Mail_From_reject': 'Fail', 'PermError_reject': 'False', 'TempError_Defer': 'False', 'skip_addresses': '127.0.0.0/8,::ffff:127.0.0.0/104,::1', 'TestOnly': 0, 'SPF_Enhanced_Status_Codes': 'Yes', 'Header_Type': 'SPF', 'Hide_Receiver': 'Yes', 'Authserv_Id': 'mail.example.com', 'Lookup_Time': 20, 'Whitelist_Lookup_Time': 10, 'Void_Limit': 2, 'Reason_Message': 'Message {rejectdefer} due to: {spf}. Please see {url}', 'No_Mail': False, 'Mock': False}
policyd-spf[34414]: Cached data for this instance: []

policyd-spf[34414]: skip_addresses enabled.

policyd-spf[34414]: _get_resultcodes: scope: helo, Reject_Not_Pass_Domains: None, helo_policy: SPF_Not_Pass, mfrom_policy: Fail
policyd-spf[34414]: Scope helo unused results: ['Pass', 'None', 'Temperror', 'Permerror']
policyd-spf[34414]: helo policy true results: actions: {'defer': [], 'reject': ['Fail', 'Softfail', 'Neutral'], 'prepend': ['Pass', 'None', 'Temperror', 'Permerror']} local {'local_helo': False, 'local_mfrom': False}
policyd-spf[34414]: spfcheck: pyspf result: "['None', '', 'helo']"
policyd-spf[34414]: None; identity=no SPF record; client-ip=xx.xx.xx.xx; helo=asd.somedomain.com; [email protected]; receiver=<UNKNOWN> 


policyd-spf[34414]: _get_resultcodes: scope: mfrom, Reject_Not_Pass_Domains: None, helo_policy: SPF_Not_Pass, mfrom_policy: Fail
policyd-spf[34414]: Scope mfrom unused results: ['Pass', 'None', 'Neutral', 'Softfail', 'Temperror', 'Permerror']
policyd-spf[34414]: mfrom policy true results: actions: {'defer': [], 'reject': ['Fail'], 'prepend': ['Pass', 'None', 'Neutral', 'Softfail', 'Temperror', 'Permerror']} local {'local_helo': False, 'local_mfrom': False}
policyd-spf[34414]: spfcheck: pyspf result: "['Fail', 'SPF fail - not authorized', 'mailfrom']"

policyd-spf[34414]: Fail; identity=mailfrom; client-ip=xx.xx.xx.xx; helo=asd.somedomain.com; [email protected]; receiver=<UNKNOWN> 


policyd-spf[34414]: Action: None: Text: None Reject action: 550 5.7.23

从日志文件中我们可以看到,SPF 检查确实返回:

spfcheck: pyspf result: "['Fail', 'SPF fail - not authorized', 'mailfrom']"

然而,最后一行是这样的:

Action: None: Text: None Reject action: 550 5.7.23

为什么会这样?为什么Action: None?在我看来,该电子邮件应该被拒绝,服务器不应接受。我做错了什么?

答案1

环境

TestOnly = 1

解决问题!

答案2

您在测试期间遇到的问题可能是由于以下原因而从本地主机检查是否允许skip_addressses

skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1

相关内容