rfc1731.IMAP4_auth.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. Network Working Group J. Myers
  2. Request for Comments: 1731 Carnegie Mellon
  3. Category: Standards Track December 1994
  4. IMAP4 Authentication Mechanisms
  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. 1. Introduction
  12. The Internet Message Access Protocol, Version 4 [IMAP4] contains the
  13. AUTHENTICATE command, for identifying and authenticating a user to an
  14. IMAP4 server and for optionally negotiating a protection mechanism
  15. for subsequent protocol interactions. This document describes
  16. several authentication mechanisms for use by the IMAP4 AUTHENTICATE
  17. command.
  18. 2. Kerberos version 4 authentication mechanism
  19. The authentication type associated with Kerberos version 4 is
  20. "KERBEROS_V4".
  21. The data encoded in the first ready response contains a random 32-bit
  22. number in network byte order. The client should respond with a
  23. Kerberos ticket and an authenticator for the principal
  24. "imap.hostname@realm", where "hostname" is the first component of the
  25. host name of the server with all letters in lower case and where
  26. "realm" is the Kerberos realm of the server. The encrypted checksum
  27. field included within the Kerberos authenticator should contain the
  28. server provided 32-bit number in network byte order.
  29. Upon decrypting and verifying the ticket and authenticator, the
  30. server should verify that the contained checksum field equals the
  31. original server provided random 32-bit number. Should the
  32. verification be successful, the server must add one to the checksum
  33. and construct 8 octets of data, with the first four octets containing
  34. the incremented checksum in network byte order, the fifth octet
  35. containing a bit-mask specifying the protection mechanisms supported
  36. by the server, and the sixth through eighth octets containing, in
  37. Myers [Page 1]
  38. RFC 1731 IMAP4 Authentication Mechanisms December 1994
  39. network byte order, the maximum cipher-text buffer size the server is
  40. able to receive. The server must encrypt the 8 octets of data in the
  41. session key and issue that encrypted data in a second ready response.
  42. The client should consider the server authenticated if the first four
  43. octets the un-encrypted data is equal to one plus the checksum it
  44. previously sent.
  45. The client must construct data with the first four octets containing
  46. the original server-issued checksum in network byte order, the fifth
  47. octet containing the bit-mask specifying the selected protection
  48. mechanism, the sixth through eighth octets containing in network byte
  49. order the maximum cipher-text buffer size the client is able to
  50. receive, and the following octets containing a user name string. The
  51. client must then append from one to eight octets so that the length
  52. of the data is a multiple of eight octets. The client must then PCBC
  53. encrypt the data with the session key and respond to the second ready
  54. response with the encrypted data. The server decrypts the data and
  55. verifies the contained checksum. The username field identifies the
  56. user for whom subsequent IMAP operations are to be performed; the
  57. server must verify that the principal identified in the Kerberos
  58. ticket is authorized to connect as that user. After these
  59. verifications, the authentication process is complete.
  60. The protection mechanisms and their corresponding bit-masks are as
  61. follows:
  62. 1 No protection mechanism
  63. 2 Integrity (krb_mk_safe) protection
  64. 4 Privacy (krb_mk_priv) protection
  65. EXAMPLE: The following are two Kerberos version 4 login scenarios
  66. (note that the line breaks in the sample authenticators are for
  67. editorial clarity and are not in real authenticators)
  68. S: * OK IMAP4 Server
  69. C: A001 AUTHENTICATE KERBEROS_V4
  70. S: + AmFYig==
  71. C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT
  72. +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd
  73. WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh
  74. S: + or//EoAADZI=
  75. C: DiAF5A4gA+oOIALuBkAAmw==
  76. S: A001 OK Kerberos V4 authentication successful
  77. Myers [Page 2]
  78. RFC 1731 IMAP4 Authentication Mechanisms December 1994
  79. S: * OK IMAP4 Server
  80. C: A001 AUTHENTICATE KERBEROS_V4
  81. S: + gcfgCA==
  82. C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT
  83. +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd
  84. WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh
  85. S: A001 NO Kerberos V4 authentication failed
  86. 3. GSSAPI authentication mechanism
  87. The authentication type associated with all mechanisms employing the
  88. GSSAPI [RFC1508] is "GSSAPI".
  89. The first ready response issued by the server contains no data. The
  90. client should call GSS_Init_sec_context, passing in 0 for
  91. input_context_handle (initially) and a targ_name equal to output_name
  92. from GSS_Import_Name called with input_name_type of NULL and
  93. input_name_string of "SERVICE:imap@hostname" where "hostname" is the
  94. fully qualified host name of the server with all letters in lower
  95. case. The client must then respond with the resulting output_token.
  96. If GSS_Init_sec_context returns GSS_CONTINUE_NEEDED, then the client
  97. should expect the server to issue a token in a subsequent ready
  98. response. The client must pass the token to another call to
  99. GSS_Init_sec_context.
  100. If GSS_Init_sec_context returns GSS_COMPLETE, then the client should
  101. respond with any resulting output_token. If there is no
  102. output_token, the client should respond with no data. The client
  103. should then expect the server to issue a token in a subsequent ready
  104. response. The client should pass this token to GSS_Unseal and
  105. interpret the first octet of resulting cleartext as a bit-mask
  106. specifying the protection mechanisms supported by the server and the
  107. second through fourth octets as the maximum size output_message to
  108. send to the server. The client should construct data, with the first
  109. octet containing the bit-mask specifying the selected protection
  110. mechanism, the second through fourth octets containing in network
  111. byte order the maximum size output_message the client is able to
  112. receive, and the remaining octets containing a user name string. The
  113. client must pass the data to GSS_Seal with conf_flag set to FALSE,
  114. and respond with the generated output_message. The client can then
  115. consider the server authenticated.
  116. The server must issue a ready response with no data and pass the
  117. resulting client supplied token to GSS_Accept_sec_context as
  118. input_token, setting acceptor_cred_handle to NULL (for "use default
  119. credentials"), and 0 for input_context_handle (initially). If
  120. GSS_Accept_sec_context returns GSS_CONTINUE_NEEDED, the server should
  121. Myers [Page 3]
  122. RFC 1731 IMAP4 Authentication Mechanisms December 1994
  123. return the generated output_token to the client in a ready response
  124. and pass the resulting client supplied token to another call to
  125. GSS_Accept_sec_context.
  126. If GSS_Accept_sec_context returns GSS_COMPLETE, then if an
  127. output_token is returned, the server should return it to the client
  128. in a ready response and expect a reply from the client with no data.
  129. Whether or not an output_token was returned, the server then should
  130. then construct 4 octets of data, with the first octet containing a
  131. bit-mask specifying the protection mechanisms supported by the server
  132. and the second through fourth octets containing in network byte order
  133. the maximum size output_token the server is able to receive. The
  134. server must then pass the plaintext to GSS_Seal with conf_flag set to
  135. FALSE and issue the generated output_message to the client in a ready
  136. response. The server must then pass the resulting client supplied
  137. token to GSS_Unseal and interpret the first octet of resulting
  138. cleartext as the bit-mask for the selected protection mechanism, the
  139. second through fourth octets as the maximum size output_message to
  140. send to the client, and the remaining octets as the user name. Upon
  141. verifying the src_name is authorized to authenticate as the user
  142. name, The server should then consider the client authenticated.
  143. The protection mechanisms and their corresponding bit-masks are as
  144. follows:
  145. 1 No protection mechanism
  146. 2 Integrity protection.
  147. Sender calls GSS_Seal with conf_flag set to FALSE
  148. 4 Privacy protection.
  149. Sender calls GSS_Seal with conf_flag set to TRUE
  150. 4. S/Key authentication mechanism
  151. The authentication type associated with S/Key [SKEY] is "SKEY".
  152. The first ready response issued by the server contains no data. The
  153. client responds with the user name string.
  154. The data encoded in the second ready response contains the decimal
  155. sequence number followed by a single space and the seed string for
  156. the indicated user. The client responds with the one-time-password,
  157. as either a 64-bit value in network byte order or encoded in the "six
  158. English words" format.
  159. Upon successful verification of the one-time-password, the server
  160. should consider the client authenticated.
  161. Myers [Page 4]
  162. RFC 1731 IMAP4 Authentication Mechanisms December 1994
  163. S/Key authentication does not provide for any protection mechanisms.
  164. EXAMPLE: The following are two S/Key login scenarios.
  165. S: * OK IMAP4 Server
  166. C: A001 AUTHENTICATE SKEY
  167. S: +
  168. C: bW9yZ2Fu
  169. S: + OTUgUWE1ODMwOA==
  170. C: Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
  171. S: A001 OK S/Key authentication successful
  172. S: * OK IMAP4 Server
  173. C: A001 AUTHENTICATE SKEY
  174. S: +
  175. C: c21pdGg=
  176. S: + OTUgUWE1ODMwOA==
  177. C: BsAY3g4gBNo=
  178. S: A001 NO S/Key authentication failed
  179. 5. References
  180. [IMAP4] Crispin, M., "Internet Message Access Protocol - Version 4",
  181. RFC 1730, University of Washington, December 1994.
  182. [RFC1508] Linn, J., "Generic Security Service Application Program
  183. Interface", RFC 1508, Geer Zolot Associates, September 1993.
  184. [SKEY] Haller, Neil M. "The S/Key One-Time Password System",
  185. Bellcore, Morristown, New Jersey, October 1993,
  186. thumper.bellcore.com:pub/nmh/docs/ISOC.symp.ps
  187. Myers [Page 5]
  188. RFC 1731 IMAP4 Authentication Mechanisms December 1994
  189. 6. Security Considerations
  190. Security issues are discussed throughout this memo.
  191. 7. Author's Address
  192. John G. Myers
  193. Carnegie-Mellon University
  194. 5000 Forbes Ave.
  195. Pittsburgh PA, 15213-3890
  196. EMail: jgm+@cmu.edu
  197. Myers [Page 6]