Network Working Group                                       J. Hutzelman
Internet-Draft                                                       CMU
Expires: July 14, August 31, 2001                                      J. Salowey
                                                           Cisco Systems
                                                        January 13,
                                                           March 2, 2001

      Using GSSAPI authentication for key exchange in Secure Shell
                      draft-ietf-secsh-gsskeyex-00
                      draft-ietf-secsh-gsskeyex-01

Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   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 and may be updated, replaced, or obsoleted by other documents
   at any time. It is inappropriate 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.

   This Internet-Draft will expire on July 14, August 31, 2001.

Copyright Notice

   Copyright (C) The Internet Society (2001). All Rights Reserved.

Abstract

   This memo describes a method for using the Generic Security Service
   Application Program Interface [2] for key exchange in the Secure
   Shell protocol, by defining a class of SSH key exchange methods
   which use GSSAPI to authenticate the Diffie-Hellman exchange
   described in [10].

   This memo also defines a new host public key algorithm which can be
   used when no operations are needed using a host's public key, and a
   new user authentication method which allows an authorization name to
   be used in conjunction with any authentication which has already
   occurred as a side-effect of key exchange.

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [7].

1. GSSAPI Authenticated Diffie-Hellman Key Exchange

   This section defines a class of key exchange methods which combine
   the Diffie-Hellman key exchange from section 6 of [10] with mutual
   authentication using GSSAPI.

   Since the GSSAPI key exchange methods described in this section do
   not require the use of public key signature or encryption
   algorithms, they MAY be used with any host hey key algorithm, including
   the "null" algorithm described in section 2 of this document.

1.1 Generic method description

   The following symbols are used in this description:

   o  C is the client, and S is the server

   o  p is a large safe prime, g is a generator for a subgroup of
      GF(p), and q is the order of the subgroup

   o  V_S is S's version string, and V_C is C's version string

   o  I_C is C's KEXINIT message, and I_S is S's KEXINIT message

   1.  C generates a random number x (1 < x < q) and computes e = g^x
       mod p.

   2.  C calls GSS_Init_sec_context, using the most recent reply token
       received from S during this exchange, if any.  For this call,
       the client MUST set the mutual_req_flag to "true" to request
       that mutual authentication be performed.  It also MUST set the
       integ_req_flag to "true" to request that per-message integrity
       protection be supported for this context.  In addition, the
       deleg_req_flag MAY be set to "true" to request access
       delegation, if requested by the user. Since the key exchange
       process authenticates only the host, the setting of the
       anon_req_flag is immaterial to this process.  If the client or
       server does
       not support the "external-keyx" user authentication method
       described in section 3 of this document, or if the client does not intend to
       use that method, then the anon_req_flag SHOULD be set to "true".
       Otherwise, this flag MAY be set to true if the client wishes to
       hide its identity.

       *  If the resulting major_status code is GSS_S_COMPLETE and the
          mutual_state flag is not true, then mutual authentication has
          not been established, and the key exchange MUST fail.

       *  If the resulting major_status code is GSS_S_COMPLETE and the
          integ_avail flag is not true, then per-message integrity
          protection is not available, and the key exchange MUST fail.

       *  If the resulting major_status code is GSS_S_COMPLETE and the
          mutual_state flag is true, the resulting output token is sent
          to S along with "e". S.

       *  If the resulting major_status code is GSS_S_CONTINUE_NEEDED,
          the the output_token (only) is sent to S, which will reply with a
          new token to be provided to GSS_Init_sec_context.

       *  The client MUST also include "e" with exactly one of the messages first message it
          sends to the server during this process; if the server
          receives more than one "e" or none at all, the key exchange
          fails.  The client SHOULD wait until the last message (that
          is, the one containing the token returned by
          GSS_Init_sec_context at the same time it returned
          GSS_S_COMPLETE) to send "e", so that it is not sent if there

       *  It is an error in if the course call does not produce a token of setting up
          non-zero length to be sent to the GSSAPI security
          context. server.  In this case, the
          key exchange MUST fail.

   3.  S calls GSS_Accept_sec_context, using the token received from C.

       *  If the resulting major_status code is GSS_S_COMPLETE and the
          mutual_state flag is not true, then mutual authentication has
          not been established, and the key exchange MUST fail.

       *  If the resulting major_status code is GSS_S_COMPLETE and the
          mutual_state flag is true, then the security context has been
          established, and processing continues with step 4.

       *  If the resulting major_status code is GSS_S_CONTINUE_NEEDED,
          then the output token is sent to C, and processing continues
          with step 2.

       *  If the resulting major_status code is GSS_S_COMPLETE, but a
          non-zero-length reply token is returned, then that token is
          sent to the client.

   4.  S generates a random number y (0 < y < q) and computes f = g^y
       mod p.  It computes K = e ^ y mod p, and H = hash(V_C || V_S ||
       I_C || I_S || e || f || K).  It then calls GSS_GetMIC to obtain
       a GSSAPI message integrity code for H.  S then sends f and the
       MIC to C.

   5.  This step is performed only if the server's final call to
       GSS_Accept_sec_context produced a non-zero-length final reply
       token to be sent to the client _and_ no previous call by the
       client to GSS_Init_sec_context has resulted in a major_status of
       GSS_S_COMPLETE.  Under these conditions, the client makes an
       additional call to GSS_Init_sec_context to process the final
       reply token.  This call is made exactly as described above.
       However, if the resulting major_status is anything other than
       GSS_S_COMPLETE, or a non-zero-length token is returned, it is an
       error and the key exchange MUST fail.

   6.  C computes K = f^x mod p, and H = hash(V_C || V_S || I_C || I_S
       || e || f || K).  It then calls GSS_VerifyMIC to verify that the
       MIC sent by S matches H.

   Either side MUST NOT send or accept e or f values that are not in
   the range [1, p-1].  If this condition is violated, the key exchange
   fails.

   If any call to GSS_Init_sec_context or GSS_Accept_sec_context
   returns a major_status other than GSS_S_COMPLETE or
   GSS_S_CONTINUE_NEEDED, or any other GSSAPI call returns a
   major_status other than GSS_S_COMPLETE, the key exchange fails.

   This is implemented with the following messages.  The hash algorithm
   for computing the exchange hash is defined by the method name, and
   is called HASH.  The group used for Diffie-Hellman key exchange and
   the underlying GSSAPI mechanism are also defined by the method name.

   After the client's first call to GSS_Init_sec_context, it sends the
   following:

           byte      SSH_MSG_GSSAPI_INIT
           boolean   TRUE
           string    output_token (from GSS_Init_sec_context)
           mpint     e

   Each time GSS_Init_sec_context the server's call to GSS_Accept_sec_context returns a
   major_status code of GSS_S_CONTINUE_NEEDED, it sends the following
   reply to the client:

           byte      SSH_MSG_GSSAPI_CONTINUE
           string    output_token (from GSS_Accept_sec_context)

   If the client receives this message appears after a call to
   GSS_Init_sec_context has returned a major_status code of
   GSS_S_COMPLETE, a protocol error has occurred and the key exchange
   MUST fail.

   Each time the client receives the message described above, it makes
   another call to GSS_Init_sec_context.  It then sends the following:

           byte      SSH_MSG_GSSAPI_INIT
           boolean   FALSE
           string    output_token (from GSS_Init_sec_context)
   The server responds with and client continue to trade these two messages as long
   as the following:

           byte      SSH_MSG_GSSAPI_CONTINUE
           string    output_token (from GSS_Accept_sec_context) server's calls to GSS_Accept_sec_context result in
   major_status codes of GSS_S_CONTINUE_NEEDED.  When GSS_Init_sec_context returns a call results in
   a major_status code of GSS_S_COMPLETE, it sends one of two final
   messages.

   If the client server's final call to GSS_Accept_sec_contents (resulting in
   a major_status code of GSS_S_COMPLETE) returns a non-zero-length
   token to be sent to the client, it sends the following:

           byte      SSH_MSG_GSSAPI_INIT      SSH_MSG_GSSAPI_COMPLETE
           mpint     f
           string    per_msg_token (MIC of H)
           boolean   TRUE
           string    output_token (from GSS_Init_sec_context)
           mpint     e

   The server responds with GSS_Accept_sec_context)

   If the client receives this message appears after a call to
   GSS_Init_sec_context has returned a major_status code of
   GSS_S_COMPLETE, a protocol error has occurred and the key exchange
   MUST fail.

   If the server's final call to GSS_Accept_sec_contents (resulting in
   a major_status code of GSS_S_COMPLETE) returns a zero-length token
   or no token at all, it sends the following:

           byte      SSH_MSG_GSSAPI_COMPLETE
           mpint     f
           string    per_msg_token (MIC of H)
           boolean   FALSE

   If the client receives this message when no call to
   GSS_Init_sec_context has yet resulted in a major_status code of
   GSS_S_COMPLETE, a protocol error has occurred and the key exchange
   MUST fail.

   The hash H is computed as the HASH hash of the concatenation of the
   following:

           string    V_C, the client's version string (CR and NL excluded)
           string    V_S, the server's version string (CR and NL excluded)
           string    I_C, the payload of the client's SSH_MSG_KEXINIT
           string    I_S, the payload of the server's SSH_MSG_KEXINIT
           mpint     e, exchange value sent by the client
           mpint     f, exchange value sent by the server
           mpint     K, the shared secret

   This value is called the exchange hash, and it is used to
   authenticate the key exchange.  The exchange hash SHOULD be kept
   secret.

   The GSS_GetMIC call MUST be applied over H, not the original data.

1.2 gss-group1-sha1-*

   Each of these methods specifies GSSAPI authenticated Diffie-Hellman
   key exchange as described in section 1.1 of this document, with
   SHA-1 as HASH, and the group defined in section 6.1 of [10].  The
   method name for each method is the concatenation of the string
   "gss-group1-sha1-" with the Base64 encoding of the first ten bytes
   of the MD5 hash [5] of
   the ASN.1 DER encoding [1] of the underlying GSSAPI mechanism's OID.
   Base64 encoding is described in section 6.8 of [6].

   Each and every such key exchange method is implicitly registered by
   this specification.  The IESG is considered to be the owner of all
   such key exchange methods; this does NOT imply that the IESG is
   considered to be the owner of the underlying GSSAPI mechanism.

1.3 Other GSSAPI key exchange methods

   Key exchange method names starting with "gss-" are reserved for key
   exchange methods which conform to this document; in particular, for
   those methods which use the GSSAPI authenticated Diffie-Hellman key
   exchange algorithm described in section 1.1 of this document,
   including any future methods which use different groups and/or hash
   functions.  The intent is that the names for any such future methods
   methods be defined in a similar manner to that used in section 1.2
   of this document.

1.4 SPNEGO

   The use of the Simple and Protected GSS-API Negotiation Mechanism
   [8] in conjunction with the key exchange methods described in this
   document is both unnecessary and undesirable. As a result, key
   exchange mechanisms conforming to this document MUST NOT use SPNEGO
   as the underlying GSSAPI mechanism.

   Since SSH performs its own negotiation of key exchange methods, and
   there exists a separate method name corresponding to every possible
   underlying GSSAPI mechanism, the negotiation capability of SPNEGO
   alone does not provide any added benefit.  In fact, as described
   below, it has the potential to result in the use of a weaker method
   than desired.

   Normally, SPNEGO provides the added benefit of protecting the GSSAPI
   mechanism negotiation.  It does this by having the server compute a
   MIC of the list of mechanisms proposed by the client, and then
   checking that value at the client.  The key exchange methods
   described in this document already perform an equivalent operation;
   namely, they generate a MIC of the SSH exchange hash, which is a
   hash of several items including the lists of key exchange mechanisms
   supported by both sides.  Thus, the extra level of protection
   offered by SPNEGO is unnecessary in this case.

   The use of SPNEGO combined with GSSAPI mechanisms used without
   SPNEGO can lead to interoperability problems.  For example, a client
   which supports key exchange using the Kerberos V5 GSSAPI mechanism
   [4] only underneath SPNEGO will not interoperate with a server which
   supports key exchange only using the Kerberos V5 GSSAPI mechanism
   directly.  As a result, allowing GSSAPI mechanisms to be used both
   with and without SPNEGO is undesirable.

   If a client's policy is to first prefer GSSAPI-based key exchange
   method X, then non-GSSAPI method Y, then GSSAPI-based method Z, and
   if a server supports mechanisms Y and Z but not X, then an attempt
   to use SPNEGO to negotiate a GSSAPI mechanism might result in the
   use of method Z when method Y would have been preferable.  As a
   result, the use of SPNEGO could result in the subversion of the
   negotiation algorithm for key exchange methods as described in
   section 5.1 of [10].

1.5 Naming Conventions

   In order to establish a GSSAPI security context, the SSH client
   needs to determine the appropriate targ_name to use in identifying
   the server when calling GSS_Init_sec_context.  For this purpose, the
   GSSAPI mechanism-independent name form for host-based services is
   used, as described in section 4.1 of [2].

   In particular, the targ_name to pass to GSS_Init_sec_context is
   obtained by calling GSS_Import_name with an input_name_type of
   GSS_C_NT_HOSTBASED_SERVICE, and an input_name_string consisting of
   the string "host@" concatenated with the hostname of the SSH server.

1.6 Channel Bindings

   This document recommends that channel bindings SHOULD NOT be
   specified in the calls during context establishment.  This document
   does not specify any standard data to be used as channel bindings
   and the use of network addresses as channel bindings may break SSH
   in environments where it is most useful.

2. Null Host Key Algorithm

   The "null" host key algorithm has no associated host key material,
   and provides neither signature nor encryption algorithms.  Thus, it
   can be used only with key exchange methods that do not require any
   public-key operations and do not require the use of host public key
   material.  The key exchange methods described in section 1 of this
   document are examples of such methods.

   This algorithm is used when, as a matter of configuration, the host
   does not have or does not wish to use a public key.  For example, it
   can be used when the administrator has decided as a matter of policy
   to require that all key exchanges be authenticated using Kerberos
   [3], and thus the only permitted key exchange method is the
   GSSAPI-authenticated Diffie-Hellman exchange described above, with
   Kerberos V5 as the underlying GSSAPI mechanism.  In such a
   configuration, the server implementation supports the "ssh-dss" key
   algorithm (as required by [10], but could be prohibited by
   configuration from using it.  In this situation, the server needs
   some key exchange algorithm to advertise; the "null" algorithm fills
   this purpose.

   Note that the use of the "null" algorithm in this way means that the
   server will not be able to interoperate with clients which do not
   support this algorithm.  This is not a significant problem, since in
   the configuration described, it will also be unable to interoperate
   with implementations that do not support the GSSAPI-authenticated
   key exchange and Kerberos.

   Any implementation supporting at least one key exchange method which
   conforms to section 1 of this document MUST also support the "null"
   host key algorithm.  Servers MUST NOT advertise the "null" host key
   algorithm unless it is the only algorithm advertised.

3. External Key Exchange user authentication

   This section describes a user authentication method building on the
   framework described in [11].  This method relies upon the key
   exchange to authenticate both the client and the server.  If the key
   exchange did not successfully perform these functions then the
   server MUST always respond to this request with
   SSH_MSG_USERAUTH_FAILURE with partial success set to false.

   The new mechanism is defined as follows:

         byte SSH_MSG_USERAUTH_REQUEST
         string authorization-ID
         string service
         string "external-keyx"

   If the user authenticated in the key-exchange is allowed to assume
   the authorization identity, this method is successful, and the
   server responds with SSH_MSG_USERAUTH_SUCCESS if no more
   authentications are needed, or with SSH_MSG_USERAUTH_FAILURE with
   partial success set to true if more authentications are needed.

   If the user authenticated in the key-exchange is not allowed to
   assume the authorization identity, then SSH_MSG_USERAUTH_FAILURE is
   returned with partial success set to false.

   Any implementation supporting at least one key exchange method which
   conforms to section 1 of this document SHOULD also support the
   "external-keyx" user authentication method, in order to allow user
   authentication to be performed at the same time as key exchange,
   thereby reducing the number of round trips needed for connection
   setup.

4. Summary of Message Numbers

   The following message numbers have been defined in this document:

          #define SSH_MSG_GSSAPI_INIT             30
          #define SSH_MSG_GSSAPI_CONTINUE         31
          #define SSH_MSG_GSSAPI_COMPLETE         32

   The numbers 30-49 are key exchange specific and may be redefined by
   other kex methods.

5. Security Considerations

   This document describes an authentication and key-exchange protocol.
   As such, security considerations are discussed throughout.

   This protocol depends on the SSH protocol itself, the GSSAPI, any
   underlying GSSAPI mechanisms which are used, and any protocols on
   which such mechanisms might depend.  Each of these components plays
   a part in the security of the resulting connection, and each will
   have its own security considerations.

   The key exchange method described in section 1 of this document
   depends on the underlying GSSAPI mechanism to provide both mutual
   authentication and per-message integrity services.  If either of
   these features is not supported by a particular GSSAPI mechanism, or
   by a particular implementation of a GSSAPI mechanism, then the key
   exchange is not secure and MUST fail.

   In order for the "external-keyx" user authentication method to be
   used, it MUST have access to user authentication information
   obtained as a side-effect of the key exchange.  If this information
   is unavailable, the authentication MUST fail.

5. Trademark Issues

   SSH is a registered trademark and Secure Shell is a trademark of SSH
   Communications Security Corp (www.ssh.com), and are used herein to
   describe and refer

6. Acknowledgements

   The authors would like to the SSH protocol, as permitted in section 9 of
   [9].  These trademarks may not be used as part of a product name or
   in otherwise confusing manner without prior written permission of
   SSH Communications Security Corp. thank Sam Hartman and Simon Wilkinson for
   their invaluable assistance with this document.

References

   [1]   ISO/IEC, "Specification of Abstract Syntax Notation One
         (ASN.1)", ISO/IEC 8824, November 1998.

   [2]   Linn, J., "Generic Security Service Application Program
         Interface Version 2, Update 1", RFC 2743, January 2000.

   [3]   Kohl, J. and C. Neuman, "The Kerberos Network Authentication
         Service (V5)", RFC 1510, September 1993.

   [4]   Linn, J., "The Kerberos Version 5 GSS-API Mechanism", RFC
         1964, June 1996.

   [5]   Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
         April 1992.

   [6]   Freed, N. and N. Borenstein, "Multipurpose Internet Mail
         Extensions (MIME) Part One: Format of Internet Message
         Bodies", RFC 2045, November 1996.

   [7]   Bradner, S., "Key words for use in RFCs to Indicate
         Requirement Levels", RFC 2119, BCP 14, March 1997.

   [8]   Baize, E. and D. Pinkas, "The Simple and Protected GSS-API
         Negotiation Mechanism", RFC 2478, December 1998.

   [9]   Ylonen, T., Kivinen, T., Saarinen, M., Rinne, T. and S.
         Lehtinen, "SSH Protocol Architecture", November 2000.

   [10]  Ylonen, T., Kivinen, T., Saarinen, M., Rinne, T. and S.
         Lehtinen, "SSH Transport Layer Protocol", November 2000.

   [11]  Ylonen, T., Kivinen, T., Saarinen, M., Rinne, T. and S.
         Lehtinen, "SSH Authentication Protocol", November 2000.

Authors' Addresses

   Jeffrey Hutzelman
   Carnegie Mellon University
   5000 Forbes Ave
   Pittsburgh, PA  15213
   US

   Phone: +1 412 268 7225
   EMail: jhutz+@cmu.edu
   URI:   http://www.cs.cmu.edu/~jhutz/
   Joseph Salowey
   Cisco Systems
   Bldg 20
   725 Alder Drive
   Milpitas, CA  95035
   US

   Phone: +1 408 525 6381
   EMail: jsalowey@cisco.com

Full Copyright Statement

   Copyright (C) The Internet Society (2001). All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph
   are included on all such copies and derivative works. However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assigns.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS 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.

Acknowledgement

   Funding for the RFC editor function is currently provided by the
   Internet Society.