Network Working Group Robert Siemborski INTERNET-DRAFT Google, Inc. Intended Category: Proposed Standard February, 2005 Obsoletes: RFC 1734 Updates: RFC 2449 POP3 SASL Authentication Mechanism Status of this Memo By submitting this Internet-Draft, I certify that any applicable patent or other IPR claims of which I am aware have been disclosed, and any of which I become aware will be disclosed, in accordance with RFC 3668. Internet Drafts are working documents of the Internet Engineering Task Force (IETF), its Areas, and its Working Groups. Note that other groups may also distribute working documents as Internet Drafts. Internet Drafts are draft documents valid for a maximum of six months. Internet Drafts may be updated, replaced, or obsoleted by other documents at any time. It is not appropriate to use Internet Drafts as reference material or to cite them other than as ``work in progress''. The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. A revised version of this draft document will be submitted to the RFC editor as a Standards Track RFC for the Internet Community. Discussion and suggestions for improvement are requested. Distribution of this draft is unlimited. When published as an RFC this document will obsolete RFC 1734 and update RFC 2449. Siemborski Expires August, 2005 [Page 1] POP3 SASL Authentication Mechanism February, 2005 Abstract This document defines a profile of the Simple Authentication and Security Layer (SASL) for the Post Office Protocol (POP3). This extension allows a POP3 client to indicate an authentication mechanism to the server, perform an authentication protocol exchange, and optionally negotiate a security layer for subsequent protocol interactions during this session. This document seeks to consolidate the information related to POP3 AUTH into a single document. To this end, this document obsoletes RFC 1734, replacing it as a Proposed Standard and updates information contained in Section 6.3 of RFC 2449. Siemborski Expires August, 2005 [Page 2] POP3 SASL Authentication Mechanism February, 2005 Table of Contents 1. How to Read This Document . . . . . . . . . . . . . . . . . . . . 4 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. The SASL Capability . . . . . . . . . . . . . . . . . . . . . . . 4 4. The AUTH Command . . . . . . . . . . . . . . . . . . . . . . . . 5 4.1. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5. Protocol Actions . . . . . . . . . . . . . . . . . . . . . . . . 11 6. Intellectual Property Rights . . . . . . . . . . . . . . . . . . 11 7. Copyright . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 9. Changes From RFC 1734, RFC 2449. . . . . . . . . . . . . . . . . 14 10. Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 14 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 14 Siemborski Expires August, 2005 [Page 3] POP3 SASL Authentication Mechanism February, 2005 1. How to Read This Document The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "RECOMMENDED", and "MAY" in this document are to be interpreted as defined in "Key words for use in RFCs to Indicate Requirement Levels" [KEYWORDS] In examples, "C:" and "S:" indicate lines sent by the client and server respectively. 2. Introduction The [POP3] AUTH command [POP3-AUTH] has suffered several problems in its specification. The first is that it was very similar to a [SASL] framework, but pre-dated the initial SASL specification. It was therefore missing some key components, such as a way to list the available authentication mechanisms. Later, [POP3-EXT] attempted to remedy this situation by adding the CAPA command and allowing an initial client response to the AUTH command, however problems in the clarity of the specification of how the initial client response was to be handled remained. Additionally, there is yet another document, [POP3-CODES], that provides additional response codes that are useful during authentication. Together, this means creating a full POP3 AUTH implementaiton requires an understanding of material in at least five (and probably six) different documents. This document attempts to combine the information in [POP3-AUTH] and [POP3-EXT] to simplify this situation. Additionally, it aims to clarify and update the older specifications where appropriate. 3. The SASL Capability This section supercedes the definition of the SASL Capability in section 6.3 of [POP3-EXT]. CAPA tag: SASL Arguments: Supported SASL Mechanisms Added commands: AUTH Standard Commands Affected Siemborski Expires August, 2005 [Page 4] POP3 SASL Authentication Mechanism February, 2005 None Announced states / possible differences: both / no Commands valid in states: AUTHORIZATION Specification Reference: This Document, [SASL] Discussion The SASL capability permits the use of the AUTH command (as defined in section 4 of this document) to begin a [SASL] negotiation. The argument to the SASL capability is a space- separated list of SASL mechanisms which are supported. If a server either does not support the CAPA command or does not advertise the SASL capability, clients SHOULD NOT attempt the AUTH command. If a client does attempt the AUTH command in such a situation, it MUST NOT supply the client initial response parameter (for backwards compatibility with [POP3-AUTH]). Note that the list of available mechanisms MAY change after a successful STLS command [POP3-TLS]. However, as required by [POP3-EXT] implementations MUST continue to include the SASL capability even after a successful AUTH command has been completed (even though no further AUTH commands may be issued). Example S: +OK pop.example.com BlurdyBlurp POP3 server ready C: CAPA S: +OK List of capabilities follows S: SASL KERBEROS_V4 GSSAPI ANONYMOUS S: STLS S: IMPLEMENTATION BlurdyBlurp POP3 server S: . 4. The AUTH Command AUTH mechanism [initial-response] Arguments: mechanism: A string identifying a [SASL] authentication mechanism. Siemborski Expires August, 2005 [Page 5] POP3 SASL Authentication Mechanism February, 2005 initial-response: An optional initial client response. If present, this response MUST be encoded as specified in Section 3 of [BASE64]. Restrictions: After an AUTH command has been successfully completed, no more AUTH commands may be issued in the same session. After a successful AUTH command completes, a server MUST reject any further AUTH commands with an -ERR reply. The AUTH command may only be given during the AUTHORIZATION state. Discussion: The AUTH command initiates a [SASL] authentication exchange between the client and the server. The client identifies the SASL mechanism to use with the first parameter of the AUTH command. If the server supports the requested authentication mechanism, it performs the SASL exchange to authenticate the user. Optionally, it also negotiates a security layer for subsequent protocol interactions during this session. If the requested authentication mechanism is not supported, the server rejects the AUTH command with an -ERR reply. The authentication protocol exchange consists of a series of server challenges and client responses that are specific to the chosen [SASL] mechanism. A server challenge is sent as a line consisting of a "+" character followed by a single space and a string encoded as specified in Section 3 of [BASE64]. This line MUST NOT contain any text other than the BASE64 encoded challenge. A client response consists of a line containing a string encoded as defined in Section 3 of [BASE64]. If the client wishes to cancel the authentication exchange, it issues a line with a single "*". If the server receives such a response, it MUST reject the AUTH command by sending an -ERR reply. The optional initial response argument to the AUTH command is used to save a round trip when using authentication mechanisms that support an initial client response. If the initial response argument is omitted and the chosen mechanism requires an initial client response, the server MUST proceed as defined in section 5.1 of [SASL]. In POP3, a server challenge with no data is defined as line with only a "+" followed by a single space. It MUST NOT contain any other data. Siemborski Expires August, 2005 [Page 6] POP3 SASL Authentication Mechanism February, 2005 For the purposes of the initial client response, the line length limitation defined in [POP3-EXT] still applies. If a client initial send would cause the AUTH command to exceed this length, the client MUST NOT use the initial response parameter (and instead proceed as defined in section 5.1 of [SASL]). If the client needs to send a zero-length initial response, the client MUST transmit the response as a single equals sign ("="). This indicates that the response is present, but contains no data. If the client uses an initial-response argument to the AUTH command with a SASL mechanism that does not support an initial client send, the server MUST reject the AUTH command with an -ERR reply. If the server cannot [BASE64] decode a client response, it MUST reject the AUTH command with an -ERR reply. If the client cannot BASE64 decode a server challenge, it MUST cancel the authentication using the "*" response. In particular, servers and clients MUST reject (and not ignore) any character not explicitly allowed by the BASE64 alphabet, and MUST reject any sequence of BASE64 characters that contains the pad character ('=') anywhere other than the end of the string (e.g. "=AAA" and "AAA=BBB" are not allowed). Note that these [BASE64] strings (excepting the initial client response) may be of arbitrarily length. Clients and servers MUST be able to handle the maximum encoded size of challenges and responses generated by their supported authentication mechanisms. This requirement is independent of any line length limitations the client or server may have in other parts of its protocol implementation. If the server is unable to authenticate the client, it MUST reject the AUTH command with an -ERR reply. Should the client successfully complete the exchange, the server issues a +OK reply. Additionally, upon success, the POP3 session enters the TRANSACTION state. The authorization identity generated by the [SASL] exchange is a simple username, and MUST use the [SASLprep] profile of the [StringPrep] algorithm to prepare these names for matching. If preparation of the authorization identity fails or results in an empty string (unless it was transmitted as the empty string), the server MUST fail the authentication. Siemborski Expires August, 2005 [Page 7] POP3 SASL Authentication Mechanism February, 2005 If a security layer is negotiated during the SASL exchange, it takes effect for the client on the octet immediately following the CRLF that concludes the last response generated by the client. For the server, it takes effect immediately following the CRLF of its success reply. When a security layer takes effect, the server MUST discard any knowledge previously obtained from the client, which was not obtained from the SASL negotiation itself. Likewise, the client MUST discard any knowledge obtained from the server, such as the list of available POP3 service extensions. When both [TLS] and SASL security layers are in effect, the TLS encoding MUST be applied after the SASL encoding, regardless of the order in which the layers were negotiated. The service name specified by this protocol's profile of SASL is "pop". If an AUTH command fails, the client may try another authentication mechanism or present different credentials by issuing another AUTH command (or by using one of the other [POP3] authentication mechanisms). Likewise, the server MUST behave as if the client had not issued the AUTH command. To ensure interoperability, client and server implementations of this extension MUST implement the [DIGEST-MD5] SASL mechanism. 4.1. Formal Syntax The following syntax specification uses the Augmented Backus-Naur Form notation as specified in [ABNF]. Except as noted otherwise, all alphabetic characters are case- insensitive. The use of upper or lower case characters to define token strings is for editorial clarity only. Implementations MUST accept these strings in a case-insensitive fashion. UPALPHA = %x41-5A ;; Uppercase: A-Z LOALPHA = %x61-7A ;; Lowercase: a-z ALPHA = UPALPHA / LOALPHA ;; case insensitive DIGIT = %x30-39 ;; Digits 0-9 Siemborski Expires August, 2005 [Page 8] POP3 SASL Authentication Mechanism February, 2005 AUTH_CHAR = ALPHA / DIGIT / "-" / "_" auth_type = 1*20AUTH_CHAR auth_command = "AUTH" SPACE auth_type [SPACE (base64 / "=")] *(CRLF [base64]) CRLF auth_resp = ("*" / base64) CRLF base64 = base64_terminal / ( 1*(4base64_CHAR) [base64_terminal] ) base64_char = UPALPHA / LOALPHA / DIGIT / "+" / "/" ;; Case-sensitive base64_terminal = (2base64_char "==") / (3base64_char "=") continue_req = "+" SPACE [base64] CRLF CR = %x0C ;; ASCII CR, carriage return CRLF = CR LF LF = %x0A ;; ASCII LF, line feed SPACE = %x20 ;; ASCII SP, space Additionally, the ABNF specified in [POP3-EXT] is updated as follows: response = greeting / single-line / capa-resp / multi-line / continue_req 4.2. Examples Here is an example of a client attempting AUTH PLAIN under TLS and making use of the initial client response: Siemborski Expires August, 2005 [Page 9] POP3 SASL Authentication Mechanism February, 2005 S: +OK pop.example.com BlurdyBlurp POP3 server ready C: CAPA S: +OK List of capabilities follows S: SASL KERBEROS_V4 GSSAPI ANONYMOUS S: STLS S: IMPLEMENTATION BlurdyBlurp POP3 server S: . C: STLS S: +OK Begin TLS negotiation now ... TLS negotiation proceeds, further commands protected by TLS layer ... C: CAPA S: +OK List of capabilities follows S: SASL PLAIN KERBEROS_V4 GSSAPI ANONYMOUS S: IMPLEMENTATION BlurdyBlurp POP3 server S: . C: AUTH PLAIN dGVzdAB0ZXN0AHRlc3Q= S: +OK Maildrop locked and ready Here is another client that is attempting AUTH PLAIN under a TLS layer, this time without the initial response. Parts of the negotiation before the TLS layer was established have been omitted: ... TLS negotiation proceeds, further commands protected by TLS layer ... C: CAPA S: +OK List of capabilities follows S: SASL PLAIN KERBEROS_V4 GSSAPI ANONYMOUS S: IMPLEMENTATION BlurdyBlurp POP3 server S: . C: AUTH PLAIN (note that there is a space following the '+' on the following line) S: + C: dGVzdAB0ZXN0AHRlc3Q= S: +OK Maildrop locked and ready Here is an example using a mechanism which does not support an initial client send, and includes server challenges: Siemborski Expires August, 2005 [Page 10] POP3 SASL Authentication Mechanism February, 2005 S: +OK pop.example.com BlurdyBlurp POP3 server ready C: CAPA S: +OK List of capabilities follows S: SASL KERBEROS_V4 GSSAPI ANONYMOUS S: STLS S: IMPLEMENTATION BlurdyBlurp POP3 server S: . C: AUTH KERBEROS_V4 S: + ezLUFA== (the following lines are broken for editorial clarity only) C: BAYFQU5EUkVXLkNNVS5FRFUAOCCXeMiVyFe9K6Nwne7+sPLgIoF9YQ5ePfxUsMlJAf C7aoNySU8nrqS9m8JAddsUeuyc5HFXXovaKLrZNo2bTLH0Lyolwy0W9ryJDojbKmHy zSMqFsGD4EL0 S: + Z74fTwDw7KQ= C: vSAF7ha6qotK2UHUgKlsEA== S: +OK Maildrop locked and ready ... at this point a security layer has been established and additional commands and responses proceed within it ... 5. Protocol Actions [RFC Editor: Remove this section before publication] This document obsoletes RFC 1734 and replaces it as a Proposed Standard. By moving RFC 1734 to Historic, RFC 1731 can also be moved to Historic (as RFC 1734 was the last document to have a normative reference). It also updates information contained in Section 6.3 of RFC 2449. 6. Intellectual Property Rights The IETF takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on the IETF's procedures with respect to rights in standards-track and standards-related documentation can be found in BCP-11. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementors or users of this specification can be obtained from the IETF Secretariat. The IETF invites any interested party to bring to its attention any Siemborski Expires August, 2005 [Page 11] POP3 SASL Authentication Mechanism February, 2005 copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to practice this standard. Please address the information to the IETF Executive Director. 7. Copyright Copyright (C) The Internet Society (2005). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights." "This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Siemborski Expires August, 2005 [Page 12] POP3 SASL Authentication Mechanism February, 2005 8. References The following documents contain normative definitions or specifications that are necessary for correct understanding of this protocol: [BASE64] Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 3548, July 2003. [DIGEST-MD5] Leach, P., Melnikov, A., and Newman C., "Using Digest Authentication as a SASL Mechanism", draft-ietf-sasl- rfc2831bis-*.txt, a work in progress. [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997 [POP3] Myers, J. and Rose, M., "Post Office Protocol - Version 3", STD 53, RFC 1939, May 1996. [POP3-EXT] Gellens, R., Newman, C., and Lundblade, L., "POP3 Extension Mechanism", RFC 2449, November 1998. [POP3-TLS] Newman, C., "Using TLS with IMAP, POP3, and ACAP", RFC 2595, June 1999. [SASL] Melnikov, A., "Simple Authentication and Security Layer (SASL)", draft-ietf-sasl-rfc2222bis-*.txt, a work in progress. [SASLprep] Zeilega, K., "SASLprep: Stringprep profile for user names and passwords", draft-ietf-sasl-saslprep-*.txt, a work in progress [StringPrep] Hoffman, P. and Blanchet, M., "Preparation of Internationalized Strings ("stringprep")", draft-hoffman- rfc3454bis-*.txt, a work in progress The following references are for informational purposes only: [PLAIN] Zeilenga, K., "The Plain SASL Mechanism", draft-ietf-sasl- plain-*.txt, a work in progress. [POP3-AUTH] Myers, J., "POP3 AUTHentication Command", RFC 1734, January 1994. [POP3-CODES] Siemborski Expires August, 2005 [Page 13] POP3 SASL Authentication Mechanism February, 2005 Gellens, R., "The SYS and AUTH POP Response Codes", RFC 3206, February 2002. [TLS] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", RFC 2246, January 1999. 9. Changes From RFC 1734, RFC 2449. 1. The SASL-based semantics defined in RFC 2449 are now normative for the AUTH extension. 2. Clarifications and examples of the proper behavior of initial client response handling. 3. Minimum requirement of support for DIGEST-MD5. 4. Clarify ordering of TLS and SASL security layers. 5. Update references to newer versions of various specifications. 6. Clarify that the mechanism list can change. 7. Add the use of the SASLprep profile for preparing authorization identities. 8. General other editorial clarifications. 9. Consolidation of much applicable information into a single document. 10. Author's Address: Robert Siemborski Google, Inc. 1600 Ampitheatre Parkway Mountain View, CA 94043 +1 650 623 6925 robsiemb@google.com 11. Acknowledgments: The author would like to acknowledge the contributions of John Myers, Randall Gellens, Chris Newman, Laurence Lundblade, and other contributors to RFC 1734 and RFC 2554, on which this document draws heavily. The author would also like to thank Ken Murchison, Randall Gellens, Siemborski Expires August, 2005 [Page 14] POP3 SASL Authentication Mechanism February, 2005 Alexey Melnikov, and Mark Crispin for the time they devoted to reviewing early drafts of this document. Siemborski Expires August, 2005 [Page 15]