You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-operations/manage-mqtt-broker/howto-configure-authentication.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -332,7 +332,7 @@ For more information about enabling secure settings by configuring an Azure Key
332
332
## X.509
333
333
334
334
> [!TIP]
335
-
> For an end-to-end example of how to configure X.509 authentication, see [Tutorial: TLS, X.509 client authentication, and attribute-based access control (ABAC) authorization](./tutorial-tls-and-x509.md).
335
+
> For an end-to-end example of how to configure X.509 authentication, see [Tutorial: TLS, X.509 client authentication, and attribute-based access control (ABAC) authorization](./tutorial-tls-x509.md).
336
336
337
337
With X.509 authentication, the MQTT broker uses a **trusted CA certificate** to validate client certificates. This trusted CA can be a root or intermediate CA. The broker checks the client certificate chain against the trusted CA certificate. If the chain is valid, the client is authenticated.
338
338
@@ -608,7 +608,7 @@ To get a TLS-enabled listener port, see [Enable TLS manual certificate managemen
608
608
>
609
609
> After enabling X.509 authentication, ensure that clients trust the broker's server certificate by having the *server-side* CA certificate in their trust store. Don't confuse trusting the *server-side* CA certificate with the *client-side* CA certificate used for client authentication that is specified in the `trustedClientCaCert` field.
610
610
>
611
-
> For a full example, see [Tutorial: TLS, X.509 client authentication, and attribute-based access control (ABAC) authorization](./tutorial-tls-and-x509.md).
611
+
> For a full example, see [Tutorial: TLS, X.509 client authentication, and attribute-based access control (ABAC) authorization](./tutorial-tls-x509.md).
612
612
613
613
### Connect mosquitto client to MQTT broker with X.509 client certificate
614
614
@@ -894,4 +894,4 @@ Successful reauthentication updates the client's credential expiry with the expi
894
894
895
895
- About [BrokerListener resource](howto-configure-brokerlistener.md)
896
896
- [Configure authorization for a BrokerListener](./howto-configure-authorization.md)
897
-
- [Tutorial: TLS, X.509 client authentication, and attribute-based access control (ABAC) authorization](./tutorial-tls-and-x509.md)
897
+
- [Tutorial: TLS, X.509 client authentication, and attribute-based access control (ABAC) authorization](./tutorial-tls-x509.md)
To restrict access to MQTT topics based on the client certificate attributes, create an authorization policy that maps the client certificate attributes to allowed actions on specific topics.
266
266
267
+
The provided command is using the `mosquitto_pub` utility to publish a message to an MQTT broker with TLS encryption and client certificate authentication. Here's a breakdown of the command and the authorization system being set up:
268
+
269
+
### Command Breakdown
270
+
-`mosquitto_pub`: The command-line utility to publish messages to an MQTT broker.
271
+
-`-t "example/topic"`: Specifies the topic to which the message is published.
272
+
-`-m "example temperature measurement"`: The message payload.
273
+
-`-i thermostat`: The client ID used to identify the publisher.
274
+
-`-q 1`: Quality of Service level 1, ensuring the message is delivered at least once.
275
+
-`-V mqttv5`: Specifies the MQTT version 5.
276
+
-`-d`: Enables debug mode for detailed output.
277
+
-`-h localhost`: The hostname of the MQTT broker.
278
+
-`--key thermostat.key`: The client's private key file.
279
+
-`--cert thermostat.crt`: The client's certificate file.
280
+
-`--cafile contoso_root_ca.crt`: The CA certificate file to verify the broker's certificate.
281
+
282
+
### Authorization System
283
+
1.**Certificates Created**:
284
+
-**Client Certificate (thermostat.crt)**: Issued to the client (thermostat) and signed by an intermediate CA.
285
+
-**Client Private Key (thermostat.key)**: Corresponding private key for the client certificate.
286
+
-**Intermediate CA Certificate**: Signed by the root CA, used to sign client certificates.
287
+
-**Root CA Certificate (contoso_root_ca.crt)**: The trusted root certificate used to verify the chain of trust.
288
+
289
+
2.**Attributes Mapping**:
290
+
-**Client Certificate Attributes**: Includes details like Common Name (CN), Organization (O), and Organizational Unit (OU) that can be used for authorization.
291
+
-**Intermediate CA**: Ensures that client certificates are issued by a trusted entity.
292
+
293
+
3.**Authorization Rules**:
294
+
- The MQTT broker uses the client certificate to authenticate the client.
295
+
- The broker verifies the certificate chain up to the root CA.
296
+
- Authorization rules can be defined based on certificate attributes (e.g., CN, O, OU) to control access to specific topics.
1. The client (thermostat) uses its certificate (`thermostat.crt`) and private key (`thermostat.key`) to authenticate with the MQTT broker.
311
+
2. The broker verifies the client's certificate against the intermediate CA, which is in turn verified against the root CA (`contoso_root_ca.crt`).
312
+
3. The broker applies authorization rules based on the client's certificate attributes to control access to MQTT topics.
313
+
314
+
This setup ensures secure communication and controlled access to the MQTT broker using TLS and client certificate authentication.
315
+
267
316
1. In the Azure portal, navigate to your IoT Operations instance.
268
317
1. Under **Components**, select **MQTT Broker**.
269
318
1. Select the **Authorization** tab.
@@ -354,6 +403,7 @@ To restrict access to MQTT topics based on the client certificate attributes, cr
354
403
}
355
404
]
356
405
```
406
+
357
407
1. Select **Add** to save the changes.
358
408
359
409
:::image type="content" source="media/tutorial-tls-and-x509/abac-authz.png" alt-text="Screenshot showing Azure portal for setting up an authorization policy.":::
0 commit comments