1 2INTERNET-DRAFT Nicolas Williams 3 Sun Microsystems 4 September 2003 5 6 7 8 GSS-APIv2 Extension for Storing Delegated Credentials 9 <draft-williams-gssapi-store-deleg-creds-01.txt> 10 11 12 13 14Status of this Memo 15 16 This document is an Internet-Draft and is in full conformance with 17 all provisions of Section 10 of RFC2026 [RFC2026]. 18 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. 23 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." 28 29 The list of current Internet-Drafts can be accessed at 30 http://www.ietf.org/ietf/1id-abstracts.txt 31 32 The list of Internet-Draft Shadow Directories can be accessed at 33 http://www.ietf.org/shadow.html. 34 35 This draft expires on January 30th, 2004. Please send comments to 36 the authors. 37 38 39Copyright Notice 40 41 Copyright (C) The Internet Society (2003). All Rights Reserved. 42 43Abstract 44 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. 50 51Conventions used in this document 52 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]. 56 57N. Williams [Page 1] 58 59DRAFT GSS_Store_cred() Expires March 2004 60 61 62Table of Contents 63 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 72 731 Introduction 74 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. 81 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. 84 85 Note to the RFC editor: please remove this note before 86 publication.] 87 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). 92 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. 99 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. 109 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 114 115N. Williams [Page 2] 116 117DRAFT GSS_Store_cred() Expires March 2004 118 119 replace the process image obliterates the delegated credentials 120 handle. 121 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. 127 128 Note to the RFC editor: please remove this note before 129 publication.] 130 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()." 136 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. 142 143 Simon's code shows that: 144 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) 149 150 b) it is possible to design and implement such a generic 151 method for storing delegated credentials. 152 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. 157 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 172 173N. Williams [Page 3] 174 175DRAFT GSS_Store_cred() Expires March 2004 176 177 of the GGF's GSS_Export_cred() credential export proposal. 178 179 [*] For the exact semantics see section 1.2, paragraph 6 of 180 draft-engert-ggf-gss-extensions-00.txt 181 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. 190 191 Note to the RFC editor: please remove this note before 192 publication.] 193 1942 GSS_Store_cred() 195 196 Inputs: 197 198 o input_cred_handle CREDENTIAL HANDLE, -- credential to store; MUST 199 -- NOT be GSS_C_NO_CREDENTIAL 200 201 o cred_usage INTEGER -- 0=INITIATE-AND-ACCEPT, 1=INITIATE-ONLY, 202 -- 2=ACCEPT-ONLY 203 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 207 208 o overwrite_cred BOOLEAN, -- if TRUE replace any credential for the 209 -- same principal in the credential store 210 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) 215 216 Outputs: 217 218 o major_status INTEGER, 219 220 o minor_status INTEGER, 221 222 o mech_elements_stored SET OF OBJECT IDENTIFIER, -- the set of 223 -- mechanism OIDs for which credential elements were successfully 224 -- stored 225 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) 229 230 231N. Williams [Page 4] 232 233DRAFT GSS_Store_cred() Expires March 2004 234 235 Return major_status codes: 236 237 o GSS_S_COMPLETE indicates that the credentials were successfully 238 stored. 239 240 o GSS_S_CREDENTIALS_EXPIRED indicates that the input credentials 241 had expired or expired before they could be stored. 242 243 o GSS_S_NO_CRED indicates that no input credentials were given. 244 245 o GSS_S_UNAVAILABLE indicates that the credential store is not 246 available. 247 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. 252 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. 256 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. 260 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. 266 267 The initiator, acceptor or both usages of the input credential may be 268 stored as per the cred_usage input argument. 269 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. 273 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. 278 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(). 288 289N. Williams [Page 5] 290 291DRAFT GSS_Store_cred() Expires March 2004 292 293 2942.1 C-Bindings for GSS_Store_cred() 295 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]. 298 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) 308 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. 312 3133 Examples 314 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: 318 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 ... 328 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 ... 343 3444 Security Considerations 345 346 347N. Williams [Page 6] 348 349DRAFT GSS_Store_cred() Expires March 2004 350 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). 354 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()). 359 3605 References 361 3625.1 Normative References 363 364 [RFC2026] 365 S. Bradner, RFC2026: "The Internet Standard Process - Revision 366 3," October 1996, Obsoletes - RFC 1602, Status: Best Current 367 Practice. 368 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. 373 374 [RFC2743] 375 J. Linn, RFC2743: "Generic Security Service Application Program 376 Interface Version 2, Update 1," January 2000, Status: Proposed 377 Standard. 378 379 [RFC2744] 380 J. Wray, RFC2744: "Generic Security Service API Version 2 : 381 C-bindings," January 2000, Status: Proposed Standard. 382 3836 Author's Address 384 385 Nicolas Williams 386 Sun Microsystems 387 5300 Riata Trace Ct 388 Austin, TX 78727 389 Email: Nicolas.Williams@sun.com 390 391Full Copyright Statement 392 393 Copyright (C) The Internet Society (2003). All Rights Reserved. 394 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 404 405N. Williams [Page 7] 406 407DRAFT GSS_Store_cred() Expires March 2004 408 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. 413 414 The limited permissions granted above are perpetual and will not be 415 revoked by the Internet Society or its successors or assigns. 416 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. 423 424Acknowledgement 425 426 Funding for the RFC Editor function is currently provided by the 427 Internet Society. 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466N. Williams [Page 8] 467