rfc4954.txt 42KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. Network Working Group R. Siemborski, Ed.
  2. Request for Comments: 4954 Google, Inc.
  3. Obsoletes: 2554 A. Melnikov, Ed.
  4. Updates: 3463 Isode Limited
  5. Category: Standards Track July 2007
  6. SMTP Service Extension for Authentication
  7. Status of This Memo
  8. This document specifies an Internet standards track protocol for the
  9. Internet community, and requests discussion and suggestions for
  10. improvements. Please refer to the current edition of the "Internet
  11. Official Protocol Standards" (STD 1) for the standardization state
  12. and status of this protocol. Distribution of this memo is unlimited.
  13. Copyright Notice
  14. Copyright (C) The IETF Trust (2007).
  15. Abstract
  16. This document defines a Simple Mail Transport Protocol (SMTP)
  17. extension whereby an SMTP client may indicate an authentication
  18. mechanism to the server, perform an authentication protocol exchange,
  19. and optionally negotiate a security layer for subsequent protocol
  20. interactions during this session. This extension includes a profile
  21. of the Simple Authentication and Security Layer (SASL) for SMTP.
  22. This document obsoletes RFC 2554.
  23. Siemborski & Melnikov Standards Track [Page 1]
  24. RFC 4954 SMTP Service Extension for Authentication July 2007
  25. Table of Contents
  26. 1. Introduction ....................................................2
  27. 2. How to Read This Document .......................................2
  28. 3. The Authentication Service Extension ............................3
  29. 4. The AUTH Command ................................................3
  30. 4.1. Examples ...................................................7
  31. 5. The AUTH Parameter to the MAIL FROM command .....................9
  32. 5.1. Examples ..................................................10
  33. 6. Status Codes ...................................................11
  34. 7. Additional requirements on servers .............................12
  35. 8. Formal Syntax ..................................................13
  36. 9. Security Considerations ........................................14
  37. 10. IANA Considerations ...........................................15
  38. 11. Normative References ..........................................15
  39. 12. Informative References ........................................16
  40. 13. Acknowledgments ...............................................17
  41. 14. Additional Requirements When Using SASL PLAIN over TLS ........17
  42. 15. Changes since RFC 2554 ........................................18
  43. 1. Introduction
  44. This document defines a Simple Mail Transport Protocol (SMTP)
  45. extension whereby an SMTP client may indicate an authentication
  46. mechanism to the server, perform an authentication protocol exchange,
  47. optionally negotiate a security layer for subsequent protocol
  48. interactions during this session and, during a mail transaction,
  49. optionally specify a mailbox associated with the identity that
  50. submitted the message to the mail delivery system.
  51. This extension includes a profile of the Simple Authentication and
  52. Security Layer (SASL) for SMTP.
  53. When compared to RFC 2554, this document deprecates use of the 538
  54. response code, adds a new Enhanced Status Code, adds a requirement to
  55. support SASLprep profile for preparing authorization identities,
  56. recommends use of RFC 3848 transmission types in the Received trace
  57. header field, and clarifies interaction with SMTP PIPELINING
  58. [PIPELINING] extension.
  59. 2. How to Read This Document
  60. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  61. "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  62. document are to be interpreted as described in [KEYWORDS].
  63. In examples, "C:" and "S:" indicate lines sent by the client and
  64. server, respectively.
  65. Siemborski & Melnikov Standards Track [Page 2]
  66. RFC 4954 SMTP Service Extension for Authentication July 2007
  67. 3. The Authentication Service Extension
  68. 1. The name of this [SMTP] service extension is "Authentication".
  69. 2. The EHLO keyword value associated with this extension is "AUTH".
  70. 3. The AUTH EHLO keyword contains as a parameter a space-separated
  71. list of the names of available [SASL] mechanisms. The list of
  72. available mechanisms MAY change after a successful STARTTLS
  73. command [SMTP-TLS].
  74. 4. A new [SMTP] verb "AUTH" is defined.
  75. 5. An optional parameter using the keyword "AUTH" is added to the
  76. MAIL FROM command, and extends the maximum line length of the
  77. MAIL FROM command by 500 characters.
  78. 6. This extension is appropriate for the submission protocol
  79. [SUBMIT].
  80. 4. The AUTH Command
  81. AUTH mechanism [initial-response]
  82. Arguments:
  83. mechanism: A string identifying a [SASL] authentication
  84. mechanism.
  85. initial-response: An optional initial client response. If
  86. present, this response MUST be encoded as described in Section
  87. 4 of [BASE64] or contain a single character "=".
  88. Restrictions:
  89. After an AUTH command has been successfully completed, no more
  90. AUTH commands may be issued in the same session. After a
  91. successful AUTH command completes, a server MUST reject any
  92. further AUTH commands with a 503 reply.
  93. The AUTH command is not permitted during a mail transaction.
  94. An AUTH command issued during a mail transaction MUST be
  95. rejected with a 503 reply.
  96. Discussion:
  97. The AUTH command initiates a [SASL] authentication exchange
  98. between the client and the server. The client identifies the
  99. SASL mechanism to use with the first parameter of the AUTH
  100. command. If the server supports the requested authentication
  101. mechanism, it performs the SASL exchange to authenticate the
  102. Siemborski & Melnikov Standards Track [Page 3]
  103. RFC 4954 SMTP Service Extension for Authentication July 2007
  104. user. Optionally, it also negotiates a security layer for
  105. subsequent protocol interactions during this session. If the
  106. requested authentication mechanism is invalid (e.g., is not
  107. supported or requires an encryption layer), the server rejects
  108. the AUTH command with a 504 reply. If the server supports the
  109. [ESMTP-CODES] extension, it SHOULD return a 5.5.4 enhanced
  110. response code.
  111. The SASL authentication exchange consists of a series of
  112. server challenges and client responses that are specific to
  113. the chosen [SASL] mechanism.
  114. A server challenge is sent as a 334 reply with the text part
  115. containing the [BASE64] encoded string supplied by the SASL
  116. mechanism. This challenge MUST NOT contain any text other
  117. than the BASE64 encoded challenge.
  118. A client response consists of a line containing a [BASE64]
  119. encoded string. If the client wishes to cancel the
  120. authentication exchange, it issues a line with a single "*".
  121. If the server receives such a response, it MUST reject the
  122. AUTH command by sending a 501 reply.
  123. The optional initial response argument to the AUTH command is
  124. used to save a round-trip when using authentication mechanisms
  125. that support an initial client response. If the initial
  126. response argument is omitted and the chosen mechanism requires
  127. an initial client response, the server MUST proceed as defined
  128. in Section 5.1 of [SASL]. In SMTP, a server challenge that
  129. contains no data is defined as a 334 reply with no text part.
  130. Note that there is still a space following the reply code, so
  131. the complete response line is "334 ".
  132. Note that the AUTH command is still subject to the line length
  133. limitations defined in [SMTP]. If use of the initial response
  134. argument would cause the AUTH command to exceed this length,
  135. the client MUST NOT use the initial response parameter (and
  136. instead proceed as defined in Section 5.1 of [SASL]).
  137. If the client is transmitting an initial response of zero
  138. length, it MUST instead transmit the response as a single
  139. equals sign ("="). This indicates that the response is
  140. present, but contains no data.
  141. If the client uses an initial-response argument to the AUTH
  142. command with a SASL mechanism in which the client does not
  143. begin the authentication exchange, the server MUST reject the
  144. Siemborski & Melnikov Standards Track [Page 4]
  145. RFC 4954 SMTP Service Extension for Authentication July 2007
  146. AUTH command with a 501 reply. Servers using the enhanced
  147. status codes extension [ESMTP-CODES] SHOULD return an enhanced
  148. status code of 5.7.0 in this case.
  149. If the server cannot [BASE64] decode any client response, it
  150. MUST reject the AUTH command with a 501 reply (and an enhanced
  151. status code of 5.5.2). If the client cannot BASE64 decode any
  152. of the server's challenges, it MUST cancel the authentication
  153. using the "*" response. In particular, servers and clients
  154. MUST reject (and not ignore) any character not explicitly
  155. allowed by the BASE64 alphabet, and MUST reject any sequence
  156. of BASE64 characters that contains the pad character ('=')
  157. anywhere other than the end of the string (e.g., "=AAA" and
  158. "AAA=BBB" are not allowed).
  159. Note that these [BASE64] strings can be much longer than
  160. normal SMTP commands. Clients and servers MUST be able to
  161. handle the maximum encoded size of challenges and responses
  162. generated by their supported authentication mechanisms. This
  163. requirement is independent of any line length limitations the
  164. client or server may have in other parts of its protocol
  165. implementation. (At the time of writing of this document,
  166. 12288 octets is considered to be a sufficient line length
  167. limit for handling of deployed authentication mechanisms.)
  168. If, during an authentication exchange, the server receives a
  169. line that is longer than the server's authentication buffer,
  170. the server fails the AUTH command with the 500 reply. Servers
  171. using the enhanced status codes extension [ESMTP-CODES] SHOULD
  172. return an enhanced status code of 5.5.6 in this case.
  173. The authorization identity generated by this [SASL] exchange
  174. is a "simple username" (in the sense defined in [SASLprep]),
  175. and both client and server SHOULD (*) use the [SASLprep]
  176. profile of the [StringPrep] algorithm to prepare these names
  177. for transmission or comparison. If preparation of the
  178. authorization identity fails or results in an empty string
  179. (unless it was transmitted as the empty string), the server
  180. MUST fail the authentication.
  181. (*) Note: Future revision of this specification may change this
  182. requirement to MUST. Currently, the SHOULD is used in order to
  183. avoid breaking the majority of existing implementations.
  184. If the server is unable to authenticate the client, it SHOULD reject
  185. the AUTH command with a 535 reply unless a more specific error code
  186. is appropriate. Should the client successfully complete the
  187. exchange, the SMTP server issues a 235 reply. (Note that the SMTP
  188. protocol doesn't support the SASL feature of returning additional
  189. Siemborski & Melnikov Standards Track [Page 5]
  190. RFC 4954 SMTP Service Extension for Authentication July 2007
  191. data with a successful outcome.) These status codes, along with
  192. others defined by this extension, are discussed in Section 6 of this
  193. document.
  194. If a security layer is negotiated during the SASL exchange, it takes
  195. effect for the client on the octet immediately following the CRLF
  196. that concludes the last response generated by the client. For the
  197. server, it takes effect immediately following the CRLF of its success
  198. reply.
  199. When a security layer takes effect, the SMTP protocol is reset to the
  200. initial state (the state in SMTP after a server issues a 220 service
  201. ready greeting). The server MUST discard any knowledge obtained from
  202. the client, such as the EHLO argument, which was not obtained from
  203. the SASL negotiation itself. Likewise, the client MUST discard any
  204. knowledge obtained from the server, such as the list of SMTP service
  205. extensions, which was not obtained from the SASL negotiation itself.
  206. (Note that a client MAY compare the advertised SASL mechanisms before
  207. and after authentication in order to detect an active down-
  208. negotiation attack).
  209. The client SHOULD send an EHLO command as the first command after a
  210. successful SASL negotiation that results in the enabling of a
  211. security layer.
  212. When an entity (whether it is the client or the server end) is
  213. sending data, and both [TLS] and SASL security layers are in effect,
  214. the TLS encoding MUST be applied after the SASL encoding, regardless
  215. of the order in which the layers were negotiated.
  216. The service name specified by this protocol's profile of SASL is
  217. "smtp". This service name is also to be used for the [SUBMIT]
  218. protocol.
  219. If an AUTH command fails, the client MAY proceed without
  220. authentication. Alternatively, the client MAY try another
  221. authentication mechanism or present different credentials by issuing
  222. another AUTH
  223. Note: A server implementation MUST implement a configuration in which
  224. it does NOT permit any plaintext password mechanisms, unless either
  225. the STARTTLS [SMTP-TLS] command has been negotiated or some other
  226. mechanism that protects the session from password snooping has been
  227. provided. Server sites SHOULD NOT use any configuration which
  228. permits a plaintext password mechanism without such a protection
  229. mechanism against password snooping.
  230. Siemborski & Melnikov Standards Track [Page 6]
  231. RFC 4954 SMTP Service Extension for Authentication July 2007
  232. To ensure interoperability, client and server implementations of this
  233. extension MUST implement the [PLAIN] SASL mechanism running over TLS
  234. [TLS] [SMTP-TLS]. See also Section 15 for additional requirements on
  235. implementations of [PLAIN] over [TLS].
  236. Note that many existing client and server implementations implement
  237. CRAM-MD5 [CRAM-MD5] SASL mechanism. In order to ensure
  238. interoperability with deployed software, new implementations MAY
  239. implement it; however, implementations should be aware that this SASL
  240. mechanism doesn't provide any server authentication. Note that at
  241. the time of writing of this document the SASL Working Group is
  242. working on several replacement SASL mechanisms that provide server
  243. authentication and other features.
  244. When the AUTH command is used together with the [PIPELINING]
  245. extension, it MUST be the last command in a pipelined group of
  246. commands. The only exception to this rule is when the AUTH command
  247. contains an initial response for a SASL mechanism that allows the
  248. client to send data first, the SASL mechanism is known to complete in
  249. one round-trip, and a security layer is not negotiated by the client.
  250. Two examples of such SASL mechanisms are PLAIN [PLAIN] and EXTERNAL
  251. [SASL].
  252. 4.1. Examples
  253. Here is an example of a client attempting AUTH using the [PLAIN] SASL
  254. mechanism under a TLS layer, and making use of the initial client
  255. response:
  256. S: 220-smtp.example.com ESMTP Server
  257. C: EHLO client.example.com
  258. S: 250-smtp.example.com Hello client.example.com
  259. S: 250-AUTH GSSAPI DIGEST-MD5
  260. S: 250-ENHANCEDSTATUSCODES
  261. S: 250 STARTTLS
  262. C: STARTTLS
  263. S: 220 Ready to start TLS
  264. ... TLS negotiation proceeds, further commands
  265. protected by TLS layer ...
  266. C: EHLO client.example.com
  267. S: 250-smtp.example.com Hello client.example.com
  268. S: 250 AUTH GSSAPI DIGEST-MD5 PLAIN
  269. C: AUTH PLAIN dGVzdAB0ZXN0ADEyMzQ=
  270. S: 235 2.7.0 Authentication successful
  271. Here is another client that is attempting AUTH PLAIN under a TLS
  272. layer, this time without the initial response. Parts of the
  273. negotiation before the TLS layer was established have been omitted:
  274. Siemborski & Melnikov Standards Track [Page 7]
  275. RFC 4954 SMTP Service Extension for Authentication July 2007
  276. ... TLS negotiation proceeds, further commands
  277. protected by TLS layer ...
  278. C: EHLO client.example.com
  279. S: 250-smtp.example.com Hello client.example.com
  280. S: 250 AUTH GSSAPI DIGEST-MD5 PLAIN
  281. C: AUTH PLAIN
  282. (note: there is a single space following the 334
  283. on the following line)
  284. S: 334
  285. C: dGVzdAB0ZXN0ADEyMzQ=
  286. S: 235 2.7.0 Authentication successful
  287. Here is an example using CRAM-MD5 [CRAM-MD5], a mechanism in which
  288. the client does not begin the authentication exchange, and includes a
  289. server challenge:
  290. S: 220-smtp.example.com ESMTP Server
  291. C: EHLO client.example.com
  292. S: 250-smtp.example.com Hello client.example.com
  293. S: 250-AUTH DIGEST-MD5 CRAM-MD5
  294. S: 250-ENHANCEDSTATUSCODES
  295. S: 250 STARTTLS
  296. C: AUTH CRAM-MD5
  297. S: 334 PDQxOTI5NDIzNDEuMTI4Mjg0NzJAc291cmNlZm91ci5hbmRyZXcuY211LmVk
  298. dT4=
  299. C: cmpzMyBlYzNhNTlmZWQzOTVhYmExZWM2MzY3YzRmNGI0MWFjMA==
  300. S: 235 2.7.0 Authentication successful
  301. Here is an example of a client attempting AUTH EXTERNAL under TLS,
  302. using the derived authorization ID (and thus a zero-length initial
  303. client response).
  304. S: 220-smtp.example.com ESMTP Server
  305. C: EHLO client.example.com
  306. S: 250-smtp.example.com Hello client.example.com
  307. S: 250-AUTH GSSAPI DIGEST-MD5
  308. S: 250-ENHANCEDSTATUSCODES
  309. S: 250 STARTTLS
  310. C: STARTTLS
  311. S: 220 Ready to start TLS
  312. ... TLS negotiation proceeds, further commands
  313. protected by TLS layer ...
  314. C: EHLO client.example.com
  315. S: 250-smtp.example.com Hello client.example.com
  316. S: 250 AUTH EXTERNAL GSSAPI DIGEST-MD5 PLAIN
  317. C: AUTH EXTERNAL =
  318. S: 235 2.7.0 Authentication successful
  319. Siemborski & Melnikov Standards Track [Page 8]
  320. RFC 4954 SMTP Service Extension for Authentication July 2007
  321. 5. The AUTH Parameter to the MAIL FROM command
  322. AUTH=mailbox
  323. Arguments:
  324. A <mailbox> (see Section 4.1.2 of [SMTP]) that is associated
  325. with the identity that submitted the message to the delivery
  326. system, or the two character sequence "<>" indicating such an
  327. identity is unknown or insufficiently authenticated. To comply
  328. with restrictions imposed on ESMTP parameters, the <mailbox> is
  329. encoded inside an xtext. The syntax of an xtext is described in
  330. Section 4 of [ESMTP-DSN].
  331. Note:
  332. For the purposes of this discussion, "authenticated identity"
  333. refers to the identity (if any) derived from the authorization
  334. identity of previous AUTH command, while the terms "authorized
  335. identity" and "supplied <mailbox>" refer to the sender identity
  336. that is being associated with a particular message. Note that
  337. one authenticated identity may be able to identify messages as
  338. being sent by any number of authorized identities within a
  339. single session. For example, this may be the case when an SMTP
  340. server (one authenticated identity) is processing its queue
  341. (many messages with distinct authorized identities).
  342. Discussion:
  343. The optional AUTH parameter to the MAIL FROM command allows
  344. cooperating agents in a trusted environment to communicate the
  345. authorization identity associated with individual messages.
  346. If the server trusts the authenticated identity of the client to
  347. assert that the message was originally submitted by the supplied
  348. <mailbox>, then the server SHOULD supply the same <mailbox> in
  349. an AUTH parameter when relaying the message to any other server
  350. which supports the AUTH extension.
  351. For this reason, servers that advertise support for this
  352. extension MUST support the AUTH parameter to the MAIL FROM
  353. command even when the client has not authenticated itself to the
  354. server.
  355. A MAIL FROM parameter of AUTH=<> indicates that the original
  356. submitter of the message is not known. The server MUST NOT
  357. treat the message as having been originally submitted by the
  358. authenticated identity that resulted from the AUTH command.
  359. Siemborski & Melnikov Standards Track [Page 9]
  360. RFC 4954 SMTP Service Extension for Authentication July 2007
  361. If the AUTH parameter to the MAIL FROM command is not supplied,
  362. the client has authenticated, and the server believes the
  363. message is an original submission, the server MAY generate a
  364. <mailbox> from the user's authenticated identity for use in an
  365. AUTH parameter when relaying the message to any server which
  366. supports the AUTH extension. The generated <mailbox> is
  367. implementation specific, but it MUST conform to the syntax of
  368. [SMTP]. If the implementation cannot generate a valid
  369. <mailbox>, it MUST transmit AUTH=<> when relaying this message.
  370. If the server does not sufficiently trust the authenticated
  371. identity of the client, or if the client is not authenticated,
  372. then the server MUST behave as if the AUTH=<> parameter was
  373. supplied. The server MAY, however, write the value of any
  374. supplied AUTH parameter to a log file.
  375. If an AUTH=<> parameter was supplied, either explicitly or due
  376. to the requirement in the previous paragraph, then the server
  377. MUST supply the AUTH=<> parameter when relaying the message to
  378. any server which it has authenticated to using the AUTH
  379. extension.
  380. A server MAY treat expansion of a mailing list as a new
  381. submission, setting the AUTH parameter to the mailing list
  382. address or mailing list administration address when relaying the
  383. message to list subscribers.
  384. Note that an implementation which is hard-coded to treat all
  385. clients as being insufficiently trusted is compliant with this
  386. specification. In that case, the implementation does nothing
  387. more than parse and discard syntactically valid AUTH parameters
  388. to the MAIL FROM command, and supply AUTH=<> parameters to any
  389. servers that it authenticates to.
  390. 5.1. Examples
  391. An example where the original identity of the sender is trusted and
  392. known:
  393. C: MAIL FROM:<e=mc2@example.com> AUTH=e+3Dmc2@example.com
  394. S: 250 OK
  395. One example where the identity of the sender is not trusted or is
  396. otherwise being suppressed by the client:
  397. C: MAIL FROM:<john+@example.org> AUTH=<>
  398. S: 250 OK
  399. Siemborski & Melnikov Standards Track [Page 10]
  400. RFC 4954 SMTP Service Extension for Authentication July 2007
  401. 6. Status Codes
  402. The following error codes may be used to indicate various success or
  403. failure conditions. Servers that return enhanced status codes
  404. [ESMTP-CODES] SHOULD use the enhanced codes suggested here.
  405. 235 2.7.0 Authentication Succeeded
  406. This response to the AUTH command indicates that the authentication
  407. was successful.
  408. 432 4.7.12 A password transition is needed
  409. This response to the AUTH command indicates that the user needs to
  410. transition to the selected authentication mechanism. This is
  411. typically done by authenticating once using the [PLAIN]
  412. authentication mechanism. The selected mechanism SHOULD then work
  413. for authentications in subsequent sessions.
  414. 454 4.7.0 Temporary authentication failure
  415. This response to the AUTH command indicates that the authentication
  416. failed due to a temporary server failure. The client SHOULD NOT
  417. prompt the user for another password in this case, and should instead
  418. notify the user of server failure.
  419. 534 5.7.9 Authentication mechanism is too weak
  420. This response to the AUTH command indicates that the selected
  421. authentication mechanism is weaker than server policy permits for
  422. that user. The client SHOULD retry with a new authentication
  423. mechanism.
  424. 535 5.7.8 Authentication credentials invalid
  425. This response to the AUTH command indicates that the authentication
  426. failed due to invalid or insufficient authentication credentials. In
  427. this case, the client SHOULD ask the user to supply new credentials
  428. (such as by presenting a password dialog box).
  429. 500 5.5.6 Authentication Exchange line is too long
  430. This response to the AUTH command indicates that the authentication
  431. failed due to the client sending a [BASE64] response that is longer
  432. than the maximum buffer size available for the currently selected
  433. SASL mechanism.
  434. Siemborski & Melnikov Standards Track [Page 11]
  435. RFC 4954 SMTP Service Extension for Authentication July 2007
  436. 530 5.7.0 Authentication required
  437. This response SHOULD be returned by any command other than AUTH,
  438. EHLO, HELO, NOOP, RSET, or QUIT when server policy requires
  439. authentication in order to perform the requested action and
  440. authentication is not currently in force.
  441. 538 5.7.11 Encryption required for requested authentication
  442. mechanism
  443. This response to the AUTH command indicates that the selected
  444. authentication mechanism may only be used when the underlying SMTP
  445. connection is encrypted. Note that this response code is documented
  446. here for historical purposes only. Modern implementations SHOULD NOT
  447. advertise mechanisms that are not permitted due to lack of
  448. encryption, unless an encryption layer of sufficient strength is
  449. currently being employed.
  450. This document adds several new enhanced status codes to the list
  451. defined in [ENHANCED]:
  452. The following 3 Enhanced Status Codes were defined above:
  453. 5.7.8 Authentication credentials invalid
  454. 5.7.9 Authentication mechanism is too weak
  455. 5.7.11 Encryption required for requested authentication mechanism
  456. X.5.6 Authentication Exchange line is too long
  457. This enhanced status code SHOULD be returned when the server fails
  458. the AUTH command due to the client sending a [BASE64] response which
  459. is longer than the maximum buffer size available for the currently
  460. selected SASL mechanism. This is useful for both permanent and
  461. persistent transient errors.
  462. 7. Additional Requirements on Servers
  463. As described in Section 4.4 of [SMTP], an SMTP server that receives a
  464. message for delivery or further processing MUST insert the
  465. "Received:" header field at the beginning of the message content.
  466. This document places additional requirements on the content of a
  467. generated "Received:" header field. Upon successful authentication,
  468. a server SHOULD use the "ESMTPA" or the "ESMTPSA" [SMTP-TT] (when
  469. appropriate) keyword in the "with" clause of the Received header
  470. field.
  471. Siemborski & Melnikov Standards Track [Page 12]
  472. RFC 4954 SMTP Service Extension for Authentication July 2007
  473. 8. Formal Syntax
  474. The following syntax specification uses the Augmented Backus-Naur
  475. Form notation as specified in [ABNF]. Non-terminals referenced but
  476. not defined below are as defined by [ABNF] or [SASL]. The non-
  477. terminal <mailbox> is defined in [SMTP].
  478. Except as noted otherwise, all alphabetic characters are case-
  479. insensitive. The use of upper or lower case characters to define
  480. token strings is for editorial clarity only. Implementations MUST
  481. accept these strings in a case-insensitive fashion.
  482. hexchar = "+" HEXDIG HEXDIG
  483. xchar = %x21-2A / %x2C-3C / %x3E-7E
  484. ;; US-ASCII except for "+", "=", SP, and CTL
  485. xtext = *(xchar / hexchar)
  486. ;; non-US-ASCII is only allowed as hexchar
  487. auth-command = "AUTH" SP sasl-mech [SP initial-response]
  488. *(CRLF [base64]) [CRLF cancel-response]
  489. CRLF
  490. ;; <sasl-mech> is defined in [SASL]
  491. auth-param = "AUTH=" xtext
  492. ;; Parameter to the MAIL FROM command.
  493. ;; This non-terminal complies with
  494. ;; syntax defined by esmtp-param [SMTP].
  495. ;;
  496. ;; The decoded form of the xtext MUST be
  497. ;; either a <mailbox> or the two
  498. ;; characters "<>"
  499. base64 = base64-terminal /
  500. ( 1*(4base64-char) [base64-terminal] )
  501. base64-char = ALPHA / DIGIT / "+" / "/"
  502. ;; Case-sensitive
  503. base64-terminal = (2base64-char "==") / (3base64-char "=")
  504. continue-req = "334" SP [base64] CRLF
  505. ;; Intermediate response to the AUTH
  506. ;; command.
  507. ;; This non-terminal complies with
  508. ;; syntax defined by Reply-line [SMTP].
  509. Siemborski & Melnikov Standards Track [Page 13]
  510. RFC 4954 SMTP Service Extension for Authentication July 2007
  511. initial-response= base64 / "="
  512. cancel-response = "*"
  513. 9. Security Considerations
  514. Security issues are discussed throughout this memo.
  515. If a client uses this extension to get an encrypted tunnel through an
  516. insecure network to a cooperating server, it needs to be configured
  517. to never send mail to that server when the connection is not mutually
  518. authenticated and encrypted. Otherwise, an attacker could steal the
  519. client's mail by hijacking the [SMTP] connection and either
  520. pretending the server does not support the Authentication extension
  521. or causing all AUTH commands to fail.
  522. Before the [SASL] negotiation has begun, any protocol interactions
  523. are performed in the clear and may be modified by an active attacker.
  524. For this reason, clients and servers MUST discard any knowledge
  525. obtained prior to the start of the SASL negotiation upon the
  526. establishment of a security layer.
  527. This mechanism does not protect the TCP port, so an active attacker
  528. may redirect a relay connection attempt (i.e., a connection between
  529. two Mail Transfer Agents (MTAs)) to the submission port [SUBMIT].
  530. The AUTH=<> parameter prevents such an attack from causing a relayed
  531. message and, in the absence of other envelope authentication, from
  532. picking up the authentication of the relay client.
  533. A message submission client may require the user to authenticate
  534. whenever a suitable [SASL] mechanism is advertised. Therefore, it
  535. may not be desirable for a submission server [SUBMIT] to advertise a
  536. SASL mechanism when use of that mechanism grants the clients no
  537. benefits over anonymous submission.
  538. Servers MAY implement a policy whereby the connection is dropped
  539. after a number of failed authentication attempts. If they do so,
  540. they SHOULD NOT drop the connection until at least 3 attempts to
  541. authenticate have failed.
  542. If an implementation supports SASL mechanisms that are vulnerable to
  543. passive eavesdropping attacks (such as [PLAIN]), then the
  544. implementation MUST support at least one configuration where these
  545. SASL mechanisms are not advertised or used without the presence of an
  546. external security layer such as [TLS].
  547. Siemborski & Melnikov Standards Track [Page 14]
  548. RFC 4954 SMTP Service Extension for Authentication July 2007
  549. This extension is not intended to replace or be used instead of end-
  550. to-end message signature and encryption systems such as [S/MIME] or
  551. [PGP]. This extension addresses a different problem than end-to-end
  552. systems; it has the following key differences:
  553. 1. It is generally useful only within a trusted enclave.
  554. 2. It protects the entire envelope of a message, not just the
  555. message's body.
  556. 3. It authenticates the message submission, not authorship of the
  557. message content.
  558. 4. When mutual authentication is used along with a security layer,
  559. it can give the sender some assurance that the message was
  560. successfully delivered to the next hop.
  561. Additional security considerations are mentioned in the [SASL]
  562. specification. Additional security considerations specific to a
  563. particular SASL mechanism are described in the relevant
  564. specification. Additional security considerations for [PLAIN] over
  565. [TLS] are mentioned in Section 15 of this document.
  566. 10. IANA Considerations
  567. IANA updated the entry for the "smtp" SASL protocol name to point at
  568. this document.
  569. IANA updated the registration of the Authentication SMTP service
  570. extension as defined in Section 3 of this document. This registry is
  571. currently located at <http://www.iana.org/assignments/mail-
  572. parameters>.
  573. 11. Normative References
  574. [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax
  575. Specifications: ABNF", RFC 4234, October 2005.
  576. [BASE64] Josefsson, S., "The Base16, Base32, and Base64 Data
  577. Encodings", RFC 4648, October 2006.
  578. [ESMTP-CODES] Freed, N., "SMTP Service Extension for Returning
  579. Enhanced Error Codes", RFC 2034, October 1996.
  580. [ENHANCED] Vaudreuil, G., "Enhanced Mail System Status Codes", RFC
  581. 3463, January 2003.
  582. Siemborski & Melnikov Standards Track [Page 15]
  583. RFC 4954 SMTP Service Extension for Authentication July 2007
  584. [ESMTP-DSN] Moore, K., "Simple Mail Transfer Protocol (SMTP)
  585. Service Extension Delivery Status Notifications
  586. (DSNs)", RFC 3461, January 2003.
  587. [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
  588. Requirement Levels", BCP 14, RFC 2119, March 1997.
  589. [SASL] Melnikov, A. and K. Zeilenga, "Simple Authentication
  590. and Security Layer (SASL)", RFC 4422, June 2006.
  591. [SASLprep] Zeilenga, K., "SASLprep: Stringprep Profile for User
  592. Names and Passwords", RFC 4013, February 2005.
  593. [SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821,
  594. April 2001.
  595. [SMTP-TLS] Hoffman, P., "SMTP Service Extension for Secure SMTP
  596. over Transport Layer Security", RFC 3207, February
  597. 2002.
  598. [StringPrep] Hoffman, P. and M. Blanchet, "Preparation of
  599. Internationalized Strings ("stringprep")", RFC 3454,
  600. December 2002.
  601. [SUBMIT] Gellens, R. and J. Klensin, "Message Submission for
  602. Mail", RFC 4409, April 2006.
  603. [SMTP-TT] Newman, C., "ESMTP and LMTP Transmission Types
  604. Registration", RFC 3848, July 2004.
  605. [PLAIN] Zeilenga, K., Ed., "The PLAIN Simple Authentication and
  606. Security Layer (SASL) Mechanism", RFC 4616, August
  607. 2006.
  608. [X509] Housley, R., Polk, W., Ford, W., and D. Solo, "Internet
  609. X.509 Public Key Infrastructure Certificate and
  610. Certificate Revocation List (CRL) Profile", RFC 3280,
  611. April 2002.
  612. 12. Informative References
  613. [PGP] Elkins, M., "MIME Security with Pretty Good Privacy
  614. (PGP)", RFC 2015, October 1996.
  615. [S/MIME] Ramsdell, B., Ed., "Secure/Multipurpose Internet Mail
  616. Extensions (S/MIME) Version 3.1 Message Specification",
  617. RFC 3851, July 2004.
  618. Siemborski & Melnikov Standards Track [Page 16]
  619. RFC 4954 SMTP Service Extension for Authentication July 2007
  620. [TLS] Dierks, T. and E. Rescorla, "The Transport Layer
  621. Security (TLS) Protocol Version 1.1", RFC 4346, April
  622. 2006.
  623. [PIPELINING] Freed, N., "SMTP Service Extension for Command
  624. Pipelining", STD 60, RFC 2920, September 2000.
  625. [CRAM-MD5] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP
  626. AUTHorize Extension for Simple Challenge/Response", RFC
  627. 2195, September 1997.
  628. 13. Acknowledgments
  629. The editors would like to acknowledge the contributions of John Myers
  630. and other contributors to RFC 2554, on which this document draws from
  631. heavily.
  632. The editors would also like to thank Ken Murchison, Mark Crispin,
  633. Chris Newman, David Wilson, Dave Cridland, Frank Ellermann, Ned
  634. Freed, John Klensin, Tony Finch, Abhijit Menon-Sen, Philip Guenther,
  635. Sam Hartman, Russ Housley, Cullen Jennings, and Lisa Dusseault for
  636. the time they devoted to reviewing of this document and/or for the
  637. comments received.
  638. 14. Additional Requirements When Using SASL PLAIN over TLS
  639. This section is normative for SMTP implementations that support SASL
  640. [PLAIN] over [TLS].
  641. If an SMTP client is willing to use SASL PLAIN over TLS to
  642. authenticate to the SMTP server, the client verifies the server
  643. certificate according to the rules of [X509]. If the server has not
  644. provided any certificate, or if the certificate verification fails,
  645. the client MUST NOT attempt to authenticate using the SASL PLAIN
  646. mechanism.
  647. After a successful [TLS] negotiation, the client MUST check its
  648. understanding of the server hostname against the server's identity as
  649. presented in the server Certificate message, in order to prevent
  650. man-in-the-middle attacks. If the match fails, the client MUST NOT
  651. attempt to authenticate using the SASL PLAIN mechanism. Matching is
  652. performed according to the following rules:
  653. The client MUST use the server hostname it used to open the
  654. connection as the value to compare against the server name as
  655. expressed in the server certificate. The client MUST NOT use
  656. Siemborski & Melnikov Standards Track [Page 17]
  657. RFC 4954 SMTP Service Extension for Authentication July 2007
  658. any form of the server hostname derived from an insecure remote
  659. source (e.g., insecure DNS lookup). CNAME canonicalization is
  660. not done.
  661. If a subjectAltName extension of type dNSName is present in the
  662. certificate, it SHOULD be used as the source of the server's
  663. identity.
  664. Matching is case-insensitive.
  665. A "*" wildcard character MAY be used as the leftmost name
  666. component in the certificate. For example, *.example.com would
  667. match a.example.com, foo.example.com, etc., but would not match
  668. example.com.
  669. If the certificate contains multiple names (e.g., more than one
  670. dNSName field), then a match with any one of the fields is
  671. considered acceptable.
  672. 15. Changes since RFC 2554
  673. 1. Clarified that servers MUST support the use of the AUTH=mailbox
  674. parameter to MAIL FROM, even when the client is not
  675. authenticated.
  676. 2. Clarified the initial-client-send requirements, and give
  677. additional examples.
  678. 3. Updated references to newer versions of various specifications.
  679. 4. Required SASL PLAIN (over TLS) as mandatory-to-implement.
  680. 5. Clarified that the mechanism list can change.
  681. 6. Deprecated the use of the 538 response code.
  682. 7. Added the use of the SASLprep profile for preparing authorization
  683. identities.
  684. 8. Substantial cleanup of response codes and indicated suggested
  685. enhanced response codes. Also indicated what response codes
  686. should result in a client prompting the user for new credentials.
  687. 9. Updated ABNF section to use RFC 4234.
  688. 10. Clarified interaction with SMTP PIPELINING extension.
  689. 11. Added a reference to RFC 3848.
  690. Siemborski & Melnikov Standards Track [Page 18]
  691. RFC 4954 SMTP Service Extension for Authentication July 2007
  692. 12. Added a new Enhanced Status Code for "authentication line too
  693. long" case.
  694. 13. Other general editorial clarifications.
  695. Editors' Addresses
  696. Robert Siemborski
  697. Google, Inc.
  698. 1600 Ampitheatre Parkway
  699. Mountain View, CA 94043, USA
  700. Phone: +1 650 623 6925
  701. EMail: robsiemb@google.com
  702. Alexey Melnikov
  703. Isode Limited
  704. 5 Castle Business Village, 36 Station Road,
  705. Hampton, Middlesex, TW12 2BX, UK
  706. EMail: Alexey.Melnikov@isode.com
  707. Siemborski & Melnikov Standards Track [Page 19]
  708. RFC 4954 SMTP Service Extension for Authentication July 2007
  709. Full Copyright Statement
  710. Copyright (C) The IETF Trust (2007).
  711. This document is subject to the rights, licenses and restrictions
  712. contained in BCP 78, and except as set forth therein, the authors
  713. retain all their rights.
  714. This document and the information contained herein are provided on an
  715. "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
  716. OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
  717. THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
  718. OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
  719. THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
  720. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  721. Intellectual Property
  722. The IETF takes no position regarding the validity or scope of any
  723. Intellectual Property Rights or other rights that might be claimed to
  724. pertain to the implementation or use of the technology described in
  725. this document or the extent to which any license under such rights
  726. might or might not be available; nor does it represent that it has
  727. made any independent effort to identify any such rights. Information
  728. on the procedures with respect to rights in RFC documents can be
  729. found in BCP 78 and BCP 79.
  730. Copies of IPR disclosures made to the IETF Secretariat and any
  731. assurances of licenses to be made available, or the result of an
  732. attempt made to obtain a general license or permission for the use of
  733. such proprietary rights by implementers or users of this
  734. specification can be obtained from the IETF on-line IPR repository at
  735. http://www.ietf.org/ipr.
  736. The IETF invites any interested party to bring to its attention any
  737. copyrights, patents or patent applications, or other proprietary
  738. rights that may cover technology that may be required to implement
  739. this standard. Please address the information to the IETF at
  740. ietf-ipr@ietf.org.
  741. Acknowledgement
  742. Funding for the RFC Editor function is currently provided by the
  743. Internet Society.
  744. Siemborski & Melnikov Standards Track [Page 20]