如果父母记录比孩子更严格,那么如果它们被包含在另一个SPF记录中,对SPF记录限定符有什么影响呢?

时间:2014-02-08 16:51:22

标签: web-services email sendmail spf

我想对所有未在我的域名的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"

现在有趣的是,他们在他们的spf记录中放置了一个软故障限定符"~all"

Wikipedia描述了include指令,如下所示:

  

如果包含(用词不当)政策通过测试此机制   火柴。这通常用于包含多个策略   ISP。

我通过包含的记录将未知发件人限定为SOFT FAIL的方式解释这一点,因此传递为SOFT FAIL,因为它们包含在根记录中。即使根记录在所有未包含的源上放置FAIL

因此,incldued记录有效地使根记录的FAIL限定符无效。因此,对于未知来源而言,贪婪的严格记录会影响整体资格。

我在这个假设中是否正确?如果没有,在给出的例子中,未知发件人如何合格?

1 个答案:

答案 0 :(得分: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                 |
   +---------------------------------+---------------------------------+

此竞争中的机制是指“包含”功能。

如表中所示,softfail导致不匹配。

它还说:

   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. 

我解释的方式只是包含记录的结果是相关的,即在软故障的cas中,不匹配(就像记录woul有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