--- draft-schlitt-spf-classic-00.clean.txt 2004-12-30 17:48:06.000000000 -0600
+++ draft-schlitt-spf-classic-01pre5.clean.txt 2005-05-03 09:42:50.000000000 -0500
@@ -1,26 +1,26 @@
+
Network Working Group M. Wong
Internet-Draft W. Schlitt
-Expires: June 30, 2005 December 30, 2004
+Expires: November 4, 2005 May 3, 2005
- Sender Policy Framework: Authorizing Use of Domains in E-MAIL
- draft-schlitt-spf-classic-00
+Sender Policy Framework (SPF) For Authorizing Use of Domains in E-MAIL,
+ version 1
+ draft-schlitt-spf-classic-01
Status of this Memo
- This document is an Internet-Draft and is subject to all provisions
- of section 3 of RFC 3667. By submitting this Internet-Draft, each
- author represents that any applicable patent or other IPR claims of
- which he or she is aware have been or will be disclosed, and any of
- which he or she become aware will be disclosed, in accordance with
- RFC 3668.
+ By submitting this Internet-Draft, each author represents that any
+ applicable patent or other IPR claims of which he or she is aware
+ have been or will be disclosed, and any of which he or she becomes
+ aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that
- other groups may also distribute working documents as
- Internet-Drafts.
+ other groups may also distribute working documents as Internet-
+ Drafts.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
@@ -33,20 +33,21 @@
The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html.
- This Internet-Draft will expire on June 30, 2005.
+ This Internet-Draft will expire on November 4, 2005.
Copyright Notice
- Copyright (C) The Internet Society (2004).
+ Copyright (C) The Internet Society (2005).
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
host can use as the reverse-path of a message. This document
- describes a protocol whereby a domain can explicitly authorize the
- hosts that are allowed to use its domain name in a reverse-path, and
- a way for receiving hosts to check such authorization.
+ describes version 1 of the SPF protocol, whereby a domain can
+ explicitly authorize the hosts that are allowed to use its domain
+ name in a reverse-path, and a way for receiving hosts to check such
+ authorization.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4
@@ -60,66 +61,71 @@
2.5 Interpreting the Result . . . . . . . . . . . . . . . . . 8
2.5.1 None . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5.2 Neutral . . . . . . . . . . . . . . . . . . . . . . . 8
- 2.5.3 Pass . . . . . . . . . . . . . . . . . . . . . . . . . 8
- 2.5.4 Fail . . . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . . . 9
- 3. SPF Records . . . . . . . . . . . . . . . . . . . . . . . . . 10
- 3.1 Publishing . . . . . . . . . . . . . . . . . . . . . . . . 10
- 3.1.1 DNS Resource Record Types . . . . . . . . . . . . . . 10
- 3.1.2 Multiple Records . . . . . . . . . . . . . . . . . . . 11
- 3.1.3 Multiple Strings . . . . . . . . . . . . . . . . . . . 11
- 3.1.4 Record Size . . . . . . . . . . . . . . . . . . . . . 11
- 3.1.5 Wildcard Records . . . . . . . . . . . . . . . . . . . 12
- 4. The check_host() Function . . . . . . . . . . . . . . . . . . 13
- 4.1 Arguments . . . . . . . . . . . . . . . . . . . . . . . . 13
- 4.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . 13
- 4.3 Initial Processing . . . . . . . . . . . . . . . . . . . . 13
- 4.4 Record Lookup . . . . . . . . . . . . . . . . . . . . . . 13
- 4.5 Selecting Records . . . . . . . . . . . . . . . . . . . . 14
- 4.6 Record Evaluation . . . . . . . . . . . . . . . . . . . . 14
- 4.6.1 Term Evaluation . . . . . . . . . . . . . . . . . . . 15
- 4.6.2 Mechanisms . . . . . . . . . . . . . . . . . . . . . . 15
- 4.6.3 Modifiers . . . . . . . . . . . . . . . . . . . . . . 16
- 4.7 Default Result . . . . . . . . . . . . . . . . . . . . . . 16
- 4.8 Domain Specification . . . . . . . . . . . . . . . . . . . 16
- 5. Mechanism Definitions . . . . . . . . . . . . . . . . . . . . 17
- 5.1 "all" . . . . . . . . . . . . . . . . . . . . . . . . . . 17
- 5.2 "include" . . . . . . . . . . . . . . . . . . . . . . . . 18
- 5.3 "a" . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
- 5.4 "mx" . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
- 5.5 "ptr" . . . . . . . . . . . . . . . . . . . . . . . . . . 20
- 5.6 "ip4" and "ip6" . . . . . . . . . . . . . . . . . . . . . 21
- 5.7 "exists" . . . . . . . . . . . . . . . . . . . . . . . . . 21
- 6. Modifier Definitions . . . . . . . . . . . . . . . . . . . . . 23
- 6.1 redirect: Redirected Query . . . . . . . . . . . . . . . . 23
- 6.2 exp: Explanation . . . . . . . . . . . . . . . . . . . . . 24
- 7. Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . 26
- 7.1 Processing Limits . . . . . . . . . . . . . . . . . . . . 26
- 7.2 The Received-SPF header . . . . . . . . . . . . . . . . . 27
- 8. Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
- 8.1 Macro definitions . . . . . . . . . . . . . . . . . . . . 30
- 8.2 Expansion Examples . . . . . . . . . . . . . . . . . . . . 33
- 9. Implications . . . . . . . . . . . . . . . . . . . . . . . . . 34
- 9.1 Sending Domains . . . . . . . . . . . . . . . . . . . . . 34
- 9.2 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . 34
- 9.3 Forwarding Services and Aliases . . . . . . . . . . . . . 34
+ 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
+ 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
+ 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
+ 6. Modifier Definitions . . . . . . . . . . . . . . . . . . . . . 24
+ 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
+ 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 . . . . . . . . . . . . . . . . . . . . . . . . 35
+ 9.5 MTA Relays . . . . . . . . . . . . . . . . . . . . . . . . 36
10. Security Considerations . . . . . . . . . . . . . . . . . . 37
- 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . 39
- 12. Contributors and Acknowledgements . . . . . . . . . . . . . 40
- 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 41
- 13.1 Normative References . . . . . . . . . . . . . . . . . . . . 41
- 13.2 Informative References . . . . . . . . . . . . . . . . . . . 41
- Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 42
- A. Collected ABNF . . . . . . . . . . . . . . . . . . . . . . . . 43
- B. Extended Examples . . . . . . . . . . . . . . . . . . . . . . 45
- B.1 Simple Examples . . . . . . . . . . . . . . . . . . . . . 45
- B.2 Multiple Domain Example . . . . . . . . . . . . . . . . . 46
- B.3 DNSBL Style Example . . . . . . . . . . . . . . . . . . . 47
- Intellectual Property and Copyright Statements . . . . . . . . 48
+ 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
1. Introduction
The current e-mail infrastructure has the property that any host
@@ -127,10 +133,10 @@
name it wants. 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 end-user unwanted e-mail (or "spam").
+ 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 intent to impersonate.
+ names, often with the intent to impersonate.
This document defines a protocol by which domain owners may authorize
hosts to use their domain name in the "MAIL FROM" or "HELO" identity.
@@ -183,69 +189,74 @@
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 (sender) for
- the SMTP session. Note that requirements for the domain presented in
- the EHLO or HELO command are not always clear to the sending party,
- and SPF client must be prepared for the "HELO" identity to be
- malformed.
-
- SPF clients MAY check the "HELO" identity by calling the check_host()
- function (Section 4) with the "HELO" identity as the . If
- the HELO test returns a "fail", the overall result for the SMTP
- session is "fail", and there is no need to test the "MAIL FROM"
- identity.
+ (see [RFC2821]). These commands supply the SMTP client (sending
+ host) for the SMTP session. Note that requirements for the domain
+ presented in the EHLO or HELO command are not always clear to the
+ sending party, and SPF clients must be prepared for the "HELO"
+ identity to be malformed or an IP address literal. At the time of
+ this writing, many legitimate e-mails are delivered with invalid HELO
+ 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.
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,
+ [RFC2821]). This command supplies the "reverse-path" for a message,
which generally consists of the sender mailbox, and is the mailbox to
- which notification messages are sent if there are problems delivering
- the message.
+ which notification messages are to be sent if there are problems
+ delivering the message.
- [RFC2821] allows the reverse-path to be null (see Section 4.5.5.) In
+ [RFC2821] allows the reverse-path to be null (see Section 4.5.5). In
this case, there is no explicit sender mailbox, and such a message
can be assumed to be a notification message from the mail system
itself. When the reverse-path is null, this document defines the
"MAIL FROM" identity to be the mailbox composed of the localpart
- "postmaster" and the "HELO" identity
+ "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
- calling the check_host() function with the "MAIL FROM" identity as
- the .
+ produced a "Fail". SPF clients check the "MAIL FROM" identity by
+ applying the check_host() function to the "MAIL FROM" identity as the
+ .
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/or "MAIL FROM" identity, by some sending MTAs, and not
- by others.
-
+ the "HELO" and "MAIL FROM" identity, by some sending MTAs, and not by
+ others.
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
- A mail receiver can perform an SPF compliant check for each mail
- message it receives. This check tests the authorization of a client
- host to inject mail with a given "MAIL FROM" identity. This check
- MAY also be applied to the "HELO" identity. Typically, such checks
- are done by a receiving MTA, but can be performed elsewhere in the
- mail processing chain so long as the required information is
- available. Checking other identities against SPF records is NOT
- RECOMMENDED because there are cases that are known to give incorrect
- results.
+ 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
+ to emit mail with a given identity. Typically, such checks are done
+ by a receiving MTA, but can be performed elsewhere in the mail
+ 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.
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
may influence whether or not a particular SPF check is performed.
- For example, finding the sending host on a local white list may cause
- all other tests to be skipped and all mail from that host to be
- accepted.
+ For example, finding the sending host's IP address on a local white
+ list may cause all other tests to be skipped and all mail from that
+ host to be accepted.
When a mail receiver decides to perform an SPF check, it MUST
implement and evaluate the check_host() function (Section 4)
@@ -254,76 +265,84 @@
the correct semantics are preserved between publisher and receiver.
To make the test, the mail receiver MUST evaluate the check_host()
- with the arguments set as follows:
+ function with the arguments set as follows:
- - the IP address of the SMTP client that is injecting the
+ - the IP address of the SMTP client that is emitting the
mail, either IPv4 or IPv6.
+
- the domain portion of the "MAIL FROM" or "HELO" identity.
+
- the "MAIL FROM" or "HELO" identity.
Note that the argument may not be a well formed domain name.
- For example, if the reverse-path was null, then the EHLO or HELO
- domain is used. In a valid SMTP session, this can be an address
- literal or entirely malformed. In these cases, check_host() is
- defined in Section 4.3 to return a "None" result.
+ 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
+ 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
+ of SPF records, rejecting e-mail from invalid domains should be
+ considered.
Care must be taken to correctly extract the from the
as many MTAs will still accept such things as source routes
- (see [RFC2821] appendix C), the percent hack (see [RFC2162]) and bang
- paths (see [RFC1983]). These archaic features have been maliciously
- used to bypass security systems.
- Software SHOULD perform this authorization check during the
- processing of the SMTP transaction that injects the mail. This
- allows errors to be returned directly to the injecting server by way
- of SMTP replies. Software can perform the check as early as the MAIL
- command, though it may be easier to delay the check to some later
- stage of the transaction.
-
- Software can perform the authorization after the corresponding SMTP
- transaction has completed. There are two problems with this
- approach: 1) It may be difficult to accurately extract all the
+ (see [RFC2821] appendix C), the %-hack (see [RFC1123]) and bang paths
+ (see [RFC1983]). These archaic features have been maliciously used
+ to bypass security systems.
+
+ This authorization check SHOULD be performed during the processing of
+ the SMTP transaction that sends the mail. This allows errors to be
+ returned directly to the sending server by way of SMTP replies.
+
+ Software can also perform the authorization after the corresponding
+ SMTP transaction has completed. However there are two problems with
+ this approach: 1) It may be difficult to accurately extract all the
required information such as client IP address and HELO domain name.
2) If the authorization fails, then generating a non-delivery
notification to the alleged sender is problematic due to the large
- number of forged emails on the Internet today. Such an action would
+ 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
- The check_host() function returns one of seven results. 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.
+ 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
- A result of None means that no records were published by the domain.
- The checking software cannot ascertain if the client host is
- authorized or not.
+ 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
- The domain owner has explicitly stated that doesn't know whether the
- IP is authorized or not. A Neutral result MUST be treated exactly
- like the None result.
-
+ 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
- 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
+ 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
- A Fail result is an explicit statement that the client is not
+ A "Fail" result is an explicit statement that the client is not
authorized to use the domain in the given identity. The checking
software can choose to mark the mail based on this, or to reject the
mail outright.
+
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
- addition to an appropriate message. The check_host() function may
+ 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
@@ -336,15 +355,15 @@
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
+ 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.
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. As
- examples, the recipient's MUA could highlight the SoftFail status.
+ try to inform either the sender or the recipient of the e-mail. For
+ example, the recipient's MUA could highlight the "SoftFail" status.
Or the MTA could give the sender a message using a technique called
"greylisting" where by the MTA can issue an SMTP reply code of 451
(4.3.0 DSN code) with a note the first time the message was received,
@@ -352,64 +371,58 @@
2.5.6 TempError
- A TempError result means that the SPF client encountered a transient
- error when performing the check. Checking software can choose to
- accept or temporarily reject the message. If the message is rejected
- during the SMTP transaction for this reason, the software SHOULD use
- an SMTP reply code of 451 and, if supported, the 4.4.3 DSN code.
+ A "TempError" result means that the SPF client encountered a
+ transient error when performing the check. Checking software can
+ choose to accept or temporarily reject the message. If the message
+ is rejected during the SMTP transaction for this reason, the software
+ SHOULD use an SMTP reply code of 451 and, if supported, the 4.4.3 DSN
+ code.
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. If rejecting during SMTP transaction time, it SHOULD use an
- SMTP reply code of 550 and, if supported, the 5.5.2 DSN code.
+ 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.
3. SPF Records
- An SPF record declares which hosts are, and are not, authorized to
- use a domain name for the "HELO" or "MAIL FROM" identity. Loosely,
- the record partitions all hosts into permitted and not-permitted
- sets. (Though some hosts might fall into neither category.)
+ An SPF record is a DNS Resource Record (RR) that declares which hosts
+ are, and are not, authorized to use a domain name for the "HELO" and
+ "MAIL FROM" identities. Loosely, the record partitions all hosts
+ into permitted and not-permitted sets. (Though some hosts might fall
+ into neither category.)
The SPF record is a single string of text. An example record is:
v=spf1 +mx a:colo.example.com/28 -all
- This record has a version of "v=spf1" and three directives: "+mx",
+ This record has a version of "spf1" and three directives: "+mx",
"a:colo.example.com/28" (the + is implied), and "-all".
3.1 Publishing
Domain owners wishing to be SPF compliant must publish SPF records
- for the hosts that are used in both the MAIL FROM and HELO
- identities. The SPF records are placed in the DNS tree at the host
- name it pertains to, not a subdomain under it, such as is done with
- SRV records. This is the same whether TXT RRs or SPF RRs are used.
+ for the hosts that are used in the "MAIL FROM" and "HELO" identities.
+ The SPF records are placed in the DNS tree at the host name it
+ pertains to, not a subdomain under it, such as is done with SRV
+ records. This is the same whether the TXT or SPF RR type is used.
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/28 -all"
+ example.com. IN TXT "v=spf1 +mx a:colo.example.com -all"
smtp-out.example.com. IN 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.)
-
- An SPF record published at the zone cut for the domain will be used
- as a default for all subdomains within the zone (See Section 4.5.)
- Domain owners SHOULD publish SPF records for hosts used for the HELO
- and MAIL FROM identities instead of using the zone cut default
- because the fallback requires additional DNS lookups. The zone cut
- default does reduce the need to publish SPF records for non-email
- related hosts, such as www.example.com.
+ size limits (see Section 3.1.4).
3.1.1 DNS Resource Record Types
- This document defines a new DNS Resource Record (RR) of type SPF,
- type code to be determined. The format of this type is identical to
- the TXT RR [RFC1035]. For either type, the character content of the
- record is encoded as US-ASCII.
+ 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
+ [RFC1035]. For either type, the character content of the record is
+ encoded as US-ASCII.
It is recognized that the current practice (using a TXT record) is
not optimal, but it is necessary because there are a number of DNS
@@ -426,12 +439,14 @@
example.com. IN TXT "v=spf1 +mx a:colo.example.com/28 -all"
example.com. IN SPF "v=spf1 +mx a:colo.example.com/28 -all"
- An SPF compliant check SHOULD lookup both types. Lookups can be
- performed serially or in parallel. If both types of records are
- obtained for a domain, the SPF type MUST be used.
+ 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.
Example RRs in this document are shown with the TXT record type,
- however they could also be published with both RR types.
+ however they could be published with the SPF type or with both types.
3.1.2 Multiple Records
@@ -468,7 +483,8 @@
DNS answers should fit in UDP packets. Note that when computing the
sizes for queries of the TXT format, one must take into account any
other TXT records published at the domain name. Records that are too
- long to fit in a single UDP packet MAY be silently ignored.
+ long to fit in a single UDP packet MAY be silently ignored by SPF
+ clients.
3.1.5 Wildcard Records
@@ -503,53 +519,60 @@
4. The check_host() Function
The check_host() function fetches SPF records, parses them, and
- interprets them to evaluate if a particular host is or is not
+ interprets them to determine if a particular host is or is not
permitted to send mail with a given identity. Mail receivers that
perform this check MUST correctly evaluate the check_host() function
as described here.
Implementations MAY use a different algorithm than the canonical
- algorithm defined here, so long as the results are the same.
+ algorithm defined here, so long as the results are the same in all
+ cases.
4.1 Arguments
The function check_host() takes these arguments:
- - the IP address of the SMTP client that is injecting the
+ - the IP address of the SMTP client that is emitting the
mail, either IPv4 or IPv6.
- - the domain portion of the "MAIL FROM" or "HELO" identity.
+
+ - the domain that provides the sought-after authorization
+ information; initially the domain portion of the "MAIL FROM" or
+ "HELO" identity.
+
- the "MAIL FROM" or "HELO" identity.
The domain portion of will usually be the same as the
argument when check_host() is initially evaluated. However,
- it will generally not be true for recursive evaluations (see Section
- 5.2 below).
+ this will generally not be true for recursive evaluations (see
+ Section 5.2 below).
- Actual implementations of the check_host() function will likely need
+ Actual implementations of the check_host() function may need
additional arguments.
4.2 Results
- The function check_host() can result in one of seven results
- described in Section 2.5. Based on the result, the action to be
- taken is determined by the local policies of the receiver.
+ 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
- If the is malformed or is not a fully qualified domain name,
+ If the is malformed (label longer than 63 characters, zero
+ length label not at the end, etc.), is not a fully qualified domain
+ name, or if the DNS lookup returns "domain does not exist" (RCODE 3),
check_host() immediately returns the result "None".
If the has no localpart, substitute the string "postmaster"
for the localpart.
-
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
- for either RR type TXT, SPF or both.
+ for either RR type TXT, SPF, or both.
+
If the DNS lookup returns a server failure (RCODE 2), or other error
(RCODE other than 0 or 3), or the query times out, check_host() exits
- immediately with the result "TempError"
+ immediately with the result "TempError".
4.5 Selecting Records
@@ -563,6 +586,7 @@
1. If any records of type SPF are in the set, then all records of
type TXT are discarded.
+
2. Records that do not begin with a version section of exactly
"v=spf1" are discarded. Note that the version section is
terminated either by a SP character or the end of the record. A
@@ -574,15 +598,9 @@
remaining, then check_host() exits immediately with the result of
"PermError".
- If no matching records are returned for the , the SPF client
- MUST find the Zone Cut as defined in [RFC2181] section 6 and repeat
- the above steps. The 's zone origin is then searched for SPF
- records. If an SPF record is found at the zone origin, the
- is set to the zone origin as if a "redirect" modifier was executed.
-
- If no matching records are returned for either search, an SPF client
- MUST assume that the domain makes no SPF declarations. SPF
- processing MUST abort and return "None".
+ If no matching records are returned, an SPF client MUST assume that
+ the domain makes no SPF declarations. SPF processing MUST stop and
+ return "None".
4.6 Record Evaluation
@@ -595,6 +613,7 @@
return "PermError" if the record is not syntactically well formed.
However, in all cases, any syntax errors anywhere in the record MUST
be detected.
+
4.6.1 Term Evaluation
There are two types of terms: mechanisms and modifiers. A record
@@ -606,7 +625,6 @@
prefix = "+" / "-" / "?" / "~"
mechanism = ( all / include
/ A / MX / PTR / IP4 / IP6 / exists )
-
modifier = redirect / explanation / unknown-modifier
unknown-modifier = name "=" macro-string
@@ -620,8 +638,8 @@
Terms that do not contain any of "=", ":" or "/" are mechanisms.
- As per the definition of the ABNF notation in [RFC2234], mechanism
- and modifier names are case-insensitive.
+ 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
@@ -637,41 +655,40 @@
mechanism processing ends and the exception value is returned.
The possible prefixes, and the results they return are:
+
"+" Pass
"-" Fail
"~" SoftFail
"?" Neutral
-
The prefix is optional and defaults to "+".
- When a mechanism matches, and the prefix is "-" so that a "Fail"
- result is returned and the explanation string is computed as
- described in Section 6.2.
+ When a mechanism matches and the prefix is "-", then a "Fail" result
+ is returned and the explanation string is computed as described in
+ Section 6.2.
- Specific mechanisms are described in Section 5.
+ The specific mechanisms are described in Section 5.
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 effect the evaluation of the record, the "redirect" modifier
+ directly affect the evaluation of the record, the "redirect" modifier
has an effect after all the mechanisms have been evaluated.
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". If there is a
+ then the check_host() returns a result of "Neutral", just as if
+ "?all" were specified as the last directive. If there is a
"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
Several of these mechanisms and modifiers have a
@@ -739,6 +756,7 @@
rightmost mechanism in a record to provide an explicit default.
For example:
+
v=spf1 a mx -all
Mechanisms after "all" will never be tested. Any "redirect" modifier
@@ -755,10 +773,12 @@
evaluation of check_host().
In hind sight, the name "include" was poorly chosen. Only the
- evaluated results of the referenced SPF record is used, rather than
+ evaluated result of the referenced SPF record is used, rather than
acting as if the referenced SPF record was literally included in the
- first. Better names for this mechanism would have been something
- like "on-pass" or "if-pass".
+ first. For example, evaluating a "-all" directive in the referenced
+ record does not terminate the overall processing and does not
+ necessarily result in an overall "Fail". (Better names for this
+ mechanism would have been "if-pass", "on-pass", "call", "eval, etc.)
The "include" mechanism makes it possible for one domain to designate
multiple administratively independent domains. For example, a vanity
@@ -770,7 +790,7 @@
"v=spf1 include:example.com include:example.org -all".
That would direct check_host() to, in effect, check the records of
- example.com and example.org for a "pass" result. Only if the host
+ example.com and example.org for a "Pass" result. Only if the host
were not permitted for either of those domains would the result be
"Fail".
@@ -825,9 +845,10 @@
MX = "mx" [ ":" domain-spec ] [ dual-cidr-length ]
check_host() first performs an MX lookup on the . Then
it performs an address lookup on each MX name returned. The is
- compared to each returned IP address. To prevent DoS attacks, a
- limit of 10 MX names MUST be enforced (see Section 10). If any
- address matches, the mechanism matches.
+ compared to each returned IP address. To prevent DoS attacks, more
+ than 10 MX names MUST NOT be looked up during the evaluation of a
+ "mx" mechanism (see Section 10). If any address matches, the
+ mechanism matches.
Note regarding implicit MXes: If the has no MX records,
check_host() MUST NOT pretend the target is its single MX, and MUST
@@ -847,10 +868,10 @@
DNS reverse-mapping for , looking up the corresponding PTR record
in "in-addr.arpa." if the address is an IPv4 one and in "ip6.arpa."
if it is an IPv6 address. For each record returned, validate the
- domain name by looking up its IP address. To prevent DoS attacks, a
- limit of 10 PTR names MUST be enforced (see Section 10). If is
- among the returned IP addresses, then that domain name is validated.
- In pseudocode:
+ domain name by looking up its IP address. To prevent DoS attacks,
+ more than 10 PTR names MUST NOT be looked up during the evaluation of
+ a "ptr" mechanism (see Section 10). If is among the returned IP
+ addresses, then that domain name is validated. In pseudocode:
sending-domain_names := ptr_lookup(sending-host_IP);
if more than 10 sending-domain_names are found, use at most 10.
@@ -947,9 +968,9 @@
These modifiers MUST NOT appear in a record more than once each. If
they do, then check_host() exits with a result of "PermError".
- Unrecognized modifiers SHOULD be ignored no matter where in a record,
+ Unrecognized modifiers MUST be ignored no matter where in a record,
nor how often. This allows implementations of this document to
- handle records with modifiers that are defined in other
+ gracefully handle records with modifiers that are defined in other
specifications.
6.1 redirect: Redirected Query
@@ -984,7 +1005,7 @@
Note: In general, the domain "A" cannot reliably use a redirect to
another domain "B" not under the same administrative control. Since
the stays the same, there is no guarantee that the record at
- domain "B" will correctly work for addresses in domain "A",
+ domain "B" will correctly work for mailboxes in domain "A",
especially if domain "B" uses mechanisms involving localparts. An
"include" directive may be more appropriate.
@@ -1030,150 +1051,80 @@
Here are some examples of possible explanation TXT records at
explain._spf.example.com:
- Example.com mail should only be sent by its own servers.
-
+ "Mail from example.com should only be sent by its own servers."
-- a simple, constant message
- %{i} is not one of %{d}'s designated mail servers.
-
+ "%{i} is not one of %{d}'s designated mail servers."
-- a message with a little more info, including the IP address
that failed the check
- See http://%{d}/why.html?s=%{S}&i=%{I}
-
+ "See http://%{d}/why.html?s=%{S}&i=%{I}"
-- a complicated example that constructs a URL with the
arguments to check_host() so that a web page can be
generated with detailed, custom instructions
- Note: During recursion into an "include" mechanism, exp= modifiers do
- not propagate out. In contrast, during execution of a "redirect"
- modifier, the explanation string from the target of the redirect is
- used.
-7. Miscellaneous
-
-7.1 Processing Limits
-
- During processing, an evaluation of check_host() may require
- additional evaluations of check_host() due to the "include" mechanism
- and/or the "redirect" modifier.
-
- In order to prevent Denial-of-Service (DoS) attacks, the total number
- of DNS lookups must be limited. The subject of a DoS attack can be
- either the SPF client directly, the domain owner of the claimed
- sender, or some third party domain that is referenced in the SPF
- record.
-
- Of these, the case of a third party referenced in the SPF record is
- the easiest for a DoS attack to effectively exploit. For example, a
- malicious person could create an SPF record with many references to a
- victim domain, send many e-mails to different SPF clients and the SPF
- clients would create a DoS attack. In effect, the SPF clients are
- being used to amplify the attacker's bandwidth 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.
-
- As a result, limits that may seem reasonable for an individual mail
- server can still allow an unreasonable amount of bandwidth
- amplification. Therefore the processing limits need to be quite
- small.
-
- SPF implementations MUST limit the number of mechanism that do DNS
- lookups to at most 10, if this number is exceeded, a PermError MUST
- be returned. The mechanisms that count against this limit are
- "include", "a", "mx", "ptr", "exists" and the "redirect" modifier.
- The "all", "ip4" and "ip6" mechanisms do not require DNS lookups and
- therefore do not count against this limit. The "exp" modifier
- requires a DNS lookup, but it is not counted as it is used only in
- the case of errors.
-
- 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
- will be accepted to prevent excessive bandwidth usage or memory
- usage, and DoS attacks.
- Implementations must be prepared to handle records that are set up
- incorrectly or maliciously.
-
- MTAs or other processors MAY also impose a limit on the maximum
- amount of elapsed time to evaluate check_host(). Such a limit SHOULD
- allow at least 20 seconds. If such a limit is exceeded, the result
- of authentication SHOULD be "TempError".
-
- Domains publishing records SHOULD try to keep the number of "include"
- mechanisms and chained "redirect" modifiers to a minimum. Domains
- SHOULD also try to minimize the amount of other DNS information
- 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.
- mx.example.com. IN A 192.0.2.1
- a.example.com. IN TXT "v=spf1 mx:example.com -all"
- b.example.com. IN TXT "v=spf1 a:mx.example.com -all"
- c.example.com. IN TXT "v=spf1 ip4:192.0.2.1 -all"
-
- Evaluating check_host() for the domain "a.example.com" requires the
- MX records for "example.com", and then the A records for the listed
- hosts. Evaluating for "b.example.com" only requires the A records.
- Evaluating for "c.example.com" requires none.
-
- However, there may be administrative considerations: Using "a" over
- "ip4" allows hosts to be renumbered easily. Using "mx" over "a"
- allows the set of mail hosts to be changed easily.
-
-7.2 The Received-SPF header
+ Note: During recursion into an "include" mechanism, an exp= modifier
+ from the target domain MUST NOT be used. In contrast, when executing
+ a "redirect" modifier, an exp= modifier from the original domain MUST
+ NOT be used.
+7. The Received-SPF header
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 described in Section 6.2, Explanation.)
+ the sender is described in Section 6.2, Explanation.)
- The Received-SPF header is a trace field (See [RFC2822] section
+ The Received-SPF header is a trace field (see [RFC2822] section
3.6.7) and SHOULD be prepended to existing headers, above the
Received: header that is generated by the SMTP receiver. It MUST
appear above any other Received-SPF headers in the message. The
header has the format:
- header = "Received-SPF:" [CFWS] result [CFWS]
+
+ header = "Received-SPF:" [CFWS] result [FWS [comment]]
[ key-value-list ]
- result = "Pass" / "Fail" / "TempError" / "SoftFail" /
- "Neutral" / "None" / "PermError"
+ result = "Pass" / "Fail" / "SoftFail" / "Neutral" /
+ "None" / "TempError" / "PermError"
key-value-list = key-value-pair *( ";" [CFWS] key-value-pair )
[";"]
- key-value-pair = name [CFWS] "=" ( dot-atom / quoted-string )
+ key-value-pair = key [CFWS] "=" ( dot-atom / quoted-string )
- dot-atom = ; unquoted word as per [RFC2822]
+ key = "client-ip" / "envelope-from" / "helo" /
+ "problem" / "receiver" /
+ 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]
- The should convey supporting information for the
- result, such as , and .
+ 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.
+ client-ip the IP address of the SMTP client
- SPF clients may append zero or more of the following key-value-pairs
- at their discretion:
+ envelope-from the envelope sender mailbox
- receiver the host name of the SPF client
- client-ip the IP address of the SMTP client
- envelope-from the envelope sender address
helo the host name given in the HELO or EHLO command
+
mechanism the mechanism that matched (if no mechanisms matched,
substitute the word "default".)
+
problem if an error was returned, details about the error
- Other key-value pairs may be defined by SPF clients. Until a new key
- name becomes widely accepted, new key names should start with "x-".
+ receiver the host name of the SPF client
+
+ Other keys may be defined by SPF clients. Until a new key name
+ becomes widely accepted, new key names should start with "x-".
SPF clients MUST make sure that the Received-SPF header does not
contain invalid characters, is excessively long, or contain malicious
@@ -1185,95 +1136,74 @@
myname@example.com designates 192.0.2.1 as permitted sender)
receiver=mybox.example.org; client-ip=192.0.2.1;
envelope-from=; helo=foo.example.com;
+
+
Received-SPF: Fail (mybox.example.org: domain of
myname@example.com does not designate
192.0.2.1 as permitted sender)
- receiver=mybox.example.org;
client-ip=192.0.2.1;
envelope-from=;
- helo=foo.example.com;
-
-
- Received-SPF: SoftFail (mybox.example.org: domain of
- transitioning myname@example.com discourages
- use of 192.0.2.1 as permitted sender)
-
-
- Received-SPF: Neutral (mybox.example.org: 192.0.2.1 is neither
- permitted nor denied by domain of
- myname@example.com)
-
-
- Received-SPF: None (mybox.example.org: myname@example.com does
- not designate permitted sender hosts)
-
-
- Received-SPF: PermError (mybox.example.org: domain
- of myname@example.com used an invalid
- SPF mechanism)
-
-
- Received-SPF: TempError (mybox.example.org: error in processing
- during lookup of myname@example.com: DNS
- timeout)
8. Macros
8.1 Macro definitions
- Many mechanisms and modifiers perform macro interpolation on part of
- the term.
+ Many mechanisms and modifiers perform macro expansion on part of the
+ term.
domain-spec = macro-string domain-end
domain-end = ( "." toplabel ) / macro-expand
+
toplabel = ALPHA / ALPHA *[ alphanum / "-" ] alphanum
; LDH rule (See [RFC3696])
alphanum = ALPHA / DIGIT
- macro-string = *( macro-expand / macro-literal )
+
explain-string = *( macro-string / SP )
- macro-expand = ( "%{" macro-letter transformer *delimiter "}" )
+
+ macro-string = *( macro-expand / macro-literal )
+ macro-expand = ( "%{" macro-letter transformers *delimiter "}" )
/ "%%" / "%_" / "%-"
macro-literal = %x21-24 / %x26-7E
; visible characters except "%"
macro-letter = "s" / "l" / "o" / "d" / "i" / "p" / "h" /
"c" / "r" / "t"
- transformer = *DIGIT [ "r" ]
+ transformers = *DIGIT [ "r" ]
delimiter = "." / "-" / "+" / "," / "/" / "_" / "="
A literal "%" is expressed by "%%".
+
"%_" expands to a single " " space.
"%-" expands to a URL-encoded space, viz. "%20".
The following macro letters are expanded in term arguments:
-
s =
l = local-part of
o = domain of
d =
i =
p = the validated domain name of
- v = the string "in-addr" if is ipv4, or "ip6" if is
- ipv6
+ v = the string "in-addr" if is ipv4, or "ip6" if is ipv6
h = HELO/EHLO domain
The following macro letters are only allowed in "exp" text:
-
c = SMTP client IP (easily readable format)
r = domain name of host performing the check
t = current timestamp
-
A '%' character not followed by a '{', '%', '-', or '_' character is
a syntax error. So,
+
-exists:%(ir).sbl.spamhaus.org
+
is incorrect and will cause check_host() to return a "PermError".
Instead, say
+
-exists:%{ir}.sbl.spamhaus.org
Optional transformers are:
- *DIGIT : zero or more digits
- 'r' : reverse value, splitting on dots by default
+ *DIGIT = zero or more digits
+ 'r' = reverse value, splitting on dots by default
If transformers or delimiters are provided, the replacement value for
a macro letter is split into parts. After performing any reversal
@@ -1304,28 +1234,29 @@
the domain part. Note that these values remain the same during
recursive and chained evaluations due to "include" and/or "redirect".
Note also that if the original had no localpart, the
- localpart was set to "postmaster" in initial processing (see Section
- 4.3).
+ localpart was set to "postmaster" in initial processing (see
+ Section 4.3).
For IPv4 addresses, both the "i" and "c" macros expand to the
standard dotted-quad format.
+
For IPv6 addresses, the "i" macro expands to a dot-format address; it
is intended for use in %{ir}. The "c" macro may expand to any of the
hexadecimal colon-format addresses specified in [RFC3513] section
2.2. It is intended for humans to read.
The "p" macro expands to the validated domain name of . The
- procedure for finding the validated domain name is defined in Section
- 5.5. If the is present in the list of validated domains, it
- SHOULD be used. Otherwise, if a subdomain of the is
- present, it SHOULD be used. Otherwise, any name from the list may be
- used. If there are no validated domain name or if a DNS error
- occurs, the string "unknown" is used.
+ procedure for finding the validated domain name is defined in
+ Section 5.5. If the is present in the list of validated
+ domains, it SHOULD be used. Otherwise, if a subdomain of the
+ is present, it SHOULD be used. Otherwise, any name from the
+ list may be used. If there are no validated domain names or if a DNS
+ error occurs, the string "unknown" is used.
The "r" macro expands to the name of the receiving MTA. This SHOULD
be a fully qualified domain name, but if one does not exist (as when
- the checking is done by a script) or if policy restrictions dictate
- otherwise, the word "unknown" should be substituted. The domain name
+ the checking is done by a MUA) or if policy restrictions dictate
+ otherwise, the word "unknown" SHOULD be substituted. The domain name
may be different than the name found in the MX record that the client
MTA used to locate the receiving MTA.
@@ -1337,24 +1268,29 @@
When the result of macro expansion is used in a domain name query, if
the expanded domain name exceeds 253 characters (the maximum length
of a domain name), the left side is truncated to fit, by removing
- successive subdomains until the total length does not exceed 253
+ successive domain labels until the total length does not exceed 253
characters.
Uppercased macros expand exactly as their lower case equivalents, and
- are then URL escaped. URL escaping for the non-uric characters is
- described in [RFC2396].
+ are then URL escaped. URL escaping must be performed for characters
+ not in the "uric" set, which is defined in [RFC3986].
- Note: Domains should avoid using the "s", "l", "o" or "h" macros in
+ Note: Care must be taken so that macro expansion for legitimate
+ e-mail does not exceed the 63 character limit on DNS labels. The
+ localpart of e-mail addresses, in particular, can have more than 63
+ characters between dots.
+
+ Note: Domains should avoid using the "s", "l", "o", or "h" macros in
conjunction with any mechanism directive. While these macros are
powerful and allow per-user records to be published, they severely
limit the ability of implementations to cache results of check_host()
and they reduce the effectiveness of DNS caches.
-
Implementations should be aware that if no directive processed during
the evaluation of check_host() contains an "s", "l", "o" or "h"
macro, then the results of the evaluation can be cached on the basis
of and alone for as long as the shortest TTL of all the
DNS records involved.
+
8.2 Expansion Examples
The is strong-bad@email.example.com.
@@ -1362,6 +1298,7 @@
The IPv6 SMTP client IP is 5f05:2000:80ad:5800::1.
The PTR domain name of the client IP is mx.example.org.
+
macro expansion
------- ----------------------------
%{s} strong-bad@email.example.com
@@ -1379,7 +1316,6 @@
%{lr-} bad.strong
%{l1r-} strong
-
macro-string expansion
--------------------------------------------------------------------
%{ir}.%{v}._spf.%{d2} 3.2.0.192.in-addr._spf.example.com
@@ -1395,8 +1331,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.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
9. Implications
This section outlines the major implications that adoption of this
@@ -1419,22 +1355,24 @@
considerations.
It can be helpful to publish records that include a "tracking
- exists:" mechanism. By looking at the name server logs, an
- incompletely list may be generated. For example:
+ exists:" mechanism. By looking at the name server logs, a rough list
+ may then be generated. For example:
+
v=spf1 exists:_h.%{h}._l.%{l}._o.%{o}._i.%{i}._spf.%{d} ?all
+
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
[RFC2821] Section 3.10 and [RFC1123] Section 5.3.6 that say that the
- reverse-path MUST be changed to be the address of a person or other
+ reverse-path MUST be changed to be the mailbox of a person or other
entity who administers the list. While the reasons for changing the
reverse-path are many and long standing, SPF adds enforcement to this
requirement.
In practice, almost all mailing list software in use already complies
- with this requirement. Mailing lists that do not comply, may or may
+ with this requirement. Mailing lists that do not comply may or may
not encounter problems depending on how access to the list is
restricted. Such lists that are entirely internal to a domain (only
people in the domain can send to or receive from the list) are not
@@ -1443,60 +1381,109 @@
9.3 Forwarding Services and Aliases
Forwarding services take mail that is received at a mailbox and
- 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
+ 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
+ service, and so the "MAIL FROM" identity will not, in general, pass
authorization.
- There are several possible ways that this authorization failure can
- be ameliorated. If the owner of the external mailbox wishes to trust
- the forwarding service, they can direct the external mailbox's MTA to
- skip such tests when the client host belongs to the forwarding
- service. Tests against some other identity may also be used to
- override the test against the "MAIL FROM" identity.
-
- 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, white lists of generally
- recognized forwarding services could be employed.
-
- Forwarding services can also solve the problem by using MAIL FROM
- that contain 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 change "alias" semantics to
- "mailing list" semantics by including an adding another alias with
- "owner-" added to the beginning of the alias name. (e.g. an alias
- of "friends: george@example.com, fred@example.org" would need another
- alias of the form "owner-friends: localowner")
+ There are three places that techniques can be used to ameliorate this
+ problem.
+
+ 1. The beginning, when e-mail is first sent.
+
+ * "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"
+
+ 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.
+
+ * 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:
+
+ "v=spf1 mx exists:%{l}._spf_verify.%{d} -all"
+
+ 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,
+ good source.
+
+ * 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
+ 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
+ "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
+ "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").
+
+ 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
+ forwarding service.
+
+ * 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
+ 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
- Entities that offer mail services to other domains such as sending of
- bulk mail will may have to alter their mail in light of the
- authorization check in this document. If the MAIL FROM used for such
- e-mail uses the domain of the mail service provider, then the
- provider needs only to ensure that their sending host is authorized
- by their own SPF record, if any.
+ 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,
+ 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 authorizing the sending MTAs of another domain (the
- service provider's)
-
+ options for the third party domain to authorize the service
+ provider's MTAs to send mail on its behalf.
9.5 MTA Relays
The authorization check generally precludes the use of arbitrary MTA
relays between sender and receiver of an e-mail message.
+
Within an organization, MTA relays can be effectively deployed.
However, for purposes of this document, such relays are effectively
- invisible. The "MAIL FROM" identity authorization check is a check
- between border MTAs.
+ transparent. The "MAIL FROM" identity authorization check is a check
+ between border MTAs of different domains.
For mail senders, this means that published SPF records must
authorize any MTAs that actually send across the Internet. Usually,
@@ -1504,15 +1491,17 @@
to these MTAs for delivery.
Mail receivers will generally want to perform the authorization check
- at the border MTAs. This allows mail that fails to be rejected
- during the SMTP session rather than bounced. Internal MTAs then do
- not perform the authorization test. To perform the authorization
- test other than at the border, the host that first transferred the
- message to the organization must be determined, which can be
- difficult to extract from headers. Testing other than at the border
- is not recommended.
+ at the border MTAs, specifically including all secondary MXes. This
+ allows mail that fails to be rejected during the SMTP session rather
+ than bounced. Internal MTAs then do not perform the authorization
+ test. To perform the authorization test other than at the border,
+ the host that first transferred the message to the organization must
+ be determined, which can be difficult to extract from headers.
+ 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
@@ -1523,40 +1512,105 @@
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:
- The evaluation of check_host() relies heavily on DNS. A malicious
+ 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.
- The client IP address, , is assumed to be correct. A
+
+ 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.
- As with most aspects of mail, there are a number of ways that
- malicious parties could use the protocol as an avenue of a
- Denial-of-Service (DoS) attack. The processing limits outlined in
- Section 7.1 are designed to prevent attacks such as:
-
- Malicious parties could create SPF records that make many
- references to the target's domain and then send large volume mail
- to other SPF clients that use this SPF record. These legitimate
- machines would then present a DNS load on the target as they
- fetched the relevant DNS references.
- While implementations of check_host() need to limit the number of
- DNS lookups, malicious domains could publish records exceed these
- limits in an attempt to waste computation effort at their targets
- when they send them mail. Malicious domains could also design SPF
- records that cause excessive memory or CPU usage.
- Malicious parties could send large volume mail purporting to come
- from the intended target to a wide variety of legitimate mail
+
+10.3 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-
+ Service (DoS) attack. The processing limits outlined here are
+ designed to prevent attacks such as:
+
+ o A malicious party could create an SPF record with many references
+ to a victim's domain, send many e-mails to different SPF clients
+ and those SPF clients would then create a DoS attack. In effect,
+ the SPF clients are being used to amplify the attacker's bandwidth
+ 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
+ at their targets when they send them mail. Malicious domains
+ could also design SPF records that cause particular
+ implementations to use excessive memory or CPU usage, or to
+ trigger bugs.
+
+ o Malicious parties could send a large volume 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.
+ Of these, the case of a third party referenced in the SPF record is
+ the easiest for a DoS attack to effectively exploit. As a result,
+ limits that may seem reasonable for an individual mail server can
+ still allow an unreasonable amount of bandwidth amplification.
+ Therefore the processing limits need to be quite low.
+
+ SPF implementations MUST limit the number of mechanisms and modifiers
+ that do DNS lookups to at most 10 per SPF check. If this number is
+ exceeded during a check, a PermError MUST be returned. The
+ "include", "a", "mx", "ptr", and "exists" mechanisms as well as the
+ "redirect" and "exp" modifiers do count against this limit. The
+ "all", "ip4" and "ip6" mechanisms do not require DNS lookups and
+ therefore do not count against this limit.
+
+ 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
+ will be accepted to prevent excessive bandwidth usage or memory
+ usage, and DoS attacks.
+
+ MTAs or other processors MAY also impose a limit on the maximum
+ amount of elapsed time to evaluate check_host(). Such a limit SHOULD
+ allow at least 20 seconds. If such a limit is exceeded, the result
+ of authentication SHOULD be "TempError".
+
+ Domains publishing records SHOULD try to keep the number of "include"
+ mechanisms and chained "redirect" modifiers to a minimum. Domains
+ SHOULD also try to minimize the amount of other DNS information
+ 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.
+ mx.example.com. IN A 192.0.2.1
+ a.example.com. IN TXT "v=spf1 mx:example.com -all"
+ b.example.com. IN TXT "v=spf1 a:mx.example.com -all"
+ c.example.com. IN TXT "v=spf1 ip4:192.0.2.1 -all"
+
+ Evaluating check_host() for the domain "a.example.com" requires the
+ MX records for "example.com", and then the A records for the listed
+ hosts. Evaluating for "b.example.com" only requires the A records.
+ Evaluating for "c.example.com" requires none.
+
+ However, there may be administrative considerations: Using "a" over
+ "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
+
When the authorization check fails, an explanation string may be
included in the reject response. Both the sender and the rejecting
receiver need to be aware that the explanation was determined by the
@@ -1570,23 +1624,28 @@
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
+ 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.
-11. IANA Considerations
- The IANA needs to assign a new Resource Record Type and Qtype from
- the DNS Parameters Registry for the SPF RR type.
-12. Contributors and Acknowledgements
+10.5 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.
+11. Contributors and Acknowledgements
This document is largely based on the work of Meng Weng Wong and Mark
- Lentczner. Mark is not listed as an author by his request. While,
- as this section acknowledges, many people have contributed to this
- document, a very large portion of the writing and editing are due to
- Meng and Mark.
+ Lentczner. While, as this section acknowledges, many people have
+ contributed to this document, a very large portion of the writing and
+ editing are due to Meng and Mark.
This design owes a debt of parentage to [RMX] by Hadmut Danisch and
to [DMP] by Gordon Fecyk. The idea of using a DNS record to check
@@ -1595,19 +1654,40 @@
[Vixie] (based on suggestion by Jim Miller) and by David Green
[Green].
- Philip Gladstone contributed macros to the specification, multiplying
- the expressiveness of the language and making per-user and per-IP
- lookups possible.
+ Philip Gladstone contributed the concept of macros to the
+ specification, multiplying the expressiveness of the language and
+ making per-user and per-IP lookups possible.
The authors would also like to thank the literally hundreds of
individuals who have participated in the development of this design.
- There are far too numerous to name, but they include:
+ They are far too numerous to name, but they include:
The folks on the spf-discuss mailing list.
The folks on the SPAM-L mailing list.
The folks on the IRTF ASRG mailing list.
The folks on the IETF MARID mailing list.
The folks on #perl.
+12. IANA Considerations
+
+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
+
+ 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
+ Status: standard
+ Author/Change controller: wayne@schlitt.net
+ Specification document(s): this Internet Draft
+ (Note to RFC Editor: Replace this with RFC YYYY (RFC number of
+ this spec))
+ Related information: http://spf.mehnle.net/
13. References
13.1 Normative References
@@ -1624,35 +1704,35 @@
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC2181] Elz, R. and R. Bush, "Clarifications to the DNS
- Specification", RFC 2181, July 1997.
-
- [RFC2234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
- Specifications: ABNF", RFC 2234, November 1997.
-
- [RFC2396] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform
- Resource Identifiers (URI): Generic Syntax", RFC 2396,
- August 1998.
+ [I-D.crocker-abnf-rfc2234bis]
+ Crocker, D. and P. Overell, "Augmented BNF for Syntax
+ Specifications: ABNF", draft-crocker-abnf-rfc2234bis-00
+ (work in progress), March 2005.
[RFC2821] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821,
April 2001.
- [RFC2822] Resnick, P., "Internet Message Format", RFC 2822, April
- 2001.
+ [RFC2822] Resnick, P., "Internet Message Format", RFC 2822,
+ April 2001.
[RFC3513] Hinden, R. and S. Deering, "Internet Protocol Version 6
(IPv6) Addressing Architecture", RFC 3513, April 2003.
+ [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration
+ Procedures for Message Header Fields", BCP 90, RFC 3864,
+ September 2004.
+
+ [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
+ Resource Identifier (URI): Generic Syntax", STD 66,
+ RFC 3986, January 2005.
+
13.2 Informative References
[RFC1034] Mockapetris, P., "Domain names - concepts and facilities",
STD 13, RFC 1034, November 1987.
- [RFC1983] Malkin, G., "Internet Users' Glossary", RFC 1983, August
- 1996.
-
- [RFC2162] Allocchio, C., "MaXIM-11 - Mapping between X.400 /
- Internet mail and Mail-11 mail", RFC 2162, January 1998.
+ [RFC1983] Malkin, G., "Internet Users' Glossary", RFC 1983,
+ August 1996.
[RFC3696] Klensin, J., "Application Techniques for Checking and
Transformation of Names", RFC 3696, February 2004.
@@ -1678,7 +1758,7 @@
Meng Weng Wong
Singapore
- EMail: mengwong+spf@pobox.com
+ Email: mengwong+spf@pobox.com
URI: http://spf.pobox.com/
@@ -1687,7 +1767,7 @@
Lincoln Nebraska, NE 68506
United States of America
- EMail: wayne@schlitt.net
+ Email: wayne@schlitt.net
URI: http://www.schlitt.net/spf/
Appendix A. Collected ABNF
@@ -1695,9 +1775,10 @@
fragments in the preceding text are to be resolved in favor of this
grammar.
- See [RFC2234] for ABNF notation. Please note that as per this ABNF
- definition, literal text strings (those in quotes) are
- case-insensitive. Hence, "mx" matches "mx", "MX", "mX" and "Mx".
+ See [I-D.crocker-abnf-rfc2234bis] for ABNF notation. Please note
+ that as per this ABNF definition, literal text strings (those in
+ quotes) are case-insensitive. Hence, "mx" matches "mx", "MX", "mX"
+ and "Mx".
record = version terms *SP
version = "v=spf1"
@@ -1737,42 +1818,47 @@
toplabel = ALPHA / ALPHA *[ alphanum / "-" ] alphanum
; LDH rule (See [RFC3696])
alphanum = ALPHA / DIGIT
- macro-string = *( macro-expand / macro-literal )
+
explain-string = *( macro-string / SP )
- macro-expand = ( "%{" macro-letter transformer *delimiter "}" )
+
+ macro-string = *( macro-expand / macro-literal )
+ macro-expand = ( "%{" macro-letter transformers *delimiter "}" )
/ "%%" / "%_" / "%-"
macro-literal = %x21-24 / %x26-7E
; visible characters except "%"
macro-letter = "s" / "l" / "o" / "d" / "i" / "p" / "h" /
"c" / "r" / "t"
- transformer = *DIGIT [ "r" ]
+ transformers = *DIGIT [ "r" ]
delimiter = "." / "-" / "+" / "," / "/" / "_" / "="
name = ALPHA *( ALPHA / DIGIT / "-" / "_" / "." )
- header = "Received-SPF:" [CFWS] result [CFWS]
+ header = "Received-SPF:" [CFWS] result [FWS [comment]]
[ key-value-list ]
- result = "Pass" / "Fail" / "TempError" / "SoftFail" /
- "Neutral" / "None" / "PermError"
+ result = "Pass" / "Fail" / "SoftFail" / "Neutral" /
+ "None" / "TempError" / "PermError"
key-value-list = key-value-pair *( ";" [CFWS] key-value-pair )
[";"]
- key-value-pair = name [CFWS] "=" ( dot-atom / quoted-string )
+ key-value-pair = key [CFWS] "=" ( dot-atom / quoted-string )
- dot-atom = ; unquoted word as per [RFC2822]
+ key = "client-ip" / "envelope-from" / "helo" /
+ "problem" / "receiver" /
+ 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]
Appendix B. Extended Examples
These examples are based on the following DNS setup:
; A domain with two mail servers, two hosts
; and two servers at the domain name
-
$ORIGIN example.com.
@ MX 10 mail-a
MX 20 mail-b
@@ -1785,13 +1871,11 @@
www CNAME example.com.
; A related domain
-
- $ORIGIN example.org
+ $ORIGIN example.org.
@ MX 10 mail-c
mail-c A 192.0.2.140
; The reverse IP for those addresses
-
$ORIGIN 2.0.192.in-addr.arpa.
10 PTR example.com.
11 PTR example.com.
@@ -1803,7 +1887,6 @@
; A rogue reverse IP domain that claims to be
; something it's not
-
$ORIGIN 0.0.10.in-addr.arpa.
4 PTR bob.example.com.
@@ -1813,6 +1896,7 @@
These examples show various possible published records for
example.com and which values if would cause check_host() to
return "Pass". Note that is "example.com".
+
v=spf1 +all
-- any passes
@@ -1835,10 +1919,10 @@
-- 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 IP is valid and in
- example.com)
- -- sending host 192.0.2.140 fails (reverse IP 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
@@ -1853,16 +1937,18 @@
This record would be used if mail from example.org actually came
through servers at example.com and example.net. Example.org's
- designated servers are the union of example.com and example.net's
+ designated servers are the union of example.com's and example.net's
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 updated when the mail setup
+ 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
@@ -1870,7 +1956,7 @@
Imagine that, in addition to the domain records listed above, there
are these:
- $Origin _spf.example.com.
+ $ORIGIN _spf.example.com.
mary.mobile-users A 127.0.0.2
fred.mobile-users A 127.0.0.2
15.15.168.192.joel.remote-users A 127.0.0.2
@@ -1931,7 +2017,7 @@
Copyright Statement
- Copyright (C) The Internet Society (2004). This document is subject
+ Copyright (C) The Internet Society (2005). This document is subject
to the rights, licenses and restrictions contained in BCP 78, and
except as set forth therein, the authors retain all their rights.
@@ -1944,5 +2030,5 @@
-Wong & Schlitt Expires June 30, 2005 [Page 48]
+Wong & Schlitt Expires November 4, 2005 [Page 49]