Add.
[gsasl.git] / doc / specification / draft-ietf-sasl-plain-01.txt
blob1c4c10e3b410c496b6ddb43ab064d03f22b923cf
7 INTERNET-DRAFT                           Editor: Kurt D. Zeilenga
8 Intended Category: Standards Track            OpenLDAP Foundation
9 Expires in six months                                  4 May 2003
10 Updates: RFC 2595
13                          The Plain SASL Mechanism
14                       <draft-ietf-sasl-plain-01.txt>
17 Status of Memo
19   This document is an Internet-Draft and is in full conformance with all
20   provisions of Section 10 of RFC2026.
22   This document is intended to be, after appropriate review and
23   revision, submitted to the RFC Editor as a Standards Track document.
24   Distribution of this memo is unlimited.  Technical discussion of this
25   document will take place on the IETF SASL mailing list
26   <ietf-sasl@imc.org>.  Please send editorial comments directly to the
27   document editor <Kurt@OpenLDAP.org>.
29   Internet-Drafts are working documents of the Internet Engineering Task
30   Force (IETF), its areas, and its working groups.  Note that other
31   groups may also distribute working documents as Internet-Drafts.
32   Internet-Drafts are draft documents valid for a maximum of six months
33   and may be updated, replaced, or obsoleted by other documents at any
34   time.  It is inappropriate to use Internet-Drafts as reference
35   material or to cite them other than as ``work in progress.''
37   The list of current Internet-Drafts can be accessed at
38   <http://www.ietf.org/ietf/1id-abstracts.txt>. The list of
39   Internet-Draft Shadow Directories can be accessed at
40   <http://www.ietf.org/shadow.html>.
42   Copyright 2003, The Internet Society.  All Rights Reserved.
44   Please see the Copyright section near the end of this document for
45   more information.
48 Abstract
50   This document defines a simple clear-text user/password Simple
51   Authentication and Security Layer (SASL) mechanism called the PLAIN
52   mechanism.  The PLAIN mechanism intended to be used, in combination
53   with data confidentiality services provided by a lower layer, in
54   protocols which lack a simple password authentication command.
58 Zeilenga                  Plain SASL Mechanism                  [Page 1]
60 INTERNET-DRAFT        draft-ietf-sasl-plain-01.txt            4 May 2003
63 Conventions
65   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
66   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
67   document are to be interpreted as described in [Keywords].
70 1. Background and Intended Usage
72   Clear-text passwords are simple, interoperate with almost all existing
73   operating system authentication databases, and are useful for a smooth
74   transition to a more secure password-based authentication mechanism.
75   The drawback is that they are unacceptable for use over an unencrypted
76   network connection.
78   This document defines the PLAIN Simple Authentication and Security
79   Layer ([SASL]) mechanism for use in protocols with no clear-text login
80   command (e.g., [ACAP]).
82   The name associated with this mechanism is "PLAIN".
84   The PLAIN SASL mechanism does not provide a security layer.  This
85   mechanism MUST NOT be used without adequate security protection as the
86   mechanism affords no integrity nor confidentiality protection itself.
87   The PLAIN SASL mechanism MUST NOT be advertised unless a strong
88   encryption layer, such as provided by Transport Layer Security
89   ([TLS]), is active.
91   This document updates RFC 2595, replacing Section 6.  Changes since
92   RFC 2595 are detailed in Appendix A.
95 2. PLAIN SASL mechanism
97   The mechanism consists of a single message from the client to the
98   server.  The client sends the authorization identity (identity to
99   login as), followed by a NUL character, followed by the authentication
100   identity (identity whose password will be used), followed by a NUL
101   character, followed by the clear-text password.   The client leaves
102   the authorization identity empty if wishes the server to derive the
103   authorization identity from the provided authentication identity.
105   The formal grammar for the client message using Augmented BNF [ABNF]
106   follows.
108       message   = [authzid] NUL authcid NUL passwd
109       authcid   = 1*SAFE ; MUST accept up to 255 octets
110       authzid   = 1*SAFE ; MUST accept up to 255 octets
114 Zeilenga                  Plain SASL Mechanism                  [Page 2]
116 INTERNET-DRAFT        draft-ietf-sasl-plain-01.txt            4 May 2003
119       passwd    = 1*SAFE ; MUST accept up to 255 octets
120       NUL       = %x00
122       SAFE      = UTF1 / UTF2 / UTF3 / UTF4
123                   ;; any UTF-8 encoded Unicode character except NUL
125       UTF1      = %x01-7F ;; except NULL
126       UTF2      = %xC2-DF UTF0
127       UTF3      = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
128                   %xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
129       UTF4      = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
130                   %xF4 %x80-8F 2(UTF0)
131       UTF0      = %x80-BF
133   The authorization identity (authzid), authentication identity
134   (authcid) and password (passwd) SHALL be transferred as [UTF-8]
135   encoded strings of [Unicode] characters.  As NUL (U+0000) is used as a
136   deliminator, the NUL (U+0000) MUST NOT appear in authzid, authcid, or
137   passwd productions.
139   The form of the authzid production is specific to the
140   application-level protocol's SASL profile [SASL].  The authcid and
141   passwd productions are form-free.  Use of non-visible characters or
142   characters which a user may be unable to enter on some keyboards is
143   discouraged.
145   Servers MUST be capable of accepting authzid, authcid, and passwd
146   productions up to and including 255 octets.  It is noted that the
147   UTF-8 encoding of a Unicode character may be as long as 6 octets.
149   Upon receipt of the message, the server will verify presented
150   authentication identity (authcid) and password (passwd) with the
151   system authentication database and that the authentication credentials
152   permit the client to login as the (presented or derived) authorization
153   identity.  If both steps succeed, the user is authenticated.
155   The presented authentication identity and password strings are not be
156   compared directly with stored strings.  The server SHALL first prepare
157   authentication identity strings and password strings using the
158   [SASLPrep] profile of the [StringPrep] algorithm.  If preparation
159   fails or results in an empty string, verification SHALL fail.  If the
160   server stores only the hash of expected string, that string MUST be
161   prepared before generation of the hash.
163   The verification function (using hashed password) can be written (in
164   psuedo-code):
166       boolean Verify(string authzid, string authcid, string passwd) {
170 Zeilenga                  Plain SASL Mechanism                  [Page 3]
172 INTERNET-DRAFT        draft-ietf-sasl-plain-01.txt            4 May 2003
175         string pAuthcid = SASLprep(authcid); # prepare authcid
176         string pPasswd = SASLprep(passwd);   # prepare passwd
177         if (pAuthcid == NULL || pPasswd == NULL) {
178           return false;     # preparation failed
179         }
180         if (pAuthcid == "" || pPasswd == "") {
181           return false;     # empty prepared string
182         }
184         storedHash = FetchPasswordHash(pAuthcid);
185         if (storedHash == NULL || storedHash == "") {
186           return false;     # error or unknown authcid
187         }
189         if (!Compare(storedHash, Hash(pPassword))) {
190           return false;     # incorrect password
191         }
193         if (authzid == "") {
194           authzid = DeriveAuthzid(pAuthcid);
195           if (authzid == NULL || authzid == "") {
196               return false; # could not derive authzid
197           }
198         }
200         if (!Authorize(pAuthcid, authzid)) {
201           return false;     # not authorized
202         }
204         return true;
205       }
207   Note that the parameters provided to the Authorize function are not
208   prepared.  The application-level SASL profile should be consulted to
209   determine what, if any, preparation is necessary.
211   The server MAY also use the password to initialize any new
212   authentication database, such as one suitable for [CRAM-MD5] or
213   [DIGEST-MD5].
216 4. Example
218   Here is an example of how this might be used to initialize a CRAM-MD5
219   authentication database using the Application Configuration Access
220   Protocol ([ACAP]).  "C:" and "S:" indicate lines sent by the client
221   and server respectively and <NUL> represents a single NUL (U+0000)
222   character.
226 Zeilenga                  Plain SASL Mechanism                  [Page 4]
228 INTERNET-DRAFT        draft-ietf-sasl-plain-01.txt            4 May 2003
231       S: * ACAP (SASL "CRAM-MD5") (STARTTLS)
232       C: a001 AUTHENTICATE "CRAM-MD5"
233       S: + "<1896.697170952@postoffice.reston.mci.net>"
234       C: "tim b913a602c7eda7a495b4e6e7334d3890"
235       S: a001 NO (TRANSITION-NEEDED)
236          "Please change your password, or use TLS to login"
237       C: a002 STARTTLS
238       S: a002 OK "Begin TLS negotiation now"
239       <TLS negotiation, further commands are under TLS layer>
240       S: * ACAP (SASL "CRAM-MD5" "PLAIN" "EXTERNAL")
241       C: a003 AUTHENTICATE "PLAIN" {21+}
242       C: <NUL>tim<NUL>tanstaaftanstaaf
243       S: a003 OK CRAM-MD5 password initialized
247 5. Security Considerations
249   The PLAIN mechanism relies on the TLS encryption layer for security.
250   When used without TLS, it is vulnerable to a common network
251   eavesdropping attack.  Therefore PLAIN MUST NOT be advertised or used
252   unless a suitable TLS encryption layer is active or backwards
253   compatibility dictates otherwise.
255   When the PLAIN mechanism is used, the server gains the ability to
256   impersonate the user to all services with the same password regardless
257   of any encryption provided by TLS or other network privacy mechanisms.
258   While many other authentication mechanisms have similar weaknesses,
259   stronger SASL mechanisms such as the Kerberos-based GSSAPI mechanism
260   address this issue.  Clients are encouraged to have an operational
261   mode where all mechanisms which are likely to reveal the user's
262   password to the server are disabled.  It is RECOMMENDED that this mode
263   be the default.
265   General SASL security considerations apply to this mechanism.
266   "stringprep" and Unicode security considerations also apply.
269 6. IANA Considerations
271   It is requested that the SASL Mechanism registry [IANA-SASL] entry for
272   the PLAIN mechanism be updated to reflect that this document now
273   provides its technical specification.
275       To: iana@iana.org
276       Subject: Updated Registration of SASL mechanism PLAIN
278       SASL mechanism name: PLAIN
282 Zeilenga                  Plain SASL Mechanism                  [Page 5]
284 INTERNET-DRAFT        draft-ietf-sasl-plain-01.txt            4 May 2003
287       Security considerations: See RFC XXXX.
288       Published specification (optional, recommended): RFC XXXX
289       Person & email address to contact for further information:
290           Kurt Zeilenga <kurt@openldap.org>
291           Chris Neuman <chris.newman@innosoft.com>
292       Intended usage: COMMON
293       Author/Change controller: IESG <iesg@ietf.org>
294       Note: Updates existing entry for PLAIN
297 7. Acknowledgement
299   This document is a revision of RFC 2595 by Chris Newman.  Portions of
300   the grammar defined in Section 2 were borrowed from [UTF-8] by
301   Francois Yergeau.
304 8. Normative References
306   [ABNF]       D. Crocker, P. Overell, "Augmented BNF for Syntax
307                Specifications: ABNF", RFC 2234, November 1997.
309   [Keywords]   S. Bradner, "Key words for use in RFCs to Indicate
310                Requirement Levels", BCP 14 (also RFC 2119), March 1997.
312   [SASL]       J. Myers, "Simple Authentication and Security Layer
313                (SASL)", RFC 2222bis (a work in progress).
315   [SASLPrep]   K. Zeilenga, "SASL String Preparation Profiles", draft-
316                ietf-sasl-saslprep (a work in progress).
318   [Stringprep] P. Hoffman, M. Blanchet, "Preparation of
319                Internationalized Strings ("stringprep")", RFC 3454,
320                December 2002.
322   [Unicode]    The Unicode Consortium, "The Unicode Standard, Version
323                3.2.0", defined by: The Unicode Standard, Version 3.0
324                (Reading, MA, Addison-Wesley, 2000.  ISBN 0-201-61633-5),
325                as amended by the Unicode Standard Annex #28: Unicode 3.2
326                (http://www.unicode.org/reports/tr28/tr28-3.html).
328   [UTF-8]      F. Yergeau, "UTF-8, a transformation format of ISO
329                10646", RFC 2279, January 1998.
331   [TLS]        T. Dierks, C. Allen, "The TLS Protocol Version 1.0", RFC
332                2246, January 1999.
338 Zeilenga                  Plain SASL Mechanism                  [Page 6]
340 INTERNET-DRAFT        draft-ietf-sasl-plain-01.txt            4 May 2003
343 9. Informative References
345   [ACAP]       C. Newman, and J. Myers, "ACAP -- Application
346                Configuration Access Protocol", RFC 2244, November 1997.
348   [CRAM-MD5]   J. Klensin, R. Catoe, and P. Krumviede, "IMAP/POP
349                AUTHorize Extension for Simple Challenge/Response", RFC
350                2195, September 1997.
352   [DIGEST-MD5] P. Leach, C. Newman, "Using Digest Authentication as a
353                SASL Mechanism", RFC 2831, May 2000.
355   [IANA-SASL]  IANA, "SIMPLE AUTHENTICATION AND SECURITY LAYER (SASL)
356                MECHANISMS", http://www.iana.org/assignments/sasl-
357                mechanisms.
360 10. Editor's Address
362   Kurt Zeilenga
363   OpenLDAP Foundation
365   Email: kurt@OpenLDAP.org
368 Appendix A.  Changes since RFC 2595
370   This appendix is non-normative.
372   This document replaces Section 6 of RFC 2595.
374   The specification details how the server is to compare client-provided
375   character strings with stored character strings.
377   The ABNF grammar was updated.  In particular, the grammar now allows
378   LINE FEED (U+000A) and CARRIAGE RETURN (U+000D) characters in the
379   authzid, authcid, passwd productions.   However, whether these control
380   characters may be used depends on the string preparation rules
381   applicable to the production.   For passwd and authcid productions,
382   control characters are prohibited.  For authzid, one must consult the
383   application-level SASL profile.
386 Full Copyright Statement
388   Copyright 2003, The Internet Society.  All Rights Reserved.
390   This document and translations of it may be copied and furnished to
394 Zeilenga                  Plain SASL Mechanism                  [Page 7]
396 INTERNET-DRAFT        draft-ietf-sasl-plain-01.txt            4 May 2003
399   others, and derivative works that comment on or otherwise explain it
400   or assist in its implementation may be prepared, copied, published and
401   distributed, in whole or in part, without restriction of any kind,
402   provided that the above copyright notice and this paragraph are
403   included on all such copies and derivative works.  However, this
404   document itself may not be modified in any way, such as by removing
405   the copyright notice or references to the Internet Society or other
406   Internet organizations, except as needed for the  purpose of
407   developing Internet standards in which case the procedures for
408   copyrights defined in the Internet Standards process must be followed,
409   or as required to translate it into languages other than English.
411   The limited permissions granted above are perpetual and will not be
412   revoked by the Internet Society or its successors or assigns.
414   This document and the information contained herein is provided on an
415   "AS IS" basis and THE AUTHORS, THE INTERNET SOCIETY, AND THE INTERNET
416   ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
417   INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
418   INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
419   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
450 Zeilenga                  Plain SASL Mechanism                  [Page 8]