Include <com_err.h>
[heimdal.git] / doc / standardisation / draft-williams-gssapi-store-deleg-creds-01.txt
blobb14696e42f4562aeb4cddfc6f32caf8789f1cce1
2 INTERNET-DRAFT                                          Nicolas Williams
3                                                         Sun Microsystems
4                                                           September 2003
8            GSS-APIv2 Extension for Storing Delegated Credentials
9              <draft-williams-gssapi-store-deleg-creds-01.txt>
14 Status of this Memo
16    This document is an Internet-Draft and is in full conformance with
17    all provisions of Section 10 of RFC2026 [RFC2026].
19    Internet-Drafts are working documents of the Internet Engineering
20    Task Force (IETF), its areas, and its working groups.  Note that
21    other groups may also distribute working documents as Internet-
22    Drafts.
24    Internet-Drafts are draft documents valid for a maximum of six months
25    and may be updated, replaced, or obsoleted by other documents at any
26    time.  It is inappropriate to use Internet- Drafts as reference
27    material or to cite them other than as "work in progress."
29    The list of current Internet-Drafts can be accessed at
30    http://www.ietf.org/ietf/1id-abstracts.txt
32    The list of Internet-Draft Shadow Directories can be accessed at
33    http://www.ietf.org/shadow.html.
35    This draft expires on January 30th, 2004. Please send comments to
36    the authors.
39 Copyright Notice
41    Copyright (C) The Internet Society (2003).  All Rights Reserved.
43 Abstract
45    This document defines a new function for the GSS-API which allows
46    applications to store delegated (and other) credentials in the
47    implicit GSS-API credential store.  This is needed for GSS-API
48    applications to use delegated credentials as they would use other
49    credentials.
51 Conventions used in this document
53    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
54    "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this
55    document are to be interpreted as described in [RFC2119].
57 N. Williams                                                     [Page 1]
59 DRAFT           GSS_Store_cred()                        Expires March 2004
62 Table of Contents
64    1  Introduction
65    2  GSS_Store_cred()
66    2.1  C-Bindings for GSS_Store_cred()
67    3  Examples
68    4  Security Considerations
69    5  References
70    5.1  Normative References
71    6  Author's Address
73 1  Introduction
75    The GSS-API [RFC2743] clearly assumes that credentials exist in an
76    implicit store whence they can be acquired using GSS_Acquire_cred()
77    and GSS_Add_cred() or through use of the default credential.
78    Multiple credential stores may exist on a given host, but only one
79    store may be accessed by GSS_Acquire_cred() and GSS_Add_cred() at any
80    given time.
82    [NOTE:  This assumption can be seen in sections 1.1.1.2 and 1.1.1.3
83            of RFC2743 as well as in section 3.5 of RFC2744.
85            Note to the RFC editor: please remove this note before
86            publication.]
88    Applications may be able to change the credential store from which
89    credentials can be acquired, either by changing user contexts (where
90    the applications have the privilege to do so) or by other means
91    (where a user may have multiple credential stores).
93    Some GSS-API acceptor applications always change user contexts, after
94    accepting a GSS-API security context and making appropriate
95    authorization checks, to the user context corresponding to the
96    initiator principal name or to a context requested by the initiator.
97    The means by which credential stores are managed are generally beyond
98    the scope of the GSS-API.
100    In the case of delegated credential handles however, such credentials
101    do not exist in the acceptor's credential store or in the credential
102    stores of the user contexts to which the acceptor application might
103    change - which is precisely the raison d'etre of credential
104    delegation.  But the GSS-API provides no mechanism by which delegated
105    credential handles can be made available for acquisition through
106    GSS_Acquire_cred()/GSS_Add_cred().  The GSS-API also does not provide
107    any credential import/export interfaces like the GSS-API context
108    import/export interfaces.
110    Thus acceptors are limited to making only direct use of delegated
111    credential handles and only with GSS_Init_sec_context(),
112    GSS_Inquire_cred*() and GSS_Release_cred().  This limitation is
113    particularly onerous on Unix systems where a call to exec() to
115 N. Williams                                                     [Page 2]
117 DRAFT           GSS_Store_cred()                        Expires March 2004
119    replace the process image obliterates the delegated credentials
120    handle.  
122    [NOTE:  Delegated credentials are practically unusable on Unix
123            implementations of Secure Shell (SSHv2) servers, except where
124            there are extended interfaces for dealing with delegated
125            credentials, which to date have always been
126            mechanism-specific interfaces.
128            Note to the RFC editor: please remove this note before
129            publication.]
131    In order to make delegated credentials generally as useful as
132    credentials that can be acquired with GSS_Acquire_cred() and
133    GSS_Add_cred() a primitive is needed which allows storing of
134    credentials in the implicit credential store.  This primitive we call
135    "GSS_Store_cred()."
137    [NOTE:  Simon Wilkinson's patches to OpenSSH for GSS-API sport a
138            simple internal interface for storing delegated credentials
139            in users' credential store - this internal interface wraps
140            around two mechanism specific internal interfaces for storing
141            GSI and Kerberos V credentials.
143            Simon's code shows that:
145            a) a generic method is needed for making delegated
146               credentials available for indirect use through acquisition
147               (as opposed to just using the actual delegated cred
148               handle)
150            b) it is possible to design and implement such a generic
151               method for storing delegated credentials.
153            No new concepts are added to the GSS-API by this document,
154            but the implicit existence of a credential store in the
155            background is made explicit, and a deficiency of the GSS-API
156            is corrected.
158            Compare this to the GGF proposal which includes a credential
159            import/export facility (like the existing context import/
160            export facility), but with an option to export as
161            "environment variables," meaning something like "store these
162            input creds in some new credential store and then tell me the
163            name of that credential store through some output environment
164            variable"[*].  Thus, the GGF export-cred-to-environment-
165            variable proposal adds knowledge of environment variables to
166            the GSS-API, which this proposal does not.  Note that a
167            credential import/export facility along the lines of the
168            existing context import/export facility may be useful and
169            complements the GSS_Store_cred() interface; in fact, with
170            GSS_Store_cred() it should be possible to remove the
171            'option_req' input parameter and export-to-env-var features
173 N. Williams                                                     [Page 3]
175 DRAFT           GSS_Store_cred()                        Expires March 2004
177            of the GGF's GSS_Export_cred() credential export proposal.
179            [*]  For the exact semantics see section 1.2, paragraph 6 of
180                 draft-engert-ggf-gss-extensions-00.txt
182            One side effect of GSS_Store_cred(), however, is that it
183            allows applications that can switch their current credential
184            store to move credentials from one store to the other; this
185            is a direct result of making it possible to store a
186            credential given a GSS-API credential handle.  Perhaps there
187            should be some text allowing, or recommending, that
188            implementations of GSS_Store_cred() allow only the storage of
189            credentials acquired through credential delegation.
191            Note to the RFC editor: please remove this note before
192            publication.]
194 2  GSS_Store_cred()
196    Inputs:
198    o  input_cred_handle CREDENTIAL HANDLE, -- credential to store; MUST
199    -- NOT be GSS_C_NO_CREDENTIAL
201    o  cred_usage INTEGER -- 0=INITIATE-AND-ACCEPT, 1=INITIATE-ONLY,
202    -- 2=ACCEPT-ONLY
204    o  desired_mech_element OBJECT IDENTIFIER, -- if GSS_C_NULL_OID
205    -- then store all the elements of the input_cred_handle, otherwise
206    -- store only the element of the corresponding mechanism
208    o  overwrite_cred BOOLEAN, -- if TRUE replace any credential for the
209    -- same principal in the credential store
211    o  default_cred BOOLEAN -- if TRUE make the stored credential
212    -- available as the default credential (for acquisition with
213    -- GSS_C_NO_NAME as the desired name or for use as
214    -- GSS_C_NO_CREDENTIAL)
216    Outputs:
218    o  major_status INTEGER,
220    o  minor_status INTEGER,
222    o  mech_elements_stored SET OF OBJECT IDENTIFIER, -- the set of
223    -- mechanism OIDs for which credential elements were successfully
224    -- stored
226    o  cred_usage_stored INTEGER -- like cred_usage, but indicates what
227    -- kind of credential was stored (useful when the cred_usage input
228    -- parameter is set to INITIATE-AND-ACCEPT)
231 N. Williams                                                     [Page 4]
233 DRAFT           GSS_Store_cred()                        Expires March 2004
235    Return major_status codes:
237    o  GSS_S_COMPLETE indicates that the credentials were successfully
238    stored.
240    o  GSS_S_CREDENTIALS_EXPIRED indicates that the input credentials
241    had expired or expired before they could be stored.
243    o  GSS_S_NO_CRED indicates that no input credentials were given.
245    o  GSS_S_UNAVAILABLE indicates that the credential store is not
246    available.
248    o  GSS_S_DUPLICATE_ELEMENT indicates that an element of the input
249    credential could not be stored because a credential for the same
250    principal exists in the current credential store and the
251    overwrite_cred input argument was FALSE.
253    o  GSS_S_FAILURE indicates that the credential could not be stored
254    for some other reason.  The minor status code may provide more
255    information if a non-GSS_C_NULL_OID desired_mech_element was given.
257    GSS_Store_cred() is used to store, in the current credential store, a
258    given credential that has either been acquired from a different
259    credential store or been accepted as a delegated credential.
261    Specific mechanism elements of a credential can be stored one at a
262    time by specifying a non-GSS_C_NULL_OID mechanism OID as the
263    desired_mech_element input argument, in which case the minor status
264    output SHOULD have a mechanism-specific value when the major status
265    is not GSS_S_COMPLETE.
267    The initiator, acceptor or both usages of the input credential may be
268    stored as per the cred_usage input argument.
270    The credential elements that were actually stored, when the major
271    status is GSS_S_COMPLETE, are indicated through the cred_usage_stored
272    and mech_elements_stored function outputs.
274    If credentials already exist in the current store for the principal
275    of the input_cred_handle, then those credentials are not replaced
276    with the input credentials unless the overwrite_cred input argument
277    is TRUE.
279    Finally, if the current credential store has no default credential
280    (that is, no credential that could be acquired for GSS_C_NO_NAME) or
281    if the default_cred input argument is TRUE, and the input credential
282    can be successfully stored, then the input credential will be
283    available for acquisition with GSS_C_NO_NAME as the desired name
284    input to GSS_Acquire_cred() or GSS_Add_cred() as well as for use as
285    GSS_C_NO_CREDENTIAL for the cred_handle inputs to GSS_Inquire_cred(),
286    GSS_Inquire_cred_by_mech(), GSS_Init_sec_context() and
287    GSS_Accept_sec_context().
289 N. Williams                                                     [Page 5]
291 DRAFT           GSS_Store_cred()                        Expires March 2004
294 2.1  C-Bindings for GSS_Store_cred()
296    The C-bindings for GSS_Store_cred() make use of types from and are
297    designed based on the style of the GSS-APIv2 C-Bindings [RFC2744].
299    OM_uint32 gss_store_cred(
300       OM_uint32         *minor_status,
301       gss_cred_id_t     input_cred,
302       gss_cred_usage_t  cred_usage,
303       const gss_OID     desired_mech,
304       OM_uint32         overwrite_cred,
305       OM_uint32         default_cred,
306       gss_OID_set       *elements_stored,
307       gss_cred_usage_t  *cred_usage_stored)
309    The two boolean arguments, 'overwrite_cred' and 'default_cred' are
310    typed as OM_uint32; 0 corresponds to FALSE, non-zero values
311    correspond to TRUE.
313 3  Examples
315    The intended usage of GSS_Store_cred() is to make delegated
316    credentials available to child processes of GSS-API acceptor
317    applications.  Example pseudo-code:
319    /*
320     * <GSS_Accept_sec_context() loop resulting in GSS_S_COMPLETE, an
321     * initiator name (hereafter, "src_name") and a delegated credential
322     * handle (hereafter "deleg_cred").>
323     *
324     * <"requested_username" is a username derived from the initiator
325     * name or explicitly requested by the initiator application.>
326     */
327    ...
329    if (authorize_gss_client(src_name, requested_username)) {
330       /*
331        * For Unix-type platforms this may mean calling setuid() and it
332        * may or may not also mean setting/unsetting such environment
333        * variables as KRB5CCNAME and what not.
334        */
335       if (change_user_context(requested_username))
336          (void) gss_store_creds(&minor_status, deleg_cred,
337                                 GSS_C_INITIATE, actual_mech,
338                                 0, 1, NULL, NULL);
339       }
340       else ...
341    }
342    else ...
344 4  Security Considerations
347 N. Williams                                                     [Page 6]
349 DRAFT           GSS_Store_cred()                        Expires March 2004
351    Acceptor applications MUST only store delegated credentials into
352    appropriate credential stores and only after proper authorization of
353    the authenticated initiator principal to the requested service(s).
355    Acceptor applications that have no use for delegated credentials MUST
356    release them (such acceptor applications that use the GSS-API
357    C-Bindings may simply provide a NULL value for the
358    delegated_cred_handle argument to gss_accept_sec_context()).
360 5  References
362 5.1  Normative References
364    [RFC2026]
365       S. Bradner, RFC2026:  "The Internet Standard Process - Revision
366       3," October 1996, Obsoletes - RFC 1602, Status: Best Current
367       Practice.
369    [RFC2119]
370       S. Bradner, RFC2119 (BCP14):  "Key words for use in RFCs to
371       Indicate Requirement Levels," March 1997, Status: Best Current
372       Practice.
374    [RFC2743]
375       J. Linn, RFC2743: "Generic Security Service Application Program
376       Interface Version 2, Update 1," January 2000, Status: Proposed
377       Standard.
379    [RFC2744]
380       J. Wray, RFC2744: "Generic Security Service API Version 2 :
381       C-bindings," January 2000, Status: Proposed Standard.
383 6  Author's Address
385    Nicolas Williams
386    Sun Microsystems
387    5300 Riata Trace Ct
388    Austin, TX 78727
389    Email: Nicolas.Williams@sun.com
391 Full Copyright Statement
393    Copyright (C) The Internet Society (2003).  All Rights Reserved.
395    This document and translations of it may be copied and furnished to
396    others, and derivative works that comment on or otherwise explain it
397    or assist in its implementation may be prepared, copied, published
398    and distributed, in whole or in part, without restriction of any
399    kind, provided that the above copyright notice and this paragraph are
400    included on all such copies and derivative works.  However, this
401    document itself may not be modified in any way, such as by removing
402    the copyright notice or references to the Internet Society or other
403    Internet organizations, except as needed for the purpose of
405 N. Williams                                                     [Page 7]
407 DRAFT           GSS_Store_cred()                        Expires March 2004
409    developing Internet standards in which case the procedures for
410    copyrights defined in the Internet Standards process must be
411    followed, or as required to translate it into languages other than
412    English.
414    The limited permissions granted above are perpetual and will not be
415    revoked by the Internet Society or its successors or assigns.
417    This document and the information contained herein is provided on an
418    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
419    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
420    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
421    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
422    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
424 Acknowledgement
426    Funding for the RFC Editor function is currently provided by the
427    Internet Society.
466 N. Williams                                                     [Page 8]