| 1 |
root |
1.1 |
<%attr> |
| 2 |
|
|
autohandler_skip => 1 |
| 3 |
|
|
</%attr> |
| 4 |
|
|
|
| 5 |
|
|
Internet Draft |
| 6 |
|
|
Category: Experimental Mark Lentczner |
| 7 |
|
|
draft-mengwong-spf-01.txt Meng Weng Wong, pobox.com |
| 8 |
|
|
Expires: September 2004 May 2004 |
| 9 |
|
|
|
| 10 |
|
|
Sender Policy Framework (SPF) |
| 11 |
|
|
A Convention to Describe Hosts Authorized to Send SMTP Traffic |
| 12 |
|
|
|
| 13 |
|
|
Status of this Memo |
| 14 |
|
|
|
| 15 |
|
|
This document is an Internet-Draft and is subject to all provisions |
| 16 |
|
|
of Section 10 of RFC2026. |
| 17 |
|
|
|
| 18 |
|
|
Internet-Drafts are working documents of the Internet Engineering |
| 19 |
|
|
Task Force (IETF), its areas, and its working groups. Note that |
| 20 |
|
|
other groups may also distribute working documents as |
| 21 |
|
|
Internet-Drafts. |
| 22 |
|
|
|
| 23 |
|
|
Internet-Drafts are draft documents valid for a maximum of six |
| 24 |
|
|
months and may be updated, replaced, or obsoleted by other |
| 25 |
|
|
documents at any time. It is inappropriate to use Internet- |
| 26 |
|
|
Drafts as reference material or to cite them other than as |
| 27 |
|
|
"work in progress." |
| 28 |
|
|
|
| 29 |
|
|
The list of current Internet-Drafts can be accessed at |
| 30 |
|
|
http://www.ietf.org/1id-abstracts.html |
| 31 |
|
|
|
| 32 |
|
|
The list of Internet-Draft Shadow Directories can be accessed at |
| 33 |
|
|
http://www.ietf.org/shadow.html |
| 34 |
|
|
|
| 35 |
|
|
This Internet-Draft will expire in September 2004. |
| 36 |
|
|
|
| 37 |
|
|
|
| 38 |
|
|
Abstract |
| 39 |
|
|
|
| 40 |
|
|
Email address forgery is a problem on the Internet today. Domain |
| 41 |
|
|
owners want to control the use of their names in email, but are |
| 42 |
|
|
helpless because they lack the means. This document introduces a |
| 43 |
|
|
language for domains to make email-related declarations in DNS. It |
| 44 |
|
|
defines in detail one possible sender authentication scheme for |
| 45 |
|
|
domains to describe the hosts from which they send mail. SMTP |
| 46 |
|
|
receivers can use this scheme to detect sender forgery. |
| 47 |
|
|
|
| 48 |
|
|
|
| 49 |
|
|
|
| 50 |
|
|
|
| 51 |
|
|
|
| 52 |
|
|
|
| 53 |
|
|
Table of Contents |
| 54 |
|
|
|
| 55 |
|
|
TOC GOES HERE |
| 56 |
|
|
|
| 57 |
|
|
|
| 58 |
|
|
1. Introduction |
| 59 |
|
|
|
| 60 |
|
|
The intended audience for this document includes administrators of |
| 61 |
|
|
the Domain Name System and developers of Mail Transfer Agents (MTAs), |
| 62 |
|
|
Mail Delivery Agents (MDAs), and Mail User Agents (MUAs). They are |
| 63 |
|
|
assumed to be familiar with the workings of SMTP and DNS. See |
| 64 |
|
|
[RFC2821] and [RFC1034]. |
| 65 |
|
|
|
| 66 |
|
|
Forgery of domain names is a problem. Malicious entities often |
| 67 |
|
|
falsify envelope and header addresses to make it harder to identify |
| 68 |
|
|
the source of a message. When those addresses correspond to real |
| 69 |
|
|
people and organizations, the victims of forgery suffer a cost in |
| 70 |
|
|
bounce messages, tarnished reputations, and misdirected abuse |
| 71 |
|
|
reports. |
| 72 |
|
|
|
| 73 |
|
|
SPF is designed to fight email address forgery. It does this by |
| 74 |
|
|
establishing a policy framework and an authentication scheme. |
| 75 |
|
|
|
| 76 |
|
|
SPF defines a simple language. Domains can use that language to |
| 77 |
|
|
describe the mail they send. SMTP receivers can use these |
| 78 |
|
|
descriptions to evaluate messages. |
| 79 |
|
|
|
| 80 |
|
|
SPF can implement a sender authentication scheme. In a sender |
| 81 |
|
|
authentication scheme, a domain owner asserts that legitimate |
| 82 |
|
|
messages from that domain must meet certain criteria. Messages which |
| 83 |
|
|
do not meet the criteria are not legitimate. These assertions are |
| 84 |
|
|
made in machine-readable form. |
| 85 |
|
|
|
| 86 |
|
|
SPF defines a specific sender authentication scheme based on the |
| 87 |
|
|
designated sender model. A domain identifies certain hosts as |
| 88 |
|
|
designated senders. Mail from those hosts is considered legitimate. |
| 89 |
|
|
Mail from other hosts is not. |
| 90 |
|
|
|
| 91 |
|
|
SPF publishes policy data in the DNS. DNS resolvers can cache SPF |
| 92 |
|
|
data. Caching reduces lookup traffic. Sender domains do not have to |
| 93 |
|
|
run new servers to advertise SPF information. |
| 94 |
|
|
|
| 95 |
|
|
SPF is extensible. Multiple mechanisms can be defined. While other |
| 96 |
|
|
sender authentication schemes can be expressed in SPF, the rest of |
| 97 |
|
|
this document defines a designated sender scheme in detail. |
| 98 |
|
|
|
| 99 |
|
|
1.1 Terminology |
| 100 |
|
|
|
| 101 |
|
|
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
| 102 |
|
|
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in |
| 103 |
|
|
this document are to be interpreted as described in [RFC2119]. |
| 104 |
|
|
|
| 105 |
|
|
An SMTP client sends mail to an SMTP server. The SMTP server and |
| 106 |
|
|
downstream systems comprise the SMTP receiver. The SMTP receiver |
| 107 |
|
|
acts as an SPF client to an SPF publisher domain. |
| 108 |
|
|
|
| 109 |
|
|
SPF processing may occur as early as the MAIL FROM stage of an SMTP |
| 110 |
|
|
transaction or as late as the display stage in a Mail-User Agent. |
| 111 |
|
|
For convenience, SMTP servers which accept, classify, discard, or |
| 112 |
|
|
reject mail on the basis of SPF tests may be said to be speaking |
| 113 |
|
|
"SMTP+SPF". |
| 114 |
|
|
|
| 115 |
|
|
1.2 Designated Senders |
| 116 |
|
|
|
| 117 |
|
|
Designated sender schemes are weaker than cryptographic schemes but |
| 118 |
|
|
provide more assurance than the current SMTP model. |
| 119 |
|
|
|
| 120 |
|
|
SPF defines a set of mechanisms which add up to a designated sender |
| 121 |
|
|
scheme. First, domain owners designate legitimate outbound mail |
| 122 |
|
|
servers in a compact, symbolic notation. SMTP receivers may query |
| 123 |
|
|
sender domains using these mechanisms and decide the validity of a |
| 124 |
|
|
given SMTP transaction while that transaction is ongoing, even before |
| 125 |
|
|
any message data is passed. Alternatively, SPF tests can be |
| 126 |
|
|
performed after SMTP time by an MDA or MUA. MTAs, MDAs, and MUAs may |
| 127 |
|
|
choose to accept, classify, discard, or reject messages based on the |
| 128 |
|
|
result of an SPF test. |
| 129 |
|
|
|
| 130 |
|
|
SPF can be used to verify the sender of a message based on envelope |
| 131 |
|
|
information available at SMTP time or according to the headers after |
| 132 |
|
|
an SMTP transaction has completed. |
| 133 |
|
|
|
| 134 |
|
|
|
| 135 |
|
|
|
| 136 |
|
|
2. SPF Records |
| 137 |
|
|
|
| 138 |
|
|
Domains declare verifiable attributes that describe the mail they |
| 139 |
|
|
send. |
| 140 |
|
|
|
| 141 |
|
|
A domain's declarations are presented in an SPF record. The record |
| 142 |
|
|
is a single string of text: |
| 143 |
|
|
|
| 144 |
|
|
SPF-record = version *( 1*SP ( directive | modifier ) ) |
| 145 |
|
|
|
| 146 |
|
|
An example SPF Record is: |
| 147 |
|
|
|
| 148 |
|
|
v=spf1 +mx +a:colo.example.com/28 -all |
| 149 |
|
|
|
| 150 |
|
|
This record has a version of "v=spf1" and three directives: |
| 151 |
|
|
"+mx", "+a:colo.example.com/28", and "-all". |
| 152 |
|
|
|
| 153 |
|
|
2.1 Publishing |
| 154 |
|
|
|
| 155 |
|
|
The SPF record is published in the DNS. The record is of type TXT. |
| 156 |
|
|
The record is placed in the DNS tree at the level of the domain. |
| 157 |
|
|
|
| 158 |
|
|
The TXT type was chosen for pragmatic reasons. |
| 159 |
|
|
|
| 160 |
|
|
SPF clients ignore records which do not carry a recognized version |
| 161 |
|
|
string. This document specifies the version string "v=spf1". |
| 162 |
|
|
|
| 163 |
|
|
A domain MUST NOT return multiple records that begin with the |
| 164 |
|
|
version "v=spf1". If more than one "v=spf1" record is returned, |
| 165 |
|
|
this constitutes a syntax error and the result is "unknown". |
| 166 |
|
|
|
| 167 |
|
|
Note: The comparison is done on the entire version section (which is |
| 168 |
|
|
terminated either by a SP character, or the end of the TXT record). |
| 169 |
|
|
Hence, a record with a version of "v=spf10" is not considered a |
| 170 |
|
|
record with version "v=spf1". |
| 171 |
|
|
|
| 172 |
|
|
An example SPF record is: |
| 173 |
|
|
|
| 174 |
|
|
v=spf1 +mx +a:colo.example.com/28 -all |
| 175 |
|
|
|
| 176 |
|
|
This might be published easily via this line in a domain file: |
| 177 |
|
|
|
| 178 |
|
|
example.com. IN TXT "v=spf1 +mx +a:colo.example.com/28 -all" |
| 179 |
|
|
|
| 180 |
|
|
In unusual situations, directives may require additional DNS records. |
| 181 |
|
|
If additional records are used, they MAY be published under the |
| 182 |
|
|
"_spf" subdomain. See Appendix B for examples. |
| 183 |
|
|
|
| 184 |
|
|
An SPF record MAY consist of a single TXT record with multiple |
| 185 |
|
|
strings. If such an TXT record is encountered, then an SPF client |
| 186 |
|
|
MUST concatenate those strings without adding spaces, eg |
| 187 |
|
|
TXT "v=spf1 .... first" "second string..." |
| 188 |
|
|
MUST be treated as equivalent to |
| 189 |
|
|
TXT "v=spf1 .... firstsecond string..." |
| 190 |
|
|
|
| 191 |
|
|
TXT records containing multiple strings are useful in order to |
| 192 |
|
|
construct more complex SPF records which would otherwise exceed |
| 193 |
|
|
the maximum length of a string within a TXT record. |
| 194 |
|
|
|
| 195 |
|
|
Note: Many nameserver implementations will silently split long |
| 196 |
|
|
strings in TXT records into several shorter strings. |
| 197 |
|
|
|
| 198 |
|
|
|
| 199 |
|
|
2.2 Interpretation |
| 200 |
|
|
|
| 201 |
|
|
SPF clients are applications that parse and interpret the SPF record |
| 202 |
|
|
for a domain. Clients MUST correctly interpret the SPF record |
| 203 |
|
|
according to the canonical algorithm defined here. |
| 204 |
|
|
|
| 205 |
|
|
Clients MAY use a different algorithm, so long as the results are |
| 206 |
|
|
the same. |
| 207 |
|
|
|
| 208 |
|
|
|
| 209 |
|
|
2.2.1 Subject of SPF testing |
| 210 |
|
|
|
| 211 |
|
|
In an SMTP transaction, an SMTP client may provide FQDNs in the HELO |
| 212 |
|
|
argument and in the MAIL FROM return-path. SMTP+SPF receivers MAY |
| 213 |
|
|
check the HELO argument and MUST check the return-path. A single |
| 214 |
|
|
SMTP transaction may therefore trigger one or two SPF queries. |
| 215 |
|
|
|
| 216 |
|
|
Accordingly, the <responsible-sender> may be drawn from the HELO |
| 217 |
|
|
argument or from the "MAIL FROM" return-path. This document |
| 218 |
|
|
sometimes refers to the <responsible-sender> as the "envelope |
| 219 |
|
|
sender". |
| 220 |
|
|
|
| 221 |
|
|
It is RECOMMENDED that SMTP+SPF receivers perform tests using the |
| 222 |
|
|
following algorithm. |
| 223 |
|
|
|
| 224 |
|
|
SMTP+SPF receivers MAY check the HELO argument. In this mode, the |
| 225 |
|
|
<responsible-sender> comes from the HELO argument IF the HELO |
| 226 |
|
|
argument is a fully qualified domain name. If the HELO argument |
| 227 |
|
|
is not an FQDN, there is nothing to check and the result is |
| 228 |
|
|
"unknown". If the HELO test returns a "fail", the overall result |
| 229 |
|
|
for the envelope is "fail", and there is no need to test the |
| 230 |
|
|
return-path. |
| 231 |
|
|
|
| 232 |
|
|
SMTP+SPF receivers MUST check the return-path unless HELO testing |
| 233 |
|
|
produced a "fail". In this mode, the <responsible-sender> comes |
| 234 |
|
|
from the domain name of the "MAIL FROM" return-path. When the |
| 235 |
|
|
return-path has no domain, a client MUST use the HELO domain |
| 236 |
|
|
instead. If the HELO argument does not provide an FQDN, SPF |
| 237 |
|
|
processing terminates with "unknown". |
| 238 |
|
|
|
| 239 |
|
|
If SPF processing occurs after SMTP time, the envelope sender may |
| 240 |
|
|
be obtained from the Return-Path header. If the Return-Path header |
| 241 |
|
|
has no domain, a client MAY try to extract the HELO domain from the |
| 242 |
|
|
Received headers. If the headers do not yield useful envelope |
| 243 |
|
|
information, SPF processing terminates with "unknown". |
| 244 |
|
|
|
| 245 |
|
|
SMTP+SPF receivers MAY test the domain given in the HELO argument |
| 246 |
|
|
whether or not the return-path contains a domain name. |
| 247 |
|
|
|
| 248 |
|
|
However, the <responsible-sender> address MAY be drawn from an |
| 249 |
|
|
alternative source. For example, an MUA may find it more convenient |
| 250 |
|
|
to extract the <responsible-sender> from the Return-Path header or |
| 251 |
|
|
from the Sender: header. |
| 252 |
|
|
|
| 253 |
|
|
If the <responsible-sender> has no localpart, clients MUST |
| 254 |
|
|
substitute the string "postmaster" for the localpart. |
| 255 |
|
|
|
| 256 |
|
|
The <current-domain> is initially drawn from the |
| 257 |
|
|
<responsible-sender>. Recursive mechanisms such as Include and |
| 258 |
|
|
Redirect replace the initial <current-domain> with another domain. |
| 259 |
|
|
However, they do not change the value of the <responsible-sender>. |
| 260 |
|
|
See sections 4.2, 3.3, and 8.4. |
| 261 |
|
|
|
| 262 |
|
|
2.2.2 Lookup |
| 263 |
|
|
|
| 264 |
|
|
SPF clients perform a TXT type query in search of an SPF record. |
| 265 |
|
|
|
| 266 |
|
|
Any number of records may be returned. Only the record which begins |
| 267 |
|
|
with the version "v=spf1" is relevant to this document. CNAME |
| 268 |
|
|
responses are followed as usual. |
| 269 |
|
|
|
| 270 |
|
|
If no matching records are returned, an SPF client MUST assume that |
| 271 |
|
|
the domain makes no SPF declarations. SPF processing MUST abort |
| 272 |
|
|
and return "none". |
| 273 |
|
|
|
| 274 |
|
|
If the domain does not exist (NXDOMAIN), SPF clients MUST return |
| 275 |
|
|
"unknown". |
| 276 |
|
|
|
| 277 |
|
|
If a domain has no SPF record, clients MAY substitute SPF data from |
| 278 |
|
|
a parent domain ONLY IF the appropriate parent domain's SPF record |
| 279 |
|
|
sets "match_subdomains=yes". For example, if no SPF record is |
| 280 |
|
|
found for "workstation.example.com", clients MAY proceed to |
| 281 |
|
|
automatically query "example.com". The appropriate parent domain |
| 282 |
|
|
to fallback on MUST be determined according to the DNS zone cut. |
| 283 |
|
|
|
| 284 |
|
|
3. SPF Record Evaluation |
| 285 |
|
|
|
| 286 |
|
|
An SPF client evaluates an SPF record and produces one of seven |
| 287 |
|
|
results: |
| 288 |
|
|
|
| 289 |
|
|
None: The domain does not publish SPF data. |
| 290 |
|
|
|
| 291 |
|
|
Neutral (?): The SPF client MUST proceed as if a domain did not |
| 292 |
|
|
publish SPF data. This result occurs if the domain explicitly |
| 293 |
|
|
specifies a "?" value, or if processing "falls off the end" of |
| 294 |
|
|
the SPF record. |
| 295 |
|
|
|
| 296 |
|
|
Pass (+): the message meets the publishing domain's definition of |
| 297 |
|
|
legitimacy. MTAs proceed to apply local policy and MAY accept or |
| 298 |
|
|
reject the message accordingly. |
| 299 |
|
|
|
| 300 |
|
|
Fail (-): the message does not meet a domain's definition of |
| 301 |
|
|
legitimacy. MTAs MAY reject the message using a permanent |
| 302 |
|
|
failure reply code. (Code 550 is RECOMMENDED. See [RFC2821] |
| 303 |
|
|
section 7.1.) |
| 304 |
|
|
|
| 305 |
|
|
Softfail (~): the message does not meet a domain's strict |
| 306 |
|
|
definition of legitimacy, but the domain cannot confidently state |
| 307 |
|
|
that the message is a forgery. MTAs SHOULD accept the message |
| 308 |
|
|
but MAY subject it to a higher transaction cost, deeper scrutiny, |
| 309 |
|
|
or an unfavourable score. |
| 310 |
|
|
|
| 311 |
|
|
There are two error conditions, one temporary and one permanent. |
| 312 |
|
|
|
| 313 |
|
|
Error: indicates an error during lookup; an MTA SHOULD reject the |
| 314 |
|
|
message using a transient failure code, such as 450. |
| 315 |
|
|
|
| 316 |
|
|
Unknown: indicates incomplete processing: an MTA MUST proceed as |
| 317 |
|
|
if a domain did not publish SPF data. |
| 318 |
|
|
|
| 319 |
|
|
When SPF-aware SMTP receivers accept a message, they SHOULD prepend a |
| 320 |
|
|
Received-SPF header. See section 6. |
| 321 |
|
|
|
| 322 |
|
|
SPF clients MUST use the algorithm described in this section |
| 323 |
|
|
or its functional equivalent. |
| 324 |
|
|
|
| 325 |
|
|
If an SPF client encounters a syntax error in an |
| 326 |
|
|
SPF record, it must terminate processing and return a result |
| 327 |
|
|
of "unknown". |
| 328 |
|
|
|
| 329 |
|
|
3.1 Matching Version |
| 330 |
|
|
|
| 331 |
|
|
An SPF record begins with a version section: |
| 332 |
|
|
|
| 333 |
|
|
version = "v=spf" version-number |
| 334 |
|
|
version-number = 1*DIGIT |
| 335 |
|
|
|
| 336 |
|
|
SPF clients MUST use only the records of the highest understood |
| 337 |
|
|
version published by a domain and ignore all lower versions, unless |
| 338 |
|
|
that version explicitly recognizes lower versioned responses. |
| 339 |
|
|
|
| 340 |
|
|
For example, if an SPF client understands versions 1, 2 and 3, and |
| 341 |
|
|
the DNS query results in records of version 1, 2 and 4, then only |
| 342 |
|
|
the record with version 2 is used. |
| 343 |
|
|
|
| 344 |
|
|
This specification describes version 1. If multiple "v=spf1" records |
| 345 |
|
|
are returned, the SPF client MUST reject them all and act as if no |
| 346 |
|
|
version 1 records were returned. |
| 347 |
|
|
|
| 348 |
|
|
SPF-like records of the form "v=spf1+ext" or "v=spf1.1" are not |
| 349 |
|
|
described by this document. |
| 350 |
|
|
|
| 351 |
|
|
3.2 SPF Directive Evaluation |
| 352 |
|
|
|
| 353 |
|
|
There are two types of directives: mechanisms and modifiers. A given |
| 354 |
|
|
mechanism type may always appear multiple times in a record. |
| 355 |
|
|
Modifiers may be constrained to appear at most once per record, |
| 356 |
|
|
depending on the definition of the modifier. Unknown mechanisms |
| 357 |
|
|
cause processing to abort with the result "unknown". Unknown |
| 358 |
|
|
modifiers are ignored by clients. |
| 359 |
|
|
|
| 360 |
|
|
An SPF record contains an ordered list of mechanisms and modifiers: |
| 361 |
|
|
|
| 362 |
|
|
SPF-record = version *( 1*SP ( directive / modifier ) ) *SP |
| 363 |
|
|
|
| 364 |
|
|
version = "v=spf" 1*DIGIT |
| 365 |
|
|
|
| 366 |
|
|
prefix = "+" / "-" / "?" / "~" |
| 367 |
|
|
|
| 368 |
|
|
directive = [prefix] mechanism |
| 369 |
|
|
mechanism = name [ ":" macro-string ] *[ '/' *DIGIT ] |
| 370 |
|
|
modifier = name "=" macro-string |
| 371 |
|
|
name = alpha *( alpha / digit / "-" / "_" / "." ) |
| 372 |
|
|
|
| 373 |
|
|
|
| 374 |
|
|
|
| 375 |
|
|
|
| 376 |
|
|
|
| 377 |
|
|
Modifiers always contain an equals ('=') character. |
| 378 |
|
|
|
| 379 |
|
|
Mechanisms usually contain ':' or '/' characters. |
| 380 |
|
|
|
| 381 |
|
|
Directives that do not contain any of '=', ':', or '/' are |
| 382 |
|
|
mechanisms. |
| 383 |
|
|
|
| 384 |
|
|
Modifiers MAY appear to the right of a terminal mechanism such as |
| 385 |
|
|
"all". SPF parsers may therefore choose to extract all the |
| 386 |
|
|
modifiers from a record before interpreting mechanisms. |
| 387 |
|
|
Alternatively, they may continue to parse a record in search of a |
| 388 |
|
|
meaningful modifier even after mechanism evaluation has completed. |
| 389 |
|
|
|
| 390 |
|
|
Each mechanism is considered in turn from left to right. |
| 391 |
|
|
|
| 392 |
|
|
When a mechanism is evaluated, one of three things can happen: it |
| 393 |
|
|
can match, it can not match, or it can throw an exception. |
| 394 |
|
|
|
| 395 |
|
|
If it matches, processing ends and the prefix value is returned as |
| 396 |
|
|
the result of that record. (The default prefix value is "+".) |
| 397 |
|
|
|
| 398 |
|
|
If it does not match, processing continues with the next mechanism. |
| 399 |
|
|
If no mechanisms remain, the default result is specified in section |
| 400 |
|
|
3.3. |
| 401 |
|
|
|
| 402 |
|
|
If it throws an exception, mechanism processing ends and |
| 403 |
|
|
the exception value is returned (either "error" |
| 404 |
|
|
indicating a temporary failure, usually DNS-related, or |
| 405 |
|
|
"unknown" indicating a syntax error or other permanent |
| 406 |
|
|
failure resulting in incomplete processing.) |
| 407 |
|
|
|
| 408 |
|
|
Mechanisms are described in Sections 4 and 5. |
| 409 |
|
|
|
| 410 |
|
|
A missing prefix for a mechanism is the same as a prefix of "+". |
| 411 |
|
|
|
| 412 |
|
|
The possible prefixes are: |
| 413 |
|
|
+ pass |
| 414 |
|
|
- fail |
| 415 |
|
|
~ softfail |
| 416 |
|
|
? neutral |
| 417 |
|
|
|
| 418 |
|
|
Mechanism and modifier names are case-insensitive. A mechanism |
| 419 |
|
|
"INCLUDE" is equivalent to "include". However, case SHOULD be |
| 420 |
|
|
preserved in arguments to mechanisms and modifiers. |
| 421 |
|
|
|
| 422 |
|
|
|
| 423 |
|
|
|
| 424 |
|
|
3.3 Default result |
| 425 |
|
|
|
| 426 |
|
|
If none of the mechanisms match and there is no redirect modifier, |
| 427 |
|
|
then the result of the SPF query is "neutral". If there is a |
| 428 |
|
|
redirect modifier, the SPF client proceeds as defined in section 5.1. |
| 429 |
|
|
|
| 430 |
|
|
Note that SPF records SHOULD always either use a redirect modifier or |
| 431 |
|
|
an "all" mechanism to explicitly terminate processing. |
| 432 |
|
|
|
| 433 |
|
|
For example: |
| 434 |
|
|
|
| 435 |
|
|
v=spf1 +mx -all |
| 436 |
|
|
|
| 437 |
|
|
v=spf1 +mx redirect=_spf.example.com |
| 438 |
|
|
|
| 439 |
|
|
4. Mechanism Definitions |
| 440 |
|
|
|
| 441 |
|
|
This section defines two types of mechanisms. |
| 442 |
|
|
|
| 443 |
|
|
Basic mechanisms contribute to the SPF language framework. They |
| 444 |
|
|
do not specify a particular type of authentication scheme. |
| 445 |
|
|
|
| 446 |
|
|
- all |
| 447 |
|
|
- include |
| 448 |
|
|
|
| 449 |
|
|
Designated sender mechanisms are used to discover the relationship of |
| 450 |
|
|
the client IP address to the <responsible-sender>. |
| 451 |
|
|
|
| 452 |
|
|
- a - ip4 |
| 453 |
|
|
- mx - ip6 |
| 454 |
|
|
- ptr - exists |
| 455 |
|
|
|
| 456 |
|
|
Other mechanisms can be independently defined in the future. |
| 457 |
|
|
|
| 458 |
|
|
Mechanisms either match, do not match, or throw an exception. |
| 459 |
|
|
If they match, their prefix value is returned. |
| 460 |
|
|
If they do not match, processing continues. |
| 461 |
|
|
If they throw an exception, the exception value is returned. |
| 462 |
|
|
|
| 463 |
|
|
Several of these mechanisms take an optional <domain-spec> argument. |
| 464 |
|
|
If the <domain-spec> is present, then it is macro expanded (see |
| 465 |
|
|
Section 7) and becomes the <target-name>. If the <domain-spec> is |
| 466 |
|
|
not provided, the <current-domain> is used as the <target-name>. |
| 467 |
|
|
|
| 468 |
|
|
Several mechanisms require DNS lookups. In those lookups, CNAME |
| 469 |
|
|
responses are followed in the usual way. |
| 470 |
|
|
|
| 471 |
|
|
|
| 472 |
|
|
|
| 473 |
|
|
4.1 "all" |
| 474 |
|
|
|
| 475 |
|
|
all = "all" |
| 476 |
|
|
|
| 477 |
|
|
The "all" mechanism is a test that always matches. It is used as the |
| 478 |
|
|
rightmost mechanism in an SPF record to provide an explicit default. |
| 479 |
|
|
|
| 480 |
|
|
For example: |
| 481 |
|
|
v=spf1 +mx +a -all |
| 482 |
|
|
|
| 483 |
|
|
Mechanisms after "all" will never be tested. |
| 484 |
|
|
|
| 485 |
|
|
4.2 "include" |
| 486 |
|
|
|
| 487 |
|
|
include = "include" ":" domain-spec |
| 488 |
|
|
|
| 489 |
|
|
The "include" mechanism triggers a recursive SPF query. The |
| 490 |
|
|
domain-spec is expanded as per section 7. Then a new query is |
| 491 |
|
|
launched using the resulting string as the <current-domain>. The |
| 492 |
|
|
<responsible-sender> stays the same. |
| 493 |
|
|
|
| 494 |
|
|
"Include" makes it possible for one domain to designate multiple |
| 495 |
|
|
administratively independent domains. |
| 496 |
|
|
|
| 497 |
|
|
For example, a vanity domain "example.net" might send mail using the |
| 498 |
|
|
servers of administratively independent domains example.com and |
| 499 |
|
|
example.org. |
| 500 |
|
|
|
| 501 |
|
|
Example.net could say |
| 502 |
|
|
|
| 503 |
|
|
"v=spf1 include:example.com include:example.org -all". |
| 504 |
|
|
|
| 505 |
|
|
That would direct an SPF client to, in effect, search the SPF records |
| 506 |
|
|
for example.com and example.org for a "pass" result. Only if the |
| 507 |
|
|
message were not permitted for either of those domains would the |
| 508 |
|
|
result be "fail". |
| 509 |
|
|
|
| 510 |
|
|
This mechanism matches when the inner, included query result returns |
| 511 |
|
|
a pass, and doesn't match when the result is fail, softfail, or |
| 512 |
|
|
neutral. However, if the new query returns none, error, or unknown, |
| 513 |
|
|
then processing of the entire SPF query stops immediately and |
| 514 |
|
|
returns the error result. |
| 515 |
|
|
|
| 516 |
|
|
|
| 517 |
|
|
|
| 518 |
|
|
|
| 519 |
|
|
|
| 520 |
|
|
included include |
| 521 |
|
|
query mechanism SPF |
| 522 |
|
|
result result processing |
| 523 |
|
|
-------- -- -------------- ------------------------------------- |
| 524 |
|
|
pass => match, return the prefix value for "include" |
| 525 |
|
|
fail => no match, continue processing |
| 526 |
|
|
softfail => no match, continue processing |
| 527 |
|
|
neutral => no match, continue processing |
| 528 |
|
|
error => throw error, abort processing, return error |
| 529 |
|
|
unknown => throw unknown, abort processing, return unknown |
| 530 |
|
|
none => throw unknown, abort processing, return unknown |
| 531 |
|
|
|
| 532 |
|
|
If the parent domain includes another domain, and that domain one day |
| 533 |
|
|
loses its SPF record, it is better for the query to abort with |
| 534 |
|
|
"unknown" than to continue on to a potential "-all". |
| 535 |
|
|
|
| 536 |
|
|
The Include mechanism is intended for crossing administrative |
| 537 |
|
|
boundaries. While it is possible to use Includes to consolidate |
| 538 |
|
|
multiple domains that share the same set of designated hosts, domains |
| 539 |
|
|
are encouraged to use Redirects where possible, and to minimize the |
| 540 |
|
|
number of <Includes> within a single administrative domain. |
| 541 |
|
|
For example, if example.com and example.org were managed by the same |
| 542 |
|
|
entity, and if the canonical set of designated mailers for both |
| 543 |
|
|
domains were "mx:example.com", it would be possible for example.org |
| 544 |
|
|
to specify "include:example.com", but it would be preferable to |
| 545 |
|
|
specify "redirect=example.com" or even "mx:example.com". |
| 546 |
|
|
|
| 547 |
|
|
4.3 Introducing Designated Sender Mechanisms |
| 548 |
|
|
|
| 549 |
|
|
Designated sender schemes allow SMTP receivers to make policy |
| 550 |
|
|
decisions on the basis of domain name rather than IP address. |
| 551 |
|
|
|
| 552 |
|
|
These mechanisms allow a domain to declare that certain hosts send |
| 553 |
|
|
mail from that domain. When an SPF client processes these |
| 554 |
|
|
mechanisms, it tests to see if the <sending-host> matches. |
| 555 |
|
|
|
| 556 |
|
|
Usually, the <sending-host> is the IP address of an SMTP client. The |
| 557 |
|
|
SMTP receiver is the SPF client. The SPF lookup may also operate |
| 558 |
|
|
after the SMTP transaction has terminated. In these cases the |
| 559 |
|
|
<sending-host> may have to be extracted from the Received header or |
| 560 |
|
|
some other meta-data about the message. Received headers can be |
| 561 |
|
|
forged. Still, accurate analysis is possible if care is taken. |
| 562 |
|
|
|
| 563 |
|
|
If mail is transferred between mail systems internal to an |
| 564 |
|
|
organization, and that organization chooses to process SPF after such |
| 565 |
|
|
transfers, then the <sending-host> should be the external host that |
| 566 |
|
|
first transferred the mail into the organization's mail system. |
| 567 |
|
|
|
| 568 |
|
|
When the <sending-host> is localhost, Designated Sender mechanisms |
| 569 |
|
|
are not meaningful. Therefore, an SPF client immediately returns |
| 570 |
|
|
"pass" without evaluating mechanisms. |
| 571 |
|
|
|
| 572 |
|
|
The <sending-host> is required for these mechanisms. If it cannot |
| 573 |
|
|
be determined, then these mechanisms cannot be tested, and "unknown" |
| 574 |
|
|
is returned. |
| 575 |
|
|
|
| 576 |
|
|
The following conventions apply to designated sender mechanisms: |
| 577 |
|
|
|
| 578 |
|
|
If the optional <CIDR-length> is given, then only the upper |
| 579 |
|
|
<CIDR-length> bits of each IP are compared to the <sending-host>. |
| 580 |
|
|
|
| 581 |
|
|
If the SMTP connection is IPv6, read "AAAA lookup" for "A lookup", |
| 582 |
|
|
except where "A" lookups are explicitly specified. |
| 583 |
|
|
|
| 584 |
|
|
|
| 585 |
|
|
|
| 586 |
|
|
|
| 587 |
|
|
|
| 588 |
|
|
4.4 "a" |
| 589 |
|
|
|
| 590 |
|
|
This mechanism matches if the <sending-host> is one of the |
| 591 |
|
|
<target-name>'s IP addresses. |
| 592 |
|
|
|
| 593 |
|
|
A = "a" [ ":" domain-spec ] [ dual-cidr-length ] |
| 594 |
|
|
|
| 595 |
|
|
The <sending-host> is compared to the IP address(es) of the |
| 596 |
|
|
<target-name>. If any address matches, the mechanism matches. |
| 597 |
|
|
|
| 598 |
|
|
4.5 "mx" |
| 599 |
|
|
|
| 600 |
|
|
This mechanism matches if the <sending-host> is one of the MX hosts |
| 601 |
|
|
for a domain name. |
| 602 |
|
|
|
| 603 |
|
|
MX = "mx" [ ":" domain-spec ] [ dual-cidr-length ] |
| 604 |
|
|
|
| 605 |
|
|
SPF clients first perform an MX lookup on the <target-name>. SPF |
| 606 |
|
|
clients then perform an A lookup on each MX name returned, in order |
| 607 |
|
|
of MX priority. The <sending-host> is compared to each returned IP |
| 608 |
|
|
address. If any address matches, the mechanism matches. |
| 609 |
|
|
|
| 610 |
|
|
Note Regarding Implicit MXes: If the <target-name> has no MX records, |
| 611 |
|
|
SPF clients MUST NOT pretend the target is its single MX, and MUST |
| 612 |
|
|
NOT default to an A lookup on the <target-name> directly. This |
| 613 |
|
|
behaviour breaks with the legacy "implicit MX" rule. See [RFC2821] |
| 614 |
|
|
Section 5. If such behaviour is desired, the publisher should |
| 615 |
|
|
specify an "a" directive. |
| 616 |
|
|
|
| 617 |
|
|
4.6 "ptr" |
| 618 |
|
|
|
| 619 |
|
|
This mechanism tests if the <sending-host>'s name is within a |
| 620 |
|
|
particular domain. |
| 621 |
|
|
|
| 622 |
|
|
PTR = "ptr" [ ":" domain-spec ] |
| 623 |
|
|
|
| 624 |
|
|
First the <sending-host>'s name is looked up using this procedure: |
| 625 |
|
|
perform a PTR lookup against the <sending-host>'s IP. For each |
| 626 |
|
|
record returned, validate the host name by looking up its IP address. |
| 627 |
|
|
If the <sending-host>'s IP is among the returned IP addresses, then |
| 628 |
|
|
that host name is validated. In pseudocode: |
| 629 |
|
|
|
| 630 |
|
|
sending-host_names := ptr_lookup(sending-host_IP); |
| 631 |
|
|
for each name in (sending-host_names) { |
| 632 |
|
|
IP_addresses := a_lookup(name); |
| 633 |
|
|
if the sending-host_IP is one of the IP_addresses { |
| 634 |
|
|
validated_sending-host_names += name; |
| 635 |
|
|
} } |
| 636 |
|
|
|
| 637 |
|
|
Check all validated hostnames to see if they end in the <target-name> |
| 638 |
|
|
domain. If any do, this mechanism matches. If no validated hostname |
| 639 |
|
|
can be found, or if none of the validated hostnames end in the |
| 640 |
|
|
<target-name>, this mechanism fails to match. |
| 641 |
|
|
|
| 642 |
|
|
Pseudocode: |
| 643 |
|
|
for each name in (validated_sending-host_names) { |
| 644 |
|
|
if name ends in <domain-spec>, return match. |
| 645 |
|
|
if name is <domain-spec>, return match. |
| 646 |
|
|
} |
| 647 |
|
|
return no-match. |
| 648 |
|
|
|
| 649 |
|
|
This mechanism matches if the <target-name> is an ancestor of the |
| 650 |
|
|
<sending-host>, or if the <target-name> and the <sending-host> are |
| 651 |
|
|
the same. For example: "mail.example.com" is within the domain |
| 652 |
|
|
"example.com", but "mail.bad-example.com" is not. If a validated |
| 653 |
|
|
hostname is the <target-name>, a match results. |
| 654 |
|
|
|
| 655 |
|
|
|
| 656 |
|
|
|
| 657 |
|
|
|
| 658 |
|
|
|
| 659 |
|
|
|
| 660 |
|
|
|
| 661 |
|
|
|
| 662 |
|
|
|
| 663 |
|
|
|
| 664 |
|
|
4.7 "ip4" and "ip6" |
| 665 |
|
|
|
| 666 |
|
|
These mechanisms test if the <sending-host> falls into a given IP |
| 667 |
|
|
network. |
| 668 |
|
|
|
| 669 |
|
|
IP4 = "ip4" ":" ip4-network [ ip4-cidr-length ] |
| 670 |
|
|
IP6 = "ip6" ":" ip6-network [ ip6-cidr-length ] |
| 671 |
|
|
ip4-cidr-length = "/" 1*DIGIT |
| 672 |
|
|
ip6-cidr-length = "/" 1*DIGIT |
| 673 |
|
|
|
| 674 |
|
|
ip4-network = dotted-quad notation |
| 675 |
|
|
ip6-network = conventional IPv6 notation |
| 676 |
|
|
|
| 677 |
|
|
The <sending-host> is compared to the given network. If they match, |
| 678 |
|
|
the mechanism matches. |
| 679 |
|
|
|
| 680 |
|
|
If the cidr-length is omitted, the ip4-cidr-length is taken to be |
| 681 |
|
|
"/32" and the ip6-cidr-length is taken to be "/128". |
| 682 |
|
|
|
| 683 |
|
|
4.8 "exists" |
| 684 |
|
|
|
| 685 |
|
|
This mechanism is used to construct an arbitrary host name that is |
| 686 |
|
|
used for a DNS A record query. It allows for complicated schemes |
| 687 |
|
|
involving arbitrary parts of the mail envelope to determine what is |
| 688 |
|
|
legal. |
| 689 |
|
|
|
| 690 |
|
|
exists = "exists" ":" domain-spec |
| 691 |
|
|
|
| 692 |
|
|
The domain-spec is expanded as per Section 7. The resulting domain |
| 693 |
|
|
name is used for a DNS A lookup. If any A record is returned, this |
| 694 |
|
|
mechanism matches. The lookup type is 'A' even when the connection |
| 695 |
|
|
type is IPv6. |
| 696 |
|
|
|
| 697 |
|
|
SPF publishers can use this mechanism to specify arbitrarily complex |
| 698 |
|
|
queries. For example, suppose example.com publishes the SPF record: |
| 699 |
|
|
|
| 700 |
|
|
v=spf1 exists:%{ir}.%{l1r+-}._spf.%{d} -all |
| 701 |
|
|
|
| 702 |
|
|
The target-name might expand to |
| 703 |
|
|
"1.2.0.192.someuser._spf.example.com". This makes fine-grained |
| 704 |
|
|
decisions possible at the level of the user and client IP address. |
| 705 |
|
|
|
| 706 |
|
|
|
| 707 |
|
|
|
| 708 |
|
|
|
| 709 |
|
|
|
| 710 |
|
|
|
| 711 |
|
|
|
| 712 |
|
|
5. Modifier Definitions |
| 713 |
|
|
|
| 714 |
|
|
Only two standard modifiers are defined: "redirect" and "exp". SPF |
| 715 |
|
|
clients MUST support them both. |
| 716 |
|
|
|
| 717 |
|
|
Modifiers are not mechanisms: they do not return match or no-match. |
| 718 |
|
|
|
| 719 |
|
|
Instead they provide additional information or change the course of |
| 720 |
|
|
SPF processing. |
| 721 |
|
|
|
| 722 |
|
|
While unrecognized mechanisms cause an immediate "unknown" abort, |
| 723 |
|
|
unrecognized modifiers are simply ignored. |
| 724 |
|
|
|
| 725 |
|
|
Modifiers therefore provide an easy way to extend the SPF protocol. |
| 726 |
|
|
|
| 727 |
|
|
This document reserves one extension modifier, "accredit", one |
| 728 |
|
|
deprecated modifier "default", and one future modifier |
| 729 |
|
|
"match_subdomains". |
| 730 |
|
|
|
| 731 |
|
|
|
| 732 |
|
|
5.1 redirect: Redirected Query |
| 733 |
|
|
|
| 734 |
|
|
If all mechanisms fail to match, and a redirect modifier is present, |
| 735 |
|
|
then processing proceeds as follows. |
| 736 |
|
|
|
| 737 |
|
|
redirect = "redirect" "=" domain-spec |
| 738 |
|
|
|
| 739 |
|
|
The domain-spec portion of the redirect section is expanded |
| 740 |
|
|
as per the macro rules in section 7. The resulting string |
| 741 |
|
|
is a new domain that is now queried: The <current-domain> |
| 742 |
|
|
is set to this new domain, and the new domain's SPF record |
| 743 |
|
|
is fetched and processed. Note that <responsible-sender> does not |
| 744 |
|
|
change. |
| 745 |
|
|
|
| 746 |
|
|
The result of this new query is then considered the result of |
| 747 |
|
|
original query. |
| 748 |
|
|
|
| 749 |
|
|
Note that the newly queried domain may itself specify redirect |
| 750 |
|
|
processing. |
| 751 |
|
|
|
| 752 |
|
|
This facility is intended for use by organizations that wish to apply |
| 753 |
|
|
the same SPF record to multiple domains. For example: |
| 754 |
|
|
|
| 755 |
|
|
la.example.com. TXT "v=spf1 redirect=_spf.example.com" |
| 756 |
|
|
ny.example.com. TXT "v=spf1 redirect=_spf.example.com" |
| 757 |
|
|
sf.example.com. TXT "v=spf1 redirect=_spf.example.com" |
| 758 |
|
|
_spf.example.com. TXT "v=spf1 mx:example.com -all" |
| 759 |
|
|
|
| 760 |
|
|
In this example, mail from any of the three domains is described by |
| 761 |
|
|
the same SPF record. This can be an administrative advantage. |
| 762 |
|
|
|
| 763 |
|
|
Note: in general, a domain A cannot reliably use a redirect to |
| 764 |
|
|
another domain B not under the same administrative control. Since |
| 765 |
|
|
the <responsible-sender> stays the same, there is no guarantee that |
| 766 |
|
|
the SPF directives at domain B will correctly work for addresses in |
| 767 |
|
|
domain A, especially if domain B uses mechanisms involving |
| 768 |
|
|
localparts. An "Include" directive may be more appropriate. |
| 769 |
|
|
|
| 770 |
|
|
Only one redirect modifier may appear per SPF record. The modifier |
| 771 |
|
|
does not have to appear at the end; it MAY appear anywhere in the |
| 772 |
|
|
record. However, for clarity it is RECOMMENDED that redirect |
| 773 |
|
|
modifiers appear after mechanisms. |
| 774 |
|
|
|
| 775 |
|
|
|
| 776 |
|
|
|
| 777 |
|
|
5.2 exp: Explanation |
| 778 |
|
|
|
| 779 |
|
|
The argument to the explanation modifier is a domain-spec to be TXT |
| 780 |
|
|
queried. The result of the TXT query is a macro-string that is |
| 781 |
|
|
macro-expanded. If SPF processing results in a rejection, the |
| 782 |
|
|
expanded result SHOULD be shown to the sender in the SMTP reject |
| 783 |
|
|
message. This string allows the publishing domain to communicate |
| 784 |
|
|
further information via the SMTP receiver to legitimate senders in |
| 785 |
|
|
the form of a short message or URL. |
| 786 |
|
|
|
| 787 |
|
|
Only one exp modifier may appear per SPF record. |
| 788 |
|
|
|
| 789 |
|
|
explanation = "exp" "=" domain-spec |
| 790 |
|
|
|
| 791 |
|
|
When an SPF client performs a query, and the result is anything other |
| 792 |
|
|
than pass, then the explanation string, if present, SHOULD be |
| 793 |
|
|
presented to the SMTP client after macro expansion. See section 7. |
| 794 |
|
|
|
| 795 |
|
|
Suppose example.com has this SPF record |
| 796 |
|
|
|
| 797 |
|
|
v=spf1 mx -all exp=explain._spf.%{d} |
| 798 |
|
|
|
| 799 |
|
|
Here are some examples of possible explanation TXT records at |
| 800 |
|
|
explain._spf.example.com: |
| 801 |
|
|
|
| 802 |
|
|
Example.com mail should only be sent by its own servers. |
| 803 |
|
|
-- a simple, constant message |
| 804 |
|
|
|
| 805 |
|
|
%{i} is not one of %{d}'s designated mail servers. |
| 806 |
|
|
-- a message with a little more info, including the |
| 807 |
|
|
-- SMTP sender's IP address |
| 808 |
|
|
|
| 809 |
|
|
See http://%{d}/why.html?s=%{S}&i=%{I}&h=%{H} |
| 810 |
|
|
-- a complicated example that constructs a URL with |
| 811 |
|
|
-- most of the parameters of the failed message so that |
| 812 |
|
|
-- a web page can be generated with instructions |
| 813 |
|
|
|
| 814 |
|
|
If multiple explanation TXT records are returned, they are |
| 815 |
|
|
concatenated in the order they were received. Use of multiple TXT |
| 816 |
|
|
records is discouraged as DNS does not guarantee order. |
| 817 |
|
|
|
| 818 |
|
|
Note: during recursion into an Include mechanism, explanations do not |
| 819 |
|
|
propagate out. But during execution of a Redirect modifier, the |
| 820 |
|
|
explanation string from the target of the redirect is used. |
| 821 |
|
|
|
| 822 |
|
|
5.3 accredit: Sender Accreditation |
| 823 |
|
|
|
| 824 |
|
|
accreditation = 'accredit' '=' domain-spec |
| 825 |
|
|
|
| 826 |
|
|
The argument to the accreditation modifier is a domain-spec to be |
| 827 |
|
|
macro-expanded and queried. The result of the query is interpreted |
| 828 |
|
|
according to the definitions set forth by the accreditation service. |
| 829 |
|
|
|
| 830 |
|
|
For example, |
| 831 |
|
|
|
| 832 |
|
|
accredit=%{d}.accreditation-provider.example.com |
| 833 |
|
|
accredit=%{ir}.accreditation-provider.example.com |
| 834 |
|
|
|
| 835 |
|
|
This facility allows the publishing domain to make independently |
| 836 |
|
|
verifiable assertions about itself in machine-readable form. |
| 837 |
|
|
|
| 838 |
|
|
Multiple "accredit" modifiers may appear in one SPF record. |
| 839 |
|
|
|
| 840 |
|
|
The "accredit" modifier is OPTIONAL. SPF publishers MAY omit it. |
| 841 |
|
|
SPF clients MAY ignore any or all "accredit" modifiers. If a |
| 842 |
|
|
receiver does not recognize the domain-spec argument, it MAY ignore |
| 843 |
|
|
the modifier. |
| 844 |
|
|
|
| 845 |
|
|
It is expected that SPF-enabled receivers will maintain a library of |
| 846 |
|
|
recognized accreditation providers, keyed by the domain-spec. An |
| 847 |
|
|
accreditation provider is responsible for describing the protocol it |
| 848 |
|
|
uses to encode assertions. For example, suppose an accreditation |
| 849 |
|
|
provider supports DNS "A" queries against the expanded domain-spec. |
| 850 |
|
|
A result of NXDOMAIN could mean "domain is not known to the |
| 851 |
|
|
accreditation service." A result of "127.0.0.10" could mean "the |
| 852 |
|
|
accreditation service vouches for the integrity of the sender |
| 853 |
|
|
domain." Accreditation providers can make up any protocol they like |
| 854 |
|
|
as long as they can convince receivers to use it. |
| 855 |
|
|
|
| 856 |
|
|
Accreditation is only meaningful if the result of the SPF query is a |
| 857 |
|
|
PASS. |
| 858 |
|
|
|
| 859 |
|
|
Accreditation operates on behalf of the sender. Receivers, and the |
| 860 |
|
|
reputation services that operate on their behalf, are expected to |
| 861 |
|
|
adopt a critical stance toward accreditation assertions. |
| 862 |
|
|
|
| 863 |
|
|
6. Miscellaneous |
| 864 |
|
|
|
| 865 |
|
|
6.1 Unrecognized Mechanisms and Modifiers |
| 866 |
|
|
|
| 867 |
|
|
Future extensions to this standard may introduce new mechanisms and |
| 868 |
|
|
modifiers. |
| 869 |
|
|
|
| 870 |
|
|
Unrecognized mechanisms cause processing to abort: if, during |
| 871 |
|
|
evaluation of an SPF record, an SPF client encounters a mechanism |
| 872 |
|
|
which it does not understand or which it cannot properly evaluate |
| 873 |
|
|
(due perhaps to insufficient information about the message at |
| 874 |
|
|
evaluation time), then it terminates processing and returns |
| 875 |
|
|
"unknown", without evaluating any further mechanisms. Mechanisms |
| 876 |
|
|
listed before the unknown mechanism MUST, however, be evaluated. |
| 877 |
|
|
|
| 878 |
|
|
For example, given the record |
| 879 |
|
|
|
| 880 |
|
|
v=spf1 a mx ptr domainkeys:_dk.%{d} -all |
| 881 |
|
|
|
| 882 |
|
|
messages that match the "a", "mx", or "ptr" mechanisms would return a |
| 883 |
|
|
"pass" result. An SPF client that did not recognize the mechanism |
| 884 |
|
|
"domainkeys" would return "unknown". An SPF client that was |
| 885 |
|
|
domainkeys-aware would be able to perform extended evaluation. If |
| 886 |
|
|
the message matched the domainkeys test, it would pass; if it did |
| 887 |
|
|
not, evaluation would proceed to "-all" and return "fail". |
| 888 |
|
|
|
| 889 |
|
|
"domainkeys" is an example of an unknown extension mechanism that |
| 890 |
|
|
could be defined in future versions of this standard. It is NOT |
| 891 |
|
|
defined by this proposal. |
| 892 |
|
|
|
| 893 |
|
|
Unrecognized modifiers are ignored: if an SPF client encounters |
| 894 |
|
|
modifiers which it does not recognize, it MUST ignore them and |
| 895 |
|
|
continue processing. Modifiers always contain an "=" sign. |
| 896 |
|
|
|
| 897 |
|
|
Unrecognized mechanisms are preserved in the Received-SPF header. |
| 898 |
|
|
See section 6.3. |
| 899 |
|
|
|
| 900 |
|
|
|
| 901 |
|
|
|
| 902 |
|
|
|
| 903 |
|
|
|
| 904 |
|
|
6.2 Processing Limits |
| 905 |
|
|
|
| 906 |
|
|
During processing, an SPF client may perform additional SPF |
| 907 |
|
|
subqueries due to the Include mechanism and the Redirect modifier. |
| 908 |
|
|
|
| 909 |
|
|
SPF clients must be prepared to handle records that are set up |
| 910 |
|
|
incorrectly or maliciously. SPF clients MUST perform loop detection, |
| 911 |
|
|
limit SPF recursion, or both. If an SPF client chooses to limit |
| 912 |
|
|
recursion depth, then at least a total of 20 redirects and includes |
| 913 |
|
|
SHOULD be supported. (This number should be enough for even the most |
| 914 |
|
|
complicated configurations.) |
| 915 |
|
|
|
| 916 |
|
|
If a loop is detected, or if more than 20 subqueries are triggered, |
| 917 |
|
|
an SPF client MAY abort the lookup and return the result "unknown". |
| 918 |
|
|
|
| 919 |
|
|
Regular non-recursive lookups due to mechanisms like "a" and "mx" or |
| 920 |
|
|
due to modifiers like "exp" do not count toward this total. |
| 921 |
|
|
|
| 922 |
|
|
6.3 The Received-SPF header |
| 923 |
|
|
|
| 924 |
|
|
It is RECOMMENDED that SMTP receivers record the result of SPF |
| 925 |
|
|
processing in the message headers. If an SMTP receiver chooses to do |
| 926 |
|
|
so, it MUST use the "Received-SPF" header defined here. This |
| 927 |
|
|
information is intended for the recipient. (Information intended for |
| 928 |
|
|
the sender of the e-mail is described in Section 5.2, Explanation.) |
| 929 |
|
|
|
| 930 |
|
|
The header SHOULD be prepended to existing headers. It MUST appear |
| 931 |
|
|
above any other Received-SPF headers in the message. The header has |
| 932 |
|
|
the format: |
| 933 |
|
|
|
| 934 |
|
|
header = "Received-SPF:" 1*SP result [ 1*SP "(" comment ")" ] |
| 935 |
|
|
*( 1*SP key-value-pair ) |
| 936 |
|
|
|
| 937 |
|
|
result = "pass" / "fail" / "error" / "softfail" / "neutral" / |
| 938 |
|
|
"none" / "unknown" / unknown-mechanisms |
| 939 |
|
|
|
| 940 |
|
|
unknown-mechanisms = "unknown" *( 1*SP [prefix] mechanism ) |
| 941 |
|
|
|
| 942 |
|
|
key-value-pair = 1*VCHAR "=" *(WSP / VCHAR) ";" |
| 943 |
|
|
|
| 944 |
|
|
comment = [ smtp-receiver-hostname ": " comment-string ] |
| 945 |
|
|
|
| 946 |
|
|
The comment-string should convey supporting information for the |
| 947 |
|
|
result (such as <responsible-sender> and <current-domain>). |
| 948 |
|
|
|
| 949 |
|
|
If processing was aborted due to unrecognized mechanisms, the |
| 950 |
|
|
Received-SPF header SHOULD show the unrecognized mechanisms after |
| 951 |
|
|
the "unknown" word. |
| 952 |
|
|
|
| 953 |
|
|
Example headers generated by mybox.example.org: |
| 954 |
|
|
|
| 955 |
|
|
Received-SPF: pass (mybox.example.org: domain of |
| 956 |
|
|
myname@example.com designates 192.0.2.1 as permitted sender) |
| 957 |
|
|
receiver=mybox.example.org; client-ip=192.0.2.1; |
| 958 |
|
|
envelope-from=<myname@example.com>; helo=foo.example.com; |
| 959 |
|
|
|
| 960 |
|
|
Received-SPF: fail (mybox.example.org: domain of |
| 961 |
|
|
myname@example.com does not designate |
| 962 |
|
|
192.0.2.1 as permitted sender) |
| 963 |
|
|
receiver=mybox.example.org; |
| 964 |
|
|
client-ip=192.0.2.1; |
| 965 |
|
|
envelope-from=<myname@example.com>; |
| 966 |
|
|
helo=foo.example.com; |
| 967 |
|
|
|
| 968 |
|
|
Received-SPF: softfail (mybox.example.org: domain of |
| 969 |
|
|
transitioning myname@example.com does not |
| 970 |
|
|
designate 192.0.2.1 as permitted sender) |
| 971 |
|
|
|
| 972 |
|
|
Received-SPF: neutral (mybox.example.org: 192.0.2.1 is neither |
| 973 |
|
|
permitted nor denied by domain of |
| 974 |
|
|
myname@example.com) |
| 975 |
|
|
|
| 976 |
|
|
Received-SPF: none (mybox.example.org: myname@example.com does |
| 977 |
|
|
not designate permitted sender hosts) |
| 978 |
|
|
|
| 979 |
|
|
Received-SPF: unknown -extension:foo (mybox.example.org: domain |
| 980 |
|
|
of myname@example.com uses a |
| 981 |
|
|
mechanism not recognized by this client) |
| 982 |
|
|
|
| 983 |
|
|
Received-SPF: error (mybox.example.org: error in processing |
| 984 |
|
|
during lookup of myname@example.com: DNS |
| 985 |
|
|
timeout) |
| 986 |
|
|
|
| 987 |
|
|
SPF clients may append zero or more of the following key-value-pairs |
| 988 |
|
|
at their discretion: |
| 989 |
|
|
|
| 990 |
|
|
receiver the hostname of the SPF client |
| 991 |
|
|
client-ip the IP address of the SMTP client |
| 992 |
|
|
envelope-from the envelope sender address |
| 993 |
|
|
helo the hostname given in the HELO or EHLO command |
| 994 |
|
|
mechanism the mechanism that matched (if no mechanisms |
| 995 |
|
|
matched, substitute the word "default".) |
| 996 |
|
|
problem if an error was returned, details about the error |
| 997 |
|
|
|
| 998 |
|
|
Other key-value pairs may be defined by SPF clients. Until a new key |
| 999 |
|
|
name becomes widely accepted, new key names should start with "x-". |
| 1000 |
|
|
|
| 1001 |
|
|
7. Macros |
| 1002 |
|
|
|
| 1003 |
|
|
7.1 Macro definitions |
| 1004 |
|
|
|
| 1005 |
|
|
Certain directives perform macro interpolation on their arguments. |
| 1006 |
|
|
|
| 1007 |
|
|
macro-string = *( macro-char / VCHAR ) |
| 1008 |
|
|
macro-char = ( "%{" ALPHA transformer *delimiter "}" ) |
| 1009 |
|
|
/ "%%" / "%_" / "%-" |
| 1010 |
|
|
transformer = [ *DIGIT ] [ "r" ] |
| 1011 |
|
|
delimiter = "." / "-" / "+" / "," / "/" / "_" / "=" |
| 1012 |
|
|
|
| 1013 |
|
|
A literal "%" is expressed by "%%". |
| 1014 |
|
|
%_ expands to a single " " space. |
| 1015 |
|
|
%- expands to a URL-encoded space, viz. "%20". |
| 1016 |
|
|
|
| 1017 |
|
|
The following macro letters are expanded in directive arguments: |
| 1018 |
|
|
|
| 1019 |
|
|
l = local-part of responsible-sender |
| 1020 |
|
|
s = responsible-sender |
| 1021 |
|
|
o = responsible-domain |
| 1022 |
|
|
d = current-domain |
| 1023 |
|
|
i = SMTP client IP (nibble format when an IPv6 address) |
| 1024 |
|
|
p = SMTP client domain name |
| 1025 |
|
|
v = client IP version string: "in-addr" for ipv4 or "ip6" for ipv6 |
| 1026 |
|
|
h = HELO/EHLO domain |
| 1027 |
|
|
r = receiving domain |
| 1028 |
|
|
|
| 1029 |
|
|
The following macro letters are expanded only in "exp" text: |
| 1030 |
|
|
|
| 1031 |
|
|
c = SMTP client IP (easily readable format) |
| 1032 |
|
|
t = current timestamp in UTC epoch seconds notation |
| 1033 |
|
|
|
| 1034 |
|
|
The uppercase versions of all these macros are URL-encoded. |
| 1035 |
|
|
|
| 1036 |
|
|
A '%' character not followed by a '{', '%', '-', or '_' character |
| 1037 |
|
|
MUST be interpreted as a literal. SPF publishers SHOULD NOT rely on |
| 1038 |
|
|
this feature; they MUST escape % literals. For example, an |
| 1039 |
|
|
explanation TXT record |
| 1040 |
|
|
Your spam volume has increased by 581% |
| 1041 |
|
|
is incorrect. Instead, say |
| 1042 |
|
|
Your spam volume has increased by 581%% |
| 1043 |
|
|
|
| 1044 |
|
|
Legal optional transformers are: |
| 1045 |
|
|
|
| 1046 |
|
|
*DIGIT ; zero or more digits |
| 1047 |
|
|
'r' ; reverse value, splitting on dots by default |
| 1048 |
|
|
|
| 1049 |
|
|
If transformers or delimiters are provided, the macro strings are |
| 1050 |
|
|
split into parts. After performing any reversal operation or |
| 1051 |
|
|
removal of left-hand parts, the parts are rejoined using "." and not |
| 1052 |
|
|
the original splitting characters. |
| 1053 |
|
|
|
| 1054 |
|
|
By default, strings are split on "." (dots). Macros may specify |
| 1055 |
|
|
delimiter characters which are used instead of ".". Delimiters |
| 1056 |
|
|
MUST be one or more of the characters: |
| 1057 |
|
|
"." / "-" / "+" / "," / "/" / "_" / "=" |
| 1058 |
|
|
|
| 1059 |
|
|
The 'r' transformer indicates a reversal operation: if the client IP |
| 1060 |
|
|
address were 192.0.2.1, the macro %{i} would expand to "192.0.2.1" |
| 1061 |
|
|
and the macro %{ir} would expand to "1.2.0.192". |
| 1062 |
|
|
|
| 1063 |
|
|
The DIGIT transformer indicates the number of right-hand parts to |
| 1064 |
|
|
use after optional reversal. If a DIGIT is specified, the value |
| 1065 |
|
|
MUST be nonzero. If no DIGITs are specified, or if the value |
| 1066 |
|
|
specifies more parts than are available, all the available parts |
| 1067 |
|
|
are used. If the DIGIT was 5, and only 3 parts were available, the |
| 1068 |
|
|
macro interpreter would pretend the DIGIT was 3. Implementations |
| 1069 |
|
|
MUST support at least a value of 128, as that is the maximum number |
| 1070 |
|
|
of labels in a domain name. |
| 1071 |
|
|
|
| 1072 |
|
|
For the "l" and "s" macros: when the local-part is not defined, the |
| 1073 |
|
|
string "postmaster" is substituted. The local-part might be |
| 1074 |
|
|
undefined if the <current-domain> is drawn from the HELO command |
| 1075 |
|
|
rather than the MAIL FROM. |
| 1076 |
|
|
|
| 1077 |
|
|
For IPv4 addresses, both the "i" and "c" macros expand to the |
| 1078 |
|
|
standard dotted-quad format. |
| 1079 |
|
|
|
| 1080 |
|
|
For IPv6 addresses, the "i" macro expands to dot-format address; it |
| 1081 |
|
|
is intended for use in %{ir}. The "c" macro may expand to any of |
| 1082 |
|
|
the hexadecimal colon-format addresses specified in [RFC3513] section |
| 1083 |
|
|
2.2. It is intended for humans to read. |
| 1084 |
|
|
|
| 1085 |
|
|
Use of the "t" macro in DNS lookups would greatly reduce the |
| 1086 |
|
|
effectiveness of DNS caching. The "t" macro is only allowed in |
| 1087 |
|
|
explanation records. The value of the "t" macro SHOULD NOT change |
| 1088 |
|
|
during the evaluation of a given SPF record. |
| 1089 |
|
|
|
| 1090 |
|
|
The "p" macro expands to the validated domain name of the SMTP |
| 1091 |
|
|
client. The validation procedure is described in section 4.6. If |
| 1092 |
|
|
there are no validated domain names, the word "unknown" is |
| 1093 |
|
|
substituted. If multiple validated domain names exist, the first one |
| 1094 |
|
|
returned in the PTR result is chosen. |
| 1095 |
|
|
|
| 1096 |
|
|
|
| 1097 |
|
|
|
| 1098 |
|
|
The "r" macro expands to the name of the receiving MTA. This SHOULD |
| 1099 |
|
|
be a fully qualified domain name, but if one does not exist (as when |
| 1100 |
|
|
the checking is done by a script) or if policy restrictions dictate |
| 1101 |
|
|
otherwise, the word "unknown" SHOULD be substituted. The domain |
| 1102 |
|
|
name MAY be different than the name found in the MX record that the |
| 1103 |
|
|
client MTA used to locate the receiving MTA. |
| 1104 |
|
|
|
| 1105 |
|
|
The "s" macro expands to the sender email address: a localpart, an @ |
| 1106 |
|
|
sign, and a domain. The "o" macro is the domain part of the "s". |
| 1107 |
|
|
They remain the same during a recursive "include" or "redirect" |
| 1108 |
|
|
subquery. |
| 1109 |
|
|
|
| 1110 |
|
|
When the result of macro expansion is used in a domain name query, if |
| 1111 |
|
|
the expanded domain name exceeds 255 characters (the maximum length |
| 1112 |
|
|
of a domain name), the left side is truncated to fit, by removing |
| 1113 |
|
|
successive subdomains until the total length falls below 255 |
| 1114 |
|
|
characters. |
| 1115 |
|
|
|
| 1116 |
|
|
Uppercased macros are URL escaped. |
| 1117 |
|
|
|
| 1118 |
|
|
URL encoding is described in [RFC2396]. |
| 1119 |
|
|
|
| 1120 |
|
|
7.2 Expansion Examples |
| 1121 |
|
|
|
| 1122 |
|
|
The <responsible-sender> is strong-bad@email.example.com. |
| 1123 |
|
|
The IPv4 SMTP client IP is 192.0.2.3. |
| 1124 |
|
|
The IPv6 SMTP client IP is 5f05:2000:80ad:5800::1. |
| 1125 |
|
|
The PTR domain name of the client IP is mx.example.org. |
| 1126 |
|
|
|
| 1127 |
|
|
macro expansion |
| 1128 |
|
|
------------------------------- |
| 1129 |
|
|
%{s} strong-bad@email.example.com |
| 1130 |
|
|
%{o} email.example.com |
| 1131 |
|
|
%{d} email.example.com |
| 1132 |
|
|
%{d4} email.example.com |
| 1133 |
|
|
%{d3} email.example.com |
| 1134 |
|
|
%{d2} example.com |
| 1135 |
|
|
%{d1} com |
| 1136 |
|
|
%{p} mx.example.org |
| 1137 |
|
|
%{p2} example.org |
| 1138 |
|
|
%{dr} com.example.email |
| 1139 |
|
|
%{d2r} example.email |
| 1140 |
|
|
%{l} strong-bad |
| 1141 |
|
|
%{l-} strong.bad |
| 1142 |
|
|
%{lr} strong-bad |
| 1143 |
|
|
%{lr-} bad.strong |
| 1144 |
|
|
%{l1r-} strong |
| 1145 |
|
|
|
| 1146 |
|
|
macro-string expansion |
| 1147 |
|
|
--------------------------------------------------------------------- |
| 1148 |
|
|
%{ir}.%{v}._spf.%{d2} 3.2.0.192.in-addr._spf.example.com |
| 1149 |
|
|
%{lr-}.lp._spf.%{d2} bad.strong.lp._spf.example.com |
| 1150 |
|
|
|
| 1151 |
|
|
%{lr-}.lp.%{ir}.%{v}._spf.%{d2} |
| 1152 |
|
|
bad.strong.lp.3.2.0.192.in-addr._spf.example.com |
| 1153 |
|
|
|
| 1154 |
|
|
%{ir}.%{v}.%{l1r-}.lp._spf.%{d2} |
| 1155 |
|
|
3.2.0.192.in-addr.strong.lp._spf.example.com |
| 1156 |
|
|
|
| 1157 |
|
|
%{p2}.trusted-domains.example.net |
| 1158 |
|
|
example.org.trusted-domains.example.net |
| 1159 |
|
|
|
| 1160 |
|
|
IPv6: |
| 1161 |
|
|
%{ir}.example.org 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8. |
| 1162 |
|
|
5.d.a.0.8.0.0.0.2.5.0.f.5.example.org |
| 1163 |
|
|
|
| 1164 |
|
|
8. Conformance Definitions |
| 1165 |
|
|
|
| 1166 |
|
|
The following sections define SPF conformance applied to various |
| 1167 |
|
|
entities. |
| 1168 |
|
|
|
| 1169 |
|
|
8.1 Introduction |
| 1170 |
|
|
|
| 1171 |
|
|
In an SMTP+SPF transaction, there are three primary entites: |
| 1172 |
|
|
- the envelope sender domain |
| 1173 |
|
|
- the sending host (the SMTP client) |
| 1174 |
|
|
- the SMTP receiver |
| 1175 |
|
|
|
| 1176 |
|
|
The conformance status of each entity has implications for the |
| 1177 |
|
|
transaction as a whole. |
| 1178 |
|
|
|
| 1179 |
|
|
8.2 Conformance with regard to sender domains |
| 1180 |
|
|
|
| 1181 |
|
|
For a domain to be considered SPF-conformant, its authoritative DNS |
| 1182 |
|
|
servers are REQUIRED to publish an SPF record for that domain. |
| 1183 |
|
|
Domains which do not publish SPF data SHALL NOT be deemed |
| 1184 |
|
|
SPF-conformant. |
| 1185 |
|
|
|
| 1186 |
|
|
If foo.example.com claims SPF compliance, it must have a record of |
| 1187 |
|
|
the form: |
| 1188 |
|
|
|
| 1189 |
|
|
foo.example.com IN TXT "v=spf1 ..." |
| 1190 |
|
|
|
| 1191 |
|
|
A domain also SHOULD publish policy records for each of its |
| 1192 |
|
|
designated servers. |
| 1193 |
|
|
|
| 1194 |
|
|
|
| 1195 |
|
|
8.3 Conformance with regard to sending e-mail systems |
| 1196 |
|
|
|
| 1197 |
|
|
To be considered SPF-conformant, an SMTP sending host MUST resolve a |
| 1198 |
|
|
"pass" for all the SPF-conformant domains which appear in the "MAIL |
| 1199 |
|
|
FROM" command. |
| 1200 |
|
|
|
| 1201 |
|
|
An SMTP sending host MUST also resolve a "pass" for all the |
| 1202 |
|
|
SPF-conformant domains which appear in the "HELO" or "EHLO" command. |
| 1203 |
|
|
|
| 1204 |
|
|
If the domains used in MAIL FROM and in HELO/EHLO do not publish SPF |
| 1205 |
|
|
information, an SMTP sending host is considered conformant by |
| 1206 |
|
|
default. Only when those domains do publish SPF is the SMTP sending |
| 1207 |
|
|
host required to resolve a "pass". |
| 1208 |
|
|
|
| 1209 |
|
|
For example: in a transaction where host mx01 emits: |
| 1210 |
|
|
|
| 1211 |
|
|
HELO mx01.example.com |
| 1212 |
|
|
MAIL FROM:<strongbad@example.com> |
| 1213 |
|
|
|
| 1214 |
|
|
An SMTP+SPF receiver will attempt to find an SPF record at |
| 1215 |
|
|
|
| 1216 |
|
|
example.com TXT |
| 1217 |
|
|
|
| 1218 |
|
|
An SMTP+SPF receiver may also attempt to find an SPF record at |
| 1219 |
|
|
|
| 1220 |
|
|
mx01.example.com TXT |
| 1221 |
|
|
|
| 1222 |
|
|
If either query returns an SPF record, host mx01 MUST return a |
| 1223 |
|
|
"pass" for that SPF test. |
| 1224 |
|
|
|
| 1225 |
|
|
|
| 1226 |
|
|
8.4 Conformance with regard to receiving e-mail systems |
| 1227 |
|
|
|
| 1228 |
|
|
To describe itself as SPF-conformant, an SMTP receiver MUST perform |
| 1229 |
|
|
SPF tests. |
| 1230 |
|
|
|
| 1231 |
|
|
SPF tests need not be performed while an SMTP transaction is ongoing: |
| 1232 |
|
|
if the MDA performs the test, that is sufficient. A server need not |
| 1233 |
|
|
reject a message; but if it does not, it SHOULD add a Received-SPF |
| 1234 |
|
|
header. If a server rejects a message, it SHOULD include any |
| 1235 |
|
|
<explanation> provided by the SPF publisher. |
| 1236 |
|
|
|
| 1237 |
|
|
If a receiver system has a choice of testing the envelope sender (as |
| 1238 |
|
|
recorded in the Return-Path header) versus the message headers (as |
| 1239 |
|
|
recorded in Sender or From), the envelope is recommended. |
| 1240 |
|
|
|
| 1241 |
|
|
If the domain passed in the HELO command is a fully-qualified domain |
| 1242 |
|
|
name, an SPF-conformant receiver MAY test that domain name. |
| 1243 |
|
|
|
| 1244 |
|
|
Receiver systems SHOULD exclude special recipients such as |
| 1245 |
|
|
postmaster@ and abuse@ from SPF processing. See [RFC2142]. |
| 1246 |
|
|
|
| 1247 |
|
|
SPF is only one component in a policy engine. An SPF-conformant SMTP |
| 1248 |
|
|
receiver is NOT REQUIRED to perform SPF tests on messages whose |
| 1249 |
|
|
dispositions have already been decided on the basis of other policy. |
| 1250 |
|
|
|
| 1251 |
|
|
Example 1: if an SMTP receiver requires that sender domains must |
| 1252 |
|
|
possess MX or A records, and rejects transactions where they do |
| 1253 |
|
|
not, then SPF tests are moot. |
| 1254 |
|
|
|
| 1255 |
|
|
Example 2: if an SMTP receiver expects messages from a trusted |
| 1256 |
|
|
client, such as a secondary MX for its own domain, then SPF tests |
| 1257 |
|
|
are not needed. |
| 1258 |
|
|
|
| 1259 |
|
|
Example 3: if an SMTP receiver is considering a transaction which |
| 1260 |
|
|
does not yield a fully-qualified domain name in either the MAIL |
| 1261 |
|
|
FROM sender or the HELO command, SPF tests are not appropriate, and |
| 1262 |
|
|
the disposition of the message should be decided on the basis of |
| 1263 |
|
|
other policy. |
| 1264 |
|
|
|
| 1265 |
|
|
8.5 Conformance with regard to a particular SMTP transaction |
| 1266 |
|
|
|
| 1267 |
|
|
An email message during delivery is conformant if SPF evaluation |
| 1268 |
|
|
results in a "pass", "neutral", or "softfail". |
| 1269 |
|
|
|
| 1270 |
|
|
8.6 Conformance with regard to an email-sending user |
| 1271 |
|
|
|
| 1272 |
|
|
An email-sending user is conformant if all of her outbound mail is |
| 1273 |
|
|
sent through a designated mailer for her sender domain. |
| 1274 |
|
|
|
| 1275 |
|
|
8.7 Rejection of non-SPF conformant email |
| 1276 |
|
|
|
| 1277 |
|
|
Mail from a domain SHOULD NOT be automatically treated as suspect |
| 1278 |
|
|
just because the domain doesn't publish SPF records. |
| 1279 |
|
|
|
| 1280 |
|
|
If SPF tests return an explicit "fail" result during processing, the |
| 1281 |
|
|
receiver domain MAY reject, label, or classify the message as it |
| 1282 |
|
|
wishes. If the message is rejected, the receiver domain SHOULD |
| 1283 |
|
|
provide the "exp" string specified in section 5.2. |
| 1284 |
|
|
|
| 1285 |
|
|
|
| 1286 |
|
|
|
| 1287 |
|
|
|
| 1288 |
|
|
|
| 1289 |
|
|
8.8 Rejection of SPF conformant email |
| 1290 |
|
|
|
| 1291 |
|
|
An SPF email system MAY choose to reject or discard email on the |
| 1292 |
|
|
basis of local policy. SPF is one component in an overall |
| 1293 |
|
|
email-policy engine. SPF merely makes it possible for policy |
| 1294 |
|
|
decisions to be made with confidence at the sender-domain level. The |
| 1295 |
|
|
actual policy decisions are outside the scope of this document. |
| 1296 |
|
|
|
| 1297 |
|
|
8.9 Recommendations |
| 1298 |
|
|
|
| 1299 |
|
|
If a domain contains subdomains or hostnames that have A or MX |
| 1300 |
|
|
records, those subdomains and hostnames SHOULD publish SPF records as |
| 1301 |
|
|
well. If they do not, they remain at risk of forgery. |
| 1302 |
|
|
|
| 1303 |
|
|
Domain names used in a legitimate envelope sender SHOULD possess MX |
| 1304 |
|
|
records. |
| 1305 |
|
|
|
| 1306 |
|
|
This proposal recommends the deprecation of the legacy "implicit |
| 1307 |
|
|
MX" rule defined in [RFC2821] section 5. Domains that want to |
| 1308 |
|
|
receive mail SHOULD always define explicit MX records. |
| 1309 |
|
|
|
| 1310 |
|
|
This proposal also recommends that HELO arguments SHOULD be |
| 1311 |
|
|
fully-qualified domain names that resolve to the IP address of the |
| 1312 |
|
|
sending MTA. |
| 1313 |
|
|
|
| 1314 |
|
|
8.10 Changes to Existing Semantics |
| 1315 |
|
|
|
| 1316 |
|
|
8.10.1 The Return-Path is now also a Responsible Sender |
| 1317 |
|
|
|
| 1318 |
|
|
From [RFC2821]: |
| 1319 |
|
|
The <reverse-path> portion of the first or only argument contains |
| 1320 |
|
|
the source mailbox (between "<" and ">" brackets), which can be |
| 1321 |
|
|
used to report errors (see section 4.2 for a discussion of error |
| 1322 |
|
|
reporting). |
| 1323 |
|
|
|
| 1324 |
|
|
When SPF is used to authenticate the return-path, the domain in the |
| 1325 |
|
|
source mailbox is now also considered accountable for injecting the |
| 1326 |
|
|
message into the mailstream. |
| 1327 |
|
|
|
| 1328 |
|
|
This semantic change is justified by the desire to control joe-jobs. |
| 1329 |
|
|
Joe jobs are a distributed denial of service attack against a given |
| 1330 |
|
|
address executed by forging messages using a victim sender address |
| 1331 |
|
|
and sending them to thousands of recipients. Inevitably, some of |
| 1332 |
|
|
those delivery attempts fail, and bounce messages are generated to |
| 1333 |
|
|
the victim sender address. These unwanted bounce messages can end up |
| 1334 |
|
|
crippling the victim mailbox. SPF gives these potential victims a |
| 1335 |
|
|
way to protect their mailboxes. With SPF, senders can now control |
| 1336 |
|
|
the use of their address in the return-path. |
| 1337 |
|
|
|
| 1338 |
|
|
9. Applicability Statement |
| 1339 |
|
|
|
| 1340 |
|
|
This section discusses deployment considerations. |
| 1341 |
|
|
|
| 1342 |
|
|
9.1 Adoption by disreputable domains |
| 1343 |
|
|
|
| 1344 |
|
|
It is trivial for a domain to publish "+all" to allow all. A |
| 1345 |
|
|
disreputable domain could then send unwanted email from any host. |
| 1346 |
|
|
This is a common objection to SPF. |
| 1347 |
|
|
|
| 1348 |
|
|
SPF provides a value-neutral framework for sender authentication and |
| 1349 |
|
|
accreditation. Senders use that framework to make assertions |
| 1350 |
|
|
regarding the quality of messages. |
| 1351 |
|
|
|
| 1352 |
|
|
It is the responsibility of the SMTP receiver to evaluate those |
| 1353 |
|
|
assertions. First the SMTP receiver discards obvious forgeries. |
| 1354 |
|
|
Then it evaluates the remaining messages according to the reputation |
| 1355 |
|
|
of the sender and any accompanying accreditation assertions. |
| 1356 |
|
|
|
| 1357 |
|
|
Whether a given domain is reputable or not is a decision that belongs |
| 1358 |
|
|
to an SMTP receiver. Policy decisions regarding particular messages |
| 1359 |
|
|
are outside the scope of SPF. |
| 1360 |
|
|
|
| 1361 |
|
|
9.2 Limitations |
| 1362 |
|
|
|
| 1363 |
|
|
In an SPF-conformant environment, envelope sender forgery is limited |
| 1364 |
|
|
to the local domain. Unless per-user macros are used, it is possible |
| 1365 |
|
|
for one user to forge another user's address within that domain. |
| 1366 |
|
|
However, the organization responsible for the domain presumably has |
| 1367 |
|
|
the wherewithal to follow an audit trail. |
| 1368 |
|
|
|
| 1369 |
|
|
9.3 Phased Rollout |
| 1370 |
|
|
|
| 1371 |
|
|
At an adopting domain, adoption of SPF could occur in phases. A |
| 1372 |
|
|
domain might move through these phases by changing its default |
| 1373 |
|
|
response type from "neutral" to "softfail" to "fail". |
| 1374 |
|
|
|
| 1375 |
|
|
The phases are characterized by different levels of awareness |
| 1376 |
|
|
among the domain's userbase, and different levels of strictness on |
| 1377 |
|
|
the part of SPF-conformant receivers. |
| 1378 |
|
|
|
| 1379 |
|
|
When a sufficient majority of its users are SPF-conformant, a |
| 1380 |
|
|
domain SHOULD change its default to "-all". This constitutes a |
| 1381 |
|
|
request to mail receivers to reject non-conformant mail. Setting |
| 1382 |
|
|
"-all" protects the users from account fraud and joe-jobbing. |
| 1383 |
|
|
|
| 1384 |
|
|
Messages that explicitly fail SPF with a "fail" SHOULD be rejected. |
| 1385 |
|
|
|
| 1386 |
|
|
9.4 Verbatim Forwarding |
| 1387 |
|
|
|
| 1388 |
|
|
SPF changes the model of email from a store-and-forward system to an |
| 1389 |
|
|
end-to-end system. Verbatim email forwarding suffers accordingly. |
| 1390 |
|
|
|
| 1391 |
|
|
In verbatim forwarding, an intermediate forwarding host rewrites the |
| 1392 |
|
|
envelope recipient, but leaves the envelope sender untouched. |
| 1393 |
|
|
|
| 1394 |
|
|
There are two ways to preserve forwarding functionality under SPF. |
| 1395 |
|
|
Either forwarders can change to remailing, or receiver systems can |
| 1396 |
|
|
whitelist forwarders. |
| 1397 |
|
|
|
| 1398 |
|
|
In remailing, forwarding hosts rewrite the return-path address. |
| 1399 |
|
|
The rewritten envelope sender can take a variety of forms, depending |
| 1400 |
|
|
on whether bounces should be forwarded back to the original sender. |
| 1401 |
|
|
If bounces are unimportant, the rewritten sender could be as simple |
| 1402 |
|
|
as <nobody@example.com>. If bounces are important, forwarders can |
| 1403 |
|
|
use envelope encapsulation with a MAC nonce, or rewrite the address |
| 1404 |
|
|
into a database-backed cookie. |
| 1405 |
|
|
|
| 1406 |
|
|
If return-path rewriting is not feasible, receiver systems can simply |
| 1407 |
|
|
whitelist trusted sites which are known to forward mail to local |
| 1408 |
|
|
receivers. |
| 1409 |
|
|
|
| 1410 |
|
|
|
| 1411 |
|
|
9.5 Per-user exemptions |
| 1412 |
|
|
|
| 1413 |
|
|
The "exists" mechanism can be used to exempt certain users from the |
| 1414 |
|
|
SPF requirements that apply to the rest of the domain. |
| 1415 |
|
|
|
| 1416 |
|
|
|
| 1417 |
|
|
10. Security Considerations |
| 1418 |
|
|
|
| 1419 |
|
|
SPF depends on DNS. A malicious attacker could poison a target's DNS |
| 1420 |
|
|
cache with spoofed DNS data. |
| 1421 |
|
|
|
| 1422 |
|
|
SPF assumes the client IP address is true. A malicious attacker |
| 1423 |
|
|
could spoof TCP sequences to make mail appear to come from a |
| 1424 |
|
|
designated host. If this happens, an "echo" command could be |
| 1425 |
|
|
introduced to ESMTP to require a simple challenge/response |
| 1426 |
|
|
confirmation. |
| 1427 |
|
|
|
| 1428 |
|
|
SPF clients need to limit the number of includes and redirects to |
| 1429 |
|
|
avoid attacks. Implementations are required to follow recursion to a |
| 1430 |
|
|
minimum of 20. |
| 1431 |
|
|
|
| 1432 |
|
|
|
| 1433 |
|
|
11. IANA Considerations |
| 1434 |
|
|
|
| 1435 |
|
|
The registry of standard mechanism and modifier names may be turned |
| 1436 |
|
|
over to IANA for management. |
| 1437 |
|
|
|
| 1438 |
|
|
12. Contributors and Acknowledgements |
| 1439 |
|
|
|
| 1440 |
|
|
SPF owes a debt of parentage to RMX (by Hadmut Danisch in 2003) and to |
| 1441 |
|
|
DMP (by Gordon Fecyk in 2003). It traces its ancestry farther back |
| 1442 |
|
|
through "Repudiating Mail-From" by Paul Vixie in 2002 to a suggestion |
| 1443 |
|
|
by Jim Miller in 1998. |
| 1444 |
|
|
|
| 1445 |
|
|
Philip Gladstone contributed macros to the specification, multiplying |
| 1446 |
|
|
the expressiveness of the language and making per-user and per-IP |
| 1447 |
|
|
lookups possible. |
| 1448 |
|
|
|
| 1449 |
|
|
The authors would also like to thank the following individuals who |
| 1450 |
|
|
contributed to, critically reviewed, or otherwise furthered the |
| 1451 |
|
|
development of this specification. The authors wish to apologize in |
| 1452 |
|
|
advance for any omissions. |
| 1453 |
|
|
|
| 1454 |
|
|
Jameel Akari, Marc Alaia, Dave Alden, Tom Allison, Eric Allman, |
| 1455 |
|
|
Justo Alonso, Mark Anderson, Matthias Andree, Don Andrews, |
| 1456 |
|
|
Mohammad Arca, Aredridel, William Astle, Bob Atkinson, Roy Badami, |
| 1457 |
|
|
Andy Bakun, Derek J. Balling, Arik Baratz, Graham Barr, Matthew |
| 1458 |
|
|
Barr, Ernesto Baschny, Mike Batchelor, Peter Baumann, Steven |
| 1459 |
|
|
Bellovin, Jon Bertrand, Paul Blair, Andrew Boling, Richard |
| 1460 |
|
|
Bollinger, Dan Boresjo, Nicolas Bougues, Daniel Bourque, Jeremy |
| 1461 |
|
|
T. Bouse, Raymond S Brand, Seth Breidbart, David Brodbeck, Neil |
| 1462 |
|
|
Brown, Zack Brown, Michael R. Brumm, Jason Buchanan, Jasmin |
| 1463 |
|
|
Buchert, Ted Cabeen, Dave Camp, Anthony Campbell, Bryan Campbell, |
| 1464 |
|
|
Brian Candler, John Capo, Dennis Carr, L. Carver, Lee Carver, Ian |
| 1465 |
|
|
Castle, Jose Celestino, Christopher Chan, Jason Chen, Joe Christy, |
| 1466 |
|
|
Andrew Church, Greg Cirino, Bradley Cloete, James H. Cloos Jr., |
| 1467 |
|
|
Bill Cole, Brian Coloney, Sean Comeau, Greg Connor, Erik Corry, Dj |
| 1468 |
|
|
Coster, James Couzens, Chris Cowherd, Dave Crocker, Arlie Davis, |
| 1469 |
|
|
Alan DeKok, Mark Delany, Kitt Diebold, Mark Jason Dominus, Andrew |
| 1470 |
|
|
W. Donoho, William H. Dorell, Jeremy Doupe, Lilia Downs, Chris |
| 1471 |
|
|
Drake, Jesus Duarte, Viktor Duchovni, Lars B. Dybdahl, David |
| 1472 |
|
|
Dyer-Bennet, Lyndon Eaton, Henrik Edlund, William Elan, Matthew |
| 1473 |
|
|
Elvey, Stefan Engelbert, Shaun T. Erickson, Ray Everett-Church, |
| 1474 |
|
|
Mark Farver, Nick Fields, Guillaume Filion, Tony Finch, Cary |
| 1475 |
|
|
Fitch, Gustav Foseid, Mark Foster, Steven Foster, Benjamin Franz, |
| 1476 |
|
|
Tim Freeman, Tugrul Galatali, Stuart D. Gathman, Fotis Georgatos, |
| 1477 |
|
|
Richard George, Oliver Gerler, Dean Gibson, B. Gingery, Eric |
| 1478 |
|
|
Girard, Tim Gladding, Philip Gladstone, Etta Good, Seth Goodman, |
| 1479 |
|
|
Gabriel Granger, Ben Greear, Bob Greene, Ronald F. Guilmette, |
| 1480 |
|
|
Phillip Hallam-Baker, Clifford Hammerschmidt, Catherine Hampton, |
| 1481 |
|
|
Ask Bjoern Hansen, Richard Hansen, Howard Lee Harkness, Thomas |
| 1482 |
|
|
Harold, Edward Ned Harvey, Ned Harvey, Brian Hatch, Refugio |
| 1483 |
|
|
Hayden, Philip Hazel, Zan Hecht, Eric Helfgott, George Herson, |
| 1484 |
|
|
Greg Hewgill, Alan Hodgson, Vidar Holen, Sam Horrocks, Phil |
| 1485 |
|
|
Howard, Paul Howarth, Anthony Howe, Marc Hudson, John Hughes, Kenn |
| 1486 |
|
|
Humborg, Adam Hunt, Carl Hutzler, Paul Iadonisi, Lars Magne |
| 1487 |
|
|
Ingebrigtsen, Aditya Ivaturi, Mitcheal Jackmoore, Jeremy Jackson, |
| 1488 |
|
|
Bryce Jasmer, Mark Jeftovic, Jim Jobe, B. Johannessen, Thomas H |
| 1489 |
|
|
Jones II, Nico Kadel-Garcia, Rob Kaper, Phil Karn, Harry Katz, Lou |
| 1490 |
|
|
Katz, Richard Kay, Izzy Kindred, Alain Knaff, Don Koch, Kevin |
| 1491 |
|
|
Kolk, Tomasz Konefal, Thor Kooda, Karl Kraft, Andreas Kreuzinger, |
| 1492 |
|
|
Russell Kroll, Carsten Kuckuk, Jon Kyme, Ty Lammy, Bill Landry, |
| 1493 |
|
|
Mark Lentczner, Nate Leon, Andy Lester, John R Levine, Jon |
| 1494 |
|
|
Loeliger, Will Lowe, Dave Lugo, Jim Lyon, Marty Lyons, Vivien M., |
| 1495 |
|
|
Daniel Mack, Dr Belo Madu, Lee Maguire, Ryan Malayter, Walt |
| 1496 |
|
|
Mankowski, Marrandy, K.F.J. Martens, John A. Martin, Tracy Martin, |
| 1497 |
|
|
Justin Mason, Jeroen Massar, Mike McCandless, Joel McClung, Chuck |
| 1498 |
|
|
Mead, Tim Meadowcroft, Julian Mehnle, Cyrus Mehta, Michael Meier, |
| 1499 |
|
|
Scott Merrill, Nigel Metheringham, Bob Miller, Nelson Minica, Anne |
| 1500 |
|
|
Mitchell, George Mitchell, Dr. Ernst Molitor, Michael Fischer |
| 1501 |
|
|
V. Mollard, Philipp Morger, Roger Moser, der Mouse, Matthew |
| 1502 |
|
|
Mucker, Simon J Mudd, Graham Murray, Dan Nadir, Alain Nakache, |
| 1503 |
|
|
Brian Nelson, Scott Nelson, Sam Norris, Daryl Odnert, Leonard Orb, |
| 1504 |
|
|
Steven W. Orr, Seun Osewa, Gerald Oskoboiny, Harry Palmer, John |
| 1505 |
|
|
Payne, Hans Dieter Pearcey, Randy Pearson, Matt Perry, R. Scott |
| 1506 |
|
|
Perry, Kevin Peuhkurinen, Nick Phillips, Richard Pitt, Jordan |
| 1507 |
|
|
Pollack, Bob Poortinga, Jim Popovitch, Kenneth Porter, Bob Proulx, |
| 1508 |
|
|
Loic Prylli, Rich Puhek, Nils Puhlmann, James Pullicino, Jeremy |
| 1509 |
|
|
Pullicino, Daniel Quinlan, Ramakanta, Suresh Ramasubramanian, Jim |
| 1510 |
|
|
Ramsay, Eric S. Raymond, Kevin Reed, Alan Reider, Joe Rhett, Bill |
| 1511 |
|
|
Rockefeller, Daniel Roethlisberger, Andrew Rose, Alex Rosen, David |
| 1512 |
|
|
Saez, Hector Santos, Christophe Saout, Scott Savarese, Wayne |
| 1513 |
|
|
Schlitt, George Schlossnagle, Theo Schlossnagle, Stuart Schneider, |
| 1514 |
|
|
Neil Schwartzman, Frank Segtrop, Klaus Alexander Seistrup, Will |
| 1515 |
|
|
Senn, Matt Sergeant, Yakov Shafranovich, Shevek, Mark Shewmaker, |
| 1516 |
|
|
G. Roderick Singleton, Fridrik Skulason, Martin H. Sluka, Andy |
| 1517 |
|
|
Smith, Karl J. Smith, Larry Smith, Steven Earl Smith, Richard |
| 1518 |
|
|
Soderberg, Rolf E. Sonneveld, Robert Spier, Jonathan Steinert, |
| 1519 |
|
|
Thomas R. Stephenson, Rick Stewart, Andrew Sweger, Bob Tanner, |
| 1520 |
|
|
Daniel Taylor, Brad Templeton, Rahul Tongia, Laszlo Toth, Dustin |
| 1521 |
|
|
D. Trammell, Mark Tranchant, Philip Tucker, Alex Van Den Bogaerdt, |
| 1522 |
|
|
Dirk Van Mieghem, Rik Van Riel, Theo Van Dinter, Wietse Venema, |
| 1523 |
|
|
Kelson Vibber, Peter Viertel, Paul Vixie, Martin Treusch Von |
| 1524 |
|
|
Buttlar, Graham Wager, Matthew Walker, Jasper Wallace, John |
| 1525 |
|
|
Warren, Odhiambo Washington, Terence Way, George Webb, Wechsler, |
| 1526 |
|
|
Rick Wesson, Casey West, Peter Westlake, Nathan Wharton, David |
| 1527 |
|
|
A. Wheeler, Weldon Whipple, Phil White, Sanford Whiteman, Colin |
| 1528 |
|
|
Whittaker, Tim Wilde, Jan Wildeboer, Dan Willett Sr., |
| 1529 |
|
|
Steven G. Willis, Chuck Wolber, David Woodhouse, Simon Woodward, |
| 1530 |
|
|
Greg Wooledge, Paul Wouters, Samson Yormie, Zolta'N Za'Mbori, Joe |
| 1531 |
|
|
Zasada, and Lloyd Zusman. |
| 1532 |
|
|
|
| 1533 |
|
|
The folks on the SPAM-L mailing list. |
| 1534 |
|
|
The folks on the ASRG and MARID/MXCOMP mailing lists. |
| 1535 |
|
|
The folks on the spf-discuss mailing list. |
| 1536 |
|
|
The folks on the mailing list that shall not be named. |
| 1537 |
|
|
The folks on #perl. |
| 1538 |
|
|
|
| 1539 |
|
|
|
| 1540 |
|
|
|
| 1541 |
|
|
|
| 1542 |
|
|
|
| 1543 |
|
|
|
| 1544 |
|
|
|
| 1545 |
|
|
|
| 1546 |
|
|
|
| 1547 |
|
|
|
| 1548 |
|
|
|
| 1549 |
|
|
|
| 1550 |
|
|
|
| 1551 |
|
|
|
| 1552 |
|
|
|
| 1553 |
|
|
|
| 1554 |
|
|
|
| 1555 |
|
|
|
| 1556 |
|
|
|
| 1557 |
|
|
|
| 1558 |
|
|
|
| 1559 |
|
|
|
| 1560 |
|
|
|
| 1561 |
|
|
|
| 1562 |
|
|
|
| 1563 |
|
|
|
| 1564 |
|
|
|
| 1565 |
|
|
|
| 1566 |
|
|
|
| 1567 |
|
|
|
| 1568 |
|
|
|
| 1569 |
|
|
|
| 1570 |
|
|
|
| 1571 |
|
|
|
| 1572 |
|
|
|
| 1573 |
|
|
|
| 1574 |
|
|
|
| 1575 |
|
|
|
| 1576 |
|
|
Appendix A. Collected ABNF for SPF records |
| 1577 |
|
|
|
| 1578 |
|
|
This section is normative and any discrepancies with the ABNF fragments |
| 1579 |
|
|
in the preceding text are to be resolved in favor of this grammar. |
| 1580 |
|
|
|
| 1581 |
|
|
See [RFC2234] for ABNF notation. |
| 1582 |
|
|
|
| 1583 |
|
|
SPF-record = version *( 1*SP ( directive / modifier ) ) *SP |
| 1584 |
|
|
|
| 1585 |
|
|
version = "v=spf" 1*DIGIT |
| 1586 |
|
|
|
| 1587 |
|
|
directive = [ prefix ] mechanism |
| 1588 |
|
|
prefix = "+" / "-" / "?" / "~" |
| 1589 |
|
|
modifier = redirect / explanation / unknown-modifier |
| 1590 |
|
|
redirect = "redirect" "=" domain-spec |
| 1591 |
|
|
explanation = "exp" "=" domain-spec |
| 1592 |
|
|
unknown-modifier = name "=" macro-string |
| 1593 |
|
|
|
| 1594 |
|
|
mechanism = ( all / include |
| 1595 |
|
|
/ A / MX / PTR / IP4 / IP6 / exists |
| 1596 |
|
|
/ extension ) |
| 1597 |
|
|
|
| 1598 |
|
|
all = "all" |
| 1599 |
|
|
include = "include" ":" domain-spec |
| 1600 |
|
|
A = "a" [ ":" domain-spec ] [ dual-cidr-length ] |
| 1601 |
|
|
MX = "mx" [ ":" domain-spec ] [ dual-cidr-length ] |
| 1602 |
|
|
PTR = "ptr" [ ":" domain-spec ] |
| 1603 |
|
|
IP4 = "ip4" ":" ip4-network [ ip4-cidr-length ] |
| 1604 |
|
|
IP6 = "ip6" ":" ip6-network [ ip6-cidr-length ] |
| 1605 |
|
|
exists = "exists" ":" domain-spec |
| 1606 |
|
|
|
| 1607 |
|
|
extension = name [ ":" macro-string ] |
| 1608 |
|
|
|
| 1609 |
|
|
ip4-network = as in [RFC2373] [15], e.g. 192.0.2.0 |
| 1610 |
|
|
ip6-network = as in [RFC2373] [15], e.g. 12AB:0:0:CD30 |
| 1611 |
|
|
|
| 1612 |
|
|
domain-spec = domain-name / macro-string |
| 1613 |
|
|
domain-name = domain-part *( "." domain-part ) [ "." ] |
| 1614 |
|
|
domain-part = as defined in [RFC1034] |
| 1615 |
|
|
|
| 1616 |
|
|
dual-cidr-length = [ ip4-cidr-length ] [ "/" ip6-cidr-length ] |
| 1617 |
|
|
ip4-cidr-length = "/" 1*DIGIT |
| 1618 |
|
|
ip6-cidr-length = "/" 1*DIGIT |
| 1619 |
|
|
|
| 1620 |
|
|
macro-string = *( macro-char / VCHAR ) |
| 1621 |
|
|
macro-char = ( "%{" ALPHA transformer *delimiter "}" ) |
| 1622 |
|
|
/ "%%" / "%_" / "%-" |
| 1623 |
|
|
transformer = [ *DIGIT ] [ "r" ] |
| 1624 |
|
|
|
| 1625 |
|
|
name = alpha *( alpha / digit / "-" / "_" / "." ) |
| 1626 |
|
|
delimiter = "." / "-" / "+" / "," / "/" / "_" / "=" |
| 1627 |
|
|
|
| 1628 |
|
|
Appendix B. Extended Examples |
| 1629 |
|
|
|
| 1630 |
|
|
These examples are based on the following DNS setup: |
| 1631 |
|
|
|
| 1632 |
|
|
; A domain with two mail servers, two hosts |
| 1633 |
|
|
; and two servers at the domain name |
| 1634 |
|
|
|
| 1635 |
|
|
$ORIGIN example.com. |
| 1636 |
|
|
@ MX 10 mail-a |
| 1637 |
|
|
MX 20 mail-b |
| 1638 |
|
|
A 192.168.1.10 |
| 1639 |
|
|
A 192.168.1.11 |
| 1640 |
|
|
amy A 192.168.1.65 |
| 1641 |
|
|
bob A 192.168.1.66 |
| 1642 |
|
|
mail-a A 192.168.1.129 |
| 1643 |
|
|
mail-b A 192.168.1.130 |
| 1644 |
|
|
www CNAME example.com. |
| 1645 |
|
|
|
| 1646 |
|
|
; The reverse IP for that domain |
| 1647 |
|
|
|
| 1648 |
|
|
$ORIGIN 1.168.192.in-addr.arpa. |
| 1649 |
|
|
10 PTR example.com. |
| 1650 |
|
|
11 PTR example.com. |
| 1651 |
|
|
65 PTR amy.example.com. |
| 1652 |
|
|
66 PTR bob.example.com. |
| 1653 |
|
|
129 PTR mail-a.example.com. |
| 1654 |
|
|
130 PTR mail-b.example.com. |
| 1655 |
|
|
|
| 1656 |
|
|
; A related domain |
| 1657 |
|
|
|
| 1658 |
|
|
$ORIGIN example.org |
| 1659 |
|
|
@ MX 10 mail-c |
| 1660 |
|
|
mail-c A 192.168.2.140 |
| 1661 |
|
|
|
| 1662 |
|
|
; The reverse IP for that domain |
| 1663 |
|
|
|
| 1664 |
|
|
$ORIGIN 2.168.192.in-addr.arpa. |
| 1665 |
|
|
140 PTR mail-c.example.org. |
| 1666 |
|
|
|
| 1667 |
|
|
; A rogue reverse IP domain that claims to be |
| 1668 |
|
|
; something it's not |
| 1669 |
|
|
|
| 1670 |
|
|
$ORIGIN 0.0.10.in-addr.arpa. |
| 1671 |
|
|
4 PTR bob.example.com. |
| 1672 |
|
|
|
| 1673 |
|
|
|
| 1674 |
|
|
|
| 1675 |
|
|
Appendix B.1 Simple Example |
| 1676 |
|
|
|
| 1677 |
|
|
If <current-domain> is "example.com", then this describes the |
| 1678 |
|
|
effect various possible SPF records for example.com would have |
| 1679 |
|
|
on various <sending-hosts> |
| 1680 |
|
|
|
| 1681 |
|
|
"v=spf1 +all" |
| 1682 |
|
|
-- any mail message passes |
| 1683 |
|
|
|
| 1684 |
|
|
|
| 1685 |
|
|
"v=spf1 a -all" |
| 1686 |
|
|
-- sending hosts 192.168.1.10 and 192.168.1.11 pass |
| 1687 |
|
|
|
| 1688 |
|
|
"v=spf1 a:example.org -all" |
| 1689 |
|
|
-- no sending hosts pass since example.org has no A records |
| 1690 |
|
|
|
| 1691 |
|
|
|
| 1692 |
|
|
"v=spf1 mx -all" |
| 1693 |
|
|
-- sending hosts 192.168.1.129 and 192.168.1.130 pass |
| 1694 |
|
|
|
| 1695 |
|
|
"v=spf1 mx:example.org -all" |
| 1696 |
|
|
-- sending host 192.168.2.140 passes |
| 1697 |
|
|
|
| 1698 |
|
|
"v=spf1 mx mx:example.org -all" |
| 1699 |
|
|
-- sending hosts 192.168.1.129, 192.168.1.130, |
| 1700 |
|
|
and 192.168.2.140 pass |
| 1701 |
|
|
|
| 1702 |
|
|
"v=spf1 mx/24 mx:example.org/24 -all" |
| 1703 |
|
|
-- any sending host in 192.168.1.0/24 or 192.168.2.0/24 passes |
| 1704 |
|
|
|
| 1705 |
|
|
|
| 1706 |
|
|
"v=spf1 ptr -all" |
| 1707 |
|
|
-- sending host 192.168.1.65 passes |
| 1708 |
|
|
(reverse IP is valid and in example.com) |
| 1709 |
|
|
-- sending host 192.168.2.140 fails |
| 1710 |
|
|
(reverse IP is valid, but not in example.com) |
| 1711 |
|
|
-- sending host 10.0.0.4 fails |
| 1712 |
|
|
(reverse IP is not valid) |
| 1713 |
|
|
|
| 1714 |
|
|
|
| 1715 |
|
|
"v=spf1 ip4:192.168.1.128/25 -all" |
| 1716 |
|
|
-- sending host 192.168.1.65 fails |
| 1717 |
|
|
-- sending host 192.168.1.129 passes |
| 1718 |
|
|
|
| 1719 |
|
|
|
| 1720 |
|
|
|
| 1721 |
|
|
|
| 1722 |
|
|
|
| 1723 |
|
|
Appendix B.2 Multiple Domain Examples |
| 1724 |
|
|
|
| 1725 |
|
|
These examples show the effect of related SPF records: |
| 1726 |
|
|
|
| 1727 |
|
|
example.org: "v=spf1 include:example.com include:example.net -all" |
| 1728 |
|
|
|
| 1729 |
|
|
This SPF record would be used if mail from example.org actually came |
| 1730 |
|
|
through servers at example.com and example.net. Example.org's |
| 1731 |
|
|
designated servers are the union of example.com and example.net's |
| 1732 |
|
|
designated servers. |
| 1733 |
|
|
|
| 1734 |
|
|
1.example.org: "v=spf1 redirect=example.org" |
| 1735 |
|
|
2.example.org: "v=spf1 redirect=example.org" |
| 1736 |
|
|
3.example.org: "v=spf1 redirect=example.org" |
| 1737 |
|
|
|
| 1738 |
|
|
These SPF records allow a set of domains that all use the same |
| 1739 |
|
|
mail system to make use of that mail system's SPF record. In this |
| 1740 |
|
|
way, only the mail system's SPF record needs to updated when |
| 1741 |
|
|
the mail setup changes. These domains' SPF records never have to |
| 1742 |
|
|
change. |
| 1743 |
|
|
|
| 1744 |
|
|
Appendix B.3 RBL Style Example |
| 1745 |
|
|
|
| 1746 |
|
|
Imagine that, in addition to the domain records listed above, |
| 1747 |
|
|
there are these: |
| 1748 |
|
|
|
| 1749 |
|
|
$Origin _spf.example.com. |
| 1750 |
|
|
mary.mobile-users A 127.0.0.2 |
| 1751 |
|
|
fred.mobile-users A 127.0.0.2 |
| 1752 |
|
|
15.15.168.192.joel.remote-users A 127.0.0.2 |
| 1753 |
|
|
16.15.168.192.joel.remote-users A 127.0.0.2 |
| 1754 |
|
|
|
| 1755 |
|
|
The following SPF records describe users at example.com who mail |
| 1756 |
|
|
from arbitrary servers, or who mail from personal servers. |
| 1757 |
|
|
|
| 1758 |
|
|
example.com: |
| 1759 |
|
|
"v=spf1 mx |
| 1760 |
|
|
include:mobile-users._spf.%{d} |
| 1761 |
|
|
include:remote-users._spf.%{d} -all" |
| 1762 |
|
|
|
| 1763 |
|
|
mobile-users._spf.example.com: |
| 1764 |
|
|
"v=spf1 exists:%{l1r+}.%{d}" |
| 1765 |
|
|
|
| 1766 |
|
|
remote-users._spf.example.com: |
| 1767 |
|
|
"v=spf1 exists:%{ir}.%{l1r+}.%{d}" |
| 1768 |
|
|
|
| 1769 |
|
|
|
| 1770 |
|
|
Normative References |
| 1771 |
|
|
|
| 1772 |
|
|
[RFC2396] |
| 1773 |
|
|
|
| 1774 |
|
|
Informative References |
| 1775 |
|
|
|
| 1776 |
|
|
[RFC1034] |
| 1777 |
|
|
[RFC1464] |
| 1778 |
|
|
[RFC2119] |
| 1779 |
|
|
[RFC2142] |
| 1780 |
|
|
[RFC2234] |
| 1781 |
|
|
[RFC2373] |
| 1782 |
|
|
[RFC2505] |
| 1783 |
|
|
[RFC2821] |
| 1784 |
|
|
[RFC2822] |
| 1785 |
|
|
|
| 1786 |
|
|
Danisch, Hadmut. |
| 1787 |
|
|
"The RMX DNS RR Type for light weight sender authentication", |
| 1788 |
|
|
http://www.danisch.de/work/security/antispam.html, October 2003, |
| 1789 |
|
|
Work In Progress. |
| 1790 |
|
|
|
| 1791 |
|
|
Fecyk, Gordon. "Designated Mailers Protocol", December 2003, |
| 1792 |
|
|
Work In Progress. http://www.pan-am.ca/dmp/ |
| 1793 |
|
|
|
| 1794 |
|
|
Wong, M.W., "Sender Rewriting Scheme", Work In Progress, |
| 1795 |
|
|
http://spf.pobox.com/srs.html |
| 1796 |
|
|
|
| 1797 |
|
|
DeKok, Alan. The LMAP discussion document. |
| 1798 |
|
|
|
| 1799 |
|
|
Vixie, Paul. "Repudiating Mail-From". |
| 1800 |
|
|
http://ops.ietf.org/lists/namedroppers/namedroppers.2002/msg00658.html |
| 1801 |
|
|
|
| 1802 |
|
|
http://nospam.couchpotato.net/ |
| 1803 |
|
|
|
| 1804 |
|
|
http://asrg.sp.am/ |
| 1805 |
|
|
|
| 1806 |
|
|
http://www.ietf.org/html.charters/marid-charter.html |
| 1807 |
|
|
|
| 1808 |
|
|
|
| 1809 |
|
|
|
| 1810 |
|
|
|
| 1811 |
|
|
|
| 1812 |
|
|
|
| 1813 |
|
|
|
| 1814 |
|
|
|
| 1815 |
|
|
|
| 1816 |
|
|
Authors |
| 1817 |
|
|
|
| 1818 |
|
|
Meng Weng Wong |
| 1819 |
|
|
Singapore |
| 1820 |
|
|
mengwong+spf@pobox.com |
| 1821 |
|
|
|
| 1822 |
|
|
Mark Lentczner |
| 1823 |
|
|
1209 Villa Street |
| 1824 |
|
|
Mountain View, CA 94041 |
| 1825 |
|
|
United States of America |
| 1826 |
|
|
markl@glyphic.com |
| 1827 |
|
|
|
| 1828 |
|
|
Comments on this draft are welcome. In the interests of openness, |
| 1829 |
|
|
before contacting the authors directly, please post to the |
| 1830 |
|
|
spf-discuss mailing list. |
| 1831 |
|
|
|
| 1832 |
|
|
To join the mailing list, please see |
| 1833 |
|
|
http://spf.pobox.com/mailinglist.html |
| 1834 |
|
|
|
| 1835 |
|
|
Developers of SPF-conformant software SHOULD join the spf-devel |
| 1836 |
|
|
mailing list. They also SHOULD consult the SPF Developers Guide at |
| 1837 |
|
|
http://spf.pobox.com/developers-guide.html. While specifications |
| 1838 |
|
|
published as RFCs are relatively static, the mailing list and |
| 1839 |
|
|
developers guide are living resources. They augment this core |
| 1840 |
|
|
protocol specification with generally accepted implementation |
| 1841 |
|
|
practices which are outside the scope of this document. They also |
| 1842 |
|
|
provide a forum for interoperability testing. |
| 1843 |
|
|
|