Internet-Draft | pubsub-profile | December 2021 |
Palombini & Sengul | Expires 2 July 2022 | [Page] |
This specification defines an application profile for authentication and authorization for Publishers and Subscribers in a constrained pub-sub scenario, using the ACE framework. This profile relies on transport layer or application layer security to authorize the pub-sub clients to the broker. Moreover, it describes the use of application layer security to protect the content of the pub-sub client message exchange through the broker. The profile covers pub-sub scenarios using either the Constrained Application Protocol (CoAP) [I-D.ietf-core-coap-pubsub] or the Message Queue Telemetry Transport (MQTT) [MQTT-OASIS-Standard-v5] protocol.¶
Source for this draft and an issue tracker can be found at https://github.com/ace-wg/pubsub-profile.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 2 July 2022.¶
Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
In the publish-subscribe (pub-sub) scenario, devices with limited reachability communicate via a broker, which enables store-and-forward messaging between the devices. This document defines a way to authorize pub-sub clients using the ACE framework [I-D.ietf-ace-oauth-authz] to obtain the keys for protecting the content of their pub-sub messages when communicating through the broker. The pub-sub communication using the Constrained Application Protocol (CoAP) [RFC7252] is specified in [I-D.ietf-core-coap-pubsub], while the one using MQTT is specified in [MQTT-OASIS-Standard-v5]. This document gives detailed specifications for MQTT and CoAP pub-sub, but can easily be adapted for other transport protocols as well.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].¶
Readers are expected to be familiar with the terms and concepts described in [I-D.ietf-ace-oauth-authz], [I-D.ietf-ace-key-groupcomm]. In particular, analogously to [I-D.ietf-ace-oauth-authz], terminology for entities in the architecture such as Client (C), Resource Server (RS), and Authorization Server (AS) is defined in OAuth 2.0 [RFC6749] and [I-D.ietf-ace-actors], and terminology for entities such as the Key Distribution Center (KDC) and Dispatcher in [I-D.ietf-ace-key-groupcomm].¶
Readers are expected to be familiar with terms and concepts of pub-sub group communication, as described in [I-D.ietf-core-coap-pubsub], or MQTT [MQTT-OASIS-Standard-v5].¶
The objective of this document is to specify how to authorize nodes, provide keys, and protect a pub-sub communication, using [I-D.ietf-ace-key-groupcomm], which expands from the ACE framework ([I-D.ietf-ace-oauth-authz]), and transport profiles ([I-D.ietf-ace-dtls-authorize], [I-D.ietf-ace-oscore-profile], [I-D.ietf-ace-mqtt-tls-profile]). The pub-sub communication protocol can be based on CoAP, as described in [I-D.ietf-core-coap-pubsub], MQTT [MQTT-OASIS-Standard-v5] , or other transport. Note that both Publishers and Subscribers use the same pub-sub communication protocol and the same transport profile of ACE in their interaction with the broker. However, all clients need to use CoAP when communicating to the KDC.¶
The architecture of the scenario is shown in Figure 1.¶
Publisher or Subscriber Clients is referred to as Client in short. A Client can act both as a publisher and a subscriber, publishing to some topics, and subscribing to others. However, for the simplicity of presentation, this profile describes Publisher and Subscriber clients separately. The Broker acts as the ACE RS, and also corresponds to the Dispatcher in [I-D.ietf-ace-key-groupcomm]).¶
This profile specifies:¶
These exchanges aim at setting up two different security associations. On the one hand, the Publisher and the Subscriber clients have a security association with the Broker, so that, as the ACE RS, it can verify that the Clients are authorized (Security Association 1). On the other hand, the Publisher has a security association with the Subscriber, to protect the publication content (Security Association 2) while sending it through the broker. The Security Association 1 is set up using AS and a transport profile of [I-D.ietf-ace-oauth-authz], the Security Association 2 is set up using AS, KDC and [I-D.ietf-ace-key-groupcomm]. Note that, given that the publication content is protected, the Broker MAY accept unauthorised Subscribers. In this case, the Subscriber client can skip setting up Security Association 1 with the Broker and connect to it as an anonymous client to subscribe to topics of interest at the Broker.¶
After receiving a token from the AS, the Client posts the token to the KDC (Section 3.3 [I-D.ietf-ace-key-groupcomm]). In addition to the token post, a Subscriber Client MAY ask for the format of the public keys in the group, used for source authentication, as well as any other group parameters. In this case, the message MUST have Content-Format set to "application/ace+cbor" defined in Section 8.16 of [I-D.ietf-ace-oauth-authz]. The message payload MUST be formatted as a CBOR map, which MUST include the access token and the 'sign_info' parameter. The details for the 'sign_info' parameter can be found in Section 3.3 of [I-D.ietf-ace-key-groupcomm]. Alternatively, the joining node may retrieve this information by other means as described in [I-D.ietf-ace-key-groupcomm].¶
The KDC verifies the token to check of the Client is authorized to access the topic with the requested role. After successful verification, the Client is authorized to receive the group keying material from the KDC and join the group. The KDC replies to the Client with a 2.01 (Created) response, using Content-Format "application/ace+cbor". The payload of the 2.01 response is a CBOR map.¶
A Publisher Client MUST send its own public key to the KDC when joining the group. Since the access token from a Publisher Client will have "pub" role, the KDC MUST include 'kdcchallenge' in the CBOR map, specifying a dedicated challenge N_S generated by the KDC. The Client uses this challenge to prove possession of its own private key (see [I-D.ietf-ace-key-groupcomm] for details).¶
In the next step, a joining node MUST have a secure communication association established with the KDC, before starting to join a group under that KDC. Possible ways to provide a secure communication association are described in the DTLS transport profile [I-D.ietf-ace-dtls-authorize] and OSCORE transport profile [I-D.ietf-ace-oscore-profile] of ACE.¶
After establishing a secure communication, the Client sends a Joining Request to the KDC as described in Section 4.3 of [I-D.ietf-ace-key-groupcomm]. More specifically, the Client sends a POST request to the /ace-group/GROUPNAME endpoint on KDC, with Content-Format "application/ace-groupcomm+cbor" that MUST contain in the payload (formatted as a CBOR map, Section 4.1.2.1 of [I-D.ietf-ace-key-groupcomm]):¶
TODO: Check 'cnonce'¶
Note that for a Subscriber-only Client, the Joining Request MUST NOT contain the 'client_cred parameter', the role element in the 'scope' parameter MUST be set to "sub". The Subscriber MUST have access to the public keys of all the Publishers; this MAY be achieved in the Joining Request by using the parameter 'get_pub_keys' encoding the CBOR simple value 'null' (0xf6) (as described in Section 4.3.1 of [I-D.ietf-ace-key-groupcomm]) to retrieve the public keys of all the Publishers.¶
If the 'client_cred' parameter is present, KDC stores the public key of the Client. Note that the alg parameter in the 'client_cred' COSE_Key MUST be a signing algorithm, as defined in [I-D.ietf-cose-rfc8152bis-algs] [I-D.ietf-cose-rfc8152bis-struct], and that it is the same algorithm used to compute the signature sent in 'client_cred_verify'.¶
The KDC responds with a Joining Response, which has the Content-Format "application/ace-groupcomm+cbor". The payload (formatted as a CBOR map) MUST contain the following fields from the Joining Response (Section 4.3.1 of [I-D.ietf-ace-key-groupcomm]):¶
'key', which contains a "COSE_Key" object (defined in [I-D.ietf-cose-rfc8152bis-algs][I-D.ietf-cose-rfc8152bis-struct], containing:¶
An example of the Joining Request and corresponding Response for a CoAP Publisher using CoAP and CBOR is specified in Figure 6 and Figure 7, where SIG is a signature computed using the private key associated to the public key and the algorithm in 'client_cred'.¶
An example of the payload of a Joining Request and corresponding Response for a Subscriber using CoAP and CBOR is specified in Figure 8 and Figure 9.¶
ToDO: Fix Example for COSE_Key for public key¶
(D) corresponds to the publication of a topic on the Broker. The publication (the resource representation) is protected with COSE ([I-D.ietf-cose-rfc8152bis-algs] [I-D.ietf-cose-rfc8152bis-struct]) by the Publisher. The (E) message is the subscription of the Subscriber. The subscription MAY be unprotected. The (F) message is the response from the Broker, where the publication is protected with COSE by the Publisher.¶
The flow graph is presented below for CoAP. The message flow is similar for MQTT, where PUT corresponds to a PUBLISH message, and GET corresponds to a SUBSCRIBE message. Whenever a Client publishes a new message, the Broker sends this message to all valid subscribers.¶
The Publisher uses the symmetric COSE Key received from the KDC (Section 4) to protect the payload of the PUBLISH operation (Section 4.3 of [I-D.ietf-core-coap-pubsub] and [MQTT-OASIS-Standard-v5]). Specifically, the COSE Key is used to create a COSE_Encrypt0 object with algorithm specified by KDC. The Publisher uses the private key corresponding to the public key sent to the KDC in exchange B (Section 4) to countersign the COSE Object as specified in [I-D.ietf-cose-rfc8152bis-algs] [I-D.ietf-cose-rfc8152bis-struct]. The payload is replaced by the COSE object before the publication is sent to the Broker.¶
The Subscriber uses the 'kid' in the 'countersignature' field in the COSE object to retrieve the right public key to verify the countersignature. It then uses the symmetric key received from KDC to verify and decrypt the publication received in the payload from the Broker (in the case of CoAP the publication is received by the CoAP Notification and for MQTT, it is received as a PUBLISH message from the Broker to the subscribing client).¶
The COSE object is constructed in the following way:¶
The unprotected Headers MUST contain the Partial IV, with value a sequence number that is incremented for every message sent, and the counter signature that includes:¶
The 'external_aad' is an empty string.¶
An example is given in Figure 12:¶
The encryption and decryption operations are described in [I-D.ietf-cose-rfc8152bis-algs] [I-D.ietf-cose-rfc8152bis-struct].¶
This section summarises the CoAP and MQTT specific pub-sub communications, and considerations respectively.¶
A CoAP Pub-Sub Client and Broker use an ACE transport profile such as DTLS [I-D.ietf-ace-dtls-authorize], OSCORE [I-D.ietf-ace-oscore-profile].¶
As shown in Figure 1, (A) is an Access Token Request and Response exchange between Publisher and Authorization Server to retrieve the Access Token and RS (Broker) Information. As specified, the Client has the role of a CoAP client, the Broker has the role of the CoAP server.¶
(B) corresponds to the retrieval of the keying material to protect the publication end-to-end (see Section 5.1), and uses [I-D.ietf-ace-key-groupcomm]. The details are defined in Section 4.¶
(C) corresponds to the exchange between the Client and the Broker, where the Client sends its access token to the Broker and establishes a secure connection with the Broker. Depending on the Information received in (A), this can be for example DTLS handshake, or other protocols. Depending on the application, there may not be the need for this set up phase: for example, if OSCORE is used directly. Note that, in line with what defined in the ACE transport profile used, the access token includes the scope (i.e. pubsub topics on the Broker) the Publisher is allowed to publish to. For implementation simplicity, it is RECOMMENDED that the ACE transport profile used.¶
After the previous phases have taken place, the pub-sub communication can commence. The operations of publishing and subscribing are defined in [I-D.ietf-core-coap-pubsub].¶
The steps MQTT clients go through are similar to the CoAP clients as described in Section 6.1. The payload that is carried in MQTT messages will be protected using COSE.¶
In MQTT, topics are organised as a tree, and in the [I-D.ietf-ace-mqtt-tls-profile] 'scope' captures permissions for not a single topic but a topic filter. Therefore, topic names (i.e., group names) may include wildcards spanning several levels of the topic tree. Hence, it is important to distinguish application groups and security groups defined in [I-D.ietf-core-groupcomm-bis]. An application group has relevance at the application level - for example, in MQTT an application group could denote all topics stored under ""home/lights/". On the other hand, a security group is a group of endpoints that each store group security material to exchange secure communication within the group. The group communication in [I-D.ietf-ace-key-groupcomm] refers to security groups. ToDo: Give a more complete example¶
For an MQTT client we envision the following steps to take place:¶
In the profile described above, the Publisher and Subscriber use asymmetric crypto, which would make the message exchange quite heavy for small constrained devices. Moreover, all Subscribers must be able to access the public keys of all the Publishers to a specific topic to be able to verify the publications. Such a database could be set up and managed by the same entity having control of the key material for that topic, i.e. KDC.¶
An application where it is not critical that only authorized Publishers can publish on a topic may decide not to make use of the asymmetric crypto and only use symmetric encryption/MAC to confidentiality and integrity protection of the publication. However, this is not recommended since, as a result, any authorized Subscribers with access to the Broker may forge unauthorized publications without being detected. In this symmetric case the Subscribers would only need one symmetric key per topic, and would not need to know any information about the Publishers, that can be anonymous to it and the Broker.¶
Subscribers can be excluded from future publications through re-keying for a certain topic. This could be set up to happen on a regular basis, for certain applications. How this could be done is out of scope for this work.¶
The Broker is only trusted with verifying that the Publisher is authorized to publish, but is not trusted with the publications itself, which it cannot read nor modify. In this setting, caching of publications on the Broker is still allowed.¶
TODO: expand on security and privacy considerations¶
The following registrations are done for the "ACE Groupcomm Profile" Registry following the procedure specified in [I-D.ietf-ace-key-groupcomm].¶
Note to RFC Editor: Please replace all occurrences of "[[This document]]" with the RFC number of this specification and delete this paragraph.¶
The following registrations are done for the ACE Groupcomm Key Registry following the procedure specified in [I-D.ietf-ace-key-groupcomm].¶
Note to RFC Editor: Please replace all occurrences of "[[This document]]" with the RFC number of this specification and delete this paragraph.¶
Name: COSE_Key¶
Key Type Value: TBD¶
Profile: coap_pubsub_app, mqtt_pubsub_app¶
Description: COSE_Key object¶
References: [I-D.ietf-cose-rfc8152bis-algs] [I-D.ietf-cose-rfc8152bis-struct], [[This document]]¶
This section lists the specifications on this profile based on the requirements defined in Appendix A of [I-D.ietf-ace-key-groupcomm]¶
The author wishes to thank Ari Keraenen, John Mattsson, Ludwig Seitz, Goeran Selander, Jim Schaad and Marco Tiloca for the useful discussion and reviews that helped shape this document.¶