--- draft-schlitt-spf-classic-01pre5.clean.txt 2005-05-03 09:42:50.000000000 -0500 +++ draft-schlitt-spf-classic-01pre6.clean.txt 2005-05-13 16:37:33.000000000 -0500 @@ -3,7 +3,7 @@ Network Working Group M. Wong Internet-Draft W. Schlitt -Expires: November 4, 2005 May 3, 2005 +Expires: November 14, 2005 May 13, 2005 Sender Policy Framework (SPF) For Authorizing Use of Domains in E-MAIL, @@ -33,7 +33,7 @@ The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. - This Internet-Draft will expire on November 4, 2005. + This Internet-Draft will expire on November 14, 2005. Copyright Notice @@ -42,7 +42,7 @@ Abstract E-mail on the Internet can be forged in a number of ways. In - particular, existing protocols place no restriction in what a sending + particular, existing protocols place no restriction on what a sending host can use as the reverse-path of a message. This document describes version 1 of the SPF protocol, whereby a domain can explicitly authorize the hosts that are allowed to use its domain @@ -51,92 +51,94 @@ Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 1.1 Protocol Status . . . . . . . . . . . . . . . . . . . . . 4 - 1.2 Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 + 1.1. Protocol Status . . . . . . . . . . . . . . . . . . . . . 4 + 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 2. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 6 - 2.1 The HELO Identity . . . . . . . . . . . . . . . . . . . . 6 - 2.2 The MAIL FROM Identity . . . . . . . . . . . . . . . . . . 6 - 2.3 Publishing Authorization . . . . . . . . . . . . . . . . . 6 - 2.4 Checking Authorization . . . . . . . . . . . . . . . . . . 7 - 2.5 Interpreting the Result . . . . . . . . . . . . . . . . . 8 - 2.5.1 None . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 2.5.2 Neutral . . . . . . . . . . . . . . . . . . . . . . . 8 - 2.5.3 Pass . . . . . . . . . . . . . . . . . . . . . . . . . 9 - 2.5.4 Fail . . . . . . . . . . . . . . . . . . . . . . . . . 9 - 2.5.5 SoftFail . . . . . . . . . . . . . . . . . . . . . . . 9 - 2.5.6 TempError . . . . . . . . . . . . . . . . . . . . . . 9 - 2.5.7 PermError . . . . . . . . . . . . . . . . . . . . . . 10 + 2.1. The HELO Identity . . . . . . . . . . . . . . . . . . . . 6 + 2.2. The MAIL FROM Identity . . . . . . . . . . . . . . . . . . 6 + 2.3. Publishing Authorization . . . . . . . . . . . . . . . . . 6 + 2.4. Checking Authorization . . . . . . . . . . . . . . . . . . 7 + 2.5. Interpreting the Result . . . . . . . . . . . . . . . . . 8 + 2.5.1. None . . . . . . . . . . . . . . . . . . . . . . . . . 8 + 2.5.2. Neutral . . . . . . . . . . . . . . . . . . . . . . . 8 + 2.5.3. Pass . . . . . . . . . . . . . . . . . . . . . . . . . 9 + 2.5.4. Fail . . . . . . . . . . . . . . . . . . . . . . . . . 9 + 2.5.5. SoftFail . . . . . . . . . . . . . . . . . . . . . . . 9 + 2.5.6. TempError . . . . . . . . . . . . . . . . . . . . . . 9 + 2.5.7. PermError . . . . . . . . . . . . . . . . . . . . . . 10 3. SPF Records . . . . . . . . . . . . . . . . . . . . . . . . . 11 - 3.1 Publishing . . . . . . . . . . . . . . . . . . . . . . . . 11 - 3.1.1 DNS Resource Record Types . . . . . . . . . . . . . . 11 - 3.1.2 Multiple Records . . . . . . . . . . . . . . . . . . . 12 - 3.1.3 Multiple Strings . . . . . . . . . . . . . . . . . . . 12 - 3.1.4 Record Size . . . . . . . . . . . . . . . . . . . . . 12 - 3.1.5 Wildcard Records . . . . . . . . . . . . . . . . . . . 13 + 3.1. Publishing . . . . . . . . . . . . . . . . . . . . . . . . 11 + 3.1.1. DNS Resource Record Types . . . . . . . . . . . . . . 11 + 3.1.2. Multiple Records . . . . . . . . . . . . . . . . . . . 12 + 3.1.3. Multiple Strings . . . . . . . . . . . . . . . . . . . 12 + 3.1.4. Record Size . . . . . . . . . . . . . . . . . . . . . 12 + 3.1.5. Wildcard Records . . . . . . . . . . . . . . . . . . . 13 4. The check_host() Function . . . . . . . . . . . . . . . . . . 14 - 4.1 Arguments . . . . . . . . . . . . . . . . . . . . . . . . 14 - 4.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . 14 - 4.3 Initial Processing . . . . . . . . . . . . . . . . . . . . 14 - 4.4 Record Lookup . . . . . . . . . . . . . . . . . . . . . . 15 - 4.5 Selecting Records . . . . . . . . . . . . . . . . . . . . 15 - 4.6 Record Evaluation . . . . . . . . . . . . . . . . . . . . 15 - 4.6.1 Term Evaluation . . . . . . . . . . . . . . . . . . . 16 - 4.6.2 Mechanisms . . . . . . . . . . . . . . . . . . . . . . 16 - 4.6.3 Modifiers . . . . . . . . . . . . . . . . . . . . . . 17 - 4.7 Default Result . . . . . . . . . . . . . . . . . . . . . . 17 - 4.8 Domain Specification . . . . . . . . . . . . . . . . . . . 17 + 4.1. Arguments . . . . . . . . . . . . . . . . . . . . . . . . 14 + 4.2. Results . . . . . . . . . . . . . . . . . . . . . . . . . 14 + 4.3. Initial Processing . . . . . . . . . . . . . . . . . . . . 14 + 4.4. Record Lookup . . . . . . . . . . . . . . . . . . . . . . 15 + 4.5. Selecting Records . . . . . . . . . . . . . . . . . . . . 15 + 4.6. Record Evaluation . . . . . . . . . . . . . . . . . . . . 15 + 4.6.1. Term Evaluation . . . . . . . . . . . . . . . . . . . 16 + 4.6.2. Mechanisms . . . . . . . . . . . . . . . . . . . . . . 16 + 4.6.3. Modifiers . . . . . . . . . . . . . . . . . . . . . . 17 + 4.7. Default Result . . . . . . . . . . . . . . . . . . . . . . 17 + 4.8. Domain Specification . . . . . . . . . . . . . . . . . . . 17 5. Mechanism Definitions . . . . . . . . . . . . . . . . . . . . 18 - 5.1 "all" . . . . . . . . . . . . . . . . . . . . . . . . . . 18 - 5.2 "include" . . . . . . . . . . . . . . . . . . . . . . . . 19 - 5.3 "a" . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 - 5.4 "mx" . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 - 5.5 "ptr" . . . . . . . . . . . . . . . . . . . . . . . . . . 21 - 5.6 "ip4" and "ip6" . . . . . . . . . . . . . . . . . . . . . 22 - 5.7 "exists" . . . . . . . . . . . . . . . . . . . . . . . . . 22 + 5.1. "all" . . . . . . . . . . . . . . . . . . . . . . . . . . 18 + 5.2. "include" . . . . . . . . . . . . . . . . . . . . . . . . 19 + 5.3. "a" . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 + 5.4. "mx" . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 + 5.5. "ptr" . . . . . . . . . . . . . . . . . . . . . . . . . . 21 + 5.6. "ip4" and "ip6" . . . . . . . . . . . . . . . . . . . . . 22 + 5.7. "exists" . . . . . . . . . . . . . . . . . . . . . . . . . 22 6. Modifier Definitions . . . . . . . . . . . . . . . . . . . . . 24 - 6.1 redirect: Redirected Query . . . . . . . . . . . . . . . . 24 - 6.2 exp: Explanation . . . . . . . . . . . . . . . . . . . . . 25 + 6.1. redirect: Redirected Query . . . . . . . . . . . . . . . . 24 + 6.2. exp: Explanation . . . . . . . . . . . . . . . . . . . . . 25 7. The Received-SPF header . . . . . . . . . . . . . . . . . . . 27 8. Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 - 8.1 Macro definitions . . . . . . . . . . . . . . . . . . . . 29 - 8.2 Expansion Examples . . . . . . . . . . . . . . . . . . . . 32 + 8.1. Macro definitions . . . . . . . . . . . . . . . . . . . . 29 + 8.2. Expansion Examples . . . . . . . . . . . . . . . . . . . . 32 9. Implications . . . . . . . . . . . . . . . . . . . . . . . . . 33 - 9.1 Sending Domains . . . . . . . . . . . . . . . . . . . . . 33 - 9.2 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . 33 - 9.3 Forwarding Services and Aliases . . . . . . . . . . . . . 33 - 9.4 Mail Services . . . . . . . . . . . . . . . . . . . . . . 35 - 9.5 MTA Relays . . . . . . . . . . . . . . . . . . . . . . . . 36 - 10. Security Considerations . . . . . . . . . . . . . . . . . . 37 - 10.1 SPF-Authorized E-Mail May Still Be UBE . . . . . . . . . . 37 - 10.2 Spoofed DNS and IP Data . . . . . . . . . . . . . . . . . 37 - 10.3 Processing Limits . . . . . . . . . . . . . . . . . . . . 37 - 10.4 Untrusted Information Sources . . . . . . . . . . . . . . 39 - 10.5 Privacy Exposure . . . . . . . . . . . . . . . . . . . . . 39 - 11. Contributors and Acknowledgements . . . . . . . . . . . . . 40 - 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . 41 - 12.1 The SPF DNS Record Type . . . . . . . . . . . . . . . . . 41 - 12.2 The Received-SPF mail header . . . . . . . . . . . . . . . 41 - 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 42 - 13.1 Normative References . . . . . . . . . . . . . . . . . . . 42 - 13.2 Informative References . . . . . . . . . . . . . . . . . . 42 - Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 43 - A. Collected ABNF . . . . . . . . . . . . . . . . . . . . . . . . 44 - B. Extended Examples . . . . . . . . . . . . . . . . . . . . . . 46 - B.1 Simple Examples . . . . . . . . . . . . . . . . . . . . . 46 - B.2 Multiple Domain Example . . . . . . . . . . . . . . . . . 47 - B.3 DNSBL Style Example . . . . . . . . . . . . . . . . . . . 48 - Intellectual Property and Copyright Statements . . . . . . . . 49 + 9.1. Sending Domains . . . . . . . . . . . . . . . . . . . . . 33 + 9.2. Mailing Lists . . . . . . . . . . . . . . . . . . . . . . 33 + 9.3. Forwarding Services and Aliases . . . . . . . . . . . . . 33 + 9.4. Mail Services . . . . . . . . . . . . . . . . . . . . . . 35 + 9.5. MTA Relays . . . . . . . . . . . . . . . . . . . . . . . . 36 + 10. Security Considerations . . . . . . . . . . . . . . . . . . . 37 + 10.1. Processing Limits . . . . . . . . . . . . . . . . . . . . 37 + 10.2. SPF-Authorized E-Mail May Be UBE . . . . . . . . . . . . . 38 + 10.3. Spoofed DNS and IP Data . . . . . . . . . . . . . . . . . 39 + 10.4. Cross-User Forgery . . . . . . . . . . . . . . . . . . . . 39 + 10.5. Untrusted Information Sources . . . . . . . . . . . . . . 39 + 10.6. Privacy Exposure . . . . . . . . . . . . . . . . . . . . . 40 + 11. Contributors and Acknowledgements . . . . . . . . . . . . . . 41 + 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 42 + 12.1. The SPF DNS Record Type . . . . . . . . . . . . . . . . . 42 + 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 43 + 13.1. Normative References . . . . . . . . . . . . . . . . . . . 43 + 13.2. Informative References . . . . . . . . . . . . . . . . . . 43 + 12.2. The Received-SPF mail header . . . . . . . . . . . . . . . 42 + Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 45 + Appendix B. Extended Examples . . . . . . . . . . . . . . . . . . 47 + B.1. Simple Examples . . . . . . . . . . . . . . . . . . . . . 47 + B.2. Multiple Domain Example . . . . . . . . . . . . . . . . . 48 + B.3. DNSBL Style Example . . . . . . . . . . . . . . . . . . . 49 + B.4. Multiple Requirements Example . . . . . . . . . . . . . . 49 + Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 50 + Intellectual Property and Copyright Statements . . . . . . . . . . 51 1. Introduction The current e-mail infrastructure has the property that any host injecting mail into the mail system can identify itself as any domain - name it wants. Hosts can do this at a variety of levels: in + name it wants to. Hosts can do this at a variety of levels: in particular, the session, the envelope, and the mail headers. While this feature is desirable in some circumstances, it is a major obstacle to reducing Unsolicited Bulk E-mail (UBE, aka "spam"). Furthermore, many domain name holders are understandably concerned about the ease with which other entities may make use of their domain - names, often with the intent to impersonate. + names, often with the malicious intent. This document defines a protocol by which domain owners may authorize hosts to use their domain name in the "MAIL FROM" or "HELO" identity. @@ -154,7 +156,7 @@ policy can take stronger action against such e-mail, such as rejecting it. -1.1 Protocol Status +1.1. Protocol Status SPF has been in development since the Summer of 2003, and has seen deployment beyond the developers beginning in December, 2003. The @@ -171,7 +173,7 @@ that we have nonetheless captured the common understanding of SPF version 1. -1.2 Terminology +1.2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this @@ -186,7 +188,7 @@ used only with the defined meanings from normative documents. 2. Operation -2.1 The HELO Identity +2.1. The HELO Identity The "HELO" identity derives from either the SMTP HELO or EHLO command (see [RFC2821]). These commands supply the SMTP client (sending @@ -198,13 +200,11 @@ domains. It is RECOMMENDED that SPF clients check not only the "MAIL FROM" - identity, but also the "HELO" identity by applying the check_host() - function (Section 4) to the "HELO" identity as the . If the - HELO test is performed, and results in a "Fail", the overall result - for the SMTP session is "Fail", and there is no need to test the - "MAIL FROM" identity. + identity, but also separately check the "HELO" identity by applying + the check_host() function (Section 4) to the "HELO" identity as the + . -2.2 The MAIL FROM Identity +2.2. The MAIL FROM Identity The "MAIL FROM" identity derives from the SMTP MAIL command (see [RFC2821]). This command supplies the "reverse-path" for a message, @@ -220,25 +220,23 @@ "postmaster" and the "HELO" identity (which may or may not have been checked separately before). - SPF clients MUST check the "MAIL FROM" identity unless HELO testing - produced a "Fail". SPF clients check the "MAIL FROM" identity by - applying the check_host() function to the "MAIL FROM" identity as the - . + SPF clients MUST check the "MAIL FROM" identity. SPF clients check + the "MAIL FROM" identity by applying the check_host() function to the + "MAIL FROM" identity as the . -2.3 Publishing Authorization +2.3. Publishing Authorization An SPF compliant domain MUST publish a valid SPF record as described in Section 3. This record authorizes the use of the domain name in - the "HELO" and "MAIL FROM" identity, by some sending MTAs, and not by - others. + the "HELO" and "MAIL FROM" identities, by MTAs it specifies. + It is RECOMMENDED that domains publish SPF records that end in "-all", or redirect to other records that do, so that a definitive determination of authorization can be made. - Domain holders may publish SPF records that explicitly authorize no hosts for domain names that shouldn't be used in sender mailboxes. -2.4 Checking Authorization +2.4. Checking Authorization A mail receiver can perform a set of SPF checks for each mail message it receives. An SPF check tests the authorization of a client host @@ -247,9 +245,15 @@ processing chain so long as the required information is available and reliable. At least the "MAIL FROM" identity MUST be checked, but it is RECOMMENDED that the "HELO" identity also be checked beforehand. - Checking other identities against SPF records is NOT RECOMMENDED - because there are cases (e.g. Section 9.3) that are known to give - incorrect results. + + Without explicit approval of the record owner, checking other + identities against SPF version 1 records is NOT RECOMMENDED because + there are cases that are known to give incorrect results. For + example, most mailing lists rewrite the "MAIL FROM" identity (see + Section 9.2), but some do not change any other identities in the + message. The scenario described in Section 9.3.1.2 is another + example. Documents that define other identities should define the + method for explicit approval. It is possible that mail receivers will use the SPF check as part of a larger set of tests on incoming mail. The results of other tests @@ -276,13 +280,14 @@ Note that the argument may not be a well formed domain name. For example, if the reverse-path was null, then the EHLO/HELO domain - is used, with its associated problems. (see Section 2.1) In these + is used, with its associated problems (see Section 2.1). In these cases, check_host() is defined in Section 4.3 to return a "None" result. + While invalid, malformed, or non-existent domains cause SPF checks to return "none" because no SPF record can be found, it has long been the policy of many MTAs to reject e-mail from such domains, - especially in the MAIL FROM. In order to prevent the circumvention + especially in the "MAIL FROM". In order to prevent the circumvention of SPF records, rejecting e-mail from invalid domains should be considered. @@ -305,34 +310,35 @@ number of forged e-mails on the Internet today. Such an action would go against the explicit wishes of the alleged sender. -2.5 Interpreting the Result +2.5. Interpreting the Result The check_host() function returns one of several result codes. This section describes how software that performs the authorization must interpret the results. If the check is being performed during the SMTP mail transaction, it also describes how to respond. -2.5.1 None +2.5.1. None A result of "None" means that no records were published by the domain, or that no checkable sender domain could be determined from the given identity. The checking software cannot ascertain if the client host is authorized or not. -2.5.2 Neutral +2.5.2. Neutral The domain owner has explicitly stated that they don't know whether the IP address is authorized or not. A "Neutral" result MUST be treated exactly like the "None" result; the distinction exists only for informational purposes. -2.5.3 Pass + +2.5.3. Pass A "Pass" result means that the client is authorized to inject mail with the given identity. Further policy checks, such as reputation, or black and/or white listing, can now proceed with confidence in the identity. -2.5.4 Fail +2.5.4. Fail A "Fail" result is an explicit statement that the client is not authorized to use the domain in the given identity. The checking @@ -341,25 +347,24 @@ If the checking software chooses to reject the mail during the SMTP transaction, then it SHOULD use an SMTP reply code of 550 (see - [RFC2821]) and, if supported, the 5.7.1 DSN code (see [RFC2034]), in + [RFC2821]) and, if supported, the 5.7.1 DSN code (see [RFC3464]), in addition to an appropriate reply text. The check_host() function may return either a default explanation string, or one from the domain that published the SPF records (see Section 6.2). If the information doesn't originate with the checking software, it should be made clear - that text is not trusted. For example: + that the text is provided by the sender's domain. For example: 550-5.7.1 SPF MAIL FROM check failed: 550-5.7.1 The domain example.com explains: 550 5.7.1 Please see http://www.example.com/mailpolicy.html - -2.5.5 SoftFail +2.5.5. SoftFail A "SoftFail" result should be treated as somewhere between a "Fail" and a "Neutral". The domain believes the host isn't authorized but isn't willing to make that strong of a statement. Receiving software - SHOULD NOT reject the message based on this result, but MAY subject - the message to closer scrutiny. + SHOULD NOT reject the message based solely on this result, but MAY + subject the message to closer scrutiny. Since the domain has discouraged the use of this host, receivers MAY try to inform either the sender or the recipient of the e-mail. For @@ -369,7 +374,7 @@ (4.3.0 DSN code) with a note the first time the message was received, but accept it the second time. -2.5.6 TempError +2.5.6. TempError A "TempError" result means that the SPF client encountered a transient error when performing the check. Checking software can @@ -378,12 +383,13 @@ SHOULD use an SMTP reply code of 451 and, if supported, the 4.4.3 DSN code. -2.5.7 PermError +2.5.7. PermError A "PermError" result means that the domain's published records - couldn't be correctly interpreted. Checking software SHOULD reject - the message with an SMTP reply code of 550 and, if supported, the - 5.5.2 DSN code. + couldn't be correctly interpreted. Checking software SHOULD treat + this result similar to the "SoftFail" result. Be aware that if the + domain owner uses macros (Section 8), it is possible that this result + is due to the checked identities having an unexpected format. 3. SPF Records An SPF record is a DNS Resource Record (RR) that declares which hosts @@ -399,7 +405,7 @@ This record has a version of "spf1" and three directives: "+mx", "a:colo.example.com/28" (the + is implied), and "-all". -3.1 Publishing +3.1. Publishing Domain owners wishing to be SPF compliant must publish SPF records for the hosts that are used in the "MAIL FROM" and "HELO" identities. @@ -410,14 +416,14 @@ The example above in Section 3 might be published easily via this lines in a domain zone file: - example.com. IN TXT "v=spf1 +mx a:colo.example.com -all" - smtp-out.example.com. IN TXT "v=spf1 a -all" + example.com. TXT "v=spf1 +mx a:colo.example.com/28 -all" + smtp-out.example.com. TXT "v=spf1 a -all" When publishing via TXT records, beware of other TXT records published there for other purposes. They may cause problems with size limits (see Section 3.1.4). -3.1.1 DNS Resource Record Types +3.1.1. DNS Resource Record Types This document defines a new DNS RR of type SPF, type code to be determined. The format of this type is identical to the TXT RR @@ -441,20 +447,20 @@ An SPF compliant check SHOULD try to look up and use a record of the SPF type first, before falling back to the TXT type. However, the - client MAY also perform lookup of both types in parallel. If for a - domain both types are obtained but their contents do not match, the - SPF client SHOULD return a "PermError" result. + client MAY also look up both types in parallel. If for a domain both + types are obtained but their contents do not match, the SPF client + SHOULD return a "PermError" result. Example RRs in this document are shown with the TXT record type, however they could be published with the SPF type or with both types. -3.1.2 Multiple Records +3.1.2. Multiple Records A domain name MUST NOT have multiple records that would cause an authorization check to select more than one record. See Section 4.5 for the selection rules. -3.1.3 Multiple Strings +3.1.3. Multiple Strings A text DNS record (either TXT and SPF RR types) can be composed of more than one string. If a published record contains multiple @@ -471,7 +477,7 @@ construct longer records which would otherwise exceed the maximum length of a string within a TXT or SPF RR record. -3.1.4 Record Size +3.1.4. Record Size The published SPF record for a given domain name SHOULD remain small enough that the results of a query for it will fit within 512 octets. @@ -486,7 +492,7 @@ long to fit in a single UDP packet MAY be silently ignored by SPF clients. -3.1.5 Wildcard Records +3.1.5. Wildcard Records Use of wildcard records for publishing is not recommended. Care must be taken if wildcard records are used. If a domain publishes @@ -528,7 +534,7 @@ algorithm defined here, so long as the results are the same in all cases. -4.1 Arguments +4.1. Arguments The function check_host() takes these arguments: @@ -536,8 +542,8 @@ mail, either IPv4 or IPv6. - the domain that provides the sought-after authorization - information; initially the domain portion of the "MAIL FROM" or - "HELO" identity. + information; initially the domain portion of the "MAIL FROM" + or "HELO" identity. - the "MAIL FROM" or "HELO" identity. @@ -549,13 +555,13 @@ Actual implementations of the check_host() function may need additional arguments. -4.2 Results +4.2. Results The function check_host() can return one of several results described in Section 2.5. Based on the result, the action to be taken is determined by the local policies of the receiver. -4.3 Initial Processing +4.3. Initial Processing If the is malformed (label longer than 63 characters, zero length label not at the end, etc.), is not a fully qualified domain @@ -564,7 +570,7 @@ If the has no localpart, substitute the string "postmaster" for the localpart. -4.4 Record Lookup +4.4. Record Lookup In accordance with how the records are published, see Section 3.1 above, a DNS query needs to be made for the name, querying @@ -574,7 +580,7 @@ (RCODE other than 0 or 3), or the query times out, check_host() exits immediately with the result "TempError". -4.5 Selecting Records +4.5. Selecting Records Records begin with a version section: @@ -602,7 +608,7 @@ the domain makes no SPF declarations. SPF processing MUST stop and return "None". -4.6 Record Evaluation +4.6. Record Evaluation After one SPF record has been selected, the check_host() function parses and interprets it to find a result for the current test. If @@ -614,7 +620,7 @@ However, in all cases, any syntax errors anywhere in the record MUST be detected. -4.6.1 Term Evaluation +4.6.1. Term Evaluation There are two types of terms: mechanisms and modifiers. A record contains an ordered list of these as specified in the following ABNF. @@ -641,7 +647,7 @@ As per the definition of the ABNF notation in [I-D.crocker-abnf- rfc2234bis], mechanism and modifier names are case-insensitive. -4.6.2 Mechanisms +4.6.2. Mechanisms Each mechanism is considered in turn from left to right. If there are no more mechanisms, the result is specified in Section 4.7. @@ -668,14 +674,14 @@ The specific mechanisms are described in Section 5. -4.6.3 Modifiers +4.6.3. Modifiers Modifiers are not mechanisms: they do not return match or not-match. Instead they provide additional information. While modifiers do not directly affect the evaluation of the record, the "redirect" modifier has an effect after all the mechanisms have been evaluated. -4.7 Default Result +4.7. Default Result If none of the mechanisms match and there is no "redirect" modifier, then the check_host() returns a result of "Neutral", just as if @@ -683,13 +689,15 @@ "redirect" modifier, check_host() proceeds as defined in Section 6.1. Note that records SHOULD always either use a "redirect" modifier or - an "all" mechanism to explicitly terminate processing. For example: + an "all" mechanism to explicitly terminate processing. + + For example: v=spf1 +mx -all + or v=spf1 +mx redirect=_spf.example.com - -4.8 Domain Specification +4.8. Domain Specification Several of these mechanisms and modifiers have a section. The string is macro expanded (see Section 8). @@ -748,7 +756,7 @@ not exist" (RCODE 3), then evaluation of the mechanism continues as if the server returned no error (RCODE 0) and zero answer records. -5.1 "all" +5.1. "all" all = "all" @@ -762,7 +770,7 @@ Mechanisms after "all" will never be tested. Any "redirect" modifier (Section 6.1) has no effect when there is an "all" mechanism. -5.2 "include" +5.2. "include" include = "include" ":" domain-spec @@ -826,7 +834,7 @@ "include:example.com", but it would be preferable to specify "redirect=example.com" or even "mx:example.com". -5.3 "a" +5.3. "a" This mechanism matches if is one of the 's IP addresses. @@ -837,7 +845,7 @@ to the returned address(es). If any address matches, the mechanism matches. -5.4 "mx" +5.4. "mx" This mechanism matches if is one of the MX hosts for a domain name. @@ -857,7 +865,7 @@ Section 5. If such behavior is desired, the publisher should specify an "a" directive. -5.5 "ptr" +5.5. "ptr" This mechanism tests if the DNS reverse mapping for exists and correctly points to a domain name within a particular domain. @@ -908,7 +916,7 @@ must be in place for the domain's hosts and the "ptr" mechanism should be one of the last mechanisms checked. -5.6 "ip4" and "ip6" +5.6. "ip4" and "ip6" These mechanisms test if is contained within a given IP network. @@ -919,9 +927,9 @@ ip6-cidr-length = "/" 1*DIGIT dual-cidr-length = [ ip4-cidr-length ] [ "/" ip6-cidr-length ] - ip4-network = ; as per conventional dotted quad notation, + ip4-network = ; e.g. 192.0.2.0 - ip6-network = ; as per [RFC 3513], section 2.2, + ip6-network = ; e.g. 2001:DB8::CD30 The is compared to the given network. If CIDR-length high-order @@ -930,9 +938,9 @@ If ip4-cidr-length is omitted it is taken to be "/32". If ip6-cidr-length is omitted it is taken to be "/128". It is not permitted to omit parts of the IP address instead of using CIDR - notations. That is, use 10.23.45.0/24 instead of 10.23.45. + notations. That is, use 192.0.2.0/24 instead of 192.0.2. -5.7 "exists" +5.7. "exists" This mechanism is used to construct an arbitrary domain name that is used for a DNS A record query. It allows for complicated schemes @@ -973,7 +981,7 @@ gracefully handle records with modifiers that are defined in other specifications. -6.1 redirect: Redirected Query +6.1. redirect: Redirected Query If all mechanisms fail to match, and a "redirect" modifier is present, then processing proceeds as follows. @@ -1012,7 +1020,7 @@ For clarity it is RECOMMENDED that any "redirect" modifier appear as the very last term in a record. -6.2 exp: Explanation +6.2. exp: Explanation explanation = "exp" "=" domain-spec @@ -1025,9 +1033,10 @@ The is macro expanded (see Section 8) and becomes the . The DNS TXT record for the is fetched. - If is empty, or there are any processing errors (any - RCODE other than 0), or if no records are returned, or if more than - one record is returned, then proceed as if no exp modifier was given. + If is empty, or there are any DNS processing errors + (any RCODE other than 0), or if no records are returned, or if more + than one record is returned, or if there are syntax errors in the + explanation string, then proceed as if no exp modifier was given. The fetched TXT record's strings are concatenated with no spaces, and then treated as an which is macro-expanded. This @@ -1071,9 +1080,10 @@ It is RECOMMENDED that SMTP receivers record the result of SPF processing in the message headers. If an SMTP receiver chooses to do - so, it SHOULD use the "Received-SPF" header defined here. This - information is intended for the recipient. (Information intended for - the sender is described in Section 6.2, Explanation.) + so, it SHOULD use the "Received-SPF" header defined here for each + identity that was checked. This information is intended for the + recipient. (Information intended for the sender is described in + Section 6.2, Explanation.) The Received-SPF header is a trace field (see [RFC2822] section 3.6.7) and SHOULD be prepended to existing headers, above the @@ -1081,7 +1091,7 @@ appear above any other Received-SPF headers in the message. The header has the format: - header = "Received-SPF:" [CFWS] result [FWS [comment]] + header = "Received-SPF:" [CFWS] result FWS [comment FWS] [ key-value-list ] result = "Pass" / "Fail" / "SoftFail" / "Neutral" / @@ -1093,23 +1103,27 @@ key-value-pair = key [CFWS] "=" ( dot-atom / quoted-string ) key = "client-ip" / "envelope-from" / "helo" / - "problem" / "receiver" / + "problem" / "receiver" / "scope" / mechanism / "x-" name / name - dot-atom = ; unquoted word as per [RFC2822] - quoted-string = ; quoted string as per [RFC2822] - comment = ; comment string as per [RFC2822] - CFWS = ; comment or folding white space as per [RFC2822] - FWS = ; folding white space as per [RFC2822] + scope = "mfrom" ; for the "MAIL FROM" identity + / "helo" ; for the "HELO" identity + / name ; other identities + + dot-atom = + quoted-string = + comment = + CFWS = + FWS = The header SHOULD include a "(...)" style after the result, conveying supporting information for the result, such as , and . The following key-value-pairs are designed for later machine parsing. - SPF clients SHOULD give at least the "client-ip" and either the - "envelope-from" or "helo" information so that the SPF results can be - verified. + SPF clients SHOULD give enough information so that the SPF results + can be verified. That is, at least the "client-ip", "helo", and, if + the "MAIL FROM" identity was checked, the "envelope-from". client-ip the IP address of the SMTP client envelope-from the envelope sender mailbox @@ -1123,6 +1137,9 @@ receiver the host name of the SPF client + scope the identity that was checked, see the ABNF + rule. + Other keys may be defined by SPF clients. Until a new key name becomes widely accepted, new key names should start with "x-". @@ -1145,7 +1162,7 @@ envelope-from=; 8. Macros -8.1 Macro definitions +8.1. Macro definitions Many mechanisms and modifiers perform macro expansion on part of the term. @@ -1193,12 +1210,12 @@ A '%' character not followed by a '{', '%', '-', or '_' character is a syntax error. So, - -exists:%(ir).sbl.spamhaus.org + -exists:%(ir).sbl.spamhaus.example.org is incorrect and will cause check_host() to return a "PermError". Instead, say - -exists:%{ir}.sbl.spamhaus.org + -exists:%{ir}.sbl.spamhaus.example.org Optional transformers are: @@ -1291,11 +1308,11 @@ of and alone for as long as the shortest TTL of all the DNS records involved. -8.2 Expansion Examples +8.2. Expansion Examples The is strong-bad@email.example.com. The IPv4 SMTP client IP is 192.0.2.3. - The IPv6 SMTP client IP is 5f05:2000:80ad:5800::1. + The IPv6 SMTP client IP is 2001:DB8::CB01. The PTR domain name of the client IP is mx.example.org. @@ -1331,8 +1348,8 @@ example.com.trusted-domains.example.net IPv6: - %{ir}.%{v}._spf.%{d2} 1.0.0.0.0.0.0.0. - 0.0.0.0.0.0.0.0.0.0.8.5.d.a.0.8.0.0.0.2.5.0.f.5.ip6._spf.example.com + %{ir}.%{v}._spf.%{d2} 1.0.B.C.0.0.0.0. + 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.B.D.0.1.0.0.2.ip6._spf.example.com 9. Implications This section outlines the major implications that adoption of this @@ -1345,7 +1362,7 @@ This section is non-normative. -9.1 Sending Domains +9.1. Sending Domains Domains that wish to be compliant with this specification will need to determine the list of hosts that they allow to use their domain @@ -1360,8 +1377,7 @@ v=spf1 exists:_h.%{h}._l.%{l}._o.%{o}._i.%{i}._spf.%{d} ?all - -9.2 Mailing Lists +9.2. Mailing Lists Mailing lists must be aware of how they re-inject mail that is sent to the list. Mailing lists MUST comply with the requirement in @@ -1378,15 +1394,15 @@ people in the domain can send to or receive from the list) are not affected. -9.3 Forwarding Services and Aliases +9.3. Forwarding Services and Aliases Forwarding services take mail that is received at a mailbox and - directs it to some external mailbox. At the time of this writing, - the near-universal practice of such services is to use the original - "MAIL FROM" of a message when re-injecting it for delivery to the - external mailbox. [RFC1123] and [RFC2821] describe this action as an - "alias" rather than a "mail list". This means the external mailbox's - MTA sees all such mail in a connection from a host of the forwarding + direct it to some external mailbox. At the time of this writing, the + near-universal practice of such services is to use the original "MAIL + FROM" of a message when re-injecting it for delivery to the external + mailbox. [RFC1123] and [RFC2821] describe this action as an "alias" + rather than a "mail list". This means the external mailbox's MTA + sees all such mail in a connection from a host of the forwarding service, and so the "MAIL FROM" identity will not, in general, pass authorization. @@ -1395,19 +1411,19 @@ 1. The beginning, when e-mail is first sent. - * "Neutral" results could be given for IP addresses that may be + 1. "Neutral" results could be given for IP addresses that may be forwarders, instead of "Fail" results. For example: - "v=spf1 mx -exists:%{ir}.sbl.spamhaus.org ?all" + "v=spf1 mx -exists:%{ir}.sbl.spamhaus.example.org ?all" This would cause a lookup on an anti-spam DNS blocklist (DNSBL) and cause a result of "Fail" only for e-mail coming from listed sources. All other e-mail, including e-mail sent through forwarders, would receive a "Neutral" result. By - checking the DNSBL after the known good sources, problems with - incorrect listing on the DNSBL are greatly reduced. + checking the DNSBL after the known good sources, problems + with incorrect listing on the DNSBL are greatly reduced. - * The "MAIL FROM" identity could have additional information in + 2. The "MAIL FROM" identity could have additional information in the localpart that cryptographically identifies the mail as coming from an authorized source. In this case, such an SPF record could be used: @@ -1417,65 +1433,69 @@ Then, a specialized DNS server can be set up to serve the _spf_verify subdomain which validates the localpart. While this requires an extra DNS lookup, this only happens when the - e-mail would otherwise be rejected as not coming from a known, + e-mail would otherwise be rejected as not coming from a known good source. - * Similarly, a specialized DNS server could be set up that will + 3. Similarly, a specialized DNS server could be set up that will rate-limit the e-mail coming from unexpected IP addresses. "v=spf1 mx exists:%{ir}._spf_rate.%{d} -all" - * SPF allows the creation of per-user policies for special + 4. SPF allows the creation of per-user policies for special cases. For example, the following SPF record and appropriate wildcard DNS records can be used: "v=spf1 mx redirect=%{l1r+}._at_.%{o}._spf.%{d}" 2. The middle, when e-mail is forwarded. - * Forwarding services can solve the problem by rewriting the + 1. Forwarding services can solve the problem by rewriting the "MAIL FROM" to be in their own domain. This means that mail bounced from the external mailbox will have to be re-bounced by the forwarding service. Various schemes to do this exist though they vary widely in complexity and resource requirements on the part of the forwarding service. - * Several popular MTAs can be forced from "alias" semantics to + 2. Several popular MTAs can be forced from "alias" semantics to "mailing list" semantics by configuring an additional alias with "owner-" prepended to the original alias name (e.g. an - alias of "friends: george@example.com, fred@example.org" would - need another alias of the form "owner-friends: localowner"). + alias of "friends: george@example.com, fred@example.org" + would need another alias of the form "owner-friends: + localowner"). 3. The end, when e-mail is received. - * If the owner of the external mailbox wishes to trust the - forwarding service, they can direct the external mailbox's MTA - to skip SPF tests when the client host belongs to the + 1. If the owner of the external mailbox wishes to trust the + forwarding service, they can direct the external mailbox's + MTA to skip SPF tests when the client host belongs to the forwarding service. - * Tests against other identities, such as the "HELO" identity, + 2. Tests against other identities, such as the "HELO" identity, may be used to override a failed test against the "MAIL FROM" identity. - * For larger domains, it may not be possible to have a complete + 3. For larger domains, it may not be possible to have a complete or accurate list of forwarding services used by the owners of the domain's mailboxes. In such cases, whitelists of generally recognized forwarding services could be employed. - -9.4 Mail Services +9.4. Mail Services Service providers that offer mail services to third party domains, such as sending of bulk mail, may have to adjust their setup in light of the authorization check described in this document. If the "MAIL - FROM" used for such e-mail uses the domain of the service provider, - then the provider needs only to ensure that their sending host is - authorized by their own SPF record, if any. - - If the "MAIL FROM" does not use the mail service provider's domain, - then extra care must be taken. The SPF record format has several - options for the third party domain to authorize the service - provider's MTAs to send mail on its behalf. -9.5 MTA Relays + FROM" identity used for such e-mail uses the domain of the service + provider, then the provider needs only to ensure that their sending + host is authorized by their own SPF record, if any. + + If the "MAIL FROM" identity does not use the mail service provider's + domain, then extra care must be taken. The SPF record format has + several options for the third party domain to authorize the service + provider's MTAs to send mail on its behalf. For mail service + providers, such as ISPs, that have a wide variety of customers using + the same MTA, steps should be taken to prevent cross-customer forgery + (see Section 10.4). + +9.5. MTA Relays The authorization check generally precludes the use of arbitrary MTA relays between sender and receiver of an e-mail message. @@ -1500,37 +1520,7 @@ Testing other than at the border is not recommended. 10. Security Considerations -10.1 SPF-Authorized E-Mail May Still Be UBE - - The "MAIL FROM" and "HELO" identity authorizations must not be - construed to provide more assurance than it does. It is entirely - possible for a malicious sender to inject a message using their own - domain in the identities used by SPF, to have that domain's SPF - record authorize the sending host, and yet the message content can - easily claim other identities in the headers. Unless the user, or - the MUA takes care to note that the authorized identity does not - match the other, more commonly presented identities (such as the - From: header), the user may be lulled into a false sense of security. - -10.2 Spoofed DNS and IP Data - - There are two aspects of this protocol that malicious parties could - exploit to undermine the validity of the check_host() function: - - o The evaluation of check_host() relies heavily on DNS. A malicious - attacker could attack the DNS infrastructure and cause - check_host() to see spoofed DNS data, and then return incorrect - results. This could include returning "Pass" for an value - where the actual domain's record would evaluate to "Fail". See - [RFC3833] for a description of the DNS weaknesses. - - o The client IP address, , is assumed to be correct. A - malicious attacker could spoof TCP sequence numbers to make mail - appear to come from a permitted host for a domain that the - attacker is impersonating. - - -10.3 Processing Limits +10.1. Processing Limits As with most aspects of e-mail, there are a number of ways that malicious parties could use the protocol as an avenue of a Denial-of- @@ -1544,6 +1534,7 @@ by using fewer bytes in the SMTP session than is generated by the DNS queries. Using SPF clients also allows the attacker to hide the true source of the attack. + o While implementations of check_host() are supposed to limit the number of DNS lookups, malicious domains could publish records that exceed these limits in an attempt to waste computation effort @@ -1552,7 +1543,7 @@ implementations to use excessive memory or CPU usage, or to trigger bugs. - o Malicious parties could send a large volume mail purporting to + o Malicious parties could send a large volume of mail purporting to come from the intended target to a wide variety of legitimate mail hosts. These legitimate machines would then present a DNS load on the target as they fetched the relevant records. @@ -1574,7 +1565,6 @@ When evaluating the "mx" and "ptr" mechanisms, or the %{p} macro, there MUST be a limit of no more than 10 MX or PTR RRs looked up and checked. - SPF implementation SHOULD limit the total amount of data obtained from the DNS queries. For example, when DNS over TCP or EDNS0 are available, there may need to be an explicit limit to how much data @@ -1592,6 +1582,7 @@ needed to evaluate a record. This can be done by choosing directives that require less DNS information and placing lower cost mechanisms earlier in the SPF record. + For example, consider a domain set up as: example.com. IN MX 10 mx.example.com. @@ -1609,7 +1600,52 @@ "ip4" allows hosts to be renumbered easily. Using "mx" over "a" allows the set of mail hosts to be changed easily. -10.4 Untrusted Information Sources +10.2. SPF-Authorized E-Mail May Be UBE + + The "MAIL FROM" and "HELO" identity authorizations must not be + construed to provide more assurance than it does. It is entirely + possible for a malicious sender to inject a message using their own + domain in the identities used by SPF, to have that domain's SPF + record authorize the sending host, and yet the message content can + easily claim other identities in the headers. Unless the user, or + the MUA takes care to note that the authorized identity does not + match the other, more commonly presented identities (such as the + From: header), the user may be lulled into a false sense of security. +10.3. Spoofed DNS and IP Data + + There are two aspects of this protocol that malicious parties could + exploit to undermine the validity of the check_host() function: + + o The evaluation of check_host() relies heavily on DNS. A malicious + attacker could attack the DNS infrastructure and cause + check_host() to see spoofed DNS data, and then return incorrect + results. This could include returning "Pass" for an value + where the actual domain's record would evaluate to "Fail". See + [RFC3833] for a description of the DNS weaknesses. + + o The client IP address, , is assumed to be correct. A + malicious attacker could spoof TCP sequence numbers to make mail + appear to come from a permitted host for a domain that the + attacker is impersonating. + +10.4. Cross-User Forgery + + By definition, SPF policies just map domain names to sets of + authorized MTAs, not whole e-mail addresses to sets of authorized + users. Although the "l" macro (Section 8) provides a limited way to + define individual sets of authorized MTAs for specific e-mail + addresses, it is generally impossible to authenticate, through SPF, + the use of specific e-mail addresses by individual users of the same + MTA. + + It is up to mail services and their MTAs to directly prevent cross- + user forgery: based on SMTP AUTH ([RFC2554]), users should be + restricted to using only those e-mail addresses that are actually + under their control (see [RFC2476] section 6.1). Another means to + authenticate the identity of individual users is message cryptography + such as PGP ([RFC2440]) or S/MIME ([RFC2633]). + +10.5. Untrusted Information Sources When the authorization check fails, an explanation string may be included in the reject response. Both the sender and the rejecting @@ -1623,23 +1659,22 @@ another way, the only people who see malicious explanation strings are people whose messages claim to be from domains that publish such strings in their SPF records. - SPF uses information supplied by third parties, such as the "HELO" - domain name, the "MAIL FROM" and SPF records. This information is - then sent to the receiver in the Received-SPF: mail headers and - possibly returned to the client MTA in the form of an SMTP rejection - message. This information must be checked for invalid characters and - excessively long lines. + domain name, the "MAIL FROM" address, and SPF records. This + information is then passed to the receiver in the Received-SPF: mail + headers and possibly returned to the client MTA in the form of an + SMTP rejection message. This information must be checked for invalid + characters and excessively long lines. -10.5 Privacy Exposure +10.6. Privacy Exposure Checking SPF records causes DNS queries to be sent to the domain owner. These DNS queries, especially if they are caused by the "exists" mechanism, can contain information about who is sending e-mail and likely to which MTA the e-mail is being sent to. This can introduce some privacy concerns, which may be more or less of an - issue depending on local laws and the relationships between the - domain owner and the persons sending the e-mail. + issue depending on local laws and the relationship between the domain + owner and the person sending the e-mail. 11. Contributors and Acknowledgements This document is largely based on the work of Meng Weng Wong and Mark @@ -1669,19 +1704,19 @@ The folks on #perl. 12. IANA Considerations -12.1 The SPF DNS Record Type +12.1. The SPF DNS Record Type The IANA needs to assign a new Resource Record Type and Qtype from the DNS Parameters Registry for the SPF RR type. -12.2 The Received-SPF mail header +12.2. The Received-SPF mail header Per [RFC3864], the "Received-SPF:" header field is added to the IANA Permanent Message Header Field Registry. The following is the registration template: Header field name: Received-SPF - Applicable protocol: mail + Applicable protocol: mail ([RFC2822]) Status: standard Author/Change controller: wayne@schlitt.net Specification document(s): this Internet Draft @@ -1698,9 +1733,6 @@ [RFC1123] Braden, R., "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, October 1989. - [RFC2034] Freed, N., "SMTP Service Extension for Returning Enhanced - Error Codes", RFC 2034, October 1996. - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. @@ -1715,6 +1747,10 @@ [RFC2822] Resnick, P., "Internet Message Format", RFC 2822, April 2001. + [RFC3464] Moore, K. and G. Vaudreuil, "An Extensible Message Format + for Delivery Status Notifications", RFC 3464, + January 2003. + [RFC3513] Hinden, R. and S. Deering, "Internet Protocol Version 6 (IPv6) Addressing Architecture", RFC 3513, April 2003. @@ -1734,8 +1770,21 @@ [RFC1983] Malkin, G., "Internet Users' Glossary", RFC 1983, August 1996. + [RFC2440] Callas, J., Donnerhacke, L., Finney, H., and R. Thayer, + "OpenPGP Message Format", RFC 2440, November 1998. + + [RFC2476] Gellens, R. and J. Klensin, "Message Submission", + RFC 2476, December 1998. + + [RFC2554] Myers, J., "SMTP Service Extension for Authentication", + RFC 2554, March 1999. + + [RFC2633] Ramsdell, B., "S/MIME Version 3 Message Specification", + RFC 2633, June 1999. + [RFC3696] Klensin, J., "Application Techniques for Checking and Transformation of Names", RFC 3696, February 2004. + [RFC3833] Atkins, D. and R. Austein, "Threat Analysis of the Domain Name System (DNS)", RFC 3833, August 2004. @@ -1751,24 +1800,6 @@ [Vixie] Vixie, P., "Repudiating MAIL FROM", 2002. [Green] Green, D., "Domain-Authorized SMTP Mail", 2002. - - -Authors' Addresses - - Meng Weng Wong - Singapore - - Email: mengwong+spf@pobox.com - URI: http://spf.pobox.com/ - - - Wayne Schlitt - 4615 Meredeth #9 - Lincoln Nebraska, NE 68506 - United States of America - - Email: wayne@schlitt.net - URI: http://www.schlitt.net/spf/ Appendix A. Collected ABNF This section is normative and any discrepancies with the ABNF @@ -1808,9 +1839,9 @@ ip6-cidr-length = "/" 1*DIGIT dual-cidr-length = [ ip4-cidr-length ] [ "/" ip6-cidr-length ] - ip4-network = ; as per conventional dotted quad notation, + ip4-network = ; e.g. 192.0.2.0 - ip6-network = ; as per [RFC 3513], section 2.2, + ip6-network = ; e.g. 2001:DB8::CD30 domain-spec = macro-string domain-end @@ -1833,7 +1864,7 @@ name = ALPHA *( ALPHA / DIGIT / "-" / "_" / "." ) - header = "Received-SPF:" [CFWS] result [FWS [comment]] + header = "Received-SPF:" [CFWS] result FWS [comment FWS] [ key-value-list ] result = "Pass" / "Fail" / "SoftFail" / "Neutral" / @@ -1845,14 +1876,18 @@ key-value-pair = key [CFWS] "=" ( dot-atom / quoted-string ) key = "client-ip" / "envelope-from" / "helo" / - "problem" / "receiver" / + "problem" / "receiver" / "scope" / mechanism / "x-" name / name - dot-atom = ; unquoted word as per [RFC2822] - quoted-string = ; quoted string as per [RFC2822] - comment = ; comment string as per [RFC2822] - CFWS = ; comment or folding white space as per [RFC2822] - FWS = ; folding white space as per [RFC2822] + scope = "mfrom" ; for the "MAIL FROM" identity + / "helo" ; for the "HELO" identity + / name ; other identities + + dot-atom = + quoted-string = + comment = + CFWS = + FWS = Appendix B. Extended Examples These examples are based on the following DNS setup: @@ -1890,8 +1925,7 @@ $ORIGIN 0.0.10.in-addr.arpa. 4 PTR bob.example.com. - -B.1 Simple Examples +B.1. Simple Examples These examples show various possible published records for example.com and which values if would cause check_host() to @@ -1902,7 +1936,6 @@ v=spf1 a -all -- hosts 192.0.2.10 and 192.0.2.11 pass - v=spf1 a:example.org -all -- no sending hosts pass since example.org has no A records @@ -1919,17 +1952,17 @@ -- any sending host in 192.0.2.128/30 or 192.0.2.140/30 passes v=spf1 ptr -all - -- sending host 192.0.2.65 passes (reverse DNS is valid - and is in example.com) - -- sending host 192.0.2.140 fails (reverse DNS is valid, - but not in example.com) + -- sending host 192.0.2.65 passes (reverse DNS is valid and is in + example.com) + -- sending host 192.0.2.140 fails (reverse DNS is valid, but not + in example.com) -- sending host 10.0.0.4 fails (reverse IP is not valid) v=spf1 ip4:192.0.2.128/28 -all -- sending host 192.0.2.65 fails -- sending host 192.0.2.129 passes -B.2 Multiple Domain Example +B.2. Multiple Domain Example These examples show the effect of related records: @@ -1941,17 +1974,14 @@ designated servers. la.example.org: "v=spf1 redirect=example.org" - ny.example.org: "v=spf1 redirect=example.org" - sf.example.org: "v=spf1 redirect=example.org" These records allow a set of domains that all use the same mail system to make use of that mail system's record. In this way, only the mail system's record needs to be updated when the mail setup changes. These domains' records never have to change. - -B.3 DNSBL Style Example +B.3. DNSBL Style Example Imagine that, in addition to the domain records listed above, there are these: @@ -1979,6 +2009,39 @@ remote-users._spf.example.com: v=spf1 exists:%{ir}.%{l1r+}.%{d} + +B.4. Multiple Requirements Example + + Say that your sender policy requires that both the IP address is + within a certain range and that the reverse DNS for the IP matches. + This can be done several ways, including: + + example.com. SPF ( "v=spf1 " + "-include:ip4._spf.%{d} " + "-include:ptr._spf.%{d} " + "+all" ) + ip4._spf.example.com. SPF "v=spf1 -ip4:192.0.2.0/24 +all" + ptr._spf.example.com. SPF "v=spf1 -ptr +all" + + This example shows how the "-include" mechanism can be useful, how an + SPF record that ends in "+all" can be very restrictive and the use of + De Morgan's Law. +Authors' Addresses + + Meng Weng Wong + Singapore + + Email: mengwong+spf@pobox.com + URI: http://spf.pobox.com/ + + + Wayne Schlitt + 4615 Meredeth #9 + Lincoln Nebraska, NE 68506 + United States of America + + Email: wayne@schlitt.net + URI: http://www.schlitt.net/spf/ Intellectual Property Statement The IETF takes no position regarding the validity or scope of any @@ -2030,5 +2093,5 @@ -Wong & Schlitt Expires November 4, 2005 [Page 49] +Wong & Schlitt Expires November 14, 2005 [Page 51]