tech-invite   World Map     

IETF     RFCs     Groups     SIP     ABNFs    |    3GPP     Specs     Gloss.     Arch.     IMS     UICC    |    Misc.    |    search     info

RFC 7208

 
 
 

Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1

Part 4 of 4, p. 50 to 64
Prev RFC Part

 


prevText      Top      Up      ToC       Page 50 
15.  References

15.1.  Normative References

   [RFC1035]  Mockapetris, P., "Domain names - implementation and
              specification", STD 13, RFC 1035, November 1987.

   [RFC1123]  Braden, R., "Requirements for Internet Hosts - Application
              and Support", STD 3, RFC 1123, October 1989.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC3463]  Vaudreuil, G., "Enhanced Mail System Status Codes",
              RFC 3463, January 2003.

   [RFC3864]  Klyne, G., Nottingham, M., and J. Mogul, "Registration
              Procedures for Message Header Fields", BCP 90, RFC 3864,
              September 2004.

   [RFC3986]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
              Resource Identifier (URI): Generic Syntax", STD 66,
              RFC 3986, January 2005.

   [RFC4291]  Hinden, R. and S. Deering, "IP Version 6 Addressing
              Architecture", RFC 4291, February 2006.

   [RFC5234]  Crocker, D. and P. Overell, "Augmented BNF for Syntax
              Specifications: ABNF", STD 68, RFC 5234, January 2008.

Top      Up      ToC       Page 51 
   [RFC5321]  Klensin, J., "Simple Mail Transfer Protocol", RFC 5321,
              October 2008.

   [RFC5322]  Resnick, P., Ed., "Internet Message Format", RFC 5322,
              October 2008.

   [RFC5598]  Crocker, D., "Internet Mail Architecture", RFC 5598,
              July 2009.

   [RFC5890]  Klensin, J., "Internationalized Domain Names for
              Applications (IDNA): Definitions and Document Framework",
              RFC 5890, August 2010.

   [RFC7001]  Kucherawy, M., "Message Header Field for Indicating
              Message Authentication Status", RFC 7001, September 2013.

   [US-ASCII]
              American National Standards Institute (formerly United
              States of America Standards Institute), "USA Code for
              Information Interchange, X3.4", 1968.

              ANSI X3.4-1968 has been replaced by newer versions with
              slight modifications, but the 1968 version remains
              definitive for the Internet.

15.2.  Informative References

   [BATV]     Levine, J., Crocker, D., Silberman, S., and T. Finch,
              "Bounce Address Tag Validation (BATV)", Work in Progress,
              May 2008.

   [DMP]      Fecyk, G., "Designated Mailers Protocol", Work in
              Progress, May 2004.

   [Green]    Green, D., "Domain-Authorized SMTP Mail", June 2002,
              <http://www.mhonarc.org/archive/html/ietf-asrg/2003-03/
              msg01525.html>.

   [RFC1034]  Mockapetris, P., "Domain names - concepts and facilities",
              STD 13, RFC 1034, November 1987.

   [RFC1983]  Malkin, G., "Internet Users' Glossary", RFC 1983,
              August 1996.

   [RFC2308]  Andrews, M., "Negative Caching of DNS Queries (DNS
              NCACHE)", RFC 2308, March 1998.

Top      Up      ToC       Page 52 
   [RFC2671]  Vixie, P., "Extension Mechanisms for DNS (EDNS0)",
              RFC 2671, August 1999.

   [RFC2782]  Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for
              specifying the location of services (DNS SRV)", RFC 2782,
              February 2000.

   [RFC3464]  Moore, K. and G. Vaudreuil, "An Extensible Message Format
              for Delivery Status Notifications", RFC 3464,
              January 2003.

   [RFC3696]  Klensin, J., "Application Techniques for Checking and
              Transformation of Names", RFC 3696, February 2004.

   [RFC3833]  Atkins, D. and R. Austein, "Threat Analysis of the Domain
              Name System (DNS)", RFC 3833, August 2004.

   [RFC3834]  Moore, K., "Recommendations for Automatic Responses to
              Electronic Mail", RFC 3834, August 2004.

   [RFC4033]  Arends, R., Austein, R., Larson, M., Massey, D., and S.
              Rose, "DNS Security Introduction and Requirements",
              RFC 4033, March 2005.

   [RFC4408]  Wong, M. and W. Schlitt, "Sender Policy Framework (SPF)
              for Authorizing Use of Domains in E-Mail, Version 1",
              RFC 4408, April 2006.

   [RFC4632]  Fuller, V. and T. Li, "Classless Inter-domain Routing
              (CIDR): The Internet Address Assignment and Aggregation
              Plan", BCP 122, RFC 4632, August 2006.

   [RFC4880]  Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R.
              Thayer, "OpenPGP Message Format", RFC 4880, November 2007.

   [RFC4954]  Siemborski, R. and A. Melnikov, "SMTP Service Extension
              for Authentication", RFC 4954, July 2007.

   [RFC5507]  IAB, Faltstrom, P., Austein, R., and P. Koch, "Design
              Choices When Expanding the DNS", RFC 5507, April 2009.

   [RFC5751]  Ramsdell, B. and S. Turner, "Secure/Multipurpose Internet
              Mail Extensions (S/MIME) Version 3.2 Message
              Specification", RFC 5751, January 2010.

   [RFC5782]  Levine, J., "DNS Blacklists and Whitelists", RFC 5782,
              February 2010.

Top      Up      ToC       Page 53 
   [RFC6409]  Gellens, R. and J. Klensin, "Message Submission for Mail",
              STD 72, RFC 6409, November 2011.

   [RFC6647]  Kucherawy, M. and D. Crocker, "Email Greylisting: An
              Applicability Statement for SMTP", RFC 6647, June 2012.

   [RFC6648]  Saint-Andre, P., Crocker, D., and M. Nottingham,
              "Deprecating the "X-" Prefix and Similar Constructs in
              Application Protocols", BCP 178, RFC 6648, June 2012.

   [RFC6652]  Kitterman, S., "Sender Policy Framework (SPF)
              Authentication Failure Reporting Using the Abuse Reporting
              Format", RFC 6652, June 2012.

   [RFC6686]  Kucherawy, M., "Resolution of the Sender Policy Framework
              (SPF) and Sender ID Experiments", RFC 6686, July 2012.

   [RFC6891]  Damas, J., Graff, M., and P. Vixie, "Extension Mechanisms
              for DNS (EDNS(0))", STD 75, RFC 6891, April 2013.

   [RMX]      Danisch, H., "The RMX DNS RR and method for lightweight
              SMTP sender authorization", Work in Progress, May 2004.

   [Vixie]    Vixie, P., "Repudiating MAIL FROM", 2002,
              <http://marc.info/?l=namedroppers&m=102298170127004&w=4>.

Top      Up      ToC       Page 54 
Appendix A.  Extended Examples

   These examples are based on the following DNS setup:

   ; A domain with two mail servers, two hosts, and two servers
   ; at the domain name
   $ORIGIN example.com.
   @           MX  10 mail-a
               MX  20 mail-b
               A   192.0.2.10
               A   192.0.2.11
   amy         A   192.0.2.65
   bob         A   192.0.2.66
   mail-a      A   192.0.2.129
   mail-b      A   192.0.2.130
   www         CNAME example.com.

   ; A related domain
   $ORIGIN example.org.
   @           MX  10 mail-c
   mail-c      A   192.0.2.140

   ; The reverse IP for those addresses
   $ORIGIN 2.0.192.in-addr.arpa.
   10          PTR example.com.
   11          PTR example.com.
   65          PTR amy.example.com.
   66          PTR bob.example.com.
   129         PTR mail-a.example.com.
   130         PTR mail-b.example.com.
   140         PTR mail-c.example.org.

   ; A rogue reverse IP domain that claims to be
   ; something it's not
   $ORIGIN 0.0.10.in-addr.arpa.
   4           PTR bob.example.com.

Top      Up      ToC       Page 55 
A.1.  Simple Examples

   These examples show various possible published records for
   example.com and which values of <ip> would cause check_host() to
   return "pass".  Note that <domain> is "example.com".

   v=spf1 +all

      -- any <ip> passes

   v=spf1 a -all

      -- hosts 192.0.2.10 and 192.0.2.11 pass

   v=spf1 a:example.org -all

      -- no sending hosts pass since example.org has no A records

   v=spf1 mx -all

      -- sending hosts 192.0.2.129 and 192.0.2.130 pass

   v=spf1 mx:example.org -all

      -- sending host 192.0.2.140 passes

   v=spf1 mx mx:example.org -all

      -- sending hosts 192.0.2.129, 192.0.2.130, and 192.0.2.140 pass

   v=spf1 mx/30 mx:example.org/30 -all

      -- any sending host in 192.0.2.128/30 or 192.0.2.140/30 passes

   v=spf1 ptr -all

      -- sending host 192.0.2.65 passes (reverse DNS is valid and is
         in example.com)

      -- sending host 192.0.2.140 fails (reverse DNS is valid, but not
         in example.com)

      -- sending host 10.0.0.4 fails (reverse IP is not valid)

Top      Up      ToC       Page 56 
   v=spf1 ip4:192.0.2.128/28 -all

      -- sending host 192.0.2.65 fails

      -- sending host 192.0.2.129 passes

A.2.  Multiple Domain Example

   These examples show the effect of related records:

      example.org: "v=spf1 include:example.com include:example.net -all"

   This record would be used if mail from example.org actually came
   through servers at example.com and example.net.  Example.org's
   designated servers are the union of example.com's and example.net's
   designated servers.

      la.example.org: "v=spf1 redirect=example.org"

      ny.example.org: "v=spf1 redirect=example.org"

      sf.example.org: "v=spf1 redirect=example.org"

   These records allow a set of domains that all use the same mail
   system to make use of that mail system's record.  In this way, only
   the mail system's record needs to be updated when the mail setup
   changes.  These domains' records never have to change.

A.3.  DNS Blacklist (DNSBL) Style Example

   Imagine that, in addition to the domain records listed above, there
   are these (see [RFC5782]):

   $ORIGIN _spf.example.com.
   mary.mobile-users                   A 127.0.0.2
   fred.mobile-users                   A 127.0.0.2
   15.15.168.192.joel.remote-users     A 127.0.0.2
   16.15.168.192.joel.remote-users     A 127.0.0.2

Top      Up      ToC       Page 57 
   The following records describe users at example.com who mail from
   arbitrary servers, or who mail from personal servers.

   example.com:

   v=spf1 mx
          include:mobile-users._spf.%{d}
          include:remote-users._spf.%{d}
          -all

   mobile-users._spf.example.com:

   v=spf1 exists:%{l1r+}.%{d}

   remote-users._spf.example.com:

   v=spf1 exists:%{ir}.%{l1r+}.%{d}

A.4.  Multiple Requirements Example

   Say that your sender policy requires both that the IP address is
   within a certain range and that the reverse DNS for the IP matches.
   This can be done several ways, including the following:

   example.com.           SPF  ( "v=spf1 "
                                 "-include:ip4._spf.%{d} "
                                 "-include:ptr._spf.%{d} "
                                 "+all" )
   ip4._spf.example.com.  SPF  "v=spf1 -ip4:192.0.2.0/24 +all"
   ptr._spf.example.com.  SPF  "v=spf1 -ptr +all"

   This example shows how the "-include" mechanism can be useful, how an
   SPF record that ends in "+all" can be very restrictive, and the use
   of De Morgan's Law.

Appendix B.  Changes in Implementation Requirements from RFC 4408

   The modifications to implementation requirements from [RFC4408] are
   all either (a) corrections to errors in [RFC4408] or (b) additional
   documentation based on consensus of operational experience acquired
   since the publication of [RFC4408].

   o  Use of DNS RR type SPF (99) has been removed from the protocol;
      see [RFC6686] for background.

   o  A new DNS-related processing limit based on "void lookups" has
      been added (Section 4.6.4).

Top      Up      ToC       Page 58 
   o  Use of the ptr mechanism and the %p macro has been strongly
      discouraged (Sections 5.5 and 7.2).  The ptr mechanism and the %p
      macro remain part of the protocol because they were found to be in
      use, but records ought to be updated to avoid them.

   o  Use of the "Authentication-Results" header field [RFC7001] as a
      possible alternative to use of the "Received-SPF" header field is
      discussed (Section 9.2).

   o  There have been a number of minor corrections to the ABNF to make
      it more clear and correct (Section 12).  SPF library implementers
      should give the revised ABNF a careful review to determine if
      implementation changes are needed.

   o  Use of X- fields in the ABNF has been removed; see [RFC6648] for
      background.

   o  Ambiguity about how to deal with invalid <domain-spec> after macro
      expansion has been documented.  Depending on one specific behavior
      has to be avoided (Section 4.8).

   o  General operational information has been updated and expanded
      based on eight years of post-[RFC4408] operations experience.  See
      Section 10 and Appendices D through G below.

   o  Security considerations have been reviewed and updated
      (Section 11).

Appendix C.  Further Testing Advice

   Another approach that can be helpful is 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

   This associated macro expansion would cause the sending HELO domain,
   local-part of the sending email address, domain part of the sending
   email address, and the IP address from which the connection was
   received to be embedded in an SPF query and logged in the sender's
   DNS logs.

   This approach, which has been used since very early in the SPF
   project, allows senders to unilaterally collect data to evaluate the
   correctness of their SPF records.  Unlike newer feedback mechanisms,
   it does not require any special cooperation from SPF verifiers.  A
   similar example, one of the earliest SPF records published, can still
   be found as of this writing at altavista.net.

Top      Up      ToC       Page 59 
Appendix D.  SPF/Mediator Interactions

   There are three places that techniques can be used to ameliorate
   unintended SPF failures with mediators.

D.1.  Originating ADMDs

   The beginning, when email is first sent:

   o  "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}.whitelist.example.org -all"

      This would cause a lookup on a DNS White List (DNSWL) and cause a
      result of "fail" only for email not coming from either the
      domain's mx host(s) (SPF pass) or whitelisted sources (SPF
      neutral).  This, in effect, outsources an element of sender policy
      to the maintainer of the whitelist.

   o  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, an SPF record such as
      the following 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 to either only produce local-parts with a maximum of
      63 characters or gracefully handle truncated local-parts.  The
      method used to secure the local-part is a local implementation
      issue; it need not be standard.  An example of one way to do it
      can be found in [BATV].

   o  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"

Top      Up      ToC       Page 60 
   o  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}"

D.2.  Mediators

   The middle, when email is forwarded:

   o  Mediators 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 mediator.

   o  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").

   o  Mediators could reject mail that would "fail" SPF if forwarded
      using an SMTP reply code of 551, User not local (see Section 3.4
      of [RFC5321]) to communicate the correct target address to resend
      the mail to.

D.3.  Receiving ADMDs

   The end, when email is received:

   o  If the owner of the external mailbox wishes to trust the mediator,
      he can direct the external mailbox's MTA to skip SPF tests when
      the client host belongs to the mediator.

   o  Tests against other identities, such as the "HELO" identity, can
      be used to override a failed test against the "MAIL FROM"
      identity.

   o  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.

Top      Up      ToC       Page 61 
Appendix E.  Mail Services

   MSPs (Mail Service Providers -- Section 2.3 of [RFC5598]) that offer
   mail services to third-party domains, such as the 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 one of the MSP's
   domains, 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
   mitigate 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 the
   sender and receiver of an email message.

   Within an organization, MTA relays can be effectively deployed.
   However, for the 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 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 as both 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 has 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.  This is described further in Appendix D
   of [RFC7001].

Top      Up      ToC       Page 62 
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 "whitelists" of
   known "good" domains to bypass some or all additional pre-delivery
   email checks.  Exactly which checks and how to determine appropriate
   whitelist entries have 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 in this section (Appendix G), SPF-based
   rejection does present some risk of rejecting legitimate email when
   rejecting email based on "MAIL FROM" results.

   SPF "fail" results can alternately be used as one input into a larger
   set of evaluations that might, based on a combination of SPF "fail"
   results 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 has 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; either they are 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 reliability and
   utility of email across the Internet.

Top      Up      ToC       Page 63 
G.3.  Policy for SPF Permerror

   The "permerror" result (see Section 2.6.7) indicates that 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
   SPF verifier operators that wish to implement SPF checking as
   strictly as possible, nor is this sort of passive reporting of
   problems typically effective.

   There is of course the option of placing this choice in the hands of
   the SPF verifier 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 SPF verifier operators need to be cautious of
   all choices and outcomes when handling SPF results.

G.4.  Policy for SPF Temperror

   The "temperror" result (see Section 2.6.6) indicates that the SPF
   processing module at the receiver could not retrieve an SPF policy
   record due to a (probably) transient condition.  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.

Top      Up      ToC       Page 64 
   Deferring 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 "temperror" results, only the sender is actively
   notified of the defect (in the form of mail rejected after it times
   out of the sending queue), and not the receiver making use of SPF.

   Because of long queue lifetimes, it is possible that mail will be
   repeatedly deferred for several days, and so any awareness that the
   sender may have regarding a problem could be quite delayed.  If
   "temperrors" persist for multiple delivery attempts, it might be
   preferable to treat the error as permanent and reduce the amount of
   time the message is in transit.

   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
   SPF verifier operators that wish to implement SPF checking as
   strictly as possible, nor is this sort of passive reporting of
   problems typically effective.

   There is of course the option of placing this choice in the hands of
   the SPF verifier 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 SPF verifier operators need to be cautious of
   all choices and outcomes when handling SPF results.

Author's Address

   Scott Kitterman
   Kitterman Technical Services
   3611 Scheel Dr.
   Ellicott City, MD  21042
   United States of America

   EMail: scott@kitterman.com