7Network Working Group P. Hoffman
8Request for Comments: 3207 Internet Mail Consortium
9Obsoletes: 2487 February 2002
10Category: Standards Track
13 SMTP Service Extension for
14 Secure SMTP over Transport Layer Security
18 This document specifies an Internet standards track protocol for the
19 Internet community, and requests discussion and suggestions for
20 improvements. Please refer to the current edition of the "Internet
21 Official Protocol Standards" (STD 1) for the standardization state
22 and status of this protocol. Distribution of this memo is unlimited.
26 Copyright (C) The Internet Society (2002). All Rights Reserved.
30 This document describes an extension to the SMTP (Simple Mail
31 Transfer Protocol) service that allows an SMTP server and client to
32 use TLS (Transport Layer Security) to provide private, authenticated
33 communication over the Internet. This gives SMTP agents the ability
34 to protect some or all of their communications from eavesdroppers and
39 SMTP [RFC2821] servers and clients normally communicate in the clear
40 over the Internet. In many cases, this communication goes through
41 one or more router that is not controlled or trusted by either
42 entity. Such an untrusted router might allow a third party to
43 monitor or alter the communications between the server and client.
45 Further, there is often a desire for two SMTP agents to be able to
46 authenticate each others' identities. For example, a secure SMTP
47 server might only allow communications from other SMTP agents it
48 knows, or it might act differently for messages received from an
49 agent it knows than from one it doesn't know.
58Hoffman Standards Track [Page 1]
60RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
63 TLS [TLS], more commonly known as SSL, is a popular mechanism for
64 enhancing TCP communications with privacy and authentication. TLS is
65 in wide use with the HTTP protocol, and is also being used for adding
66 security to many other common protocols that run over TCP.
68 This document obsoletes RFC 2487.
72 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
73 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
74 document are to be interpreted as described in [RFC2119].
78 The STARTTLS extension to SMTP is laid out as follows:
80 (1) the name of the SMTP service defined here is STARTTLS;
82 (2) the EHLO keyword value associated with the extension is STARTTLS;
84 (3) the STARTTLS keyword has no parameters;
86 (4) a new SMTP verb, "STARTTLS", is defined;
88 (5) no additional parameters are added to any SMTP command.
92 The STARTTLS keyword is used to tell the SMTP client that the SMTP
93 server is currently able to negotiate the use of TLS. It takes no
98 The format for the STARTTLS command is:
104 After the client gives the STARTTLS command, the server responds with
105 one of the following reply codes:
108 501 Syntax error (no parameters allowed)
109 454 TLS not available due to temporary reason
114Hoffman Standards Track [Page 2]
116RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
119 If the client receives the 454 response, the client must decide
120 whether or not to continue the SMTP session. Such a decision is
121 based on local policy. For instance, if TLS was being used for
122 client authentication, the client might try to continue the session,
123 in case the server allows it even with no authentication. However,
124 if TLS was being negotiated for encryption, a client that gets a 454
125 response needs to decide whether to send the message anyway with no
126 TLS encryption, whether to wait and try again later, or whether to
127 give up and notify the sender of the error.
129 A publicly-referenced SMTP server MUST NOT require use of the
130 STARTTLS extension in order to deliver mail locally. This rule
131 prevents the STARTTLS extension from damaging the interoperability of
132 the Internet's SMTP infrastructure. A publicly-referenced SMTP
133 server is an SMTP server which runs on port 25 of an Internet host
134 listed in the MX record (or A record if an MX record is not present)
135 for the domain name on the right hand side of an Internet mail
138 Any SMTP server may refuse to accept messages for relay based on
139 authentication supplied during the TLS negotiation. An SMTP server
140 that is not publicly referenced may refuse to accept any messages for
141 relay or local delivery based on authentication supplied during the
144 A SMTP server that is not publicly referenced may choose to require
145 that the client perform a TLS negotiation before accepting any
146 commands. In this case, the server SHOULD return the reply code:
150 to every command other than NOOP, EHLO, STARTTLS, or QUIT. If the
151 client and server are using the ENHANCEDSTATUSCODES ESMTP extension
152 [RFC2034], the status code to be returned SHOULD be 5.7.0.
154 After receiving a 220 response to a STARTTLS command, the client MUST
155 start the TLS negotiation before giving any other SMTP commands. If,
156 after having issued the STARTTLS command, the client finds out that
157 some failure prevents it from actually starting a TLS handshake, then
158 it SHOULD abort the connection.
160 If the SMTP client is using pipelining as defined in RFC 2920, the
161 STARTTLS command must be the last command in a group.
170Hoffman Standards Track [Page 3]
172RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
1754.1 Processing After the STARTTLS Command
177 After the TLS handshake has been completed, both parties MUST
178 immediately decide whether or not to continue based on the
179 authentication and privacy achieved. The SMTP client and server may
180 decide to move ahead even if the TLS negotiation ended with no
181 authentication and/or no privacy because most SMTP services are
182 performed with no authentication and no privacy, but some SMTP
183 clients or servers may want to continue only if a particular level of
184 authentication and/or privacy was achieved.
186 If the SMTP client decides that the level of authentication or
187 privacy is not high enough for it to continue, it SHOULD issue an
188 SMTP QUIT command immediately after the TLS negotiation is complete.
189 If the SMTP server decides that the level of authentication or
190 privacy is not high enough for it to continue, it SHOULD reply to
191 every SMTP command from the client (other than a QUIT command) with
192 the 554 reply code (with a possible text string such as "Command
193 refused due to lack of security").
195 The decision of whether or not to believe the authenticity of the
196 other party in a TLS negotiation is a local matter. However, some
197 general rules for the decisions are:
199 - A SMTP client would probably only want to authenticate an SMTP
200 server whose server certificate has a domain name that is the
201 domain name that the client thought it was connecting to.
202 - A publicly-referenced SMTP server would probably want to accept
203 any verifiable certificate from an SMTP client, and would possibly
204 want to put distinguishing information about the certificate in
205 the Received header of messages that were relayed or submitted
2084.2 Result of the STARTTLS Command
211 the initial state (the state in SMTP after a server issues a 220
212 service ready greeting). The server MUST discard any knowledge
213 obtained from the client, such as the argument to the EHLO command,
214 which was not obtained from the TLS negotiation itself. The client
215 MUST discard any knowledge obtained from the server, such as the list
216 of SMTP service extensions, which was not obtained from the TLS
217 negotiation itself. The client SHOULD send an EHLO command as the
218 first command after a successful TLS negotiation.
220 The list of SMTP service extensions returned in response to an EHLO
221 command received after the TLS handshake MAY be different than the
222 list returned before the TLS handshake. For example, an SMTP server
226Hoffman Standards Track [Page 4]
228RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
231 might not want to advertise support for a particular SASL mechanism
232 [SASL] unless a client has sent an appropriate client certificate
233 during a TLS handshake.
236 active. A client MUST NOT attempt to start a TLS session if a TLS
238 extension in response to an EHLO command received after a TLS
239 handshake has completed.
2414.3 STARTTLS on the Submission Port
243 STARTTLS is a valid ESMTP extension when used on the Submission port,
244 as defined in [RFC2476]. In fact, since the submission port is by
245 definition not a publicly referenced SMTP server, the STARTTLS
246 extension can be particularly useful by providing security and
247 authentication for this service.
251 The following dialog illustrates how a client and server can start a
254 S: <waits for connection on TCP port 25>
255 C: <opens connection>
256 S: 220 mail.imc.org SMTP service ready
257 C: EHLO mail.example.com
258 S: 250-mail.imc.org offers a warm hug of welcome
264 C: <starts TLS negotiation>
265 C & S: <negotiate a TLS session>
266 C & S: <check result of negotiation>
267 C: EHLO mail.example.com
268 S: 250-mail.imc.org touches your hand gently for a moment
2726. Security Considerations
274 It should be noted that SMTP is not an end-to-end mechanism. Thus,
275 if an SMTP client/server pair decide to add TLS privacy, they are not
276 securing the transport from the originating mail user agent to the
277 recipient. Further, because delivery of a single piece of mail may
278 go between more than two SMTP servers, adding TLS privacy to one pair
282Hoffman Standards Track [Page 5]
284RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
287 of servers does not mean that the entire SMTP chain has been made
288 private. Further, just because an SMTP server can authenticate an
289 SMTP client, it does not mean that the mail from the SMTP client was
290 authenticated by the SMTP client when the client received it.
292 Both the SMTP client and server must check the result of the TLS
293 negotiation to see whether an acceptable degree of authentication and
294 privacy was achieved. Ignoring this step completely invalidates
295 using TLS for security. The decision about whether acceptable
296 authentication or privacy was achieved is made locally, is
297 implementation-dependent, and is beyond the scope of this document.
299 The SMTP client and server should note carefully the result of the
300 TLS negotiation. If the negotiation results in no privacy, or if it
301 results in privacy using algorithms or key lengths that are deemed
302 not strong enough, or if the authentication is not good enough for
303 either party, the client may choose to end the SMTP session with an
304 immediate QUIT command, or the server may choose to not accept any
307 A man-in-the-middle attack can be launched by deleting the "250
308 STARTTLS" response from the server. This would cause the client not
309 to try to start a TLS session. Another man-in-the-middle attack is
310 to allow the server to announce its STARTTLS capability, but to alter
311 the client's request to start TLS and the server's response. In
312 order to defend against such attacks both clients and servers MUST be
313 able to be configured to require successful TLS negotiation of an
314 appropriate cipher suite for selected hosts before messages can be
315 successfully transferred. The additional option of using TLS when
316 possible SHOULD also be provided. An implementation MAY provide the
317 ability to record that TLS was used in communicating with a given
318 peer and generating a warning if it is not used in a later session.
320 If the TLS negotiation fails or if the client receives a 454
321 response, the client has to decide what to do next. There are three
322 main choices: go ahead with the rest of the SMTP session, retry TLS
323 at a later time, or give up and return the mail to the sender. If a
324 failure or error occurs, the client can assume that the server may be
325 able to negotiate TLS in the future, and should try negotiate TLS in
326 a later session, until some locally-chosen timeout occurs, at which
327 point, the client should return the mail to the sender. However, if
328 the client and server were only using TLS for authentication, the
329 client may want to proceed with the SMTP session, in case some of the
330 operations the client wanted to perform are accepted by the server
331 even if the client is unauthenticated.
333 Before the TLS handshake has begun, any protocol interactions are
334 performed in the clear and may be modified by an active attacker.
338Hoffman Standards Track [Page 6]
340RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
343 For this reason, clients and servers MUST discard any knowledge
344 obtained prior to the start of the TLS handshake upon completion of
347 The STARTTLS extension is not suitable for authenticating the author
348 of an email message unless every hop in the delivery chain, including
349 the submission to the first SMTP server, is authenticated. Another
350 proposal [SMTP-AUTH] can be used to authenticate delivery and MIME
351 security multiparts [MIME-SEC] can be used to authenticate the author
352 of an email message. In addition, the [SMTP-AUTH] proposal offers
353 simpler and more flexible options to authenticate an SMTP client and
354 the SASL EXTERNAL mechanism [SASL] MAY be used in conjunction with
355 the STARTTLS command to provide an authorization identity.
359 [RFC2821] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821,
362 [RFC2034] Freed, N., "SMTP Service Extension for Returning Enhanced
363 Error Codes", RFC 2034, October 1996.
365 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
366 Requirement Levels", BCP 14, RFC 2119, March 1997.
368 [RFC2476] Gellens, R. and J. Klensin, "Message Submission", RFC
371 [SASL] Myers, J., "Simple Authentication and Security Layer
372 (SASL)", RFC 2222, October 1997.
374 [SMTP-AUTH] Myers, J., "SMTP Service Extension for Authentication",
375 RFC 2554, March 1999.
377 [TLS] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0",
378 RFC 2246, January 1999.
394Hoffman Standards Track [Page 7]
396RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
401 This document is a revision of RFC 2487, which is a Proposed
402 Standard. The changes from that document are:
404 - Section 5 and 7: More discussion of the man-in-the-middle attacks
405 - Section 5: Additional discussion of when a server should and
406 should not advertise the STARTTLS extension
407 - Section 5: Changed the requirements on SMTP clients after
408 receiving a 220 response.
409 - Section 5.1: Clarified description of verifying certificates.
410 - Section 5.3: Added the section on "STARTTLS on the Submission
412 - Section 6: Bug fix in the example to indicate that the client
413 needs to issue a new EHLO command, as already is described in
415 - Section 7: Clarification of the paragraph on acceptable degree of
416 privacy. Significant change to the discussion of how to avoid a
417 man-in-the-middle attack.
418 - Section A: Update reference from RFC 821 to RFC 2821.
423 Internet Mail Consortium
427 Phone: (831) 426-9827
428 EMail: phoffman@imc.org
450Hoffman Standards Track [Page 8]
452RFC 3207 SMTP Service Extension - Secure SMTP over TLS February 2002
455Full Copyright Statement
457 Copyright (C) The Internet Society (2002). All Rights Reserved.
459 This document and translations of it may be copied and furnished to
460 others, and derivative works that comment on or otherwise explain it
461 or assist in its implementation may be prepared, copied, published
462 and distributed, in whole or in part, without restriction of any
463 kind, provided that the above copyright notice and this paragraph are
464 included on all such copies and derivative works. However, this
465 document itself may not be modified in any way, such as by removing
466 the copyright notice or references to the Internet Society or other
467 Internet organizations, except as needed for the purpose of
468 developing Internet standards in which case the procedures for
469 copyrights defined in the Internet Standards process must be
470 followed, or as required to translate it into languages other than
473 The limited permissions granted above are perpetual and will not be
474 revoked by the Internet Society or its successors or assigns.
476 This document and the information contained herein is provided on an
477 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
478 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
479 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
480 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
481 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
485 Funding for the RFC Editor function is currently provided by the
506Hoffman Standards Track [Page 9]