Re: [core] Mail regarding draft-ietf-core-coap

Carsten Bormann <cabo@tzi.org> Wed, 22 July 2020 04:50 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7C6C23A0DB2 for <core@ietfa.amsl.com>; Tue, 21 Jul 2020 21:50:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.919
X-Spam-Level:
X-Spam-Status: No, score=-1.919 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 CbIcm4cFzXwK for <core@ietfa.amsl.com>; Tue, 21 Jul 2020 21:50:00 -0700 (PDT)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7C6A63A0DAF for <core@ietf.org>; Tue, 21 Jul 2020 21:49:59 -0700 (PDT)
Received: from [172.16.42.100] (p5089ae91.dip0.t-ipconnect.de [80.137.174.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4BBNLD5RqyzybQ; Wed, 22 Jul 2020 06:49:56 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <971C52B6-AFD8-4BC8-BEA4-9DA05E065217@fphcare.co.nz>
Date: Wed, 22 Jul 2020 06:49:54 +0200
Cc: "core@ietf.org" <core@ietf.org>, "draft-ietf-core-coap@ietf.org" <draft-ietf-core-coap@ietf.org>
X-Mao-Original-Outgoing-Id: 617086194.339041-842dbaf214063a75bad279ea37ec3007
Content-Transfer-Encoding: quoted-printable
Message-Id: <E68803CB-4918-45E7-ADF2-27C6056B1C7F@tzi.org>
References: <971C52B6-AFD8-4BC8-BEA4-9DA05E065217@fphcare.co.nz>
To: Kawai Wong <Kawai.Wong@fphcare.co.nz>
X-Mailer: Apple Mail (2.3608.120.23.2.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/kK2iqxjaV9nel3olQHXtM_2s4RU>
Subject: Re: [core] Mail regarding draft-ietf-core-coap
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 22 Jul 2020 04:50:04 -0000

Hi Kawai,

I’m not sure your actual question has been answered yet.  Let me try.

> On 2020-07-15, at 04:34, Kawai Wong <Kawai.Wong@fphcare.co.nz> wrote:
> 
> Hi,
> Our organisation is using CoAP and we have require a special use case to provide authorization for CoAP requests, much like how there’s an Authorization header for HTTP.

First, a matter of terminology.  The header field that HTTP calls “Authorization” actually is about authentication.  RFC 7235 says (section 4.2):

   The "Authorization" header field allows a user agent to authenticate
   itself with an origin server […]

(The authentication could then be used to derive some authorization locally in the server, but that is not further specified here.)
 
> At the moment RFC7252 does not have any mechanism in place for this.
>  
> We are wondering if we can get an Option number included for this purpose as part of the standard? e.g.
> 	• Bearer Option with opaque option format for bearer tokens; Or
> 	• Authorization Option also an opaque option format

Yes, you can register such an option.
The registration procedure is described in Section 12.2 of RFC 7252 and involves a “Designated Expert” to ensure that the option number encodes the right bits (Critical/Elective etc.; see Section 5.4.6 of RFC 7252).

So this registry has been open for seven years now.  Curiously, in all this time, nobody has registered a bearer token option.  Why might that be?

As others have hinted, a bearer token is very insecure unless it is protected by some channel or object security.  I’ll assume DTLS here, because that has been part of the CoAP security solutions from the start, but similar approaches are possible with OSCORE (RFC 8613).

So you’ll want to set up a DTLS connection to protect that bearer token.
But in that connection setup, you can already provide authentication for both client and server.  Then there is no need to tediously send a bearer token with every request, which for CoAP might more than double its size.

Why isn’t HTTP doing that?  Probably for the same reason the Authorization header isn’t really used that much in HTTP:  For the browser web, the browser wants to obtain HTML with a user interface for setting up the authentication (password entry), so it needs to have the TLS connection set up already first.  This means that in HTTP, usually only the server authenticates (you can find grueling details about what needs to be done to do client authentication in a browser with HTTPS); instead Cookies are used to eventually convert client authentication into a more or less ephemeral bearer token.

The whole bearer token concept doesn’t work that great in the IoT.
In the browser web, you have a single server (think Facebook.com — even though that is replicated a lot, it appears as a single server to the client) for which you would use the bearer token.  In the IoT, you are talking to dozens or hundreds of little servers, which have no good way to synchronize their bearer tokens (and, if they did, that would be a massive security hole with the ease with with IoT devices can be stolen).  Instead, you would negotiate one bearer token with each of them.  But if you do that, you essentially have a one-on-one shared secret that instead can be used for setting up secure DTLS connections.  You can get these secrets from protocols such as ACE-OAuth before even talking to the server.  ACE-OAuth also provides a way to provision the actual authorization information that applies to the authenticated client (e.g., using draft-bormann-core-ace-aif to build a  token that is then securely forwarded to the server).

I hope this little rationale helps, and we can stay with the situation we have since 2013: we don’t have (because we don’t need) a bearer token option registered for CoAP.

Grüße, Carsten