Re: [TLS] Application layer interactions and API guidance

Ilari Liusvaara <ilariliusvaara@welho.com> Fri, 07 October 2016 22:00 UTC

Return-Path: <ilariliusvaara@welho.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 41AE3129418 for <tls@ietfa.amsl.com>; Fri, 7 Oct 2016 15:00:40 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.896
X-Spam-Level:
X-Spam-Status: No, score=-4.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-2.996] 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 yw_yVwiflwNf for <tls@ietfa.amsl.com>; Fri, 7 Oct 2016 15:00:37 -0700 (PDT)
Received: from welho-filter2.welho.com (welho-filter2.welho.com [83.102.41.24]) by ietfa.amsl.com (Postfix) with ESMTP id C149D129431 for <tls@ietf.org>; Fri, 7 Oct 2016 15:00:36 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by welho-filter2.welho.com (Postfix) with ESMTP id 17BE713229; Sat, 8 Oct 2016 01:00:35 +0300 (EEST)
X-Virus-Scanned: Debian amavisd-new at pp.htv.fi
Received: from welho-smtp1.welho.com ([IPv6:::ffff:83.102.41.84]) by localhost (welho-filter2.welho.com [::ffff:83.102.41.24]) (amavisd-new, port 10024) with ESMTP id J4Q8b-gmMF2D; Sat, 8 Oct 2016 01:00:34 +0300 (EEST)
Received: from LK-Perkele-V2 (87-100-237-87.bb.dnainternet.fi [87.100.237.87]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by welho-smtp1.welho.com (Postfix) with ESMTPSA id 84EF2C4; Sat, 8 Oct 2016 01:00:34 +0300 (EEST)
Date: Sat, 8 Oct 2016 01:00:28 +0300
From: Ilari Liusvaara <ilariliusvaara@welho.com>
To: Watson Ladd <watsonbladd@gmail.com>
Message-ID: <20161007220028.GA10288@LK-Perkele-V2.elisa-laajakaista.fi>
References: <CACsn0c=B0dVGaXKawW5DJCUfJfqFFHkk_cZCzjzKs53n4UKLpg@mail.gmail.com> <20160924054730.GB7594@LK-Perkele-V2.elisa-laajakaista.fi> <CACsn0cnpEq_00R37WZOm39dg9dXKSkpNjGt3FWg0uLgTEkwtRw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <CACsn0cnpEq_00R37WZOm39dg9dXKSkpNjGt3FWg0uLgTEkwtRw@mail.gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
Sender: ilariliusvaara@welho.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/Y1d3CF4icwa3R1C57gDUQjpS_9U>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] Application layer interactions and API guidance
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Oct 2016 22:00:40 -0000

On Fri, Oct 07, 2016 at 01:41:14PM -0700, Watson Ladd wrote:
> On Fri, Sep 23, 2016 at 10:47 PM, Ilari Liusvaara
> <ilariliusvaara@welho.com>; wrote:
> >
> > Also, it is very likely that 0-RTT would need its own read API, because
> > it is pretty unlikely that existing API could be safely retrofitted
> > or even purpose-built unified API be designed that isn't just asking
> > for security problems via mixing 0-RTT and 1-RTT data.
> 
> Yes. In particular I think the TLS state machine transitions need to
> be ordered with respect to the arrival and sending of data. The
> challenge for a multithreaded program (yes, some programs have
> multiple threads sending and receiving at once) is making this make
> sense, or even a single-threaded program where the TLS stack can
> change state at times not visible to the sending thread. Maybe there
> is some slop here, like 0-RTT can become 1-RTT on send, but this
> raises all sorts of problems for receiving. I think we need to require
> separation in the API.

0-RTT can't be allowed to become 1-RTT on send (unless it is auto-
retransmit, which needs to be disableable, as sometimes that just plain
won't work).

This impiles that the application always needs to explicitly signal
the end of 0-RTT data, even just to abort sending it.

> > (This is the reason one needs to be especially careful when combining
> > dynamic client certificates with HTTP/2... Basically, it can not be
> > done safely without coordination on application layer).
> >
> > One likely wants application protocol to be able to specify part of
> > or the entiere request context and to extract that part in the other
> > end when requesting a certificate selection. This is to allow putting
> > part of coordination data into the request itself. However, this is not
> > sufficient for e.g. HTTP/2 signaling, so more needs to be exchanged at
> > application layer.
> >
> > And then upon completion of the authentication (either successful or
> > explicitly rejected), signal the application with the new certificate
> > chain and the context the request had.
> 
> This is going to require major changes to APIs and to the HTTP/2
> layer. It also interacts with token binding, whee! My question then
> becomes one of what we actually need: can we assume that leakage
> between authentication contexts over a single session is safe because
> all contexts represent the same principal, by restricting the usages,
> or is this overly restrictive?

Yes, it is going to reuqire such changes.

And you absolutely can not assume that all contexts present the same
principal.

And as I said, in multiplexed protocol like HTTP/2, you need application-
level coordination on top. TLS just can't do that.

> When we have multiple requests and replies in flight and the
> authentication state changes, things get nasty. If we think of TLS as
> sending a stream of events including authentication changes to the
> application, this fits the semantics of the TLS draft as I understand
> them to be, but does not necessarily fit what application protocols
> want. There might be a semantic mismatch here requiring reworking of
> one or another part.

Also, some applications presumably want the events done synchronously,
so they don't move with data reads.


Basically, post-handshake auth is heckuva nasty problem.


-Ilari