RFC 8689

SMTP Require TLS Option

๐Ÿ“… published November 2019, from ietf

Abstract ๐Ÿ’–

okay bestie, so the SMTP STARTTLS option is how servers agree to encrypt email transport, and it's kinda not as protective as it could be ๐Ÿ˜ญ because it's opportunistic. Delivery gets priority over security by default ๐Ÿ’€. This doc adds an SMTP service extension called REQUIRETLS and a message header field called TLS-Required ๐ŸŽ€. If a sender uses either one, they're basically asking to override the default TLS negotiation. Either TLS gets required when the message is relayed, or they're asking that recipient-side policy mechanisms like MTA-STS and DANE get ignored when relaying a message where security doesn't matter that much โœจ.


Status of This Memo ๐ŸŒธ

This is an Internet Standards Track document ๐Ÿ‘‘.

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG). If you want more info on Internet Standards, check out Section 2 of RFC 7841 ๐Ÿงš.

For the current status of this document, any errata, and how to give feedback on it, go to https://www.rfc-editor.org/info/rfc8689 ๐Ÿ”—.

Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as in effect on the date of publication of this document. Please review these documents carefully, because they describe your rights and restrictions with respect to this document. Code Components pulled out of this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License ๐Ÿ“œ.

Table of Contents ๐Ÿ“

   1.  Introduction
     1.1.  Requirements Language
   2.  The REQUIRETLS Service Extension
   3.  The TLS-Required Header Field
   4.  REQUIRETLS Semantics
     4.1.  REQUIRETLS Receipt Requirements
     4.2.  REQUIRETLS Sender Requirements
       4.2.1.  Sending with TLS Required
       4.2.2.  Sending with TLS Optional
     4.3.  REQUIRETLS Submission
     4.4.  Delivery of REQUIRETLS messages
   5.  Non-delivery Message Handling
   6.  Reorigination Considerations
   7.  IANA Considerations
   8.  Security Considerations
     8.1.  Passive Attacks
     8.2.  Active Attacks
     8.3.  Bad-Actor MTAs
     8.4.  Policy Conflicts
   9.  References
     9.1.  Normative References
     9.2.  Informative References
   Appendix A.  Examples
     A.1.  REQUIRETLS SMTP Option
     A.2.  TLS-Required Header Field
   Acknowledgements
   Author's Address

1. Introduction โœจ

okay so the SMTP [RFC5321] STARTTLS service extension [RFC3207] is how an SMTP server and client set up a Transport Layer Security (TLS) protected session for sending email ๐Ÿ’Œ. By default, TLS only gets used if both sides mutually agree on STARTTLS (successful negotiation). If that's not possible, the message just gets sent with no transport encryption ๐Ÿ˜ฌ. It's also common practice for the client to negotiate TLS even when the SMTP server's certificate is invalid ๐Ÿ™ˆ.

Policy mechanisms like DANE [RFC7672] and MTA-STS [RFC8461] can require TLS for email going to some domains ๐Ÿ”’. But these policies don't let the sender say which messages are more sensitive and need transport-level encryption, and which ones are less sensitive and should still get relayed even if TLS can't be negotiated successfully ๐Ÿ’….

The default opportunistic nature of SMTP TLS opens up several on-the-wire attacks on SMTP security between MTAs ๐Ÿ’€. These include passive eavesdropping on connections where TLS isn't used, interference with the SMTP protocol to stop TLS from being negotiated (which presumably comes with eavesdropping), and inserting a man-in-the-middle attacker who takes advantage of the client not authenticating the server. The Security Considerations section of this document goes into these attacks in more detail ๐Ÿ”ฅ.

REQUIRETLS has two mechanisms: an SMTP service extension and a message header field ๐ŸŽ€. The service extension is used to specify that a given message, sent during a particular session, MUST be sent over a TLS-protected session with specified security characteristics. The server also has to advertise that it supports REQUIRETLS, which basically promises that it'll honor the requirement to enforce TLS transmission, and support REQUIRETLS for onward transmission of those messages too ๐Ÿซถ.

The TLS-Required message header field conveys a request to ignore recipient-side policy mechanisms like MTA-STS and DANE, which puts delivery ahead of being able to negotiate TLS ๐Ÿš€. Unlike the service extension, the TLS-Required header field lets the message pass through one or more MTAs that don't support REQUIRETLS ๐Ÿฆ‹.

1.1. Requirements Language ๐Ÿ“–

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here ๐Ÿค“.

The formal syntax uses the Augmented Backus-Naur Form (ABNF) [RFC5234], including the core rules defined in Appendix B of that document ๐Ÿง .


2. The REQUIRETLS Service Extension ๐ŸŒˆ

The REQUIRETLS SMTP service extension has these characteristics ๐Ÿ‘‘:

  1. The textual name of the extension is "Require TLS".
  2. The EHLO keyword value associated with this extension is "REQUIRETLS".
  3. No additional SMTP verbs are defined by this extension.
  4. One optional parameter ("REQUIRETLS") is added to the MAIL FROM command by this extension. No value is associated with this parameter.
  5. The maximum length of a MAIL FROM command line is increased by 11 octets by the possible addition of a space and the REQUIRETLS keyword.
  6. One new SMTP status code is defined by this extension to convey an error condition resulting from failure of the client to send data to a server that does not also support the REQUIRETLS extension.
  7. The REQUIRETLS extension is valid for message relay [RFC5321], submission [RFC6409], and the Local Mail Transfer Protocol (LMTP) [RFC2033].
  8. The ABNF syntax for the MAIL FROM parameter is as follows:
      requiretls-param  = "REQUIRETLS"
                      ; where requiretls-param is an instance of an
                      ; esmtp-param used in Mail-parameters in
                      ; RFC 5321, Section 4.1.2. There is no esmtp-value
                      ; associated with requiretls-param.

To ask for REQUIRETLS treatment on a given message, the REQUIRETLS option gets specified in the MAIL FROM command when that message is transmitted. This option MUST only be specified in the context of an SMTP session that meets the security requirements of REQUIRETLS ๐Ÿ”:

  • The session itself MUST employ TLS transmission.
  • If the SMTP server the message is being transmitted to is identified through an MX record lookup, its name MUST be validated via a DNSSEC signature on the recipient domain's MX record, or the MX hostname MUST be validated by an MTA-STS policy as described in Section 4.1 of [RFC8461]. DNSSEC is defined in [RFC4033], [RFC4034], and [RFC4035] ๐Ÿง.
  • The certificate presented by the SMTP server either MUST be verified successfully by a trust chain leading to a certificate trusted by the SMTP client, or it MUST be verified successfully using DANE, as specified in [RFC7672]. For trust chains, the choice of trusted (root) certificates is at the discretion of the SMTP client ๐ŸŽ€.
  • Following the negotiation of STARTTLS, the SMTP server MUST advertise in the subsequent EHLO response that it supports REQUIRETLS ๐Ÿ“ฃ.

3. The TLS-Required Header Field ๐Ÿ’Œ

One new message header field [RFC5322], TLS-Required, is defined by this specification. It's used for messages where the originator asks that the recipient TLS policy (including MTA-STS [RFC8461] and DANE [RFC7672]) be ignored. This might be done, for example, to report a misconfigured mail server, like one with an expired TLS certificate ๐Ÿ™ƒ.

The TLS-Required header field has a single REQUIRED parameter ๐Ÿ“:

  • No - The SMTP client SHOULD attempt to send the message regardless of its ability to negotiate STARTTLS with the SMTP server, ignoring policy-based mechanisms (including MTA-STS and DANE), if any, asserted by the recipient domain. Nevertheless, the client SHOULD negotiate STARTTLS with the server if available.

More than one instance of the TLS-Required header field MUST NOT appear in a given message ๐Ÿšซ.

The ABNF syntax for the TLS-Required header field is as follows ๐Ÿงพ:

   requiretls-field = "TLS-Required:" [FWS] "No" CRLF
           ; where requiretls-field in an instance of an
           ; optional-field defined in RFC 5322, Section 3.6.8.
   FWS = <as defined in RFC 5322>
   CRLF = <as defined in RFC 5234>

4. REQUIRETLS Semantics โญ

4.1. REQUIRETLS Receipt Requirements ๐Ÿ“ฌ

When an SMTP server gets the REQUIRETLS option on a MAIL FROM command while receiving a message, it MUST tag that message as needing REQUIRETLS handling ๐Ÿท๏ธ.

When a server implementing this specification gets a message that doesn't specify the REQUIRETLS option on its MAIL FROM command but does contain the TLS-Required header field in its message header, it MUST tag that message with the option specified in the TLS-Required header field. If the REQUIRETLS MAIL FROM parameter is specified, the TLS-Required header field MUST be ignored, but it MAY be included in the onward relay of the message ๐Ÿ’ซ.

How the above tagging happens is implementation dependent ๐Ÿคทโ€โ™€๏ธ. If the message is being locally aliased and redistributed to multiple addresses, all instances of the message MUST be tagged in the same manner ๐Ÿ‘ฏโ€โ™€๏ธ.

4.2. REQUIRETLS Sender Requirements ๐Ÿ’…

4.2.1. Sending with TLS Required ๐Ÿ“ฎ

Okay bestie, so when you're sending a message tagged as needing TLS and its MAIL FROM return-path isn't empty (an empty one means it's a bounce ๐Ÿ™ˆ), the sending (client) MTA MUST:

  1. Look up the SMTP server the message is headed to, as described in [RFC5321], Section 5.1.
  2. If that lookup goes through the recipient domain's MX record (the usual route) and doesn't come with a valid DNSSEC signature, the client MUST also check the SMTP server name with MTA-STS, as described in [RFC8461], Section 4.1.
  3. Open an SMTP session with the peer SMTP server using the EHLO verb.
  4. Set up a TLS-protected SMTP session with that peer and check its certificate as specified in [RFC6125] or [RFC7672], whichever applies. The hostname from the MX lookup (or the domain name when there's no MX record and an A record is used directly) MUST match the DNS-ID or CN-ID of the certificate the server presents.
  5. Make sure the response to the follow-up EHLO, sent after TLS is up, advertises the REQUIRETLS capability. ๐Ÿ’…

The SMTP client SHOULD follow the recommendations in [RFC7525] or its successor when it comes to negotiating the TLS session. ๐Ÿ”’

If any of those steps fail, the client MUST issue a QUIT to the server and go back through steps 2-5 with each host on the recipient domain's list of MX hosts, hunting for a mail path that meets the sender's requirements. The client MAY send other, unprotected messages to that server if it has any queued up before it issues the QUIT. If there are no more MX hosts left, the client MUST NOT transmit the message to the domain. ๐Ÿ™…โ€โ™€๏ธ

After a failure like that, the SMTP client MUST send a non-delivery notification to the reverse-path of the failed message, as described in Section 3.6 of [RFC5321]. These status codes from [RFC5248] SHOULD be used:

  • REQUIRETLS not supported by server: 5.7.30 REQUIRETLS support required
  • Unable to establish TLS-protected SMTP session: 5.7.10 Encryption needed

Check out Section 5 for more on non-delivery messages. ๐Ÿ“ฌ

If all the REQUIRETLS requirements are met, transmit the message, issuing the REQUIRETLS option on the MAIL FROM command along with the required option(s), if any. โœจ

4.2.2. Sending with TLS Optional ๐ŸŒธ

Messages tagged TLS-Required: No get handled a bit differently. When sending one of these, the sending (client) MTA MUST:

  • Look up the SMTP server the message is headed to, as described in [RFC5321], Section 5.1.
  • Open an SMTP session with the peer SMTP server using the EHLO verb. Try to negotiate STARTTLS if you can, and follow any policy the recipient domain publishes, but don't fail if that doesn't work out. ๐Ÿคทโ€โ™€๏ธ

Some SMTP servers are set up to require STARTTLS as a matter of policy, so they won't accept messages without it. A non-delivery notification MUST be returned to the sender if relay fails because STARTTLS couldn't be negotiated when the server requires it. ๐Ÿ’€

Since TLS-Required: No messages will sometimes be sent to SMTP servers that don't support REQUIRETLS, that option won't be uniformly honored by every SMTP relay hop. Not a perfect world, babe ๐Ÿฅฒ


4.3. REQUIRETLS Submission ๐Ÿ’Œ

A Mail User Agent (MUA) or other agent that makes the initial introduction of a message gets to decide whether TLS is required. If TLS is to be required, it MUST do so by negotiating STARTTLS and REQUIRETLS and including the REQUIRETLS option on the MAIL FROM command, the same way it's done for message relay. ๐ŸŽ€

When TLS is not to be required, the sender MUST include the TLS-Required header field in the message. SMTP servers implementing this specification MUST interpret this header field as described in Section 4.1. ๐Ÿงš

In either case, the decision of whether to specify REQUIRETLS MAY be made based on a user interface selection, or based on a ruleset or other policy. How that decision gets made is implementation dependent and beyond the scope of this specification. Not our circus, not our monkeys ๐Ÿ’

4.4. Delivery of REQUIRETLS messages ๐Ÿ“ฌ

End users usually pull their mail down with protocols other than SMTP, like IMAP [RFC3501], POP [RFC1939], or webmail systems. Mail delivery agents that support the REQUIRETLS SMTP option SHOULD observe the guidelines in [RFC8314]. ๐ŸŒˆ


5. Non-delivery Message Handling ๐Ÿ’€

Non-delivery ("bounce") messages usually carry important metadata about the message they refer to, including the original message header. That's why they MUST be protected in the same way as the original message. Every non-delivery message that comes from a message with the REQUIRETLS SMTP option, whether it's from a REQUIRETLS error or some other issue, MUST also specify the REQUIRETLS SMTP option, unless it's redacted as described below. ๐Ÿ”

The path from where an error bounce starts back to the MAIL FROM address may not have the same REQUIRETLS support as the forward path. So users who require TLS are advised to make sure they can receive mail using REQUIRETLS too. Otherwise, those non-delivery messages will just get lost. ๐Ÿ˜ญ

If a REQUIRETLS message is bounced, the server MUST behave as if RET=HDRS was present, as described in [RFC3461]. If both RET=FULL and REQUIRETLS are present, the RET=FULL MUST be disregarded. The SMTP client for a REQUIRETLS bounce message uses an empty MAIL FROM return-path, as required by [RFC5321]. When the MAIL FROM return-path is empty, the REQUIRETLS parameter SHOULD NOT cause a bounce message to be discarded, even if the next-hop relay doesn't advertise REQUIRETLS. ๐Ÿ™ˆ

Senders of messages that require TLS are advised to consider that bounce messages may be lost because of a REQUIRETLS return path failure, and that some information could leak if a bounce message can't be sent with REQUIRETLS. Yikes, that's a lot of "could" energy ๐Ÿ˜ฌ


6. Reorigination Considerations ๐Ÿ”

In a number of situations, a mediator [RFC5598] creates a brand-new message because of an incoming one. These situations include (but aren't limited to) mailing lists (including admin traffic like message approval requests), Sieve [RFC5228], "vacation" responders, and other filters that incoming messages might get piped into. The new messages might basically be copies of the incoming one, like with a forwarding service or a mailing list expander. Other times, like with a vacation message or a delivery notification, they'll be different but might include parts of the original message or other info that the original sender wants a say in when it comes to the TLS requirement. ๐Ÿ’–

Mediators that reoriginate messages should apply REQUIRETLS requirements from incoming messages (both requiring TLS transmission and requesting that TLS not be required) to the reoriginated messages, to the extent feasible. One limitation: for a message requiring TLS, redistributing it to multiple addresses while keeping the TLS requirement could mean it doesn't reach some of the intended recipients. ๐Ÿ“จ

User-side mediators (like Sieve rules on a user agent) typically don't have access to the SMTP details, so they may not be aware of the REQUIRETLS requirement on a delivered message. Recipients who expect sensitive traffic should avoid user-side mediators. Alternatively, if it's operationally feasible (like when forwarding to a specific, known address), they should apply REQUIRETLS to all reoriginated messages that don't contain the TLS-Required: No header field. ๐Ÿซถ


7. IANA Considerations ๐Ÿงพ

Okay so, per this document, IANA has added the following keyword to the "SMTP Service Extensions" subregistry of the "Mail Parameters" registry [MailParams]:

      EHLO Keyword:                 REQUIRETLS
      Description:                  Require TLS
      Syntax and parameters:        (no parameters)
      Additional SMTP verbs:        none
      MAIL and RCPT parameters:     REQUIRETLS parameter on MAIL
      Behavior:                     Use of the REQUIRETLS parameter on
                                    the MAIL verb causes that message to
                                    require the use of TLS and tagging
                                    with REQUIRETLS for all onward
                                    relay.
      Command length increment:     11 characters

Per this document, IANA has also added an entry to the "Enumerated Status Codes" subregistry of the "Simple Mail Transfer Protocol (SMTP) Enhanced Status Codes Registry" [SMTPStatusCodes]:

      Code:                         X.7.30
      Sample Text:                  REQUIRETLS support required
      Associated basic status code:  550
      Description:                  This indicates that the message was
                                    not able to be forwarded because it
                                    was received with a REQUIRETLS
                                    requirement and none of the SMTP
                                    servers to which the message should
                                    be forwarded provide this support.
      Reference:                    RFC 8689
      Submitter:                    J.  Fenton
      Change Controller:            IESG

And per this document, IANA has added an entry to the "Permanent Message Header Field Names" subregistry of the "Message Headers" registry [MessageHeaders], like so:

      Header field name:            TLS-Required
      Applicable protocol:          mail
      Status:                       standard
      Author/change controller:     IETF
      Specification document:       RFC 8689

8. Security Considerations ๐Ÿ”

Bestie, this section is SERIOUS business. Read it like your inbox depends on it ๐Ÿšจ

The whole purpose of REQUIRETLS is to give the originator of a message control over the security of the email they send. They can either convey an expectation that it'll be transmitted in encrypted form over the wire, or explicitly indicate that transport encryption isn't required if it can't be successfully negotiated. ๐Ÿฆ‹

The following considerations apply to the REQUIRETLS service extension but not to the TLS-Required header field, since messages specifying the header field are less concerned with transport security. ๐Ÿ“

8.1. Passive Attacks ๐Ÿ‘€

REQUIRETLS is generally effective against passive attackers who are merely trying to eavesdrop on an SMTP exchange between an SMTP client and server. This assumes, of course, the cryptographic integrity of the TLS connection being used. Main character energy for the encryption, but only if the TLS connection itself holds up ๐Ÿ’œ

8.2. Active Attacks ๐Ÿ’…

okay so active attacks on TLS-encrypted SMTP connections come in lots of flavors ๐Ÿ˜ญ one sneaky move is messing with the negotiation by swapping the STARTTLS command for something illegal, like XXXXXXXX. TLS negotiation fails, and then the messages just get sent in the clear ๐Ÿ™ˆ where anyone can intercept them. REQUIRETLS catches that the STARTTLS failed and refuses to send the message rather than sending it insecurely. slay for the save ๐Ÿ›ก๏ธ

another one is a man-in-the-middle attack, where the attacker ends the TLS connection instead of the real SMTP server. this works when the SMTP client doesn't check the server's certificate, which is pretty common, or when it connects anyway even after the check fails ๐Ÿ’€ REQUIRETLS requires successful certificate validation before it sends the message.

then there's spoofing the DNS MX records of the recipient domain. an attacker who can do that could redirect the message to a mail server they control, which would presumably have a valid certificate, so it looks legit ๐Ÿ‘€ REQUIRETLS requires that the MX record lookup gets validated either with DNSSEC or with a published MTA-STS policy that spells out the acceptable SMTP server hostname(s) for the recipient domain. main character defense energy ๐Ÿ‘‘

8.3. Bad-Actor MTAs ๐ŸŽ€

a bad-actor MTA somewhere along the transmission path could lie about supporting REQUIRETLS and/or actively strip REQUIRETLS tags off the messages it handles. but ngl, intermediate MTAs already get to see the cleartext of messages they handle, and they aren't part of the threat model for transport-layer security. so they aren't part of the threat model for REQUIRETLS either ๐Ÿคทโ€โ™€๏ธ

it needs to be said again ๐Ÿ“ฃ since SMTP TLS is a transport-layer security protocol, messages sent using REQUIRETLS are not encrypted end-to-end, and they're visible to MTAs that sit in the message delivery path. so if your message has sensitive stuff that MTAs shouldn't be able to read, it MUST be sent using end-to-end content encryption such as OpenPGP [RFC4880] or S/MIME [RFC8551] ๐Ÿ”

pls don't skip this part. transport encryption is not the same thing as end-to-end encryption, and mixing them up is how secrets leak ๐Ÿ˜ญ

8.4. Policy Conflicts ๐Ÿฆ‹

sometimes using the TLS-Required header field can clash with a recipient domain policy expressed through the DANE [RFC7672] or MTA-STS [RFC8461] protocols. these protocols encourage TLS transport by advertising that TLS is available, but using "TLS-Required: No" is an explicit choice by the sender not to require TLS. it might be used to get around a configuration error, for example ๐Ÿ”ง

the recipient domain still has the final say, though ๐Ÿ’… it can require TLS by not accepting messages when STARTTLS hasn't been negotiated. otherwise, "TLS-Required: No" is basically telling the client MTA to act like it doesn't support DANE or MTA-STS at all ๐Ÿ™ƒ


9. References ๐Ÿ“š

9.1. Normative References

9.2. Informative References


Appendix A. Examples ๐Ÿงš

This section is informative.

A.1. REQUIRETLS SMTP Option โœจ

the TLS-Required SMTP option is how the sender says they want the message relayed over TLS ๐Ÿ”’ in the example below, lines starting with "C:" are sent from the SMTP client to the server, and lines starting with "S:" go the other way round ๐Ÿ’ฌ

 S: 220 mail.example.net ESMTP
 C: EHLO mail.example.org
 S: 250-mail.example.net Hello example.org [192.0.2.1]
 S: 250-SIZE 52428800
 S: 250-8BITMIME
 S: 250-PIPELINING
 S: 250-STARTTLS
 S: 250 HELP
 C: STARTTLS
 S: TLS go ahead

(at this point TLS negotiation takes place.  The remainder of this
session occurs within TLS.)

 S: 220 mail.example.net ESMTP
 C: EHLO mail.example.org
 S: 250-mail.example.net Hello example.org [192.0.2.1]
 S: 250-SIZE 52428800
 S: 250-8BITMIME
 S: 250-PIPELINING
 S: 250-REQUIRETLS
 S: 250 HELP
 C: MAIL FROM:<roger@example.org> REQUIRETLS
 S: 250 OK
 C: RCPT TO:<editor@example.net>
 S: 250 Accepted
 C: DATA
 S: 354 Enter message, ending with "." on a line by itself

(message follows)

 C: .
 S: 250 OK
 C: QUIT

A.2. TLS-Required Header Field ๐Ÿ’Œ

the TLS-Required header field gets used when the sender wants the mail system to ignore a default recipient domain policy that requires TLS ๐Ÿ™…โ€โ™€๏ธ for example, it could be used to let someone report problems with the recipient domain's TLS certificate:

 From: Roger Reporter <roger@example.org>
 To: Andy Admin <admin@example.com>
 Subject: Certificate problem?
 TLS-Required: No
 Date: Fri, 18 Jan 2019 10:26:55 -0800
 Message-ID: <5c421a6f79c0e_d153ff8286d45c468473@mail.example.org>

 Andy, there seems to be a problem with the TLS certificate
 on your mail server. Are you aware of this?

 Roger

Acknowledgements ๐Ÿซถ

The author would like to acknowledge many helpful suggestions on the ietf-smtp and uta mailing lists, in particular those of Viktor Dukhovni, Tony Finch, Jeremy Harris, Arvel Hathcock, John Klensin, Barry Leiba, John Levine, Chris Newman, Rolf Sonneveld, and Per Thorsheim. ๐Ÿ’œ

Author's Address ๐ŸŒธ

Jim Fenton
Altmode Networks
Los Altos, California 94024
United States of America

Email: fenton@bluepopcorn.net
๐Ÿ“ฆ where this page comes from