Re: [kitten] AD Review: draft-ietf-kitten-rfc5653bis-04

Benjamin Kaduk <kaduk@mit.edu> Tue, 18 July 2017 00:22 UTC

Return-Path: <kaduk@mit.edu>
X-Original-To: kitten@ietfa.amsl.com
Delivered-To: kitten@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C0C3B131D02 for <kitten@ietfa.amsl.com>; Mon, 17 Jul 2017 17:22:27 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.202
X-Spam-Level:
X-Spam-Status: No, score=-4.202 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=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 X5xDya_D59mb for <kitten@ietfa.amsl.com>; Mon, 17 Jul 2017 17:22:25 -0700 (PDT)
Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu [18.9.25.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8766D131CFC for <kitten@ietf.org>; Mon, 17 Jul 2017 17:22:25 -0700 (PDT)
X-AuditID: 1209190f-81fff70000001f0c-ad-596d54beed4e
Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id 37.C3.07948.EB45D695; Mon, 17 Jul 2017 20:22:24 -0400 (EDT)
Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id v6I0ML9U002938; Mon, 17 Jul 2017 20:22:22 -0400
Received: from kduck.kaduk.org (24-107-191-124.dhcp.stls.mo.charter.com [24.107.191.124]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id v6I0MHwi015945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 17 Jul 2017 20:22:20 -0400
Date: Mon, 17 Jul 2017 19:22:17 -0500
From: Benjamin Kaduk <kaduk@mit.edu>
To: Eric Rescorla <ekr@rtfm.com>
Cc: Weijun Wang <weijun.wang@oracle.com>, kitten <kitten@ietf.org>
Message-ID: <20170718002217.GL75962@kduck.kaduk.org>
References: <CABcZeBPG-xqYj+FrPfJofvpLP-UD2PA52NrgxR_Y4nzwY4S8Uw@mail.gmail.com> <DC114106-3DAA-4CFC-B83D-EA277036AEAE@oracle.com> <CABcZeBP6+dtxoR9eib2Ymhv7fBORMnw4M+NSKN-7WG3AowVG0Q@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CABcZeBP6+dtxoR9eib2Ymhv7fBORMnw4M+NSKN-7WG3AowVG0Q@mail.gmail.com>
User-Agent: Mutt/1.8.3 (2017-05-23)
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplleLIzCtJLcpLzFFi42IR4hTV1j0Qkhtp0HZQyGLF63PsFkc3r2Kx +Lp0A7MDs8eSJT+ZPD4+vcXiMflxG3MAcxSXTUpqTmZZapG+XQJXxrTba5gK9jlXtKz/ydzA eNyki5GTQ0LAROLzjImMXYxcHEICi5kkTjXeYwZJCAlsZJSY0McMkbjKJHF6/xlWkASLgKrE 2cZHbCA2m4CKREP3ZbAGEQEFiV9/TrCA2MwCThKrZl1hBLGFBRwkti9bDVbDC7Tt8s1Z7BBD TzNKbH5xih0iIShxcuYTqGZ1iT/zLgE1cADZ0hLL/3FAhOUlmrfOBpvDKRAo8Wf5Y7BWUQFl iXn7VrFNYBSchWTSLCSTZiFMmoVk0gJGllWMsim5Vbq5iZk5xanJusXJiXl5qUW6Jnq5mSV6 qSmlmxjBoS7Jv4NxToP3IUYBDkYlHl6DfTmRQqyJZcWVuYcYJTmYlER5L7JlRwrxJeWnVGYk FmfEF5XmpBYfYpTgYFYS4b1imhspxJuSWFmVWpQPk5LmYFES5xXXaIwQEkhPLEnNTk0tSC2C ycpwcChJ8P4OBmoULEpNT61Iy8wpQUgzcXCCDOcBGr4WpIa3uCAxtzgzHSJ/ilFRSpy3HiQh AJLIKM2D6wWlIons/TWvGMWBXhHmrQKp4gGmMbjuV0CDmYAGC/vmgAwuSURISTUwxngvstf6 Vbg8N8MhWH/OQ9tr/fYpG9ZKhlq+FvhS3Nq8dMHhhJeuAes+WK1P/7nDtKykMItJ9+xeX3mp nCfcl/gTjxi1n/5/8e/it53GH4Uu3hfZVNgWstmWa82phs1nl9nfZDGbtEAu5a7jRLmMwIcL zm18/15AZTlP2zrF0KN366f7Tl9tr8RSnJFoqMVcVJwIALhbA8EgAwAA
Archived-At: <https://mailarchive.ietf.org/arch/msg/kitten/m9c87mZyya5Mm6q872k6lKl_oKc>
Subject: Re: [kitten] AD Review: draft-ietf-kitten-rfc5653bis-04
X-BeenThere: kitten@ietf.org
X-Mailman-Version: 2.1.22
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: <https://mailarchive.ietf.org/arch/browse/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: Tue, 18 Jul 2017 00:22:28 -0000

On Fri, Jul 14, 2017 at 08:57:32AM -0700, Eric Rescorla wrote:
> On Wed, Jul 12, 2017 at 8:41 PM, Weijun Wang <weijun.wang@oracle.com> wrote:
> 
> > Hi Ekr
> >
> > Please read my answers below to your original questions.
> >
> > > On Jun 18, 2017, at 2:23 AM, Eric Rescorla <ekr@rtfm.com> wrote:
> > >
> > > This document seems generally sound. There are some things about this
> > > API that confused/surprised me and seem perhaps unwise, but given that
> > > this is a bis, I will mostly confine my review to mostly calling them
> > > out and asking you to make sure I understand and that the document is
> > > clear.
> > >
> > > OVERALL
> > > 1. What is a fatal error?
> > > The document describes exceptions as indicating "fatal errors".
> > > What does this mean for the state of the context. For instance,
> > > if I receive an exception from initSecContext(), does that mean
> > > that it is no longer possible to initiate it? Your example code
> > > seems to treat them as fatal for the context. What happens
> > > if I try to use a context after such an event?
> >
> > I’ll add a paragraph in "5.12.  Error Reporting” explaining whether the
> > context is useable after an exception is thrown, for context establishment
> > and per-message calls, respectively. Something like
> >
> > +If an exception is thrown during context establishment, the context
> > +negotiation has failed and the GSSContext object must be abandoned.
> > +If it is thrown in a per-message call, the context can remain useful.
> >
> > >
> > >
> > > 2. How do I enforce properties for received messages?
> > > I see that I can request services for context initialization
> > > (requestConf), and that I can check whether a given message
> > > was encrypted (getPrivacy) but it's not clear to me if this
> > > causes the API to enforce these rules for tokens that I
> > > receive. Is that possible or do I just need to check?
> >
> > You would have to check. Even if an established security context already
> > has its getConfState() being true, one can still wrap a message with
> > privacy state set to false and the peer will unwrap it with success. If the
> > peer insists only encrypted messages are allowed, she should always check.
> >
> > This is already documented in 6.4.10.
> >
> > >
> > > 3. Are the request* flags() hard limits? E.g., if I do
> > > requestMutualAuth() do I get it or fail?
> >
> > The method does not fail itself (i.e. does not throws an exception) and
> > you need to check the result with those getXyzState() methods after the
> > context is established.
> >
> > I can add a paragraph in S 5.9, something like:
> >
> > +If any retrieved attribute does not match the desired value
> > +but it is necessary for the application protocol, the application should
> > +destroy the security context and not use it for application traffic.
> > +Otherwise, at this point, the context can be used by the application to
> > +apply cryptographic services to its data.
> >
> 
> Sorry, I mean does the handshake fail? Or do you just hace to check.

You have to check.  The GSS-API has always been a request-and-check
type of API.

> 
> > 4. It's a little unusual to have a structure where you keep
> > > calling initSecContext or acceptContext() repeatedly. In
> > > most APIs you would do like "setRole(Server)" or
> > > "setRoleClient(), and then "Handshake().
> >
> > Sorry but this is how GSS-API works now.
> >
> > >
> > > DETAIL
> > > S 6.1.16.
> > > Can addProviderAtFront() be used to add new providers which
> > > the API would not normally use at all?
> >
> > No, 6.1.16 already had
> >
> >    Only when the indicated provider does not support
> >    the needed mechanism should the GSSManager move on to a different
> >    provider.
> >
> > I think this implies that a new provider added might be used at all.
> >
> 
> That doesn't seem very clear to me. My point is you might have defaults and
> then add new omnes.

I think you could use this to slot in your custom provider that was not
part of the system Java implementation, yes.
But I don't interact with the Java GSS stuff very much.


> > > EDITORIAL
> > > S 3.3.
> > > Please do not use the phrase "cryptographic checksum", I recognize
> > > that the terminology in this document is idiosyncratic because of
> > > age, but this isn't really a modern term. Typically
> > > we would now use "authentication tag" or "integrity tag”
> >
> > GSS-API is still using the Checksum word everywhere (RFC 3961’s title is
> > “Encryption and Checksum Specifications for Kerberos 5"). I think the
> > cryptographic word is added like we used in cryptographic random number
> > generator, which means it’s stronger than CRC etc. I would like to continue
> > using this word.
> >
> 
> At least add a parenthetical, or som other note, because this is not a term
> others can understand.

I agree; it's probably worth putting in a "(authentication tag)"
parenthetical.  (The parallel to a Kerberos Checksum remains only a
parallel, as Kerberos is only one of many GSS mechanisms.)


> > > S 5.3.
> > > gss_release_cred() is just eager, right? In any case the data will
> > > be cleaned up on GC? In any case you should make this clear.
> >
> > gss_release_cred() is eager, and there is no other guarantee the data can
> > be automatically cleaned up. Even if GC cleaned up the GSSCredential
> > object, there might be unreleased handles underneath.
> >
> > S 6.3 already has
> >
> >    When the credential is no longer needed, the application should call
> > the dispose (equivalent to gss_release_cred) method to release any
> > resources held by the credential object and to destroy any
> > cryptographically sensitive information.
> >
> > Do you think it’s necessary to append something like “An implementation
> > should not rely on garbage control or a finalize() method to dispose a
> > credential”?
> >
> 
> Yes.
> 
> 
> 
> >
> > > S 6.1.15.
> > > I wouldn't say you are "creating a previously exported context". You
> > > are either importing it or creating a new context from a previously
> > > exported one.
> >
> > Accepted.
> >
> > >
> > > S 6.2.1.
> > >
> > >    // export and re-import the name
> > >    byte[] exportName = mechName.export();
> > >
> > >    // create a new name object from the exported buffer
> > >    GSSName newName = mgr.createName(exportName,
> > >                      GSSName.NT_EXPORT_NAME);
> > >
> > > This comment structure is confusing, because the first is just
> > > the export. I would change that.
> >
> > Accepted.
> >
> > >
> > >
> > > S 6.2.6.
> > > It's a bit unclear to me under what circumstances you can compare GSS
> > > names. I see you can do .equals() and export/memcmp, but can you
> > > compare strings? Perhaps after you canonicalize them?
> >
> > As Ben and I explained this is quite complicated. Can we not touch it in
> > this bis?
> 
> 
> The fact that it's complicated seems like more reason to explain it.

In some sense, you can always compare GSS names (in that the compare-name
function will not throw an exception), but the results may not always
match the expected behavior.  (It's too bad that RFC 6680 didn't take the
time to summarize the state of affairs when adding naming extensions.)
I don't think we should try to provide a comprehensive review of the
state of affairs in this document, nor any normative statements (that would
only apply to implementations of the Java bindings whereas the issues
apply to all GSS-API implementations).  But perhaps something like the
following would be reasonable:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

A full treatment of the behavior of GSS name comparison is outside the
scope of this work.  However, applications should note that to avoid
surpising behavior, it is best to ensure that the names being compared
are either both mechanism names for the same mechanism, or both internal
names that are not mechanism names.  This holds whether the .equals()
method is used directly, or the .export() method is used to generate byte
strings that are then compared byte-by-byte.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I considered adding a note that using .toString() and strcmp is
not recommended, but I do not think there is a non-normative statement
to be made that still provides value, and the lack of mention in the
text supplys a small disincentive to do so.

-Ben