RFC 4178 - The Simple and Protected Generic Security Service

时间:2006-11-01 来源: 作者: 点击:
NetworkWorkingGroup L.Zhu RequestforComments:4178 P.Leach Obsoletes:2478 K.Jaganathan Category:StandardsTrackMicrosoftCorporation W.Ingersoll SunMicrosystems October2005 TheSimpleandProtected GenericSecurityServiceApplicationProgramInterface(GSS-API)
  Network Working Group                                                   L. Zhu
Request for Comments: 4178                                          P. Leach
Obsoletes: 2478                                                      K. Jaganathan
Category: Standards Track                          Microsoft Corporation 
                                                                                  W. Ingersoll
                                                                         Sun Microsystems
                                                                               October 2005

                       The Simple and Protected
    Generic Security Service Application Program Interface (GSS-API)
                         Negotiation Mechanism

Status of This Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Copyright Notice

   Copyright (C) The Internet Society (2005).

Abstract

   This document specifies a negotiation mechanism for the Generic
   Security Service Application Program Interface (GSS-API), which is
   described in RFC 2743.  GSS-API peers can use this negotiation
   mechanism to choose from a common set of security mechanisms.  If
   per-message integrity services are available on the established
   mechanism context, then the negotiation is protected against an
   attacker that forces the selection of a mechanism not desired by the
   peers.

   This mechanism replaces RFC 2478 in order to fix defects in that
   specification and to describe how to inter-operate with
   implementations of that specification that are commonly deployed on
   the Internet.

Table of Contents

   1. Introduction ....................................................2
   2. Conventions Used in This Document ...............................3
   3. Negotiation Protocol ............................................3
      3.1. Negotiation Description ....................................4
      3.2. Negotiation Procedure ......................................5
   4. Token Definitions ...............................................7
      4.1. Mechanism Types ............................................7
      4.2. Negotiation Tokens .........................................7
           4.2.1. negTokenInit ........................................8
           4.2.2. negTokenResp ........................................9
   5. Processing of mechListMIC ......................................10
   6. Extensibility ..................................................13
   7. Security Considerations ........................................13
   8. Acknowledgments ................................................14
   9. References .....................................................14
      9.1. Normative References ......................................14
      9.2. Informative References ....................................15
   Appendix A.  SPNEGO ASN.1 Module ..................................16
   Appendix B.  GSS-API Negotiation Support API ......................17
      B.1.  GSS_Set_neg_mechs Call ...................................17
      B.2.  GSS_Get_neg_mechs Call ...................................18
   Appendix C.  Changes since RFC 2478 ...............................18
   Appendix D.  mechListMIC Computation Example ......................20

1.  Introduction

   The GSS-API [RFC2743] provides a generic interface that can be
   layered atop different security mechanisms such that, if
   communicating peers acquire GSS-API credentials for the same security
   mechanism, then a security context may be established between them
   (subject to policy).  However, GSS-API does not prescribe the method
   by which GSS-API peers can establish whether they have a common
   security mechanism.

   The Simple and Protected GSS-API Negotiation (SPNEGO) mechanism
   defined here is a pseudo security mechanism that enables GSS-API
   peers to determine in-band whether their credentials support a common
   set of one or more GSS-API security mechanisms; if so, it invokes the
   normal security context establishment for a selected common security
   mechanism.  This is most useful for applications that depend on GSS-
   API implementations and share multiple mechanisms between the peers.

   The SPNEGO mechanism negotiation is based on the following model: the
   initiator proposes a list of security mechanism(s), in decreasing
   preference order (favorite choice first), the acceptor (also known as
   the target) either accepts the initiator’s preferred security

   mechanism (the first in the list) or chooses one of the available
   mechanisms from the offered list; if neither is acceptable, the
   acceptor rejects the proposed value(s).  The target then informs the
   initiator of its choice.

   Once a common security mechanism is chosen, mechanism-specific
   options MAY be negotiated as part of the selected mechanism’s context
   establishment.  These negotiations (if any) are internal to the
   mechanism and opaque to the SPNEGO protocol.  As such, they are
   outside the scope of this document.

   If per-message integrity services [RFC2743] are available on the
   established mechanism security context, then the negotiation is
   protected to ensure that the mechanism list has not been modified.
   In cases where an attacker could have materially influenced the
   negotiation, peers exchange message integrity code (MIC) tokens to
   confirm that the mechanism list has not been modified.  If no action
   of an attacker could have materially modified the outcome of the
   negotiation, the exchange of MIC tokens is optional (see Section 5).
   Allowing MIC tokens to be optional in this case provides
   interoperability with existing implementations while still protecting
   the negotiation.  This interoperability comes at the cost of
   increased complexity.

   SPNEGO relies on the concepts developed in the GSS-API specification
   [RFC2743].  The negotiation data is encapsulated in context-level
   tokens.  Therefore, callers of the GSS-API do not need to be aware of
   the existence of the negotiation tokens, but only of the new pseudo-
   security mechanism.  A failure in the negotiation phase causes a
   major status code to be returned: GSS_S_BAD_MECH.

2.  Conventions Used in This Document

   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 [RFC2119].

3.  Negotiation Protocol

   When the established mechanism context provides integrity protection,
   the mechanism negotiation can be protected.  When acquiring
   negotiated security mechanism tokens, per-message integrity services
   are always requested by the SPNEGO mechanism.

   When the established mechanism context supports per-message integrity
   services, SPNEGO guarantees that the selected mechanism is mutually
   preferred.

   This section describes the negotiation process of this protocol.

3.1.  Negotiation Description

   The first negotiation token sent by the initiator contains an ordered
   list of mechanisms in decreasing preference order (favorite mechanism
   first), and optionally the initial mechanism token for the preferred
   mechanism of the initiator (i.e., the first in the list).  (Note that
   the list MUST NOT contain this SPNEGO mechanism itself or any
   mechanism for which the client does not have appropriate
   credentials.)

   The target then processes the token from the initiator.  This will
   result in one of four possible states (as defined in Section 4.2.2)
   being returned in the reply message: accept-completed, accept-
   incomplete, reject, or request-mic.  A reject state will terminate
   the negotiation; an accept-completed state indicates that the
   initiator-selected mechanism was acceptable to the target, and that
   the security mechanism token embedded in the first negotiation
   message was sufficient to complete the authentication; an accept-
   incomplete state indicates that further message exchange is needed
   but the MIC token exchange (as described in Section 5) is OPTIONAL; a
   request-mic state (this state can only be present in the first reply
   message from the target) indicates that the MIC token exchange is
   REQUIRED if per-message integrity services are available.

   Unless the preference order is specified by the application, the
   policy by which the target chooses a mechanism is an implementation-
   specific, local matter.  In the absence of an application-specified
   preference order or other policy, the target SHALL choose the first
   mechanism in the initiator proposed list for which it has valid
   credentials.

   In case of a successful negotiation, the security mechanism in the
   first reply message represents the value suitable for the target that
   was chosen from the list offered by the initiator.

   In case of an unsuccessful negotiation, the reject state is returned,
   and the generation of a context-level negotiation token is OPTIONAL.

   Once a mechanism has been selected, context establishment tokens
   specific to the selected mechanism are carried within the negotiation
   tokens.

   Lastly, MIC tokens may be exchanged to ensure the authenticity of the
   mechanism list received by the target.

   To avoid conflicts with the use of MIC tokens by SPNEGO, partially-
   established contexts MUST NOT be used for per-message calls.  To
   guarantee this, the prot_ready_state [RFC2743] MUST be set to false
   on return from GSS_Init_sec_context() and GSS_Accept_sec_context(),
   even if the underlying mechanism returned true.

   Note that in order to avoid an extra round trip, the first context
   establishment token of the initiator’s preferred mechanism SHOULD be
   embedded in the initial negotiation message (as defined in Section
   4.2).  (This mechanism token is referred to as the optimistic
   mechanism token in this document.)  In addition, using the optimistic
   mechanism token allows the initiator to recover from non-fatal errors
   encountered when trying to produce the first mechanism token before a
   mechanism can be selected.  In cases where the initiator’s preferred
   mechanism is not likely to be selected by the acceptor because of the
   significant cost of its generation, implementations MAY omit the
   optimistic mechanism token.

3.2.  Negotiation Procedure

   The basic form of the procedure assumes that per-message integrity
   services are available on the established mechanism context, and it
   is summarized as follows:

   a) The GSS-API initiator invokes GSS_Init_sec_context() as normal,
      but requests that SPNEGO be used.  SPNEGO can either be explicitly
      requested or accepted as the default mechanism.

   b) The initiator GSS-API implementation generates a negotiation token
      containing a list of one or more security mechanisms that are
      available based on the credentials used for this context
      establishment, and optionally on the initial mechanism token for
      the first mechanism in the list.

   c) The GSS-API initiator application sends the token to the target
      application.  The GSS-API target application passes the token by
      invoking GSS_Accept_sec_context().  The acceptor will do one of
      the following:

        I) If none of the proposed mechanisms are acceptable, the
           negotiation SHALL be terminated.  GSS_Accept_sec_context
           indicates GSS_S_BAD_MECH.  The acceptor MAY output a
           negotiation token containing a reject state.

       II) If either the initiator’s preferred mechanism is not accepted
           by the target or this mechanism is accepted but is not the
           acceptor’s most preferred mechanism (i.e., the MIC token
           exchange as described in Section 5 is required),

           GSS_Accept_sec_context() indicates GSS_S_CONTINUE_NEEDED.
           The acceptor MUST output a negotiation token containing a
           request-mic state.

      III) Otherwise, if at least one additional negotiation token from
           the initiator is needed to establish this context,
           GSS_Accept_sec_context() indicates GSS_S_CONTINUE_NEEDED and
           outputs a negotiation token containing an accept-incomplete
           state.

       IV) Otherwise, no additional negotiation token from the initiator
           is needed to establish this context, GSS_Accept_sec_context()
           indicates GSS_S_COMPLETE and outputs a negotiation token
           containing an accept_complete state.

      If the initiator’s preferred mechanism is accepted, and an
      optimistic mechanism token was included, this mechanism token MUST
      be passed to the selected mechanism by invoking
      GSS_Accept_sec_context().  If a response mechanism token is
      returned, it MUST be included in the response negotiation token.
      Otherwise, the target will not generate a response mechanism token
      in the first reply.

   d) The GSS-API target application returns the negotiation token to
      the initiator application.  The GSS-API initiator application
      passes the token by invoking GSS_Init_sec_context().  The security
      context initialization is then continued according to the standard
      GSS-API conventions for the selected mechanism, where the tokens
      of the selected mechanism are encapsulated in negotiation messages
      (see Section 4) until GSS_S_COMPLETE is returned for both the
      initiator and the target by the selected security mechanism.

   e) MIC tokens are then either skipped or exchanged according to
      Section 5.

   Note that the *_req_flag input parameters for context establishment
   are relative to the selected mechanism, as are the *_state output
   parameters.  That is, these parameters are not applicable to the
   negotiation process per se.

   On receipt of a negotiation token on the target side, a GSS-API
   implementation that does not support negotiation would indicate the
   GSS_S_BAD_MECH status as though a particular basic security mechanism
   had been requested and was not supported.

   When a GSS-API credential is acquired for the SPNEGO mechanism, the
   implementation SHOULD produce a credential element for the SPNEGO
   mechanism that internally contains GSS-API credential elements for

   all mechanisms for which the principal has credentials available,
   except for any mechanisms that are not to be negotiated, per
   implementation-, site-, or application-specific policy.  See Appendix
   B for interfaces for expressing application policy.

4.  Token Definitions

   The type definitions in this section assume an ASN.1 module
   definition of the following form:

      SPNEGOASNOneSpec {
         iso(1) identified-organization(3) dod(6) internet(1)
         security(5) mechanism(5) snego (2) modules(4) spec2(2)
      } DEFINITIONS EXPLICIT TAGS ::= BEGIN

      -- rest of definitions here

      END

   This specifies that the tagging context for the module will be
   explicit and non-automatic.

   The encoding of the SPNEGO protocol messages shall obey the
   Distinguished Encoding Rules (DER) of ASN.1, as described in [X690].

4.1.  Mechanism Types

   In this negotiation model, each OID represents one GSS-API mechanism
   or one variant (see Section 6) of it, according to [RFC2743].

      MechType ::= OBJECT IDENTIFIER
          -- OID represents each security mechanism as suggested by
          -- [RFC2743]

      MechTypeList ::= SEQUENCE OF MechType

4.2.  Negotiation Tokens

   The syntax of the initial negotiation tokens follows the
   initialContextToken syntax defined in Section 3.1 of [RFC2743].  The
   SPNEGO pseudo mechanism is identified by the Object Identifier
   iso.org.dod.internet.security.mechanism.snego (1.3.6.1.5.5.2).
   Subsequent tokens MUST NOT be encapsulated in this GSS-API generic
   token framing.

   This section specifies the syntax of the inner token for the initial
   message and the syntax of subsequent context establishment tokens.

      NegotiationToken ::= CHOICE {
          negTokenInit    [0] NegTokenInit,
          negTokenResp    [1] NegTokenResp
      }

4.2.1.  negTokenInit

      NegTokenInit ::= SEQUENCE {
          mechTypes       [0] MechTypeList,
          reqFlags        [1] ContextFlags  OPTIONAL,
            -- inherited from RFC 2478 for backward compatibility,
            -- RECOMMENDED to be left out
          mechToken       [2] OCTET STRING  OPTIONAL,
          mechListMIC     [3] OCTET STRING  OPTIONAL,
          ...
      }
      ContextFlags ::= BIT STRING {
          delegFlag       (0),
          mutualFlag      (1),
          replayFlag      (2),
          sequenceFlag    (3),
          anonFlag        (4),
          confFlag        (5),
          integFlag       (6)
      } (SIZE (32))

   This is the syntax for the inner token of the initial negotiation
   message.

   mechTypes

      This field contains one or more security mechanisms available for
      the initiator, in decreasing preference order (favorite choice
      first).

   reqFlags

      This field, if present, contains the service options that are
      requested to establish the context (the req_flags parameter of
      GSS_Init_sec_context()).  This field is inherited from RFC 2478
      and is not integrity protected.  For implementations of this
      specification, the initiator SHOULD omit this reqFlags field and
      the acceptor MUST ignore this reqFlags field.

      The size constraint on the ContextFlags ASN.1 type only applies to
      the abstract type.  The ASN.1 DER requires that all trailing zero
      bits be truncated from the encoding of a bit string type whose
      abstract definition includes named bits.  Implementations should

      not expect to receive exactly 32 bits in an encoding of
      ContextFlags.

   mechToken

      This field, if present, contains the optimistic mechanism token.

   mechlistMIC

      This field, if present, contains an MIC token for the mechanism
      list in the initial negotiation message.  This MIC token is
      computed according to Section 5.

4.2.2.  negTokenResp

      NegTokenResp ::= SEQUENCE {
          negState       [0] ENUMERATED {
              accept-completed    (0),
              accept-incomplete   (1),
              reject              (2),
              request-mic         (3)
          }                                 OPTIONAL,
            -- REQUIRED in the first reply from the target
          supportedMech   [1] MechType      OPTIONAL,
            -- present only in the first reply from the target
          responseToken   [2] OCTET STRING  OPTIONAL,
          mechListMIC     [3] OCTET STRING  OPTIONAL,
          ...
      }

   This is the syntax for all subsequent negotiation messages.

   negState

      This field, if present, contains the state of the negotiation.
      This can be:

      accept-completed

         No further negotiation message from the peer is expected, and
         the security context is established for the sender.

      accept-incomplete

         At least one additional negotiation message from the peer is
         needed to establish the security context.

      reject

         The sender terminates the negotiation.

      request-mic

         The sender indicates that the exchange of MIC tokens, as
         described in Section 5, will be REQUIRED if per-message
         integrity services are available on the mechanism context to be
         established.  This value SHALL only be present in the first
         reply from the target.

      This field is REQUIRED in the first reply from the target, and is
      OPTIONAL thereafter.  When negState is absent, the actual state
      should be inferred from the state of the negotiated mechanism
      context.

   supportedMech

      This field SHALL only be present in the first reply from the
      target.  It MUST be one of the mechanism(s) offered by the
      initiator.

   ResponseToken

      This field, if present, contains tokens specific to the mechanism
      selected.

   mechlistMIC

      This field, if present, contains an MIC token for the mechanism
      list in the initial negotiation message.  This MIC token is
      computed according to Section 5.

5.  Processing of mechListMIC

   If the mechanism selected by the negotiation does not support
   integrity protection, then no mechlistMIC token is used.

   Otherwise, if the accepted mechanism is the most preferred mechanism
   of both the initiator and the acceptor, then the MIC token exchange,
   as described later in this section, is OPTIONAL.  A mechanism is the
   acceptor’s most preferred mechanism if there is no other mechanism
   that the acceptor would have preferred over the accepted mechanism
   had it been present in the mechanism list.

   In all other cases, MIC tokens MUST be exchanged after the mechanism
   context is fully established.

   a) The mechlistMIC token (or simply the MIC token) is computed over
      the mechanism list in the initial negotiation message by invoking
      GSS_GetMIC() as follows: the input context_handle is the
      established mechanism context, the input qop_req is 0, and the
      input message is the DER encoding of the value of type
      MechTypeList, which is contained in the "mechTypes" field of the
      NegTokenInit.  The input message is NOT the DER encoding of the
      type "[0] MechTypeList".

   b) If the selected mechanism exchanges an even number of mechanism
      tokens (i.e., the acceptor sends the last mechanism token), the
      acceptor does the following when generating the negotiation
      message containing the last mechanism token: if the MIC token
      exchange is optional, GSS_Accept_sec_context() either indicates
      GSS_S_COMPLETE and does not include a mechlistMIC token, or
      indicates GSS_S_CONTINUE_NEEDED and includes a mechlistMIC token
      and an accept-incomplete state; if the MIC token exchange is
      required, GSS_Accept_sec_context() indicates GSS_S_CONTINUE_NEEDED
      and includes a mechlistMIC token.  Acceptors that wish to be
      compatible with legacy Windows SPNEGO implementations, as
      described in Appendix C, should not generate a mechlistMIC token
      when the MIC token exchange is not required.  The initiator then
      processes the last mechanism token, and does one of the following:

        I) If a mechlistMIC token was included and is correctly
           verified, GSS_Init_sec_context() indicates GSS_S_COMPLETE.
           The output negotiation message contains a mechlistMIC token
           and an accept_complete state.  The acceptor MUST then verify
           this mechlistMIC token.

       II) If a mechlistMIC token was included but is incorrect, the
           negotiation SHALL be terminated.  GSS_Init_sec_context()
           indicates GSS_S_DEFECTIVE_TOKEN.

      III) If no mechlistMIC token was included and the MIC token
           exchange is not required, GSS_Init_sec_context() indicates
           GSS_S_COMPLETE with no output token.
------分隔线----------------------------
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容