rfc2487.txt 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. Network Working Group P. Hoffman
  2. Request for Comments: 2487 Internet Mail Consortium
  3. Category: Standards Track January 1999
  4. SMTP Service Extension for Secure SMTP over TLS
  5. Status of this Memo
  6. This document specifies an Internet standards track protocol for the
  7. Internet community, and requests discussion and suggestions for
  8. improvements. Please refer to the current edition of the "Internet
  9. Official Protocol Standards" (STD 1) for the standardization state
  10. and status of this protocol. Distribution of this memo is unlimited.
  11. Copyright Notice
  12. Copyright (C) The Internet Society (1999). All Rights Reserved.
  13. 1. Abstract
  14. This document describes an extension to the SMTP service that allows
  15. an SMTP server and client to use transport-layer security to provide
  16. private, authenticated communication over the Internet. This gives
  17. SMTP agents the ability to protect some or all of their
  18. communications from eavesdroppers and attackers.
  19. 2. Introduction
  20. SMTP [RFC-821] servers and clients normally communicate in the clear
  21. over the Internet. In many cases, this communication goes through one
  22. or more router that is not controlled or trusted by either entity.
  23. Such an untrusted router might allow a third party to monitor or
  24. alter the communications between the server and client.
  25. Further, there is often a desire for two SMTP agents to be able to
  26. authenticate each others' identities. For example, a secure SMTP
  27. server might only allow communications from other SMTP agents it
  28. knows, or it might act differently for messages received from an
  29. agent it knows than from one it doesn't know.
  30. TLS [TLS], more commonly known as SSL, is a popular mechanism for
  31. enhancing TCP communications with privacy and authentication. TLS is
  32. in wide use with the HTTP protocol, and is also being used for adding
  33. security to many other common protocols that run over TCP.
  34. Hoffman Standards Track [Page 1]
  35. RFC 2487 SMTP Service Extension January 1999
  36. 2.1 Terminology
  37. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  38. "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  39. document are to be interpreted as described in [RFC-2119].
  40. 3. STARTTLS Extension
  41. The STARTTLS extension to SMTP is laid out as follows:
  42. (1) the name of the SMTP service defined here is STARTTLS;
  43. (2) the EHLO keyword value associated with the extension is STARTTLS;
  44. (3) the STARTTLS keyword has no parameters;
  45. (4) a new SMTP verb, "STARTTLS", is defined;
  46. (5) no additional parameters are added to any SMTP command.
  47. 4. The STARTTLS Keyword
  48. The STARTTLS keyword is used to tell the SMTP client that the SMTP
  49. server allows use of TLS. It takes no parameters.
  50. 5. The STARTTLS Command
  51. The format for the STARTTLS command is:
  52. STARTTLS
  53. with no parameters.
  54. After the client gives the STARTTLS command, the server responds with
  55. one of the following reply codes:
  56. 220 Ready to start TLS
  57. 501 Syntax error (no parameters allowed)
  58. 454 TLS not available due to temporary reason
  59. A publicly-referenced SMTP server MUST NOT require use of the
  60. STARTTLS extension in order to deliver mail locally. This rule
  61. prevents the STARTTLS extension from damaging the interoperability of
  62. the Internet's SMTP infrastructure. A publicly-referenced SMTP server
  63. is an SMTP server which runs on port 25 of an Internet host listed in
  64. the MX record (or A record if an MX record is not present) for the
  65. domain name on the right hand side of an Internet mail address.
  66. Hoffman Standards Track [Page 2]
  67. RFC 2487 SMTP Service Extension January 1999
  68. Any SMTP server may refuse to accept messages for relay based on
  69. authentication supplied during the TLS negotiation. An SMTP server
  70. that is not publicly referenced may refuse to accept any messages for
  71. relay or local delivery based on authentication supplied during the
  72. TLS negotiation.
  73. A SMTP server that is not publicly referenced may choose to require
  74. that the client perform a TLS negotiation before accepting any
  75. commands. In this case, the server SHOULD return the reply code:
  76. 530 Must issue a STARTTLS command first
  77. to every command other than NOOP, EHLO, STARTTLS, or QUIT. If the
  78. client and server are using the ENHANCEDSTATUSCODES ESMTP extension
  79. [RFC-2034], the status code to be returned SHOULD be 5.7.0.
  80. After receiving a 220 response to a STARTTLS command, the client
  81. SHOULD start the TLS negotiation before giving any other SMTP
  82. commands.
  83. If the SMTP client is using pipelining as defined in RFC 1854, the
  84. STARTTLS command must be the last command in a group.
  85. 5.1 Processing After the STARTTLS Command
  86. After the TLS handshake has been completed, both parties MUST
  87. immediately decide whether or not to continue based on the
  88. authentication and privacy achieved. The SMTP client and server may
  89. decide to move ahead even if the TLS negotiation ended with no
  90. authentication and/or no privacy because most SMTP services are
  91. performed with no authentication and no privacy, but some SMTP
  92. clients or servers may want to continue only if a particular level of
  93. authentication and/or privacy was achieved.
  94. If the SMTP client decides that the level of authentication or
  95. privacy is not high enough for it to continue, it SHOULD issue an
  96. SMTP QUIT command immediately after the TLS negotiation is complete.
  97. If the SMTP server decides that the level of authentication or
  98. privacy is not high enough for it to continue, it SHOULD reply to
  99. every SMTP command from the client (other than a QUIT command) with
  100. the 554 reply code (with a possible text string such as "Command
  101. refused due to lack of security").
  102. The decision of whether or not to believe the authenticity of the
  103. other party in a TLS negotiation is a local matter. However, some
  104. general rules for the decisions are:
  105. Hoffman Standards Track [Page 3]
  106. RFC 2487 SMTP Service Extension January 1999
  107. - A SMTP client would probably only want to authenticate an SMTP
  108. server whose server certificate has a domain name that is the
  109. domain name that the client thought it was connecting to.
  110. - A publicly-referenced SMTP server would probably want to accept
  111. any certificate from an SMTP client, and would possibly want to
  112. put distinguishing information about the certificate in the
  113. Received header of messages that were relayed or submitted from
  114. the client.
  115. 5.2 Result of the STARTTLS Command
  116. Upon completion of the TLS handshake, the SMTP protocol is reset to
  117. the initial state (the state in SMTP after a server issues a 220
  118. service ready greeting). The server MUST discard any knowledge
  119. obtained from the client, such as the argument to the EHLO command,
  120. which was not obtained from the TLS negotiation itself. The client
  121. MUST discard any knowledge obtained from the server, such as the list
  122. of SMTP service extensions, which was not obtained from the TLS
  123. negotiation itself. The client SHOULD send an EHLO command as the
  124. first command after a successful TLS negotiation.
  125. The list of SMTP service extensions returned in response to an EHLO
  126. command received after the TLS handshake MAY be different than the
  127. list returned before the TLS handshake. For example, an SMTP server
  128. might not want to advertise support for a particular SASL mechanism
  129. [SASL] unless a client has sent an appropriate client certificate
  130. during a TLS handshake.
  131. Both the client and the server MUST know if there is a TLS session
  132. active. A client MUST NOT attempt to start a TLS session if a TLS
  133. session is already active. A server MUST NOT return the TLS extension
  134. in response to an EHLO command received after a TLS handshake has
  135. completed.
  136. 6. Usage Example
  137. The following dialog illustrates how a client and server can start a
  138. TLS session:
  139. S: <waits for connection on TCP port 25>
  140. C: <opens connection>
  141. S: 220 mail.imc.org SMTP service ready
  142. C: EHLO mail.ietf.org
  143. S: 250-mail.imc.org offers a warm hug of welcome
  144. S: 250 STARTTLS
  145. C: STARTTLS
  146. S: 220 Go ahead
  147. C: <starts TLS negotiation>
  148. Hoffman Standards Track [Page 4]
  149. RFC 2487 SMTP Service Extension January 1999
  150. C & S: <negotiate a TLS session>
  151. C & S: <check result of negotiation>
  152. C: <continues by sending an SMTP command>
  153. . . .
  154. 7. Security Considerations
  155. It should be noted that SMTP is not an end-to-end mechanism. Thus, if
  156. an SMTP client/server pair decide to add TLS privacy, they are not
  157. securing the transport from the originating mail user agent to the
  158. recipient. Further, because delivery of a single piece of mail may
  159. go between more than two SMTP servers, adding TLS privacy to one pair
  160. of servers does not mean that the entire SMTP chain has been made
  161. private. Further, just because an SMTP server can authenticate an
  162. SMTP client, it does not mean that the mail from the SMTP client was
  163. authenticated by the SMTP client when the client received it.
  164. Both the STMP client and server must check the result of the TLS
  165. negotiation to see whether acceptable authentication or privacy was
  166. achieved. Ignoring this step completely invalidates using TLS for
  167. security. The decision about whether acceptable authentication or
  168. privacy was achieved is made locally, is implementation-dependant,
  169. and is beyond the scope of this document.
  170. The SMTP client and server should note carefully the result of the
  171. TLS negotiation. If the negotiation results in no privacy, or if it
  172. results in privacy using algorithms or key lengths that are deemed
  173. not strong enough, or if the authentication is not good enough for
  174. either party, the client may choose to end the SMTP session with an
  175. immediate QUIT command, or the server may choose to not accept any
  176. more SMTP commands.
  177. A server announcing in an EHLO response that it uses a particular TLS
  178. protocol should not pose any security issues, since any use of TLS
  179. will be at least as secure as no use of TLS.
  180. A man-in-the-middle attack can be launched by deleting the "250
  181. STARTTLS" response from the server. This would cause the client not
  182. to try to start a TLS session. An SMTP client can protect against
  183. this attack by recording the fact that a particular SMTP server
  184. offers TLS during one session and generating an alarm if it does not
  185. appear in the EHLO response for a later session. The lack of TLS
  186. during a session SHOULD NOT result in the bouncing of email, although
  187. it could result in delayed processing.
  188. Hoffman Standards Track [Page 5]
  189. RFC 2487 SMTP Service Extension January 1999
  190. Before the TLS handshake has begun, any protocol interactions are
  191. performed in the clear and may be modified by an active attacker. For
  192. this reason, clients and servers MUST discard any knowledge obtained
  193. prior to the start of the TLS handshake upon completion of the TLS
  194. handshake.
  195. The STARTTLS extension is not suitable for authenticating the author
  196. of an email message unless every hop in the delivery chain, including
  197. the submission to the first SMTP server, is authenticated. Another
  198. proposal [SMTP-AUTH] can be used to authenticate delivery and MIME
  199. security multiparts [MIME-SEC] can be used to authenticate the author
  200. of an email message. In addition, the [SMTP-AUTH] proposal offers
  201. simpler and more flexible options to authenticate an SMTP client and
  202. the SASL EXTERNAL mechanism [SASL] MAY be used in conjunction with
  203. the STARTTLS command to provide an authorization identity.
  204. Hoffman Standards Track [Page 6]
  205. RFC 2487 SMTP Service Extension January 1999
  206. A. References
  207. [RFC-821] Postel, J., "Simple Mail Transfer Protocol", RFC 821,
  208. August 1982.
  209. [RFC-1869] Klensin, J., Freed, N, Rose, M, Stefferud, E. and D.
  210. Crocker, "SMTP Service Extensions", STD 10, RFC 1869,
  211. November 1995.
  212. [RFC-2034] Freed, N., "SMTP Service Extension for Returning Enhanced
  213. Error Codes", RFC 2034, October 1996.
  214. [RFC-2119] Bradner, S., "Key words for use in RFCs to Indicate
  215. Requirement Levels", BCP 14, RFC 2119, March 1997.
  216. [SASL] Myers, J., "Simple Authentication and Security Layer
  217. (SASL)", RFC 2222, October 1997.
  218. [SMTP-AUTH] "SMTP Service Extension for Authentication", Work in
  219. Progress.
  220. [TLS] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0",
  221. RFC 2246, January 1999.
  222. B. Author's Address
  223. Paul Hoffman
  224. Internet Mail Consortium
  225. 127 Segre Place
  226. Santa Cruz, CA 95060
  227. Phone: (831) 426-9827
  228. EMail: phoffman@imc.org
  229. Hoffman Standards Track [Page 7]
  230. RFC 2487 SMTP Service Extension January 1999
  231. C. Full Copyright Statement
  232. Copyright (C) The Internet Society (1999). All Rights Reserved.
  233. This document and translations of it may be copied and furnished to
  234. others, and derivative works that comment on or otherwise explain it
  235. or assist in its implementation may be prepared, copied, published
  236. and distributed, in whole or in part, without restriction of any
  237. kind, provided that the above copyright notice and this paragraph are
  238. included on all such copies and derivative works. However, this
  239. document itself may not be modified in any way, such as by removing
  240. the copyright notice or references to the Internet Society or other
  241. Internet organizations, except as needed for the purpose of
  242. developing Internet standards in which case the procedures for
  243. copyrights defined in the Internet Standards process must be
  244. followed, or as required to translate it into languages other than
  245. English.
  246. The limited permissions granted above are perpetual and will not be
  247. revoked by the Internet Society or its successors or assigns.
  248. This document and the information contained herein is provided on an
  249. "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  250. TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  251. BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  252. HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  253. MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  254. Hoffman Standards Track [Page 8]