Re: [kitten] Clarification of gss_add_cred() behavior

Nico Williams <nico@cryptonector.com> Thu, 19 March 2015 21:04 UTC

Return-Path: <nico@cryptonector.com>
X-Original-To: kitten@ietfa.amsl.com
Delivered-To: kitten@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 40B811ACEC4 for <kitten@ietfa.amsl.com>; Thu, 19 Mar 2015 14:04:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.666
X-Spam-Level:
X-Spam-Status: No, score=-1.666 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, IP_NOT_FRIENDLY=0.334, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p7OVHM--EY5I for <kitten@ietfa.amsl.com>; Thu, 19 Mar 2015 14:04:58 -0700 (PDT)
Received: from homiemail-a112.g.dreamhost.com (sub4.mail.dreamhost.com [69.163.253.135]) by ietfa.amsl.com (Postfix) with ESMTP id 4D4B21ACEBD for <kitten@ietf.org>; Thu, 19 Mar 2015 14:04:58 -0700 (PDT)
Received: from homiemail-a112.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a112.g.dreamhost.com (Postfix) with ESMTP id 1493E2005E807 for <kitten@ietf.org>; Thu, 19 Mar 2015 14:04:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=cryptonector.com; bh=nP9+FJM7apEOKGaSYuUcXI+0aUs =; b=IsRKPa+kpdZkvXcrdTnaoPPbFW4U8Jmn/jNjbGJa0uKuYIIV3RwGf92VfFq +RYNlv1pN/gqPJfLXGc0qYT8MBmKVwkO6EaN1H+Aw4WdwEINLMe0K/ArYtPAqr91 NmOkkyMiKLBdzuamCoeI2JFzw7mB1Ms/kCNTciebFNiEIYWU=
Received: from localhost (108-207-244-174.lightspeed.austtx.sbcglobal.net [108.207.244.174]) (Authenticated sender: nico@cryptonector.com) by homiemail-a112.g.dreamhost.com (Postfix) with ESMTPA id D69C02005E800 for <kitten@ietf.org>; Thu, 19 Mar 2015 14:04:57 -0700 (PDT)
Date: Thu, 19 Mar 2015 16:04:57 -0500
From: Nico Williams <nico@cryptonector.com>
To: kitten@ietf.org
Message-ID: <20150319210456.GN8099@localhost>
References: <20150319025202.GB8099@localhost> <alpine.GSO.1.10.1503191446260.3953@multics.mit.edu> <20150319194002.GG4309@mournblade.imrryr.org> <alpine.GSO.1.10.1503191541510.3953@multics.mit.edu> <20150319195720.GI4309@mournblade.imrryr.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <20150319195720.GI4309@mournblade.imrryr.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Archived-At: <http://mailarchive.ietf.org/arch/msg/kitten/y4nyBVeKGynpvbYX-ozCQH6IlqY>
Subject: Re: [kitten] Clarification of gss_add_cred() behavior
X-BeenThere: kitten@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Common Authentication Technologies - Next Generation <kitten.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/kitten>, <mailto:kitten-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/kitten/>
List-Post: <mailto:kitten@ietf.org>
List-Help: <mailto:kitten-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/kitten>, <mailto:kitten-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Mar 2015 21:04:59 -0000

On Thu, Mar 19, 2015 at 07:57:20PM +0000, Viktor Dukhovni wrote:
> On Thu, Mar 19, 2015 at 03:50:22PM -0400, Benjamin Kaduk wrote:
> 
> > >     2. For this interface to be useful, the initial state one must
> > >        be able to start with an empty credential handle and build up
> > >        from there.  This presumably is specified via a NULL input
> > >        credential, and still the same name for which one wants
> > >        creds.
> > 
> > There is GSS_Acquire_cred to obtain the first credential element.
> 
> So I believe that you're saying that gss_add_cred() not intended to
> be able to add the *first* credential element.  That is:
> 
>     1. Always call gss_acquire_cred() with a singleton mechanism
>        set (to get the first mechanism) and desired name.
> 
>     2. Then, as appropriate, call gss_add_cred() for any *additional*
>        mechanisms.
> 
> This makes the API more unpleasant to use, [...]

Decidedly more unpleasant.

BTW, nowhere in RFCs 2743 and 2744 does it say that the minor_status
output of GSS_Acquire_cred() corresponds to the one mechanism in
desired_mechs when there is just one mechanism in it.

But clarifying which mech the minor_status is for is one of the reasons
given for GSS_Add_cred()'s very existence.

Another reason given for GSS_Add_cred() is to support iterative
construction of credential handles, but no mention is made of having to
use GSS_Acquire_cred() to acquire a seed handle.

>                                     [...], but sounds plausibly
> consistent with the text...

I'm not sold on that yet.  First, see above as to spec self-inconsistencies.

Second, implementations seem to disagree:

 - MIT -> input_cred_handle == default -> allocates a new cred, honors desired_name;
 - Illumos -> same as MIT;
 - Heimdal -> input_cred_handle == default -> error;
 - GNU GSS -> not implemented, returns GSS_S_UNAVAILABLE;
 - gsskrb5 (Martin's SSPI shim) -> not implemented, returns GSS_S_FAILURE;

 - Illumos kgss (for RPCSEC_GSS) implements an unused kgss_add_cred() by calling
   up to gssd, which calls the one described above;

 - FreeBSD kgss (ditto) does not implement gss_add_cred() (nor kgss_add_cred());

 - Linux kernel gss: does not implement any GSS functions dealing with creds,

but clearly the behavior you (Viktor) and I prefer cannot be surprising:
because if gss_add_cred() does anything other than fail, then it's doing
what you and I want.

Second, the "pleasant" behavior is clearly better.  Sure, one can't rely
on it, but then, neither could one rely on the default credential
behavior, and that behavior always errors out in Heimdal, GNU, and
gsskrb5.

Incidentally, are there other implementations to check?  I don't think
so.  I think I've checked all the open-source ones (even "PGSSAPI",
which also doesn't implement gss_add_cred()).  I know of none that are
not open source other than Solaris' (whose lineage is the same as
Illumos').

Nico
--