【问题标题】:What effect to SPF-record qualifiers have if they are included into another SPF record, if the parent record is stricter than the child?如果父记录比子记录更严格,如果将它们包含到另一个 SPF 记录中,对 SPF 记录限定符有什么影响?
【发布时间】:2014-02-08 16:51:22
【问题描述】:

我想对未在我的域的 SPF 记录中明确列出的所有电子邮件来源设置严格的 FAIL 限定符。

这可以通过以下记录简单地完成(-all 表示不应接受所有其他来源)

mydomain.com. IN TXT "v=spf1 ip4:my-ip-address/32 -all"

现在我的问题是我还想将我的电子邮件提供商 (mailgun.com) 以及谷歌应用列入白名单,所以我创建了以下记录:

mydomain.com. IN TXT "v=spf1 include:mailgun.org include:_spf.google.com ip4:my-ip-address/32 -all"

现在mailgun.com 的 SPF 记录(在谷歌的情况下同样适用)解析为:

mailgun.org.        3600    IN  TXT "v=spf1 ip4:173.193.210.32/27 ip4:50.23.218.192/27 ip4:174.37.226.64/27 ip4:208.43.239.136/30 ip4:50.23.215.176/30 ip4:184.173.105.0/24 ip4:184.173.153.0/24 ip4:209.61.151.0/24 ip4:166.78.68.0/22 ip4:198.61.254.0/23 ip4:192.237.158.0/23 " "~all"

现在有趣的是,他们将软失败限定符 "~all" 放在他们的 spf 记录中。

维基百科对包含指令的描述如下:

如果包含的(用词不当)策略通过了此机制的测试 火柴。这通常用于包含多个策略 互联网服务提供商。

我的解释是未知发件人被包含的记录限定为SOFT FAIL,因此传递为SOFT FAIL,因为它们包含在根记录中。即使根记录在所有未包含的来源上都放置了FAIL

因此包含的记录有效地使根记录的 FAIL 限定符无效。因此,最严格的记录取消了对未知来源的整体限定。

我的这个假设是正确的吗?如果不是,在给出的示例中,未知发件人如何合格?

【问题讨论】:

    标签: web-services email sendmail spf


    【解决方案1】:

    RFC 的第 5.2 节描述了该行为

       Whether this mechanism matches, does not match, or throws an
       exception depends on the result of the recursive evaluation of
       check_host():
    
       +---------------------------------+---------------------------------+
       | A recursive check_host() result | Causes the "include" mechanism  |
       | of:                             | to:                             |
       +---------------------------------+---------------------------------+
       | Pass                            | match                           |
       |                                 |                                 |
       | Fail                            | not match                       |
       |                                 |                                 |
       | SoftFail                        | not match                       |
       |                                 |                                 |
       | Neutral                         | not match                       |
       |                                 |                                 |
       | TempError                       | throw TempError                 |
       |                                 |                                 |
       | PermError                       | throw PermError                 |
       |                                 |                                 |
       | None                            | throw PermError                 |
       +---------------------------------+---------------------------------+
    

    本文中的机制是指“包含”功能。

    如表中所示,软失败会导致不匹配。

    它还说:

       In hindsight, the name "include" was poorly chosen.  Only the
       evaluated result of the referenced SPF record is used, rather than
       acting as if the referenced SPF record was literally included in the
       first. 
    

    我的解释是只有包含的记录的结果是相关的,也就是说,在软失败的情况下,不匹配(就像记录将具有 FAIL 一样)限定符。

    这也是在这个website上执行的py spf库的测试结果

    Input accepted, querying now...
    
    
    Mail sent from this IP address: 1.2.3.4 
    Mail from (Sender): scknpbi@cacxjxv.com 
    Mail checked using this SPF policy: v=spf1 ip4:4.5.6.7/32 include:mailgun.org -all 
    Results - FAIL Message may be rejected
    
    
    Mail sent from: 1.2.3.4 
    Mail Server HELO/EHLO identity: blanivzsrxvbla@saucjw.com 
    
    HELO/EHLO Results - none
    

    【讨论】:

      猜你喜欢
      • 2019-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-08
      • 1970-01-01
      • 2019-08-27
      • 2011-02-10
      相关资源
      最近更新 更多