Re: [Ace] Using OAuth and ACE-OAuth with MQTT

Seitz Ludwig <ludwig.seitz@combitech.se> Tue, 17 March 2020 11:41 UTC

Return-Path: <ludwig.seitz@combitech.se>
X-Original-To: ace@ietfa.amsl.com
Delivered-To: ace@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2189D3A1D77 for <ace@ietfa.amsl.com>; Tue, 17 Mar 2020 04:41:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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 V86w84h46YxS for <ace@ietfa.amsl.com>; Tue, 17 Mar 2020 04:41:43 -0700 (PDT)
Received: from weald.air.saab.se (weald.air.saab.se [136.163.212.3]) (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 648C33A1D72 for <ace@ietf.org>; Tue, 17 Mar 2020 04:41:42 -0700 (PDT)
Received: from mailhub2.air.saab.se ([136.163.213.5]) by weald.air.saab.se (8.14.4/8.14.4) with ESMTP id 02HBfYgh014719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 17 Mar 2020 12:41:34 +0100
Received: from corpappl16596.corp.saab.se (corpappl16596.corp.saab.se [10.12.12.128]) by mailhub2.air.saab.se (8.13.8/8.13.8) with ESMTP id 02HBf2dQ004014 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 17 Mar 2020 12:41:02 +0100
Received: from corpappl16593.corp.saab.se (10.12.12.125) by corpappl16596.corp.saab.se (10.12.12.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Tue, 17 Mar 2020 12:41:02 +0100
Received: from corpappl16593.corp.saab.se ([fe80::b4c9:ca69:a80d:fa3]) by corpappl16593.corp.saab.se ([fe80::b4c9:ca69:a80d:fa3%7]) with mapi id 15.01.1847.007; Tue, 17 Mar 2020 12:41:02 +0100
From: Seitz Ludwig <ludwig.seitz@combitech.se>
To: Hannes Tschofenig <Hannes.Tschofenig@arm.com>, Jim Schaad <ietf@augustcellars.com>
CC: 'Cigdem Sengul' <cigdem.sengul@gmail.com>, 'Ace Wg' <ace@ietf.org>
Thread-Topic: Using OAuth and ACE-OAuth with MQTT
Thread-Index: AQHV93e/qIYLevCHnkGnxuMjfkHI16hMoTmAgAARfGA=
Date: Tue, 17 Mar 2020 11:41:02 +0000
Message-ID: <7311eadb68474c28ba0e5065763cf750@combitech.se>
References: <005a01d5f731$193eec70$4bbcc550$@augustcellars.com> <AM0PR08MB37163CDD9FB3792242CA8B63FAFC0@AM0PR08MB3716.eurprd08.prod.outlook.com> <AM0PR08MB3716A834DFA6F07FAC325588FAF60@AM0PR08MB3716.eurprd08.prod.outlook.com>
In-Reply-To: <AM0PR08MB3716A834DFA6F07FAC325588FAF60@AM0PR08MB3716.eurprd08.prod.outlook.com>
Accept-Language: en-SE, sv-SE, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.12.13.211]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Saab-MailScanner-Information: Please contact the ISP for more information
X-Saab-MailScanner-ID: 02HBf2dQ004014
X-Saab-MailScanner: Found to be clean
X-Saab-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.344, required 5, ALL_TRUSTED -1.00, BAYES_00 -0.50, SURBL_BLOCKED 0.00, TW_MQ 0.08, TW_QT 0.08, URIBL_BLOCKED 0.00)
X-Saab-MailScanner-From: ludwig.seitz@combitech.se
X-Saab-MailScanner-Watermark: 1585050063.8925@EJUXel+zhFUyE8IYumPqNA
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (weald.air.saab.se [136.163.212.3]); Tue, 17 Mar 2020 12:41:34 +0100 (CET)
Archived-At: <https://mailarchive.ietf.org/arch/msg/ace/X06RzmQWGnbffKKPyWBFlrYa2Q8>
Subject: Re: [Ace] Using OAuth and ACE-OAuth with MQTT
X-BeenThere: ace@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Authentication and Authorization for Constrained Environments \(ace\)" <ace.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ace>, <mailto:ace-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ace/>
List-Post: <mailto:ace@ietf.org>
List-Help: <mailto:ace-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ace>, <mailto:ace-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Mar 2020 11:41:48 -0000

I'm sorry if I'm being daft here, but what is the difference to 
https://tools.ietf.org/html/draft-ietf-ace-oauth-authz-33#section-8.5  ?

/Ludwig

-----Original Message-----
From: Hannes Tschofenig <Hannes.Tschofenig@arm.com> 
Sent: den 17 mars 2020 12:38
To: Jim Schaad <ietf@augustcellars.com>; Seitz Ludwig <ludwig.seitz@combitech.se>
Cc: 'Cigdem Sengul' <cigdem.sengul@gmail.com>; 'Ace Wg' <ace@ietf.org>
Subject: RE: Using OAuth and ACE-OAuth with MQTT

Hi Jim, Hi Ludwig,

I created a PR at https://github.com/hannestschofenig/ace-oauth-params/pull/1

I wasn't quite sure how to set two registry values, namely (a) Additional Token Endpoint Response Parameters and (b) HTTP Authentication Scheme(s).
For (a) I used "none" and for (b) I used "Bearer".

Ciao
Hannes

-----Original Message-----
From: Hannes Tschofenig
Sent: Wednesday, March 11, 2020 8:34 AM
To: Jim Schaad <ietf@augustcellars.com>
Cc: 'Cigdem Sengul' <cigdem.sengul@gmail.com>; 'Ace Wg' <ace@ietf.org>
Subject: RE: Using OAuth and ACE-OAuth with MQTT

Hi Jim,

I believe you are right that the functionality is supported. In retrospect it is good that Ludwig just imported the key transport necessary functionality with draft-ietf-ace-oauth-params-12. Hence, you can do pretty everything defined in draft-ietf-oauth-pop-key-distribution with the ACE-OAuth framework. Only one piece is missing in the IANA consideration section, namely the registration of "pop" in the "OAuth Access Token Types" registry. That needs to be added. Not a big deal though. I will send text to Ludwig.

I am happy.

Ciao
Hannes

PS: I am not sure whether the authentication mechanisms defined in draft-ietf-ace-mqtt-tls-profile are actually sound. Maybe I should do a formal analysis.

-----Original Message-----
From: Jim Schaad <ietf@augustcellars.com>
Sent: Wednesday, March 11, 2020 12:10 AM
To: Hannes Tschofenig <Hannes.Tschofenig@arm.com>
Cc: 'Cigdem Sengul' <cigdem.sengul@gmail.com>; 'Ace Wg' <ace@ietf.org>
Subject: Using OAuth and ACE-OAuth with MQTT

Hannes,

This is going to be a long email and I hope that I do not get too many things wrong in the process of getting it written up.

So the question that you raised is can the current MQTT profile use the existing OAuth and ACE-OAuth protocols.  My assertion is that the answer is yes and I will walk through the two different protocols in order to demonstrate this.  For simplicilty I am only going to deal with one of the TLS configurations that the MQTT profile envisions.

For TLS authentication, the server is to be validated by using an X.509 certificate and there is to be a method for the client to be able to associate the identifier in the certificate with the OAuth token request.
This I assume is a well understood problem in the OAuth WG.  The client is not authenticated to the server by TLS, this is deferred to MQTT protocol.
When using ACE-OAuth, this is generally going to be tied through the audience field in some method.

The format of the scope field is defined in the MQTT document and the AS will need to be able to parse that field and do the proper enforcement.  I think this different than what a normal OAuth AS does where the scope is a single value rather than a composite value.

The key which is placed in the token is going to be an asymmetric signing key.  This is the standard thing for OAuth.  At some point in the future it might be nice to allow for symmetric keys to be sent out, but for now the ACE-OAuth is sufficient for dealing with that case.

Using OAuth

The client makes a request to an OAuth authorization server for a token.
The grant_type for the token is going to be "client_credentials", the scope is a text string defined by the MQTT profile document.  Authorization is needed for the connection.  My assumption is that this is now normally done by the use of HTTPS rather than something like basic authentication.

**************************************

POST /token HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&
scope=publish_topic1/topic2%2Epublish_topic3/+/stats%2Esubscribe_topic3/#

**************************************

The AS response with a standard message

**************************************

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
 "access_token":"..... JWT token ......",  "token_type":"bearer",
 "expires_in": 3600,
}

**************************************

The client now connects to the MQTT server using TLS, validating the certificate of the server against it's trust anchors and the "known" name of the MQTT server.

The client now sends an MQTT CONNECT message to the server passing the JWT token in as part of the Authentication Data (section 2.2.4 of the MQTT document).


****************************************************************

Using ACE-OAuth

*******

POST /token HTTP/1.1
Host: server.example.com
Content-Type: application/ace+json

{
  "scope": "publish_topic1/topic2 publish_topic3/+/stats subscribe_topic3/#",
  "audience": "mqtts://mqtt.example.com"
}

******

For ACE-OAuth, the default value of grant_type is client_credentials so that parameter is omitted.


*****

HTTP/1.1 200 OK
Content-Type: application/ace+json

{
 "access_token":"..... JWT token ......",
 "expires_in": 3600,
 "ace_profile" : "mqtt_tls"
}



As can be seen, there are only minimal differences between what is sent out between the Vanilla and the ACE version of OAuth.  In both cases it is assumed that the client is going to know which asymmetric key is going to be used.  There are a couple of differences however:

1.  I have used the value of "bearer" for "token_type" in OAuth because that seemed to me to be the one which mapped to the usage in a better manner.
The OAuth-ACE framework however registers the value of "PoP" and specifies it as the default value.  It may make more sense to use that value in the OAuth case as well.

2.  In the ACE-OAuth case, we can return a key to the user and thus be able to do symmetric keys as well.  If you are already doing TLS and validating signatures that way I would expect that this is not going to be a common case.

3.  In the ACE-OAuth case, it is possible to return information about the TLS key that the server would be using.  This would allow for situations were the MQTT TLS connection is not doing certificate chain validation, but instead using information passed in the rs_cnf field to validate either the public key or the certificate directly.


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.