draft-ietf-spfbis-4408bis-08.txt   draft-ietf-spfbis-4408bis-09.txt 
Network Working Group S. Kitterman Network Working Group S. Kitterman
Internet-Draft Kitterman Technical Services Internet-Draft Kitterman Technical Services
Obsoletes: 4408 (if approved) October 22, 2012 Obsoletes: 4408 (if approved) January 10, 2013
Intended status: Standards Track Intended status: Standards Track
Expires: April 25, 2013 Expires: July 14, 2013
Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Sender Policy Framework (SPF) for Authorizing Use of Domains in Email,
Version 1 Version 1
draft-ietf-spfbis-4408bis-08.txt draft-ietf-spfbis-4408bis-09.txt
Abstract Abstract
Email on the Internet can be forged in a number of ways. In Email on the Internet can be forged in a number of ways. In
particular, existing protocols place no restriction on what a sending particular, existing protocols place no restriction on what a sending
host can use as the "MAIL FROM" of a message or the domain given on host can use as the "MAIL FROM" of a message or the domain given on
the SMTP HELO/EHLO commands. This document describes version 1 of the SMTP HELO/EHLO commands. This document describes version 1 of
the Sender Policy Framework (SPF) protocol, whereby an ADMD can the Sender Policy Framework (SPF) protocol, whereby an ADMD can
explicitly authorize the hosts that are allowed to use its domain explicitly authorize the hosts that are allowed to use its domain
names, and a receiving host can check such authorization. names, and a receiving host can check such authorization.
skipping to change at page 1, line 40 skipping to change at page 1, line 40
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 25, 2013. This Internet-Draft will expire on July 14, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2012 IETF Trust and the persons identified as the Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
skipping to change at page 3, line 8 skipping to change at page 3, line 8
Without obtaining an adequate license from the person(s) controlling Without obtaining an adequate license from the person(s) controlling
the copyright in such materials, this document may not be modified the copyright in such materials, this document may not be modified
outside the IETF Standards Process, and derivative works of it may outside the IETF Standards Process, and derivative works of it may
not be created outside the IETF Standards Process, except to format not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other it for publication as an RFC or to translate it into languages other
than English. than English.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 6 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1. Protocol Status . . . . . . . . . . . . . . . . . . . . . 6 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 6
1.2. Experimental History . . . . . . . . . . . . . . . . . . . 7 1.1.1. Keywords . . . . . . . . . . . . . . . . . . . . . . . 6
1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 7 1.1.2. Imported Definitions . . . . . . . . . . . . . . . . . 6
1.3.1. Keywords . . . . . . . . . . . . . . . . . . . . . . . 7 1.1.3. MAIL FROM Definition . . . . . . . . . . . . . . . . . 7
1.3.2. Imported Definitions . . . . . . . . . . . . . . . . . 7 1.1.4. HELO Definition . . . . . . . . . . . . . . . . . . . 7
1.3.3. Mail From Definition . . . . . . . . . . . . . . . . . 7 1.1.5. Deprecated . . . . . . . . . . . . . . . . . . . . . . 7
1.3.4. HELO Definition . . . . . . . . . . . . . . . . . . . 8 2. Operational Overview . . . . . . . . . . . . . . . . . . . . . 8
1.3.5. Deprecated . . . . . . . . . . . . . . . . . . . . . . 8 2.1. The "HELO" Identity . . . . . . . . . . . . . . . . . . . 8
2. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2. The "MAIL FROM" Identity . . . . . . . . . . . . . . . . . 8
2.1. The "HELO" Identity . . . . . . . . . . . . . . . . . . . 9 2.3. Publishing Authorization . . . . . . . . . . . . . . . . . 8
2.2. The "MAIL FROM" Identity . . . . . . . . . . . . . . . . . 9 2.4. Checking Authorization . . . . . . . . . . . . . . . . . . 9
2.3. Publishing Authorization . . . . . . . . . . . . . . . . . 9 2.5. Location of Checks . . . . . . . . . . . . . . . . . . . . 10
2.4. Checking Authorization . . . . . . . . . . . . . . . . . . 10 2.6. Results of Evaluation . . . . . . . . . . . . . . . . . . 10
2.5. Interpreting the Result . . . . . . . . . . . . . . . . . 11 2.6.1. None . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.5.1. None . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6.2. Neutral . . . . . . . . . . . . . . . . . . . . . . . 11
2.5.2. Neutral . . . . . . . . . . . . . . . . . . . . . . . 12 2.6.3. Pass . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.5.3. Pass . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6.4. Fail . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.5.4. Fail . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6.5. Softfail . . . . . . . . . . . . . . . . . . . . . . . 11
2.5.5. Softfail . . . . . . . . . . . . . . . . . . . . . . . 13 2.6.6. Temperror . . . . . . . . . . . . . . . . . . . . . . 11
2.5.6. Temperror . . . . . . . . . . . . . . . . . . . . . . 13 2.6.7. Permerror . . . . . . . . . . . . . . . . . . . . . . 11
2.5.7. Permerror . . . . . . . . . . . . . . . . . . . . . . 13 3. SPF Records . . . . . . . . . . . . . . . . . . . . . . . . . 12
3. SPF Records . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1. DNS Resource Records . . . . . . . . . . . . . . . . . . . 12
3.1. DNS Resource Records . . . . . . . . . . . . . . . . . . . 14 3.2. Multiple DNS Records . . . . . . . . . . . . . . . . . . . 13
3.2. Multiple DNS Records . . . . . . . . . . . . . . . . . . . 15 3.3. Multiple Strings in a Single DNS record . . . . . . . . . 13
3.3. Multiple Strings in a Single DNS record . . . . . . . . . 15 3.4. Record Size . . . . . . . . . . . . . . . . . . . . . . . 13
3.4. Record Size . . . . . . . . . . . . . . . . . . . . . . . 15 3.5. Wildcard Records . . . . . . . . . . . . . . . . . . . . . 13
3.5. Wildcard Records . . . . . . . . . . . . . . . . . . . . . 15 4. The check_host() Function . . . . . . . . . . . . . . . . . . 15
4. The check_host() Function . . . . . . . . . . . . . . . . . . 17 4.1. Arguments . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1. Arguments . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2. Results . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2. Results . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.3. Initial Processing . . . . . . . . . . . . . . . . . . . . 16
4.3. Initial Processing . . . . . . . . . . . . . . . . . . . . 17 4.4. Record Lookup . . . . . . . . . . . . . . . . . . . . . . 16
4.4. Record Lookup . . . . . . . . . . . . . . . . . . . . . . 18 4.5. Selecting Records . . . . . . . . . . . . . . . . . . . . 16
4.5. Selecting Records . . . . . . . . . . . . . . . . . . . . 18 4.6. Record Evaluation . . . . . . . . . . . . . . . . . . . . 17
4.6. Record Evaluation . . . . . . . . . . . . . . . . . . . . 18 4.6.1. Term Evaluation . . . . . . . . . . . . . . . . . . . 17
4.6.1. Term Evaluation . . . . . . . . . . . . . . . . . . . 19 4.6.2. Mechanisms . . . . . . . . . . . . . . . . . . . . . . 17
4.6.2. Mechanisms . . . . . . . . . . . . . . . . . . . . . . 19 4.6.3. Modifiers . . . . . . . . . . . . . . . . . . . . . . 18
4.6.3. Modifiers . . . . . . . . . . . . . . . . . . . . . . 20 4.6.4. DNS Lookup Limits . . . . . . . . . . . . . . . . . . 18
4.6.4. DNS Lookup Limits . . . . . . . . . . . . . . . . . . 20 4.7. Default Result . . . . . . . . . . . . . . . . . . . . . . 19
4.7. Default Result . . . . . . . . . . . . . . . . . . . . . . 21 4.8. Domain Specification . . . . . . . . . . . . . . . . . . . 19
4.8. Domain Specification . . . . . . . . . . . . . . . . . . . 21 5. Mechanism Definitions . . . . . . . . . . . . . . . . . . . . 21
5. Mechanism Definitions . . . . . . . . . . . . . . . . . . . . 22 5.1. "all" . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.1. "all" . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.2. "include" . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2. "include" . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3. "a" . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.3. "a" . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.4. "mx" . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.4. "mx" . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.5. "ptr" (deprecated) . . . . . . . . . . . . . . . . . . . . 24
5.5. "ptr" (deprecated) . . . . . . . . . . . . . . . . . . . . 25 5.6. "ip4" and "ip6" . . . . . . . . . . . . . . . . . . . . . 26
5.6. "ip4" and "ip6" . . . . . . . . . . . . . . . . . . . . . 27 5.7. "exists" . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.7. "exists" . . . . . . . . . . . . . . . . . . . . . . . . . 27 6. Modifier Definitions . . . . . . . . . . . . . . . . . . . . . 28
6. Modifier Definitions . . . . . . . . . . . . . . . . . . . . . 29 6.1. redirect: Redirected Query . . . . . . . . . . . . . . . . 28
6.1. redirect: Redirected Query . . . . . . . . . . . . . . . . 29 6.2. exp: Explanation . . . . . . . . . . . . . . . . . . . . . 29
6.2. exp: Explanation . . . . . . . . . . . . . . . . . . . . . 30 7. Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7. Recording The Result . . . . . . . . . . . . . . . . . . . . . 32 7.1. Macro Definitions . . . . . . . . . . . . . . . . . . . . 31
7.1. The Received-SPF Header Field . . . . . . . . . . . . . . 32 7.2. Expansion Examples . . . . . . . . . . . . . . . . . . . . 34
7.2. SPF Results in the Authentication-Results Header Field . . 34 8. Result Handling . . . . . . . . . . . . . . . . . . . . . . . 36
8. Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.1. None . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8.1. Macro Definitions . . . . . . . . . . . . . . . . . . . . 36 8.2. Neutral . . . . . . . . . . . . . . . . . . . . . . . . . 36
8.2. Expansion Examples . . . . . . . . . . . . . . . . . . . . 39 8.3. Pass . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9. Implications . . . . . . . . . . . . . . . . . . . . . . . . . 41 8.4. Fail . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.1. Sending Domains . . . . . . . . . . . . . . . . . . . . . 41 8.5. Softfail . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.1.1. DNS Resource Considerations . . . . . . . . . . . . . 41 8.6. Temperror . . . . . . . . . . . . . . . . . . . . . . . . 38
9.1.2. Administrator's Considerations . . . . . . . . . . . . 42 8.7. Permerror . . . . . . . . . . . . . . . . . . . . . . . . 38
9.1.3. Bounces . . . . . . . . . . . . . . . . . . . . . . . 43 9. Recording The Result . . . . . . . . . . . . . . . . . . . . . 39
9.2. Mediators . . . . . . . . . . . . . . . . . . . . . . . . 43 9.1. The Received-SPF Header Field . . . . . . . . . . . . . . 39
9.2.1. Mailing Lists . . . . . . . . . . . . . . . . . . . . 43 9.2. SPF Results in the Authentication-Results Header Field . . 41
9.2.2. Forwarding Services and Aliases . . . . . . . . . . . 44 10. Effects on Infrastructure . . . . . . . . . . . . . . . . . . 43
9.2.3. Mail Services . . . . . . . . . . . . . . . . . . . . 46 10.1. Sending Domains . . . . . . . . . . . . . . . . . . . . . 43
9.2.4. MTA Relays . . . . . . . . . . . . . . . . . . . . . . 46 10.1.1. DNS Resource Considerations . . . . . . . . . . . . . 43
9.3. Receivers . . . . . . . . . . . . . . . . . . . . . . . . 47 10.1.2. Administrator's Considerations . . . . . . . . . . . . 44
9.3.1. Policy For SPF Pass . . . . . . . . . . . . . . . . . 47 10.1.3. Bounces . . . . . . . . . . . . . . . . . . . . . . . 45
9.3.2. Policy For SPF Fail . . . . . . . . . . . . . . . . . 47 10.2. Receivers . . . . . . . . . . . . . . . . . . . . . . . . 45
9.3.3. Policy For SPF Permerror . . . . . . . . . . . . . . . 48 10.3. Mediators . . . . . . . . . . . . . . . . . . . . . . . . 46
10. Security Considerations . . . . . . . . . . . . . . . . . . . 49 10.3.1. Mailing Lists . . . . . . . . . . . . . . . . . . . . 46
10.1. Processing Limits . . . . . . . . . . . . . . . . . . . . 49 10.3.2. Forwarding Services and Aliases . . . . . . . . . . . 46
10.2. SPF-Authorized Email May Contain Other False Identities . 49 11. Security Considerations . . . . . . . . . . . . . . . . . . . 47
10.3. Spoofed DNS and IP Data . . . . . . . . . . . . . . . . . 50 11.1. Processing Limits . . . . . . . . . . . . . . . . . . . . 47
10.4. Cross-User Forgery . . . . . . . . . . . . . . . . . . . . 50 11.2. SPF-Authorized Email May Contain Other False Identities . 47
10.5. Untrusted Information Sources . . . . . . . . . . . . . . 50 11.3. Spoofed DNS and IP Data . . . . . . . . . . . . . . . . . 48
10.5.1. Recorded Results . . . . . . . . . . . . . . . . . . . 50 11.4. Cross-User Forgery . . . . . . . . . . . . . . . . . . . . 48
10.5.2. External Explanations . . . . . . . . . . . . . . . . 51 11.5. Untrusted Information Sources . . . . . . . . . . . . . . 48
10.5.3. Macro Expansion . . . . . . . . . . . . . . . . . . . 51 11.5.1. Recorded Results . . . . . . . . . . . . . . . . . . . 48
10.6. Privacy Exposure . . . . . . . . . . . . . . . . . . . . . 51 11.5.2. External Explanations . . . . . . . . . . . . . . . . 49
11. Contributors and Acknowledgements . . . . . . . . . . . . . . 52 11.5.3. Macro Expansion . . . . . . . . . . . . . . . . . . . 49
12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 53 11.6. Privacy Exposure . . . . . . . . . . . . . . . . . . . . . 49
12.1. The SPF DNS Record Type . . . . . . . . . . . . . . . . . 53 12. Contributors and Acknowledgements . . . . . . . . . . . . . . 50
12.2. The Received-SPF Mail Header Field . . . . . . . . . . . . 53 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 51
12.3. SPF Modifier Registration . . . . . . . . . . . . . . . . 53 13.1. The SPF DNS Record Type . . . . . . . . . . . . . . . . . 51
13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 54 13.2. The Received-SPF Mail Header Field . . . . . . . . . . . . 51
13.1. Normative References . . . . . . . . . . . . . . . . . . . 54 13.3. SPF Modifier Registration . . . . . . . . . . . . . . . . 51
13.2. Informative References . . . . . . . . . . . . . . . . . . 55 14. References . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 57 14.1. Normative References . . . . . . . . . . . . . . . . . . . 52
Appendix B. Extended Examples . . . . . . . . . . . . . . . . . . 60 14.2. Informative References . . . . . . . . . . . . . . . . . . 53
B.1. Simple Examples . . . . . . . . . . . . . . . . . . . . . 60 Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 55
B.2. Multiple Domain Example . . . . . . . . . . . . . . . . . 61 Appendix B. Extended Examples . . . . . . . . . . . . . . . . . . 58
B.3. DNSBL Style Example . . . . . . . . . . . . . . . . . . . 62 B.1. Simple Examples . . . . . . . . . . . . . . . . . . . . . 58
B.4. Multiple Requirements Example . . . . . . . . . . . . . . 62 B.2. Multiple Domain Example . . . . . . . . . . . . . . . . . 59
Appendix C. Change History . . . . . . . . . . . . . . . . . . . 63 B.3. DNSBL Style Example . . . . . . . . . . . . . . . . . . . 60
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 66 B.4. Multiple Requirements Example . . . . . . . . . . . . . . 60
Appendix C. Further Testing Advice . . . . . . . . . . . . . . . 61
Appendix D. Updating Mail Forwarders . . . . . . . . . . . . . . 62
Appendix E. Mail Services . . . . . . . . . . . . . . . . . . . . 64
Appendix F. MTA Relays . . . . . . . . . . . . . . . . . . . . . 65
Appendix G. Local Policy Considerations . . . . . . . . . . . . . 66
G.1. Policy For SPF Pass . . . . . . . . . . . . . . . . . . . 66
G.2. Policy For SPF Fail . . . . . . . . . . . . . . . . . . . 66
G.3. Policy For SPF Permerror . . . . . . . . . . . . . . . . . 67
Appendix H. Protocol Status . . . . . . . . . . . . . . . . . . . 68
Appendix I. Experimental History . . . . . . . . . . . . . . . . 69
Appendix J. Change History . . . . . . . . . . . . . . . . . . . 70
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 73
1. Introduction 1. Introduction
The current email infrastructure has the property that any host The current email infrastructure has the property that any host
injecting mail into the system can use any DNS domain name it wants injecting mail into the system can use any DNS domain name it wants
in each of the various identifiers specified by [RFC5321] and in each of the various identifiers specified by [RFC5321] and
[RFC5322]. Although this feature is desirable in some circumstances, [RFC5322]. Although this feature is desirable in some circumstances,
it is a major obstacle to reducing Unsolicited Bulk Email (UBE, aka it is a major obstacle to reducing Unsolicited Bulk Email (UBE, aka
spam). Furthermore, many domain owning ADMDs (ADministrative spam). Furthermore, many domain owning ADMDs (ADministrative
Management Domains, see [RFC5598]) are understandably concerned about Management Domains, see [RFC5598]) are understandably concerned about
skipping to change at page 6, line 33 skipping to change at page 6, line 33
"HELO" or "MAIL FROM" identity during a mail transaction. "HELO" or "MAIL FROM" identity during a mail transaction.
An additional benefit to mail receivers is that after the use of an An additional benefit to mail receivers is that after the use of an
identity is verified, local policy decisions about the mail can be identity is verified, local policy decisions about the mail can be
made based on the sender's domain, rather than the host's IP address. made based on the sender's domain, rather than the host's IP address.
This is advantageous because reputation of domain names is likely to This is advantageous because reputation of domain names is likely to
be more accurate than reputation of host IP addresses. Furthermore, be more accurate than reputation of host IP addresses. Furthermore,
if a claimed identity fails verification, local policy can take if a claimed identity fails verification, local policy can take
stronger action against such email, such as rejecting it. stronger action against such email, such as rejecting it.
1.1. Protocol Status 1.1. Terminology
SPF has been in development since the summer of 2003 and has seen
deployment beyond the developers beginning in December 2003. The
design of SPF slowly evolved until the spring of 2004 and has since
stabilized. There have been quite a number of forms of SPF, some
written up as documents, some submitted as Internet Drafts, and many
discussed and debated in development forums. The protocol was
originally defined in [RFC4408], which this document replaces.
[RFC4408] was designed to clearly document the protocol defined by
earlier draft specifications of SPF as used in existing
implementations. This updated specification is intended to clarify
identified ambiguities in [RFC4408], resolve techincal issues
identified in post-RFC 4408 deplyment experience, and document widely
deployed extensions to SPF that have been developed since [RFC4408]
was published.
1.2. Experimental History
This document updates and replaces RFC 4408 that was part of a group
of simultaneously published Experimental RFCs (RFC 4405, RFC 4406,
RFC 4407, and RFC 4408) in 2006. At that time the IESG requested the
community observe the success or failure of the two approaches
documented in these RFCs during the two years following publication,
in order that a community consensus could be reached in the future.
SPF is widely deployed by large and small email providers alike.
There are multiple, interoperable implementations.
For SPF (as documented in RFC 4408) a careful effort was made to
collect and document lessons learned and errata during the two year
period. The errata list has been stable (no new submissions) and
only minor protocol lessons learned were identified. Resolution of
the IESG's experiment is documented in [RFC6686].
1.3. Terminology
1.3.1. Keywords 1.1.1. Keywords
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in "OPTIONAL" in this document are to be interpreted as described in
[RFC2119]. [RFC2119].
1.3.2. Imported Definitions 1.1.2. Imported Definitions
The ABNF tokens "ALPHA", "DIGIT", and "SP" are defined in [RFC5234]. The ABNF tokens "ALPHA", "DIGIT", and "SP" are defined in [RFC5234].
The token "local-part" is defined in [RFC5321]. The token "local-part" is defined in [RFC5321].
"dot-atom", "quoted-string", "comment", "CFWS", "FWS", and "CRLF" are "dot-atom", "quoted-string", "comment", "CFWS", "FWS", and "CRLF" are
defined in [RFC5322]. defined in [RFC5322].
1.3.3. Mail From Definition 1.1.3. MAIL FROM Definition
This document is concerned with the portion of a mail message This document is concerned with the portion of a mail message
commonly called "envelope sender", "return path", "reverse path", commonly called "envelope sender", "return path", "reverse path",
"bounce address", "5321 FROM", "MAIL FROM", or RFC5321.MailFrom. "bounce address", "5321 FROM", "MAIL FROM", or RFC5321.MailFrom.
Since these terms are either not well defined or often used casually, Since these terms are either not well defined or often used casually,
this document uses "MAIL FROM" for consistency. This means the this document uses "MAIL FROM" for consistency. This means the
RFC5321.MailFrom as defined in [RFC5598]. Note that other terms that RFC5321.MailFrom as defined in [RFC5598]. Note that other terms that
might superficially look like the common terms, such as "reverse- might superficially look like the common terms, such as "reverse-
path", are used only with the defined meanings from normative path", are used only with the defined meanings from normative
documents. documents.
1.3.4. HELO Definition 1.1.4. HELO Definition
This document also makes use of the HELO/EHLO identity. The "HELO" This document also makes use of the HELO/EHLO identity. The "HELO"
identity derives from either the SMTP HELO or EHLO command (see identity derives from either the SMTP HELO or EHLO command (see
[RFC5321]). Since HELO and EHLO can, in many cases, be used [RFC5321]). Since HELO and EHLO can, in many cases, be used
interchangeably, they are identified commonly as "HELO" in this interchangeably, they are identified commonly as "HELO" in this
document. This means RFC5321.HELO/.EHLO as defined in [RFC5598]. document. This means RFC5321.HELO/.EHLO as defined in [RFC5598].
These commands supply the identity of the SMTP client (sending host) These commands supply the identity of the SMTP client (sending host)
for the SMTP session. for the SMTP session.
1.3.5. Deprecated 1.1.5. Deprecated
There are [RFC4408] features that are marked "deprecated". In the There are [RFC4408] features that are marked "deprecated". In the
context of this document, deprecated means that senders SHOULD NOT context of this document, deprecated means that senders SHOULD NOT
publish SPF records that make use of such features because they might publish SPF records that make use of such features because they might
be removed entirely in future updates to the protocol. Such features be removed entirely in future updates to the protocol. Such features
do, however, remain part of the SPF protocol and receiving systems do, however, remain part of the SPF protocol and receiving systems
MUST support them unless this document explicitly says otherwise. MUST support them unless this document explicitly says otherwise.
2. Operation [List of deprecated features to be added here]
2. Operational Overview
2.1. The "HELO" Identity 2.1. The "HELO" Identity
It is RECOMMENDED that SPF verifiers not only check the "MAIL FROM" It is RECOMMENDED that SPF verifiers not only check the "MAIL FROM"
identity, but also separately check the "HELO" identity by applying identity, but also separately check the "HELO" identity by applying
the check_host() function (Section 4) to the "HELO" identity as the the check_host() function (Section 4) to the "HELO" identity as the
<sender>. Checking "HELO" promotes consistency of results and can <sender>. Checking "HELO" promotes consistency of results and can
reduce DNS resource usage. Additionally, since SPF records published reduce DNS resource usage. Additionally, since SPF records published
for "HELO" identities refer to a single host, when available, they for "HELO" identities refer to a single host, when available, they
are a very reliable source of host authorization status. are a very reliable source of host authorization status.
skipping to change at page 9, line 52 skipping to change at page 8, line 52
names in the "HELO" and "MAIL FROM" identities by the MTAs specified names in the "HELO" and "MAIL FROM" identities by the MTAs specified
therein. therein.
SPF results can be used to make both positive (source is authorized) SPF results can be used to make both positive (source is authorized)
and negative (source is not authorized) determinations. If domain and negative (source is not authorized) determinations. If domain
owners choose to publish SPF records and want to support receivers owners choose to publish SPF records and want to support receivers
making negative authorization determinations, then they MUST publish making negative authorization determinations, then they MUST publish
records that end in "-all", or redirect to other records that do, records that end in "-all", or redirect to other records that do,
otherwise, no definitive determination of authorization can be made. otherwise, no definitive determination of authorization can be made.
Potential issues and mitigations associated with negative Potential issues and mitigations associated with negative
determinations are discussed in Section 9. determinations are discussed in Section 10.
ADMDs can publish SPF records that explicitly authorize no hosts for ADMDs can publish SPF records that explicitly authorize no hosts for
domain names that are neither used in the domain part of email domain names that are neither used in the domain part of email
addresses nor expected to originate mail. addresses nor expected to originate mail.
When changing SPF records, care has to be taken to ensure that there When changing SPF records, care has to be taken to ensure that there
is a transition period so that the old policy remains valid until all is a transition period so that the old policy remains valid until all
legitimate email can reasonably expect to have been checked. This legitimate email can reasonably expect to have been checked. This
can be as much as 30 days. can be as much as 30 days.
skipping to change at page 10, line 28 skipping to change at page 9, line 28
to emit mail with a given identity. Typically, such checks are done to emit mail with a given identity. Typically, such checks are done
by a receiving MTA, but can be performed elsewhere in the mail by a receiving MTA, but can be performed elsewhere in the mail
processing chain so long as the required information is available and processing chain so long as the required information is available and
reliable. At least the "MAIL FROM" identity MUST be checked, but it reliable. At least the "MAIL FROM" identity MUST be checked, but it
is RECOMMENDED that the "HELO" identity also be checked beforehand. is RECOMMENDED that the "HELO" identity also be checked beforehand.
Without explicit approval of the domain owner, checking other Without explicit approval of the domain owner, checking other
identities against SPF version 1 records is NOT RECOMMENDED because identities against SPF version 1 records is NOT RECOMMENDED because
there are cases that are known to give incorrect results. For there are cases that are known to give incorrect results. For
example, almost all mailing lists rewrite the "MAIL FROM" identity example, almost all mailing lists rewrite the "MAIL FROM" identity
(see Section 9.2.1), but some do not change any other identities in (see Section 10.3.1), but some do not change any other identities in
the message. The scenario described in Section 9.2.2, sub-section the message. The scenario described in Section 10.3.2, sub-section
1.2, is another example. Documents that define other identities will 1.2, is another example. Documents that define other identities will
have to define the method for explicit approval. have to define the method for explicit approval.
It is possible that mail receivers will use the SPF check as part of 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 a larger set of tests on incoming mail. The results of other tests
might influence whether or not a particular SPF check is performed. might influence whether or not a particular SPF check is performed.
For example, finding the sending host's IP address on a local white For example, finding the sending host's IP address on a local white
list might cause all other tests to be skipped and all mail from that list might cause all other tests to be skipped and all mail from that
host to be accepted. host to be accepted.
skipping to change at page 11, line 12 skipping to change at page 10, line 12
To make the test, the mail receiver MUST evaluate the check_host() To make the test, the mail receiver MUST evaluate the check_host()
function with the arguments set as follows: function with the arguments set as follows:
<ip> - the IP address of the SMTP client that is emitting the <ip> - the IP address of the SMTP client that is emitting the
mail, either IPv4 or IPv6. mail, either IPv4 or IPv6.
<domain> - the domain portion of the "MAIL FROM" or "HELO" identity. <domain> - the domain portion of the "MAIL FROM" or "HELO" identity.
<sender> - the "MAIL FROM" or "HELO" identity. <sender> - the "MAIL FROM" or "HELO" identity.
Note that the <domain> argument might 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 cases, check_host() is defined in Section 4.3 to return a
"none" result.
Although invalid, malformed, or non-existent domains cause SPF checks Although invalid, malformed, or non-existent domains cause SPF checks
to return "none" because no SPF record can be found, it has long been to return "none" because no SPF record can be found, it has long been
the policy of many MTAs to reject email from such domains, especially the policy of many MTAs to reject email from such domains, especially
in the case of invalid "MAIL FROM". Rejecting email will prevent one in the case of invalid "MAIL FROM". Rejecting email will prevent one
method of circumventing of SPF records. method of circumventing of SPF records.
Implementations have to take care to correctly extract the <domain> Implementations have to take care to correctly extract the <domain>
from the data given with the SMTP MAIL FROM command as many MTAs will from the data given with the SMTP MAIL FROM command as many MTAs will
still accept such things as source routes (see [RFC5321], Appendix still accept such things as source routes (see [RFC5321], Appendix
C), the %-hack (see [RFC1123]), and bang paths (see [RFC1983]). C), the %-hack (see [RFC1123]), and bang paths (see [RFC1983]).
These archaic features have been maliciously used to bypass security These archaic features have been maliciously used to bypass security
systems. systems.
2.5. Interpreting the Result 2.5. Location of Checks
This section describes how software that performs the authorization The authorization check SHOULD be performed during the processing of
interprets the results of the check_host() function. The the SMTP transaction that sends the mail. This allows errors to be
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 MTA by way of SMTP replies. returned directly to the sending MTA by way of SMTP replies.
Performing the authorization other than using the return-path and Performing the authorization other than using the return-path and
client address at the time of the MAIL command during the SMTP client address at the time of the MAIL command during the SMTP
transaction can cause problems, such as the following: (1) It might transaction can cause problems, such as the following: (1) It might
be difficult to accurately extract the required information from be difficult to accurately extract the required information from
potentially deceptive headers; (2) legitimate email might fail potentially deceptive headers; (2) legitimate email might fail
because the sender's policy had since changed. because the sender's policy had since changed.
Generating non-delivery notifications to forged identities that have Generating non-delivery notifications to forged identities that have
failed the authorization check is a source of backscatter and SHOULD failed the authorization check is a source of backscatter and SHOULD
be avoided. [RFC3834] section 2 describes backscatter and the be avoided. Section 2 of [RFC3834] describes backscatter and the
problems it causes. problems it causes.
2.5.1. None 2.6. Results of Evaluation
Section 4 defines check_host(), a model function definition that uses
the inputs defined above and the sender's policy published in the DNS
to reach a conclusion about client authorization. An SPF verifier
implements something semantically identical to the function defined
there.
This section enumerates and briefly defines the possible outputs of
that function. Information about how to handle these outpus is in
Section 8
2.6.1. None
A result of "none" means either (a) no syntactically valid DNS domain A result of "none" means either (a) no syntactically valid DNS domain
name was extracted from the SMTP session that could be used as the name was extracted from the SMTP session that could be used as the
one to be authorized, or (b) no TXT records were retrieved from the one to be authorized, or (b) no TXT records were retrieved from the
DNS that appeared to be intended for use by SPF verifiers. DNS that appeared to be intended for use by SPF verifiers.
2.5.2. Neutral 2.6.2. Neutral
The domain owner has explicitly stated that they cannot or do not The domain owner has explicitly stated that it is not asserting if
want to assert whether the IP address is authorized or not. A the IP address is authorized. This result MUST be treated exactly
"neutral" result MUST be treated exactly like the "none" result; the like the "none" result; the distinction exists only for informational
distinction exists only for informational purposes. Treating purposes.
"neutral" more harshly than "none" would discourage domain owners
from testing the use of SPF records (see Section 9.1).
2.5.3. Pass 2.6.3. Pass
A "pass" result means that the client is authorized to inject mail A "pass" result means that the client is authorized to inject mail
with the given identity. The domain can now, in the sense of with the given identity. The domain can now, in the sense of
reputation, be considered responsible for sending the message. reputation, be considered responsible for sending the message.
Further policy checks can now proceed with confidence in the Further policy checks can now proceed with confidence in the
legitimate use of the identity. This is further discussed in legitimate use of the identity. This is further discussed in
Section 9.3.1. Appendix G.1.
2.5.4. Fail 2.6.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. Disposition of authorized to use the domain in the given identity.
SPF fail messages is a matter of local policy. See Section 9.3.2 for
considerations on developing local policy.
If the checking software chooses to reject the mail during the SMTP
transaction, then it SHOULD use an SMTP reply code of 550 (see
[RFC5321]) and, if supported, the 5.7.1 enhanced status code (see
[RFC3463]), in addition to an appropriate reply text. The
check_host() function will return either a default explanation string
or one from the domain that published the SPF records (see
Section 6.2). If the information does not originate with the
checking software, it is good to make it clear 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
If the checking software chooses not to reject the mail during the
SMTP transaction, then it SHOULD add a Received-SPF or
Authentication-Results header field (see Section 7) to communicate
this result to downstream message processors. While this is true for
all SPF results, it is of particular importance for "fail" results
since the message is explicitly not authorized by the domain owner.
2.5.5. Softfail
A "softfail" result ought to be treated as somewhere between "fail" 2.6.5. Softfail
and "neutral"/"none". The domain owner believes the host is not
authorized but is not willing to make a strong policy statement.
Receiving software SHOULD NOT reject the message based solely on this
result, but MAY subject the message to closer scrutiny than normal.
The domain owner wants to discourage the use of this host and thus The domain owner has published a weak statement that the host is
desires limited feedback when a "softfail" result occurs. For probably not authorized. It has not published a stronger, more
example, the recipient's Mail User Agent (MUA) could highlight the definitive policy that results in a "fail"
"softfail" status, or the receiving MTA could give the sender a
message using greylisting, [RFC6647], with a note the first time the
message is received, but accept it on a later attempt based on
receiver policy.
2.5.6. Temperror 2.6.6. Temperror
A "temperror" result means the SPF verifier encountered a transient A "temperror" result means the SPF verifier encountered a transient
(generally DNS) error while performing the check. Checking software (generally DNS) error while performing the check.
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 enhanced status code. These errors can be caused by problems
in either the sender's or receiver's DNS software.
2.5.7. Permerror 2.6.7. Permerror
A "permerror" result means the domain's published records could not A "permerror" result means the domain's published records could not
be correctly interpreted. This signals an error condition that be correctly interpreted. This signals an error condition that
definitely requires manual intervention to be resolved. If the definitely requires manual intervention to be resolved.
message is rejected during the SMTP transaction for this reason, the
software SHOULD use an SMTP reply code of 550 and, if supported, the
5.5.2 enhanced status code. 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. It is also possible
that this result is generated by certain SPF clients due to the input
arguments having an unexpected format; see Section 4.8.
3. SPF Records 3. SPF Records
An SPF record is a DNS record that declares which hosts are, and are An SPF record is a DNS record that declares which hosts are, and are
not, authorized to use a domain name for the "HELO" and "MAIL FROM" not, authorized to use a domain name for the "HELO" and "MAIL FROM"
identities. Loosely, the record partitions all hosts into permitted identities. Loosely, the record partitions all hosts into permitted
and not-permitted sets (though some hosts might fall into neither and not-permitted sets (though some hosts might fall into neither
category). category).
The SPF record is a single string of text. The record format is The SPF record is a single string of text. The record format is
skipping to change at page 14, line 39 skipping to change at page 12, line 39
smtp-out.example.com. TXT "v=spf1 a -all" smtp-out.example.com. TXT "v=spf1 a -all"
Since TXT records have multiple uses, beware of other TXT records Since TXT records have multiple uses, beware of other TXT records
published there for other purposes. They might cause problems with published there for other purposes. They might cause problems with
size limits (see Section 3.4) and care has to be taken to ensure only size limits (see Section 3.4) and care has to be taken to ensure only
SPF records are used for SPF processing. SPF records are used for SPF processing.
ADMDs publishing SPF records SHOULD try to keep the number of ADMDs publishing SPF records SHOULD try to keep the number of
"include" mechanisms and chained "redirect" modifiers to a minimum. "include" mechanisms and chained "redirect" modifiers to a minimum.
ADMDs SHOULD also try to minimize the amount of other DNS information ADMDs SHOULD also try to minimize the amount of other DNS information
needed to evaluate a record. Section 4.6.4 and Section 9.1.1 provide needed to evaluate a record. Section 4.6.4 and Section 10.1.1
some suggestions on how to achieve this. provide some suggestions on how to achieve this.
3.1. DNS Resource Records 3.1. DNS Resource Records
SPF records MUST be published as a DNS TXT (type 16) Resource Record SPF records MUST be published as a DNS TXT (type 16) Resource Record
(RR) [RFC1035] only. The character content of the record is encoded (RR) [RFC1035] only. The character content of the record is encoded
as [US-ASCII]. Use of alternate DNS RR types was supported in SPF's as [US-ASCII]. Use of alternate DNS RR types was supported in SPF's
experimental phase, but has been discontinued. See Appendix A of experimental phase, but has been discontinued. See Appendix A of
[RFC6686] for further information. [RFC6686] for further information.
3.2. Multiple DNS Records 3.2. Multiple DNS Records
skipping to change at page 15, line 21 skipping to change at page 13, line 21
3.3. Multiple Strings in a Single DNS record 3.3. Multiple Strings in a Single DNS record
As defined in [RFC1035] sections 3.3.14 and 3.3, a single text DNS As defined in [RFC1035] sections 3.3.14 and 3.3, a single text DNS
record can be composed of more than one string. If a published record can be composed of more than one string. If a published
record contains multiple character-strings, then the record MUST be record contains multiple character-strings, then the record MUST be
treated as if those strings are concatenated together without adding treated as if those strings are concatenated together without adding
spaces. For example: spaces. For example:
IN TXT "v=spf1 .... first" "second string..." IN TXT "v=spf1 .... first" "second string..."
MUST be treated as equivalent to MUST be treated as equivalent to:
IN TXT "v=spf1 .... firstsecond string..." IN TXT "v=spf1 .... firstsecond string..."
TXT records containing multiple strings are useful in constructing TXT records containing multiple strings are useful in constructing
records that would exceed the 255-byte maximum length of a character- records that would exceed the 255-byte maximum length of a character-
string within a single TXT record. string within a single TXT record.
3.4. Record Size 3.4. Record Size
The published SPF record for a given domain name SHOULD remain small The published SPF record for a given domain name SHOULD remain small
skipping to change at page 17, line 35 skipping to change at page 15, line 35
<ip> - the IP address of the SMTP client that is emitting the <ip> - the IP address of the SMTP client that is emitting the
mail, either IPv4 or IPv6. mail, either IPv4 or IPv6.
<domain> - the domain that provides the sought-after authorization <domain> - the domain that provides the sought-after authorization
information; initially, the domain portion of the "MAIL information; initially, the domain portion of the "MAIL
FROM" or "HELO" identity. FROM" or "HELO" identity.
<sender> - the "MAIL FROM" or "HELO" identity. <sender> - the "MAIL FROM" or "HELO" identity.
The domain portion of <sender> will usually be the same as the For recursive evaluations, the domain portion of <sender> might not
<domain> argument when check_host() is initially evaluated. However, be the same as the <domain> argument when check_host() is initially
this will generally not be true for recursive evaluations (see evaluated. In most other cases it will be the same. (See
Section 5.2 below). Section 5.2 below).
Note that the <domain> argument might 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 cases, check_host() is defined in Section 4.3 to return a
"none" result.
4.2. Results 4.2. Results
The function check_host() can return one of several results described 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 in Section 2.6. Based on the result, the action to be taken is
determined by the local policies of the receiver. determined by the local policies of the receiver. This is discussed
in Section 8
4.3. Initial Processing 4.3. Initial Processing
If the <domain> is malformed (e.g. label longer than 63 characters, If the <domain> is malformed (e.g. label longer than 63 characters,
zero-length label not at the end, etc.) or is not a fully qualified zero-length label not at the end, etc.) or is not a fully qualified
domain name, or if the DNS lookup returns "domain does not exist" domain name, or if the DNS lookup returns "domain does not exist"
(RCODE 3), check_host() immediately returns the result "none". (RCODE 3), check_host() immediately returns the result "none".
Properly formed domains are fully qualified email domains as Properly formed domains are fully qualified email domains as
described in [RFC5321] Section 2.3.5. Internationalized domain names described in [RFC5321] Section 2.3.5. Internationalized domain names
MUST be encoded as A-labels, as described in Section 2.3 of MUST be encoded as A-labels, as described in Section 2.3 of
skipping to change at page 21, line 26 skipping to change at page 19, line 32
For example: For example:
v=spf1 +mx -all v=spf1 +mx -all
or or
v=spf1 +mx redirect=_spf.example.com v=spf1 +mx redirect=_spf.example.com
4.8. Domain Specification 4.8. Domain Specification
Several of these mechanisms and modifiers have a domain-spec section. Several of these mechanisms and modifiers have a domain-spec section.
The domain-spec string is subject to macro expansion (see Section 8). The domain-spec string is subject to macro expansion (see Section 7).
The resulting string is the common presentation form of a fully- The resulting string is the common presentation form of a fully-
qualified DNS name: a series of labels separated by periods. This qualified DNS name: a series of labels separated by periods. This
domain is called the <target-name> in the rest of this document. domain is called the <target-name> in the rest of this document.
Note: The result of the macro expansion is not subject to any further Note: The result of the macro expansion is not subject to any further
escaping. Hence, this facility cannot produce all characters that escaping. Hence, this facility cannot produce all characters that
are legal in a DNS label (e.g., the control characters). However, are legal in a DNS label (e.g., the control characters). However,
this facility is powerful enough to express legal host names and this facility is powerful enough to express legal host names and
common utility labels (such as "_spf") that are used in DNS. common utility labels (such as "_spf") that are used in DNS.
skipping to change at page 23, line 27 skipping to change at page 22, line 27
"all" MUST be ignored. Any "redirect" modifier (Section 6.1) MUST be "all" MUST be ignored. Any "redirect" modifier (Section 6.1) MUST be
ignored when there is an "all" mechanism in the record. ignored when there is an "all" mechanism in the record.
5.2. "include" 5.2. "include"
include = "include" ":" domain-spec include = "include" ":" domain-spec
The "include" mechanism triggers a recursive evaluation of The "include" mechanism triggers a recursive evaluation of
check_host(). check_host().
1. The domain-spec is expanded as per Section 8. 1. The domain-spec is expanded as per Section 7.
2. Check_host() is evaluated with the resulting string as the 2. Check_host() is evaluated with the resulting string as the
<domain>. The <ip> and <sender> arguments remain the same as in <domain>. The <ip> and <sender> arguments remain the same as in
the current evaluation of check_host(). the current evaluation of check_host().
3. The recursive evaluation returns either match, not match, or an 3. The recursive evaluation returns either match, not match, or an
error. If it matches, then the appropriate result for the error. If it matches, then the appropriate result for the
include: mechanism is used (e.g. include or +include gives a include: mechanism is used (e.g. include or +include gives a
"pass" result and -include gives "fail). "pass" result and -include gives "fail).
skipping to change at page 27, line 48 skipping to change at page 26, line 48
5.7. "exists" 5.7. "exists"
This mechanism is used to construct an arbitrary domain name that is This mechanism is used to construct an arbitrary domain name that is
used for a DNS A record query. It allows for complicated schemes used for a DNS A record query. It allows for complicated schemes
involving arbitrary parts of the mail envelope to determine what is involving arbitrary parts of the mail envelope to determine what is
permitted. permitted.
exists = "exists" ":" domain-spec exists = "exists" ":" domain-spec
The domain-spec is expanded as per Section 8. The resulting domain The domain-spec is expanded as per Section 7. The resulting domain
name is used for a DNS A RR lookup. If any A record is returned, name is used for a DNS A RR lookup. If any A record is returned,
this mechanism matches. The lookup type is A even when the this mechanism matches. The lookup type is A even when the
connection type is IPv6. connection type is IPv6.
Domains can use this mechanism to specify arbitrarily complex Domains can use this mechanism to specify arbitrarily complex
queries. For example, suppose example.com publishes the record: queries. For example, suppose example.com publishes the record:
v=spf1 exists:%{ir}.%{l1r+-}._spf.%{d} -all v=spf1 exists:%{ir}.%{l1r+-}._spf.%{d} -all
The <target-name> might expand to The <target-name> might expand to
skipping to change at page 29, line 36 skipping to change at page 28, line 36
among records in a single ADMD. It is possible to control both among records in a single ADMD. It is possible to control both
authorized hosts and policy for an arbitrary number of domains from a authorized hosts and policy for an arbitrary number of domains from a
single record. single record.
redirect = "redirect" "=" domain-spec redirect = "redirect" "=" domain-spec
If all mechanisms fail to match, and a "redirect" modifier is If all mechanisms fail to match, and a "redirect" modifier is
present, then processing proceeds as follows: present, then processing proceeds as follows:
The domain-spec portion of the redirect section is expanded as per The domain-spec portion of the redirect section is expanded as per
the macro rules in Section 8. Then check_host() is evaluated with the macro rules in Section 7. Then check_host() is evaluated with
the resulting string as the <domain>. The <ip> and <sender> the resulting string as the <domain>. The <ip> and <sender>
arguments remain the same as in the current evaluation of arguments remain the same as in the current evaluation of
check_host(). check_host().
The result of this new evaluation of check_host() is then considered The result of this new evaluation of check_host() is then considered
the result of the current evaluation with the exception that if no the result of the current evaluation with the exception that if no
SPF record is found, or if the target-name is malformed, the result SPF record is found, or if the target-name is malformed, the result
is a "permerror" rather than "none". is a "permerror" rather than "none".
Note that the newly-queried domain can itself specify redirect Note that the newly-queried domain can itself specify redirect
skipping to change at page 30, line 33 skipping to change at page 29, line 33
6.2. exp: Explanation 6.2. exp: Explanation
explanation = "exp" "=" domain-spec explanation = "exp" "=" domain-spec
If check_host() results in a "fail" due to a mechanism match (such as If check_host() results in a "fail" due to a mechanism match (such as
"-all"), and the "exp" modifier is present, then the explanation "-all"), and the "exp" modifier is present, then the explanation
string returned is computed as described below. If no "exp" modifier string returned is computed as described below. If no "exp" modifier
is present, then either a default explanation string or an empty is present, then either a default explanation string or an empty
explanation string MUST be returned. explanation string MUST be returned.
The domain-spec is macro expanded (see Section 8) and becomes the The domain-spec is macro expanded (see Section 7) and becomes the
<target-name>. The DNS TXT record for the <target-name> is fetched. <target-name>. The DNS TXT record for the <target-name> is fetched.
If there are any DNS processing errors (any RCODE other than 0), or If 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, 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 or if there are syntax errors in the explanation string, then proceed
as if no exp modifier was given. as if no exp modifier was given.
The fetched TXT record's strings are concatenated with no spaces, and The fetched TXT record's strings are concatenated with no spaces, and
then treated as an explain-string, which is macro-expanded. This then treated as an explain-string, which is macro-expanded. This
final result is the explanation string. Implementations MAY limit final result is the explanation string. Implementations MAY limit
skipping to change at page 31, line 6 skipping to change at page 30, line 6
protocol constraints and/or reasonable processing limits. Since the protocol constraints and/or reasonable processing limits. Since the
explanation string is intended for an SMTP response and [RFC5321] explanation string is intended for an SMTP response and [RFC5321]
Section 2.4 says that responses are in [US-ASCII], the explanation Section 2.4 says that responses are in [US-ASCII], the explanation
string MUST be limited to US-ASCII. string MUST be limited to US-ASCII.
Software evaluating check_host() can use this string to communicate Software evaluating check_host() can use this string to communicate
information from the publishing domain in the form of a short message information from the publishing domain in the form of a short message
or URL. Software SHOULD make it clear that the explanation string or URL. Software SHOULD make it clear that the explanation string
comes from a third party. For example, it can prepend the macro comes from a third party. For example, it can prepend the macro
string "%{o} explains: " to the explanation, such as shown in string "%{o} explains: " to the explanation, such as shown in
Section 2.5.4. Section 2.6.4.
Suppose example.com has this record: Suppose example.com has this record:
v=spf1 mx -all exp=explain._spf.%{d} v=spf1 mx -all exp=explain._spf.%{d}
Here are some examples of possible explanation TXT records at Here are some examples of possible explanation TXT records at
explain._spf.example.com: explain._spf.example.com:
"Mail from example.com should only be sent by its own servers." "Mail from example.com should only be sent by its own servers."
-- a simple, constant message -- a simple, constant message
skipping to change at page 32, line 5 skipping to change at page 31, line 5
"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 -- a complicated example that constructs a URL with the
arguments to check_host() so that a web page can be arguments to check_host() so that a web page can be
generated with detailed, custom instructions generated with detailed, custom instructions
Note: During recursion into an "include" mechanism, an exp= modifier Note: During recursion into an "include" mechanism, an exp= modifier
from the <target-name> MUST NOT be used. In contrast, when executing from the <target-name> MUST NOT be used. In contrast, when executing
a "redirect" modifier, an exp= modifier from the original domain MUST a "redirect" modifier, an exp= modifier from the original domain MUST
NOT be used. NOT be used.
7. Recording The Result 7. Macros
To provide downstream agents, such as MUAs, with the information they
might need in terms of evaluating or representing the apparent safety
of the message content, it is RECOMMENDED that SMTP receivers record
the result of SPF processing in the message header. For operators
that choose to record SPF results in the header of the message for
processing by internal filters or MUAs, two methods are presented.
Section 7.1 defines the Received-SPF field, which is the results
field originally defined for SPF use. Section 7.2 discusses
Authentication-Results [RFC5451] which was specified more recently
and is designed for use by SPF and other authentication methods.
Both are in common use, and hence both are included here. However,
it is important to note that they were designed to serve slightly
different purposes. Received-SPF is intended to include enough
forensic information to enable reconstruction of the SPF evaluation
of the message, while Authentication-Results is designed only to
relay the result itself and related output details of likely use to
end users (e.g., what property of the message was actually
authenticated and what it contained), leaving forensic work to the
purview of system logs and the Received field contents. Also,
Received-SPF relies on compliance of agents within the receiving ADMD
to adhere to the header field ordering rules of [RFC5321] and
[RFC5322], while Authentication-Results includes some provisions to
protect against non-compliant implementations.
An operator could choose to use both to serve different downstream
agents. In such cases, care needs to be taken to ensure both fields
are conveying the same details, or unexpected results can occur.
7.1. The Received-SPF Header Field
The Received-SPF header field is a trace field (see [RFC5322] Section
3.6.7) and SHOULD be prepended to the existing header, above the
Received: field that is generated by the SMTP receiver. It MUST
appear above all other Received-SPF fields in the message. The
header field has the following format:
header-field = "Received-SPF:" [CFWS] result FWS [comment FWS]
[ key-value-list ] CRLF
result = "pass" / "fail" / "softfail" / "neutral" /
"none" / "temperror" / "permerror"
key-value-list = key-value-pair *( ";" [CFWS] key-value-pair )
[";"]
key-value-pair = key [CFWS] "=" ( dot-atom / quoted-string )
key = "client-ip" / "envelope-from" / "helo" /
"problem" / "receiver" / "identity" /
mechanism / name
identity = "mailfrom" ; for the "MAIL FROM" identity
/ "helo" ; for the "HELO" identity
/ name ; other identities
dot-atom = <unquoted word as per [RFC5322]>
quoted-string = <quoted string as per [RFC5322]>
comment = <comment string as per [RFC5322]>
CFWS = <comment or folding white space as per [RFC5322]>
FWS = <folding white space as per [RFC5322]>
CRLF = <standard end-of-line token as per [RFC2532]>
The header field SHOULD include a "(...)" style comment after the
result, conveying supporting information for the result, such as
<ip>, <sender>, and <domain>.
The following key-value pairs are designed for later machine parsing.
SPF verifiers SHOULD give enough information so that the SPF results
can be verified. That is, at least "client-ip", "helo", and, if the
"MAIL FROM" identity was checked, "envelope-from".
client-ip the IP address of the SMTP client
envelope-from the envelope sender mailbox
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
receiver the host name of the SPF verifier
identity the identity that was checked; see the <identity> ABNF
rule
Other keys MAY be defined by SPF verifiers.
SPF verifiers MUST make sure that the Received-SPF header field does
not contain invalid characters, is not excessively long (See
[RFC5322] Section 2.1.1), and does not contain malicious data that
has been provided by the sender.
Examples of various header field styles that could be generated are
the following:
Received-SPF: pass (mybox.example.org: domain of
myname@example.com designates 192.0.2.1 as permitted sender)
receiver=mybox.example.org; client-ip=192.0.2.1;
envelope-from="myname@example.com"; 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)
identity=mailfrom; client-ip=192.0.2.1;
envelope-from="myname@example.com";
7.2. SPF Results in the Authentication-Results Header Field
As mentioned in Section 7, the Authentication-Results header field is
designed to communicate lists of tests a border MTA did and their
results. The specified elements of the field provide less
information than the SPF-Received field:
Authentication-Results: myhost.example.org; spf=pass
smtp.mailfrom=example.net
Received-SPF: pass (myhost.example.org: domain of
myname@example.com designates 192.0.2.1 as permitted sender)
receiver=mybox.example.org; client-ip=192.0.2.1;
envelope-from="myname@example.com"; helo=foo.example.com;
It is, however, possible to add CFWS in the "reason" part of an
Authentication-Results header field and provide the equivalent
information, if desired.
As an example, an expanded Authentication-Results header field might
look like (for a "MAIL FROM" check in this example):
Authentication-Results: myhost.example.org; spf=pass
reason="client-ip=192.0.2.1; smtp.helo=foo.example.com"
smtp.mailfrom=user@example.net
8. Macros
8.1. Macro Definitions 7.1. Macro Definitions
Many mechanisms and modifiers perform macro expansion on a term. Many mechanisms and modifiers perform macro expansion on a term.
domain-spec = macro-string domain-end domain-spec = macro-string domain-end
domain-end = ( "." toplabel [ "." ] ) / macro-expand domain-end = ( "." toplabel [ "." ] ) / macro-expand
toplabel = ( *alphanum ALPHA *alphanum ) / toplabel = ( *alphanum ALPHA *alphanum ) /
( 1*alphanum "-" *( alphanum / "-" ) alphanum ) ( 1*alphanum "-" *( alphanum / "-" ) alphanum )
; LDH rule plus additional TLD restrictions ; LDH rule plus additional TLD restrictions
; (see [RFC3696], Section 2 for background) ; (see [RFC3696], Section 2 for background)
skipping to change at page 39, line 12 skipping to change at page 34, line 12
powerful and allow per-user records to be published, they severely powerful and allow per-user records to be published, they severely
limit the ability of implementations to cache results of check_host() limit the ability of implementations to cache results of check_host()
and they reduce the effectiveness of DNS caches. and they reduce the effectiveness of DNS caches.
Note: If no directive processed during the evaluation of check_host() Note: If no directive processed during the evaluation of check_host()
contains an "s", "l", "o", or "h" macro, then the results of the contains an "s", "l", "o", or "h" macro, then the results of the
evaluation can be cached on the basis of <domain> and <ip> alone for evaluation can be cached on the basis of <domain> and <ip> alone for
as long as the shortest Time To Live (TTL) of all the DNS records as long as the shortest Time To Live (TTL) of all the DNS records
involved. involved.
8.2. Expansion Examples 7.2. Expansion Examples
The <sender> is strong-bad@email.example.com. The <sender> is strong-bad@email.example.com.
The IPv4 SMTP client IP is 192.0.2.3. The IPv4 SMTP client IP is 192.0.2.3.
The IPv6 SMTP client IP is 2001:DB8::CB01. The IPv6 SMTP client IP is 2001:DB8::CB01.
The PTR domain name of the client IP is mx.example.org. The PTR domain name of the client IP is mx.example.org.
macro expansion macro expansion
------- ---------------------------- ------- ----------------------------
%{s} strong-bad@email.example.com %{s} strong-bad@email.example.com
%{o} email.example.com %{o} email.example.com
skipping to change at page 41, line 5 skipping to change at page 36, line 5
3.2.0.192.in-addr.strong.lp._spf.example.com 3.2.0.192.in-addr.strong.lp._spf.example.com
%{d2}.trusted-domains.example.net %{d2}.trusted-domains.example.net
example.com.trusted-domains.example.net example.com.trusted-domains.example.net
IPv6: IPv6:
%{ir}.%{v}._spf.%{d2} 1.0.B.C.0.0.0.0. %{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 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 8. Result Handling
This section provides guidance for operators in response to the
various possible outputs of check_host() on a message. Terse
definitions of SPF results are presented in Section 2.6; this section
provides more detail on each for use in developing local policy for
message handling.
Every operating environment is different. There are some receivers
for whom strict adherence to SPF is appropriate, and definitive
treatment of messages that are evaluated to be explicity unauthorized
("fail" and sometimes "softfail") is the norm. There are others for
which the "false negative" cases are more of a concern. In these,
SPF reports "fail" for legitimate mail. This concern is typically
handled by merely recording the result in the header and allow the
message to pass. There are still others where SPF is one of several
inputs to the message handling decision. As such, there is no
normative requirement for message handling in response to any
particular result. This section is provided to present a complete
picture of the likely cause of each result, and where available, the
experience gained during experimental deployment.
There are essentially two classes of handling choices:
o Handling within the SMTP session that attempted to deliver the
message, such as by returning a permanent SMTP error (rejection)
or temporary SMTP error ("try again later");
o Permitting the message to pass (a successful SMTP reply code) and
adding an additional header field that indicates the result
returned by check_host() and other salient details; this is
discussed in more detail in Section 9.
8.1. None
With a "none" result, the SPF verifier has no information at all
about the authorization or lack thereof of the client to use the
checked idenity or identities. The check_host() function completed
without errors but was not able to reach any conclusion.
8.2. Neutral
A "neutral" result indicates that although a policy for the identity
was discovered, there is no definite assertion about the (positive or
negative) about the client.
A "neutral" result MUST be treated exactly like the "none" result;
the distinction exists only for informational purposes. Treating
"neutral" more harshly than "none" would discourage domain owners
from testing the use of SPF records (see Section 10.1).
8.3. Pass
A "pass" result means that the client is authorized to inject mail
with the given identity. The domain can now, in the sense of
reputation, be considered responsible for sending the message.
Further policy checks can now proceed with confidence in the
legitimate use of the identity. This is further discussed in
Appendix G.1.
8.4. Fail
A "fail" result is an explicit statement that the client is not
authorized to use the domain in the given identity. Disposition of
SPF fail messages is a matter of local policy. See Appendix G.2 for
considerations on developing local policy.
If the checking software chooses to reject the mail during the SMTP
transaction, then it SHOULD use an SMTP reply code of 550 (see
[RFC5321]) and, if supported, the 5.7.1 enhanced status code (see
[RFC3463]), in addition to an appropriate reply text. The
check_host() function will return either a default explanation string
or one from the domain that published the SPF records (see
Section 6.2). If the information does not originate with the
checking software, it is good to make it clear 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
If the checking software chooses not to reject the mail during the
SMTP transaction, then it SHOULD add a Received-SPF or
Authentication-Results header field (see Section 9) to communicate
this result to downstream message processors. While this is true for
all SPF results, it is of particular importance for "fail" results
since the message is explicitly not authorized by the domain owner.
8.5. Softfail
A "softfail" result ought to be treated as somewhere between "fail"
and "neutral"/"none". The domain owner believes the host is not
authorized but is not willing to make a strong policy statement.
Receiving software SHOULD NOT reject the message based solely on this
result, but MAY subject the message to closer scrutiny than normal.
The domain owner wants to discourage the use of this host and thus
desires limited feedback when a "softfail" result occurs. For
example, the recipient's Mail User Agent (MUA) could highlight the
"softfail" status, or the receiving MTA could give the sender a
message using greylisting, [RFC6647], with a note the first time the
message is received, but accept it on a later attempt based on
receiver policy.
8.6. Temperror
A "temperror" result means the SPF verifier encountered a transient
(generally DNS) error while 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 enhanced status code. These errors can be caused by problems
in either the sender's or receiver's DNS software.
8.7. Permerror
A "permerror" result means the domain's published records could not
be correctly interpreted. This signals an error condition that
definitely requires manual intervention to be resolved. If the
message is rejected during the SMTP transaction for this reason, the
software SHOULD use an SMTP reply code of 550 and, if supported, the
5.5.2 enhanced status code. Be aware that if the domain owner uses
macros (Section 7), it is possible that this result is due to the
checked identities having an unexpected format. It is also possible
that this result is generated by certain SPF clients due to the input
arguments having an unexpected format; see Section 4.8.
9. Recording The Result
To provide downstream agents, such as MUAs, with the information they
might need in terms of evaluating or representing the apparent safety
of the message content, it is RECOMMENDED that SMTP receivers record
the result of SPF processing in the message header. For operators
that choose to record SPF results in the header of the message for
processing by internal filters or MUAs, two methods are presented.
Section 9.1 defines the Received-SPF field, which is the results
field originally defined for SPF use. Section 9.2 discusses
Authentication-Results [RFC5451] which was specified more recently
and is designed for use by SPF and other authentication methods.
Both are in common use, and hence both are included here. However,
it is important to note that they were designed to serve slightly
different purposes. Received-SPF is intended to include enough
forensic information to enable reconstruction of the SPF evaluation
of the message, while Authentication-Results is designed only to
relay the result itself and related output details of likely use to
end users (e.g., what property of the message was actually
authenticated and what it contained), leaving forensic work to the
purview of system logs and the Received field contents. Also,
Received-SPF relies on compliance of agents within the receiving ADMD
to adhere to the header field ordering rules of [RFC5321] and
[RFC5322], while Authentication-Results includes some provisions to
protect against non-compliant implementations.
An operator could choose to use both to serve different downstream
agents. In such cases, care needs to be taken to ensure both fields
are conveying the same details, or unexpected results can occur.
9.1. The Received-SPF Header Field
The Received-SPF header field is a trace field (see [RFC5322] Section
3.6.7) and SHOULD be prepended to the existing header, above the
Received: field that is generated by the SMTP receiver. It MUST
appear above all other Received-SPF fields in the message. The
header field has the following format:
header-field = "Received-SPF:" [CFWS] result FWS [comment FWS]
[ key-value-list ] CRLF
result = "pass" / "fail" / "softfail" / "neutral" /
"none" / "temperror" / "permerror"
key-value-list = key-value-pair *( ";" [CFWS] key-value-pair )
[";"]
key-value-pair = key [CFWS] "=" ( dot-atom / quoted-string )
key = "client-ip" / "envelope-from" / "helo" /
"problem" / "receiver" / "identity" /
mechanism / name
identity = "mailfrom" ; for the "MAIL FROM" identity
/ "helo" ; for the "HELO" identity
/ name ; other identities
dot-atom = <unquoted word as per [RFC5322]>
quoted-string = <quoted string as per [RFC5322]>
comment = <comment string as per [RFC5322]>
CFWS = <comment or folding white space as per [RFC5322]>
FWS = <folding white space as per [RFC5322]>
CRLF = <standard end-of-line token as per [RFC2532]>
The header field SHOULD include a "(...)" style comment after the
result, conveying supporting information for the result, such as
<ip>, <sender>, and <domain>.
The following key-value pairs are designed for later machine parsing.
SPF verifiers SHOULD give enough information so that the SPF results
can be verified. That is, at least "client-ip", "helo", and, if the
"MAIL FROM" identity was checked, "envelope-from".
client-ip the IP address of the SMTP client
envelope-from the envelope sender mailbox
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
receiver the host name of the SPF verifier
identity the identity that was checked; see the <identity> ABNF
rule
Other keys MAY be defined by SPF verifiers.
SPF verifiers MUST make sure that the Received-SPF header field does
not contain invalid characters, is not excessively long (See
[RFC5322] Section 2.1.1), and does not contain malicious data that
has been provided by the sender.
Examples of various header field styles that could be generated are
the following:
Received-SPF: pass (mybox.example.org: domain of
myname@example.com designates 192.0.2.1 as permitted sender)
receiver=mybox.example.org; client-ip=192.0.2.1;
envelope-from="myname@example.com"; 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)
identity=mailfrom; client-ip=192.0.2.1;
envelope-from="myname@example.com";
9.2. SPF Results in the Authentication-Results Header Field
As mentioned in Section 9, the Authentication-Results header field is
designed to communicate lists of tests a border MTA did and their
results. The specified elements of the field provide less
information than the Received-SPF field:
Authentication-Results: myhost.example.org; spf=pass
smtp.mailfrom=example.net
Received-SPF: pass (myhost.example.org: domain of
myname@example.com designates 192.0.2.1 as permitted sender)
receiver=mybox.example.org; client-ip=192.0.2.1;
envelope-from="myname@example.com"; helo=foo.example.com;
It is, however, possible to add CFWS in the "reason" part of an
Authentication-Results header field and provide the equivalent
information, if desired.
As an example, an expanded Authentication-Results header field might
look like (for a "MAIL FROM" check in this example):
Authentication-Results: myhost.example.org; spf=pass
reason="client-ip=192.0.2.1; smtp.helo=foo.example.com"
smtp.mailfrom=user@example.net
10. Effects on Infrastructure
This section outlines the major implications that adoption of this This section outlines the major implications that adoption of this
document will have on various entities involved in Internet email. document will have on various entities involved in Internet email.
It is intended to make clear to the reader where this document It is intended to make clear to the reader where this document
knowingly affects the operation of such entities. This section is knowingly affects the operation of such entities. This section is
not a "how-to" manual, or a "best practices" document, and it is not not a "how-to" manual, or a "best practices" document, and it is not
a comprehensive list of what such entities SHOULD do in light of this a comprehensive list of what such entities SHOULD do in light of this
document. document.
This section is non-normative. [RFC5598] describes the Internet This section provides operational advice and instruction only. It is
email architecture. This section is organized based on the different non-normative.
segments of the architecture.
9.1. Sending Domains [RFC5598] describes the Internet email architecture. This section is
organized based on the different segments of the architecture.
10.1. Sending Domains
Originating ADMDs (ADministrative Management Domains - [RFC5598] Originating ADMDs (ADministrative Management Domains - [RFC5598]
Section 2.2.1 and Section 2.3) that wish to be compliant with this Section 2.2.1 and Section 2.3) that wish to be compliant with this
specification will need to determine the list of relays ([RFC5598] specification will need to determine the list of relays ([RFC5598]
Section 2.2.2) that they allow to use their domain name in the "HELO" Section 2.2.2) that they allow to use their domain name in the "HELO"
and "MAIL FROM" identities when relaying to other ADMDs. It is and "MAIL FROM" identities when relaying to other ADMDs. It is
recognized that forming such a list is not just a simple technical recognized that forming such a list is not just a simple technical
exercise, but involves policy decisions with both technical and exercise, but involves policy decisions with both technical and
administrative considerations. administrative considerations.
9.1.1. DNS Resource Considerations 10.1.1. DNS Resource Considerations
Minimizing the DNS resources required for SPF lookups can be done by Minimizing the DNS resources required for SPF lookups can be done by
choosing directives that require less DNS information and by placing choosing directives that require less DNS information and by placing
lower-cost mechanisms earlier in the SPF record. lower-cost mechanisms earlier in the SPF record.
+----------+--------+-----------------+ +----------+--------+-----------------+
| term | cost | limit | | term | cost | limit |
+----------+--------+-----------------+ +----------+--------+-----------------+
| ip4/ip6 | 0 | - | | ip4/ip6 | 0 | - |
| a | 1 | 10 | | a | 1 | 10 |
skipping to change at page 42, line 31 skipping to change at page 44, line 33
@ IN TXT "v=spf1 a:authorized-spf.example.com -all" @ IN TXT "v=spf1 a:authorized-spf.example.com -all"
authorized-spf IN A 192.0.2.1 authorized-spf IN A 192.0.2.1
IN A 192.0.2.129 IN A 192.0.2.129
Expensive record: Expensive record:
example.com. IN TXT "v=spf1 mx:example.com -all" example.com. IN TXT "v=spf1 mx:example.com -all"
Wasteful, bad record: Wasteful, bad record:
example.com. IN TXT "v=spf1 ip4:192.0.2.0/24 mx -all" example.com. IN TXT "v=spf1 ip4:192.0.2.0/24 mx -all"
9.1.2. Administrator's Considerations 10.1.2. Administrator's Considerations
There might be administrative considerations: using "a" over "ip4" or There might be administrative considerations: using "a" over "ip4" or
"ip6" allows hosts to be renumbered easily. Using "mx" over "a" "ip6" allows hosts to be renumbered easily. Using "mx" over "a"
allows the set of mail hosts to be changed easily. Unless such allows the set of mail hosts to be changed easily. Unless such
changes are common, it is better to use the less resource intensive changes are common, it is better to use the less resource intensive
mechanisms like "ip4" and "ip6" over "a" or "a" or "mx". mechanisms like "ip4" and "ip6" over "a" or "a" or "mx".
In some specific cases, standard advice on record content is In some specific cases, standard advice on record content is
appropriate. Publishing SPF records for domains that send no mail is appropriate. Publishing SPF records for domains that send no mail is
a well established best practice. The record for a domain that sends a well established best practice. The record for a domain that sends
skipping to change at page 42, line 47 skipping to change at page 45, line 4
mechanisms like "ip4" and "ip6" over "a" or "a" or "mx". mechanisms like "ip4" and "ip6" over "a" or "a" or "mx".
In some specific cases, standard advice on record content is In some specific cases, standard advice on record content is
appropriate. Publishing SPF records for domains that send no mail is appropriate. Publishing SPF records for domains that send no mail is
a well established best practice. The record for a domain that sends a well established best practice. The record for a domain that sends
no mail is: no mail is:
www.example.com. IN TXT "v=spf1 -all" www.example.com. IN TXT "v=spf1 -all"
Publishing SPF records for individual hosts is also best practice. Publishing SPF records for individual hosts is also best practice.
The hostname is generally the identity used in the 5321.HELO/.EHLO The hostname is generally the identity used in the 5321.HELO/.EHLO
command. In the case of messages with a null 5321.MailFrom, this is command. In the case of messages with a null 5321.MailFrom, this is
used as the domain for 5321.MailFrom SPF checks, in addition to being used as the domain for 5321.MailFrom SPF checks, in addition to being
used in 5321.HELO/.EHLO based SPF checks. The standard SPF record used in 5321.HELO/.EHLO based SPF checks. The standard SPF record
for an individual host that is involved in mail processing is: for an individual host that is involved in mail processing is:
relay.example.com. IN TXT "v=spf1 a -all" relay.example.com. IN TXT "v=spf1 a -all"
Validating correct deployment is difficult. [RFC6652] describes one Validating correct deployment is difficult. [RFC6652] describes one
mechanism for soliciting feedback on SPF failures. Another approach mechanism for soliciting feedback on SPF failures. Another
that can be helpful to publish records that include a "tracking suggestion can be found in Appendix C.
exists:" mechanism. By looking at the name server logs, a rough list
can then be generated. For example:
v=spf1 exists:_h.%{h}._l.%{l}._o.%{o}._i.%{i}._spf.%{d} ?all
Regardless of the method used, understanding the ADMD's outbound mail Regardless of the method used, understanding the ADMD's outbound mail
architecture is essential to effective deployment. architecture is essential to effective deployment.
9.1.3. Bounces 10.1.3. Bounces
As explained in Section 1.3.3, [RFC5321] allows the reverse-path to As explained in Section 1.1.3, [RFC5321] allows the reverse-path to
be null, which is typical of some Delivery Status Notification be null, which is typical of some Delivery Status Notification
[RFC3464], commonly called email bounces. In this case the only [RFC3464], commonly called email bounces. In this case the only
entity available for performing an SPF check is the "HELO" identity entity available for performing an SPF check is the "HELO" identity
defined in Section 1.3.4. SPF functionality is enhanced by defined in Section 1.1.4. SPF functionality is enhanced by
administrators ensuring this identity is set correctly and has an administrators ensuring this identity is set correctly and has an
appropriate SPF record. It is normal to have the HELO identity set appropriate SPF record. It is normal to have the HELO identity set
to hostname instead of domain. Zone file generation for significant to hostname instead of domain. Zone file generation for significant
numbers of hosts can be consolidated using the redirect modifier and numbers of hosts can be consolidated using the redirect modifier and
scripted for initial deployment. Specific deployment advice is given scripted for initial deployment. Specific deployment advice is given
above in Section 9.1.2. above in Section 10.1.2.
9.2. Mediators 10.2. Receivers
SPF results can be used in combination with other methods to
determine the final local disposition (either positive or negative of
a message. It can also be considered dispositive on its own.
An attempt to have one organization (sender) direct the email
handling policies of another (receiver) is inherently challenging and
often controversial. As stated elsewhere in this document, there is
no normative requirement for specific handling of a message based on
any SPF result. The information presented in Section 8 and in
Appendix G is offered for receiver consideration when forming local
handling policies.
The primary considerations are that SPF might return "pass" for mail
that is ultimately harmful (e.g., spammers that arrange for SPF to
pass using nonsense domain names, or virus or spam outbreaks from
within trusted sources), and might also return "fail" for mail that
is ultimately legitimate (e.g., legitimate mail that has traversed a
mail alias). It is important take both of these cases under
consideration when establishing local handling policy.
10.3. Mediators
Broadly speaking, there are two types of mediating ADMDs that can Broadly speaking, there are two types of mediating ADMDs that can
affect SPF deployment of other ADMDs: mailing lists (see [RFC5598] affect SPF deployment of other ADMDs: mailing lists (see [RFC5598]
Section 5.3) and ReSenders ([RFC5598] Section 5.2). Section 5.3) and ReSenders ([RFC5598] Section 5.2).
9.2.1. Mailing Lists 10.3.1. Mailing Lists
Mailing lists have to be aware of how they re-inject mail that is Mailing lists have to be aware of how they re-inject mail that is
sent to the list. Mailing lists MUST comply with the requirements in sent to the list. Mailing lists MUST comply with the requirements in
[RFC5321], Section 3.10, and [RFC1123], Section 5.3.6, that say that [RFC5321], Section 3.10, and [RFC1123], Section 5.3.6, that say that
the reverse-path MUST be changed to be the mailbox of a person or the reverse-path MUST be changed to be the mailbox of a person or
other entity who administers the list. Whereas the reasons for other entity who administers the list. Whereas the reasons for
changing the reverse-path are many and long-standing, SPF adds changing the reverse-path are many and long-standing, SPF adds
enforcement to this requirement. enforcement to this requirement.
In practice, almost all mailing list software in use already complies In practice, almost all mailing list software in use already complies
with this requirement. Mailing lists that do not comply might with this requirement. Mailing lists that do not comply might
encounter problems depending on how access to the list is restricted. encounter problems depending on how access to the list is restricted.
Such lists that are entirely internal to a domain (only people in the Such lists that are entirely internal to a domain (only people in the
domain can send to or receive from the list) are not affected. domain can send to or receive from the list) are not affected.
9.2.2. Forwarding Services and Aliases 10.3.2. Forwarding Services and Aliases
Forwarding services take mail that is received at a mailbox and Forwarding services take mail that is received at a mailbox and
direct it to some external mailbox. At the time of this writing, the 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 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 FROM" of a message when re-injecting it for delivery to the external
mailbox. [RFC1123] and [RFC5321] describe this action as an "alias" mailbox. [RFC1123] and [RFC5321] describe this action as an "alias"
rather than a "mail list". This means the external mailbox's MTA 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 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 service, and so the "MAIL FROM" identity will not, in general, pass
authorization. authorization.
There are three places that techniques can be used to ameliorate this Appendix D provides some operational suggestions to adapt these
problem. services to an SPF-aware environment.
1. The beginning, when email is first sent (Originating ADMDs).
1. "Neutral" results could be given for IP addresses that might
be forwarders, instead of "fail" results based on a list of
known reliable forwarders. For example:
"v=spf1 mx ?exists:%{ir}.whitlist.example.org -all"
This would cause a lookup on an DNS white list (DNSWL) and
cause a result of "fail" only for email not either coming
from the domain's mx host(s) (SPF pass) or white listed
sources (SPF neutral). This, in effect, outsources an
element of sender policy to the maintainer of the whitelist.
2. The "MAIL FROM" identity could have additional information in
the local-part 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 that validates the local-part.
Although this requires an extra DNS lookup, this happens only
when the email would otherwise be rejected as not coming from
a known good source.
Note that due to the 63-character limit for domain labels,
this approach only works reliably if the local-part signature
scheme is guaranteed either to only produce local-parts with
a maximum of 63 characters or to gracefully handle truncated
local-parts.
3. Similarly, a specialized DNS server could be set up that will
rate-limit the email coming from unexpected IP addresses.
"v=spf1 mx exists:%{ir}._spf_rate.%{d} -all"
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 email is forwarded (Mediating ADMDs).
1. Forwarding services can solve the problem by rewriting the
"MAIL FROM" to be in their own domain. This means mail
rejected from the external mailbox will have to be forwarded
back to the original sender 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.
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").
3. Forwarding servers could reject mail that would "fail" SPF if
forwarded using an SMTP reply code of 551, User not local,
(see [RFC5321] section 3.4) to communicate the correct target
address to resend the mail to.
3. The end, when email is received (Receiving ADMDs).
1. If the owner of the external mailbox wishes to trust the
forwarding service, he can direct the external mailbox's MTA
to skip SPF tests when the client host belongs to the
forwarding service.
2. Tests against other identities, such as the "HELO" identity,
MAY be used to override a failed test against the "MAIL FROM"
identity.
3. For larger domains, it might 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.2.3. Mail Services
MSPs (Mail Service Providers - [RFC5598] Section 2.3) that offer mail
services to third-party domains, such as sending of bulk mail, might
want to adjust their configurations in light of the authorization
check described in this document. If the domain part of the "MAIL
FROM" identity used for such email uses the domain of one of the MSPs
domain, then the provider needs only to ensure that its sending host
is authorized by its own SPF record, if any.
If the "MAIL FROM" identity does not use the MSP's domain, then extra
care has to 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 MSPs, such as ISPs, that have a wide
variety of customers using the same MTA, steps are required to
mitiate the risk of cross-customer forgery (see Section 10.4).
9.2.4. MTA Relays
Relays are described in [RFC5598] Section 2.2.2. The authorization
check generally precludes the use of arbitrary MTA relays between
sender and receiver of an email message.
Within an organization, MTA relays can be effectively deployed.
However, for purposes of this document, such relays are effectively
transparent. The SPF authorization check is a check between border
MTAs of different ADMDs.
For mail senders, this means that published SPF records have to
authorize any MTAs that actually send across the Internet. Usually,
these are just the border MTAs as internal MTAs simply forward mail
to these MTAs for relaying.
The receiving ADMD will generally want to perform the authorization
check at the boundary MTAs, including all secondary MXs. Internal
MTAs (including MTAs that might serve both as boundary MTAs and
internal relays from secondary MXs when they are processing the
relayed mail stream) then do not perform the authorization test. To
perform the authorization test other than at the boundary, the host
that first transferred the message to the receiving ADMD have to be
determined, which can be difficult to extract from the message header
because (a) header fields can be forged or malformed, and (b) there's
no standard way to encode that information such that it can be
reliably extracted. Testing other than at the boundary is likely to
produce unreliable results.
9.3. Receivers
SPF results can be used in combination with other methods to
determine the final local disposition (either positive or negative of
a message. It can also be considered dispositive on its own.
9.3.1. Policy For SPF Pass
SPF pass results can be used in combination with "white lists" of
known "good" domains to bypass some or all additional pre-delivery
email checks. Exactly which checks and how to determine appropriate
white list entries has to be based on local conditions and
requirements.
9.3.2. Policy For SPF Fail
SPF fail results can be used to reject messages during the SMTP
transaction based on either "MAIL FROM" or "HELO" identity results.
This reduces resource requirements for various content filtering
methods and conserves bandwidth since rejection can be done before
the SMTP content is transferred. It also gives immediate feedback to
the sender who might then be able to resolve the issue. Due to some
of the issues described above in this section (Section 9), SPF based
rejection does present some risk of rejecting legitimate email when
rejecting based on "MAIL FROM" results.
SPF fail results can alternately be used as one input into a larger
set of evaluations which might, based on a combination with other
evaluation techniques, result in the email being marked negatively in
some way (this might be via delivery to a special spam folder,
modifying subject lines, or other locally determined means).
Developing the details of such an approach have to be based on local
conditions and requirements. Using SPF results in this way does not
have the advantages of resource conservation and immediate feedback
to the sender associated with SMTP rejection, but could produce fewer
undesirable rejections in a well designed system. Such an approach
might result in email that was not authorized by the sending ADMD
being unknowingly delivered to end users.
Either general approach can be used as they both leave a clear
disposition of emails. They are either delivered in some manner or
the sender is notified of the failure. Other dispositions such as
"dropping" or deleting email after acceptance are inappropriate
because they leave uncertainty and reduce the overall reliabilility
and utility of email across the Internet.
9.3.3. Policy For SPF Permerror
The "permerror" result (see Section 2.5.7) indicates the SPF
processing module at the receiver determined that the retrieved SPF
policy record could not be interpreted. This gives no true
indication about the authorized use of the data found in the
envelope.
As with all results, implementers have a choice to make regarding
what to do with a message that yields this result. SMTP allows only
a few basic options.
Rejection of the message is an option, in that it is the one thing a
receiver can do to draw attention to the difficulty encountered while
protecting itself from messages that do not have a definite SPF
result of some kind. However, if the SPF implementation is defective
and returns spurious "permerror" results, only the sender is actively
notified of the defect (in the form of rejected mail), and not the
receiver making use of SPF.
The less intrusive handling choice is to deliver the message, perhaps
with some kind of annotation of the difficulty encountered and/or
logging of a similar nature. However, this will not be desirable to
operators that wish to implement SPF checking as strictly as
possible, nor is this sort of passive problem reporting typically
effective.
There is of course the option placing this choice in the hands of the
operator rather than the implementer since this kind of choice is
often a matter of local policy rather than a condition with a
universal solution, but this adds one more piece of complexity to an
already non-trivial environment.
Both implementers and operators need to be cautious of all choices
and outcomes when handling SPF results.
10. Security Considerations 11. Security Considerations
10.1. Processing Limits 11.1. Processing Limits
As with most aspects of email, there are a number of ways that As with most aspects of email, there are a number of ways that
malicious parties could use the protocol as an avenue for a malicious parties could use the protocol as an avenue for a
Denial-of-Service (DoS) attack. The processing limits outlined in Denial-of-Service (DoS) attack. The processing limits outlined in
Section 4.6.4 are designed to prevent attacks such as the following: Section 4.6.4 are designed to prevent attacks such as the following:
o A malicious party could create an SPF record with many references o A malicious party could create an SPF record with many references
to a victim's domain and send many emails to different SPF to a victim's domain and send many emails to different SPF
verifiers; those SPF verifiers would then create a DoS attack. In verifiers; those SPF verifiers would then create a DoS attack. In
effect, the SPF verifiers are being used to amplify the attacker's effect, the SPF verifiers are being used to amplify the attacker's
skipping to change at page 49, line 41 skipping to change at page 47, line 41
come from the intended target to a wide variety of legitimate mail come from the intended target to a wide variety of legitimate mail
hosts. These legitimate machines would then present a DNS load on hosts. These legitimate machines would then present a DNS load on
the target as they fetched the relevant records. the target as they fetched the relevant records.
Of these, the case of a third party referenced in the SPF record is 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, the easiest for a DoS attack to effectively exploit. As a result,
limits that might seem reasonable for an individual mail server can limits that might seem reasonable for an individual mail server can
still allow an unreasonable amount of bandwidth amplification. still allow an unreasonable amount of bandwidth amplification.
Therefore, the processing limits need to be quite low. Therefore, the processing limits need to be quite low.
10.2. SPF-Authorized Email May Contain Other False Identities 11.2. SPF-Authorized Email May Contain Other False Identities
Do not construe the "MAIL FROM" and "HELO" identity authorizations to Do not construe the "MAIL FROM" and "HELO" identity authorizations to
provide more assurance than they do. It is entirely possible for a provide more assurance than they do. It is entirely possible for a
malicious sender to inject a message using his own domain in the malicious sender to inject a message using his own domain in the
identities used by SPF, to have that domain's SPF record authorize identities used by SPF, to have that domain's SPF record authorize
the sending host, and yet the message can easily list other the sending host, and yet the message can easily list other
identities in its header. Unless the user or the MUA takes care to identities in its header. Unless the user or the MUA takes care to
note that the authorized identity does not match the other more note that the authorized identity does not match the other more
commonly-presented identities (such as the From: header field), the commonly-presented identities (such as the From: header field), the
user might be lulled into a false sense of security. user might be lulled into a false sense of security.
10.3. Spoofed DNS and IP Data 11.3. Spoofed DNS and IP Data
There are two aspects of this protocol that malicious parties could There are two aspects of this protocol that malicious parties could
exploit to undermine the validity of the check_host() function: exploit to undermine the validity of the check_host() function:
o 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 attacker could attack the DNS infrastructure and cause
check_host() to see spoofed DNS data, and then return incorrect check_host() to see spoofed DNS data, and then return incorrect
results. This could include returning "pass" for an <ip> value results. This could include returning "pass" for an <ip> value
where the actual domain's record would evaluate to "fail". See where the actual domain's record would evaluate to "fail". See
[RFC3833] for a description of DNS weaknesses. [RFC3833] for a description of DNS weaknesses.
o The client IP address, <ip>, is assumed to be correct. In a o The client IP address, <ip>, is assumed to be correct. In a
modern, correctly configured system the risk of this not being modern, correctly configured system the risk of this not being
true is nil. true is nil.
10.4. Cross-User Forgery 11.4. Cross-User Forgery
By definition, SPF policies just map domain names to sets of By definition, SPF policies just map domain names to sets of
authorized MTAs, not whole email addresses to sets of authorized authorized MTAs, not whole email addresses to sets of authorized
users. Although the "l" macro (Section 8) provides a limited way to users. Although the "l" macro (Section 7) provides a limited way to
define individual sets of authorized MTAs for specific email define individual sets of authorized MTAs for specific email
addresses, it is generally impossible to verify, through SPF, the use addresses, it is generally impossible to verify, through SPF, the use
of specific email addresses by individual users of the same MTA. of specific email addresses by individual users of the same MTA.
It is up to mail services and their MTAs to directly prevent It is up to mail services and their MTAs to directly prevent
cross-user forgery: based on SMTP AUTH ([RFC4954]), users have to be cross-user forgery: based on SMTP AUTH ([RFC4954]), users have to be
restricted to using only those email addresses that are actually restricted to using only those email addresses that are actually
under their control (see [RFC6409], Section 6.1). Another means to under their control (see [RFC6409], Section 6.1). Another means to
verify the identity of individual users is message cryptography such verify the identity of individual users is message cryptography such
as PGP ([RFC4880]) or S/MIME ([RFC5751]). as PGP ([RFC4880]) or S/MIME ([RFC5751]).
10.5. Untrusted Information Sources 11.5. Untrusted Information Sources
An SPF compliant receiver gathers information from the SMTP commands An SPF compliant receiver gathers information from the SMTP commands
it receives and from the published DNS records of the sending domain it receives and from the published DNS records of the sending domain
holder, (e.g., "HELO" domain name, the "MAIL FROM" address from the holder, (e.g., "HELO" domain name, the "MAIL FROM" address from the
envelope, and SPF DNS records published by the domain holder). envelope, and SPF DNS records published by the domain holder).
10.5.1. Recorded Results 11.5.1. Recorded Results
This information, passed to the receiver in the Received-SPF: or This information, passed to the receiver in the Received-SPF: or
Authentication-Results: trace fields, may be returned to the client Authentication-Results: trace fields, may be returned to the client
MTA as an SMTP rejection message. If such an SMTP rejection message MTA as an SMTP rejection message. If such an SMTP rejection message
is generated, the information from the trace fields has to be checked is generated, the information from the trace fields has to be checked
for such problems as invalid characters and excessively long lines. for such problems as invalid characters and excessively long lines.
10.5.2. External Explanations 11.5.2. External Explanations
When the authorization check fails, an explanation string could be When the authorization check fails, an explanation string could be
included in the reject response. Both the sender and the rejecting included in the reject response. Both the sender and the rejecting
receiver need to be aware that the explanation was determined by the receiver need to be aware that the explanation was determined by the
publisher of the SPF record checked and, in general, not the publisher of the SPF record checked and, in general, not the
receiver. The explanation can contain malicious URLs, or it might be receiver. The explanation can contain malicious URLs, or it might be
offensive or misleading. offensive or misleading.
Explanations returned to sender domains due to "exp" modifiers, Explanations returned to sender domains due to "exp" modifiers,
(Section 6.2), were generated by the sender policy published by the (Section 6.2), were generated by the sender policy published by the
domain holders themselves. As long as messages are only returned domain holders themselves. As long as messages are only returned
with non-delivery notification ([RFC3464]) to domains publishing the with non-delivery notification ([RFC3464]) to domains publishing the
explanation strings from their own DNS SPF records, the only affected explanation strings from their own DNS SPF records, the only affected
parties are the original publishers of the domain's SPF records. parties are the original publishers of the domain's SPF records.
In practice, such non-delivery notifications can be misdirected, such In practice, such non-delivery notifications can be misdirected, such
as when an MTA accepts an email and only later generates the as when an MTA accepts an email and only later generates the
notification to a forged address, or when an email forwarder does not notification to a forged address, or when an email forwarder does not
direct the bounce back to the original sender. direct the bounce back to the original sender.
10.5.3. Macro Expansion 11.5.3. Macro Expansion
Macros (Section 8) allow senders to inject arbitrary text (any non- Macros (Section 7) allow senders to inject arbitrary text (any non-
null [US-ASCII] character) into receiver DNS queries. It is necesary null [US-ASCII] character) into receiver DNS queries. It is necesary
to be prepared for hostile or unexpected content. to be prepared for hostile or unexpected content.
10.6. Privacy Exposure 11.6. Privacy Exposure
Checking SPF records causes DNS queries to be sent to the domain Checking SPF records causes DNS queries to be sent to the domain
owner. These DNS queries, especially if they are caused by the owner. These DNS queries, especially if they are caused by the
"exists" mechanism, can contain information about who is sending "exists" mechanism, can contain information about who is sending
email and likely to which MTA the email is being sent. This can email and likely to which MTA the email is being sent. This can
introduce some privacy concerns, which are more or less of an issue introduce some privacy concerns, which are more or less of an issue
depending on local laws and the relationship between the domain owner depending on local laws and the relationship between the domain owner
and the person sending the email. and the person sending the email.
11. Contributors and Acknowledgements 12. Contributors and Acknowledgements
This document is largely based on the work of Meng Weng Wong, Mark This document is largely based on the work of Meng Weng Wong, Mark
Lentczner, and Wayne Schlitt. Although, as this section Lentczner, and Wayne Schlitt. Although, as this section
acknowledges, many people have contributed to this document, a very acknowledges, many people have contributed to this document, a very
large portion of the writing and editing are due to Meng, Mark, and large portion of the writing and editing are due to Meng, Mark, and
Wayne. Wayne.
This design owes a debt of parentage to [RMX] by Hadmut Danisch and 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 to [DMP] by Gordon Fecyk. The idea of using a DNS record to check
the legitimacy of an email address traces its ancestry further back the legitimacy of an email address traces its ancestry further back
skipping to change at page 53, line 5 skipping to change at page 51, line 5
the development of this design. They are far too numerous to name, the development of this design. They are far too numerous to name,
but they include the following: but they include the following:
The participants in the SPFbis working group. The participants in the SPFbis working group.
The folks on the spf-discuss mailing list. The folks on the spf-discuss mailing list.
The folks on the SPAM-L mailing list. The folks on the SPAM-L mailing list.
The folks on the IRTF ASRG mailing list. The folks on the IRTF ASRG mailing list.
The folks on the IETF MARID mailing list. The folks on the IETF MARID mailing list.
The folks on #perl. The folks on #perl.
12. IANA Considerations 13. IANA Considerations
12.1. The SPF DNS Record Type 13.1. The SPF DNS Record Type
Per [RFC4408], the IANA assigned the Resource Record Type and Qtype Per [RFC4408], the IANA assigned the Resource Record Type and Qtype
from the DNS Parameters Registry for the SPF RR type with code 99. from the DNS Parameters Registry for the SPF RR type with code 99.
The format of this type is identical to the TXT RR [RFC1035]. The The format of this type is identical to the TXT RR [RFC1035]. The
character content of the record is encoded as [US-ASCII]. Use of character content of the record is encoded as [US-ASCII]. Use of
this record type is obsolete for SPF Version 1. this record type is obsolete for SPF Version 1.
IANA is requested to add an annotation to the SPF RRTYPE saying IANA is requested to add an annotation to the SPF RRTYPE saying
"(OBSOLETE - use TXT)" in the DNS Parameters registry. "(OBSOLETE - use TXT)" in the DNS Parameters registry.
[NOTE TO RFC EDITOR: (to be changed to " ... has added ..." upon [NOTE TO RFC EDITOR: (to be changed to " ... has added ..." upon
publication)] publication)]
12.2. The Received-SPF Mail Header Field 13.2. The Received-SPF Mail Header Field
Per [RFC3864], the "Received-SPF:" header field is added to the IANA Per [RFC3864], the "Received-SPF:" header field is added to the IANA
Permanent Message Header Field Registry. The following is the Permanent Message Header Field Registry. The following is the
registration template: registration template:
Header field name: Received-SPF Header field name: Received-SPF
Applicable protocol: mail ([RFC5322]) Applicable protocol: mail ([RFC5322])
Status: Standards Track Status: Standards Track
Author/Change controller: IETF Author/Change controller: IETF
Specification document(s): RFC XXXX Specification document(s): RFC XXXX
[NOTE TO RFC EDITOR: (this document)] [NOTE TO RFC EDITOR: (this document)]
12.3. SPF Modifier Registration 13.3. SPF Modifier Registration
[RFC6652] created a new SPF Modifier Registration. IANA is requested [RFC6652] created a new SPF Modifier Registration. IANA is requested
to change the reference for the exp and redirect modifiers from to change the reference for the exp and redirect modifiers from
[RFC4408] to this document. Their status should not be changed. [RFC4408] to this document. Their status should not be changed.
13. References 14. References
13.1. Normative References 14.1. Normative References
[RFC1035] Mockapetris, P., "Domain names - implementation and [RFC1035] Mockapetris, P., "Domain names - implementation and
specification", STD 13, RFC 1035, November 1987. specification", STD 13, RFC 1035, November 1987.
[RFC1123] Braden, R., "Requirements for Internet Hosts - Application [RFC1123] Braden, R., "Requirements for Internet Hosts - Application
and Support", STD 3, RFC 1123, October 1989. and Support", STD 3, RFC 1123, October 1989.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
skipping to change at page 55, line 11 skipping to change at page 53, line 11
[US-ASCII] [US-ASCII]
American National Standards Institute (formerly United American National Standards Institute (formerly United
States of America Standards Institute), "USA Code for States of America Standards Institute), "USA Code for
Information Interchange, X3.4", 1968. Information Interchange, X3.4", 1968.
ANSI X3.4-1968 has been replaced by newer versions with ANSI X3.4-1968 has been replaced by newer versions with
slight modifications, but the 1968 version remains slight modifications, but the 1968 version remains
definitive for the Internet. definitive for the Internet.
13.2. Informative References 14.2. Informative References
[DMP] Fecyk, G., "Designated Mailers Protocol". [DMP] Fecyk, G., "Designated Mailers Protocol".
Work In Progress Work In Progress
[Green] Green, D., "Domain-Authorized SMTP Mail", 2002. [Green] Green, D., "Domain-Authorized SMTP Mail", 2002.
[RFC1034] Mockapetris, P., "Domain names - concepts and facilities", [RFC1034] Mockapetris, P., "Domain names - concepts and facilities",
STD 13, RFC 1034, November 1987. STD 13, RFC 1034, November 1987.
skipping to change at page 63, line 5 skipping to change at page 61, line 5
"-include:ip4._spf.%{d} " "-include:ip4._spf.%{d} "
"-include:ptr._spf.%{d} " "-include:ptr._spf.%{d} "
"+all" ) "+all" )
ip4._spf.example.com. SPF "v=spf1 -ip4:192.0.2.0/24 +all" ip4._spf.example.com. SPF "v=spf1 -ip4:192.0.2.0/24 +all"
ptr._spf.example.com. SPF "v=spf1 -ptr +all" ptr._spf.example.com. SPF "v=spf1 -ptr +all"
This example shows how the "-include" mechanism can be useful, how an 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 SPF record that ends in "+all" can be very restrictive, and the use
of De Morgan's Law. of De Morgan's Law.
Appendix C. Change History Appendix C. Further Testing Advice
Another approach that can be helpful to publish records that include
a "tracking exists:" mechanism. By looking at the name server logs,
a rough list can then be generated. For example:
v=spf1 exists:_h.%{h}._l.%{l}._o.%{o}._i.%{i}._spf.%{d} ?all
Appendix D. Updating Mail Forwarders
There are three places that techniques can be used to ameliorate this
problem.
1. The beginning, when email is first sent (Originating ADMDs).
* "Neutral" results could be given for IP addresses that might
be forwarders, instead of "fail" results based on a list of
known reliable forwarders. For example:
"v=spf1 mx ?exists:%{ir}.whitlist.example.org -all"
This would cause a lookup on an DNS white list (DNSWL) and
cause a result of "fail" only for email not either coming from
the domain's mx host(s) (SPF pass) or white listed sources
(SPF neutral). This, in effect, outsources an element of
sender policy to the maintainer of the whitelist.
* The "MAIL FROM" identity could have additional information in
the local-part 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 that validates the local-part. Although
this requires an extra DNS lookup, this happens only when the
email would otherwise be rejected as not coming from a known
good source.
Note that due to the 63-character limit for domain labels,
this approach only works reliably if the local-part signature
scheme is guaranteed either to only produce local-parts with a
maximum of 63 characters or to gracefully handle truncated
local-parts.
* Similarly, a specialized DNS server could be set up that will
rate-limit the email 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 email is forwarded (Mediating ADMDs).
* Forwarding services can solve the problem by rewriting the
"MAIL FROM" to be in their own domain. This means mail
rejected from the external mailbox will have to be forwarded
back to the original sender 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").
* Forwarding servers could reject mail that would "fail" SPF if
forwarded using an SMTP reply code of 551, User not local,
(see [RFC5321] section 3.4) to communicate the correct target
address to resend the mail to.
3. The end, when email is received (Receiving ADMDs).
* If the owner of the external mailbox wishes to trust the
forwarding service, he 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 might 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.
Appendix E. Mail Services
MSPs (Mail Service Providers - [RFC5598] Section 2.3) that offer mail
services to third-party domains, such as sending of bulk mail, might
want to adjust their configurations in light of the authorization
check described in this document. If the domain part of the "MAIL
FROM" identity used for such email uses the domain of one of the MSPs
domain, then the provider needs only to ensure that its sending host
is authorized by its own SPF record, if any.
If the "MAIL FROM" identity does not use the MSP's domain, then extra
care has to 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 MSPs, such as ISPs, that have a wide
variety of customers using the same MTA, steps are required to
mitiate the risk of cross-customer forgery (see Section 11.4).
Appendix F. MTA Relays
Relays are described in [RFC5598] Section 2.2.2. The authorization
check generally precludes the use of arbitrary MTA relays between
sender and receiver of an email message.
Within an organization, MTA relays can be effectively deployed.
However, for purposes of this document, such relays are effectively
transparent. The SPF authorization check is a check between border
MTAs of different ADMDs.
For mail senders, this means that published SPF records have to
authorize any MTAs that actually send across the Internet. Usually,
these are just the border MTAs as internal MTAs simply forward mail
to these MTAs for relaying.
The receiving ADMD will generally want to perform the authorization
check at the boundary MTAs, including all secondary MXs. Internal
MTAs (including MTAs that might serve both as boundary MTAs and
internal relays from secondary MXs when they are processing the
relayed mail stream) then do not perform the authorization test. To
perform the authorization test other than at the boundary, the host
that first transferred the message to the receiving ADMD have to be
determined, which can be difficult to extract from the message header
because (a) header fields can be forged or malformed, and (b) there's
no standard way to encode that information such that it can be
reliably extracted. Testing other than at the boundary is likely to
produce unreliable results.
Appendix G. Local Policy Considerations
SPF results can be used in combination with other methods to
determine the final local disposition (either positive or negative of
a message. It can also be considered dispositive on its own.
G.1. Policy For SPF Pass
SPF pass results can be used in combination with "white lists" of
known "good" domains to bypass some or all additional pre-delivery
email checks. Exactly which checks and how to determine appropriate
white list entries has to be based on local conditions and
requirements.
G.2. Policy For SPF Fail
SPF fail results can be used to reject messages during the SMTP
transaction based on either "MAIL FROM" or "HELO" identity results.
This reduces resource requirements for various content filtering
methods and conserves bandwidth since rejection can be done before
the SMTP content is transferred. It also gives immediate feedback to
the sender who might then be able to resolve the issue. Due to some
of the issues described above in this section (Section 10), SPF based
rejection does present some risk of rejecting legitimate email when
rejecting based on "MAIL FROM" results.
SPF fail results can alternately be used as one input into a larger
set of evaluations which might, based on a combination with other
evaluation techniques, result in the email being marked negatively in
some way (this might be via delivery to a special spam folder,
modifying subject lines, or other locally determined means).
Developing the details of such an approach have to be based on local
conditions and requirements. Using SPF results in this way does not
have the advantages of resource conservation and immediate feedback
to the sender associated with SMTP rejection, but could produce fewer
undesirable rejections in a well designed system. Such an approach
might result in email that was not authorized by the sending ADMD
being unknowingly delivered to end users.
Either general approach can be used as they both leave a clear
disposition of emails. They are either delivered in some manner or
the sender is notified of the failure. Other dispositions such as
"dropping" or deleting email after acceptance are inappropriate
because they leave uncertainty and reduce the overall reliabilility
and utility of email across the Internet.
G.3. Policy For SPF Permerror
The "permerror" result (see Section 2.6.7) indicates the SPF
processing module at the receiver determined that the retrieved SPF
policy record could not be interpreted. This gives no true
indication about the authorized use of the data found in the
envelope.
As with all results, implementers have a choice to make regarding
what to do with a message that yields this result. SMTP allows only
a few basic options.
Rejection of the message is an option, in that it is the one thing a
receiver can do to draw attention to the difficulty encountered while
protecting itself from messages that do not have a definite SPF
result of some kind. However, if the SPF implementation is defective
and returns spurious "permerror" results, only the sender is actively
notified of the defect (in the form of rejected mail), and not the
receiver making use of SPF.
The less intrusive handling choice is to deliver the message, perhaps
with some kind of annotation of the difficulty encountered and/or
logging of a similar nature. However, this will not be desirable to
operators that wish to implement SPF checking as strictly as
possible, nor is this sort of passive problem reporting typically
effective.
There is of course the option placing this choice in the hands of the
operator rather than the implementer since this kind of choice is
often a matter of local policy rather than a condition with a
universal solution, but this adds one more piece of complexity to an
already non-trivial environment.
Both implementers and operators need to be cautious of all choices
and outcomes when handling SPF results.
Appendix H. Protocol Status
SPF has been in development since the summer of 2003 and has seen
deployment beyond the developers beginning in December 2003. The
design of SPF slowly evolved until the spring of 2004 and has since
stabilized. There have been quite a number of forms of SPF, some
written up as documents, some submitted as Internet Drafts, and many
discussed and debated in development forums. The protocol was
originally defined in [RFC4408], which this document replaces.
[RFC4408] was designed to clearly document the protocol defined by
earlier draft specifications of SPF as used in existing
implementations. This updated specification is intended to clarify
identified ambiguities in [RFC4408], resolve techincal issues
identified in post-RFC 4408 deplyment experience, and document widely
deployed extensions to SPF that have been developed since [RFC4408]
was published.
Appendix I. Experimental History
This document updates and replaces RFC 4408 that was part of a group
of simultaneously published Experimental RFCs (RFC 4405, RFC 4406,
RFC 4407, and RFC 4408) in 2006. At that time the IESG requested the
community observe the success or failure of the two approaches
documented in these RFCs during the two years following publication,
in order that a community consensus could be reached in the future.
SPF is widely deployed by large and small email providers alike.
There are multiple, interoperable implementations.
For SPF (as documented in RFC 4408) a careful effort was made to
collect and document lessons learned and errata during the two year
period. The errata list has been stable (no new submissions) and
only minor protocol lessons learned were identified. Resolution of
the IESG's experiment is documented in [RFC6686].
Appendix J. Change History
Changes since RFC 4408 (to be removed prior to publication) Changes since RFC 4408 (to be removed prior to publication)
Moved to standards track Moved to standards track
Authors updated Authors updated
IESG Note regarding experimental use replaced with discussion of IESG Note regarding experimental use replaced with discussion of
results results
 End of changes. 82 change blocks. 
631 lines changed or deleted 767 lines changed or added

This html diff was produced by rfcdiff 1.33. The latest version is available from http://tools.ietf.org/tools/rfcdiff/