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
+46-10Lines changed: 46 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Azure IoT Operations deploys a default *BrokerAuthentication* resource named `de
39
39
# [Portal](#tab/portal)
40
40
41
41
1. In the Azure portal, navigate to your IoT Operations instance.
42
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
42
+
1. Under **Components**, select **MQTT Broker**.
43
43
1. Select the **Authentication** tab.
44
44
1. From authentication policy list, select the **default** policy name.
45
45
@@ -176,7 +176,7 @@ To add an authentication method to a policy:
176
176
# [Portal](#tab/portal)
177
177
178
178
1. In the Azure portal, navigate to your IoT Operations instance.
179
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
179
+
1. Under **Components**, select **MQTT Broker**.
180
180
1. Select the **Authentication** tab.
181
181
1. Choose an existing authentication policy or create a new one.
182
182
1. Add a new method by selecting **Add method**.
@@ -331,6 +331,9 @@ For more information about enabling secure settings by configuring an Azure Key
331
331
332
332
## X.509
333
333
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-x509.md).
336
+
334
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.
335
338
336
339
To use X.509 authentication with a trusted CA certificate, the following requirements must be met:
@@ -404,7 +407,7 @@ Once the trusted CA certificate is imported, enable X.509 client authentication
404
407
# [Portal](#tab/portal)
405
408
406
409
1. In the Azure portal, navigate to your IoT Operations instance.
407
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
410
+
1. Under **Components**, select **MQTT Broker**.
408
411
1. Select the **Authentication** tab.
409
412
1. Choose an existing authentication policy or create a new one.
410
413
1. Add a new method by selecting **Add method**.
@@ -593,16 +596,27 @@ Authorization rules can be applied to clients using X.509 certificates with thes
593
596
594
597
### Enable X.509 authentication for a listener port
595
598
596
-
After importing the trusted CA certificate and configuring the *BrokerAuthentication* resource, link it to a TLS-enabled listener port. For more details, see [Enable TLS manual certificate management for a port](./howto-configure-brokerlistener.md#enable-tls-manual-certificate-management-for-a-port) and [Enable TLS automatic certificate management for a port](./howto-configure-brokerlistener.md#enable-tls-automatic-certificate-management-for-a-port).
599
+
After importing the trusted CA certificate and configuring the *BrokerAuthentication* resource, link it to a TLS-enabled listener port. This step is important because X.509 authentication relies on TLS for client certificate validation.
597
600
601
+
To get a TLS-enabled listener port, see [Enable TLS manual certificate management for a port](./howto-configure-brokerlistener.md#enable-tls-manual-certificate-management-for-a-port) and [Enable TLS automatic certificate management for a port](./howto-configure-brokerlistener.md#enable-tls-automatic-certificate-management-for-a-port).
602
+
603
+
> [!NOTE]
604
+
> Enabling TLS on a broker listener port means the broker uses a server certificate for TLS encryption. When clients connect to this port, they must trust the server certificate by having the CA certificate that signed it in their trust store. This process is known as *trust distribution* or *trust bundling*. It's important to understand the difference between server validation and client validation:
605
+
>
606
+
> - **Client validation**: The MQTT broker (server) checks the client certificate against the trusted CA certificate specified in the `trustedClientCaCert` field for X.509 client authentication.
607
+
> - **Server validation**: Clients (like mosquitto or MQTTX) check the MQTT broker's server certificate against the trusted CA certificate in their trust store. For mosquitto clients, use the `--cafile` parameter to specify the CA certificate file. For MQTTX, add the CA certificate to the trust store in the settings.
608
+
>
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
+
>
611
+
> For a full example, see [Tutorial: TLS, X.509 client authentication, and attribute-based access control (ABAC) authorization](./tutorial-tls-x509.md).
598
612
599
613
### Connect mosquitto client to MQTT broker with X.509 client certificate
600
614
601
615
A client like mosquitto needs two files to be able to connect to MQTT broker with TLS and X.509 client authentication.
602
616
- The `--cert` parameter specifies the client certificate PEM file. This file should also include any intermediate certificates to help the MQTT broker build the complete certificate chain.
603
617
- The `--key` parameter specifies the client private key PEM file.
604
618
605
-
In cases where MQTT broker is using a self-signed CA certificate to issue its TLS server certificate, the `--cafile` parameter is needed. This file contains the CA certificate which the mosquitto client uses to validate the broker's server certificate when connecting over TLS. If the issuer of MQTT broker's server certificate is part of the system root store (such as well-known public CAs), the `--cafile` parameter can be omitted.
619
+
In cases where MQTT broker is using a self-signed CA certificate to issue its TLS server certificate, the `--cafile` parameter is needed. This file contains the CA certificate (also known as *trust bundle*) which the mosquitto client uses to validate the broker's server certificate when connecting over TLS. If the issuer of MQTT broker's server certificate is part of the system root store (such as well-known public CAs), the `--cafile` parameter can be omitted.
606
620
607
621
For example:
608
622
@@ -648,15 +662,36 @@ The broker verifies tokens using the [Kubernetes Token Review API](https://kuber
648
662
649
663
### Create a service account
650
664
651
-
To create SATs, first create a service account. The following command creates a service account called `mqtt-client`.
665
+
To create SATs, first [create a service account](https://kubernetes.io/docs/concepts/security/service-accounts/). The following command creates a service account called `mqtt-client`.
Clients authenticating via SAT can optionally have their service accounts annotated with attributes to be used with authorization policies. To distinguish these annotations from others, they begin with `aio-broker-auth/` prefix.
674
+
675
+
You can annotate a service account using `kubectl annotate`:
Or you can add the annotations to the service account manifest file:
682
+
683
+
```yaml
684
+
apiVersion: v1
685
+
kind: ServiceAccount
686
+
metadata:
687
+
name: <SERVICE_ACCOUNT_NAME>
688
+
namespace: azure-iot-operations
689
+
annotations:
690
+
aio-broker-auth/<ATTRIBUTE_1>: <VALUE_1>
691
+
aio-broker-auth/<ATTRIBUTE_2>: <VALUE_2>
692
+
```
658
693
659
-
Clients authenticating via SAT can optionally have their service accounts annotated with attributes to be used with authorization policies. To learn more, see [Authorize clients that use Kubernetes Service Account Tokens](./howto-configure-authentication.md).
694
+
To learn more, see [Authorize clients that use Kubernetes Service Account Tokens](./howto-configure-authorization.md#authorize-clients-that-use-kubernetes-service-account-tokens).
660
695
661
696
### Enable Service Account Token (SAT) authentication
662
697
@@ -665,7 +700,7 @@ Modify the `authenticationMethods` setting in a *BrokerAuthentication* resource
665
700
# [Portal](#tab/portal)
666
701
667
702
1. In the Azure portal, navigate to your IoT Operations instance.
668
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
703
+
1. Under **Components**, select **MQTT Broker**.
669
704
1. Select the **Authentication** tab.
670
705
1. Choose an existing authentication policy or create a new one.
671
706
1. Add a new method by selecting **Add method**.
@@ -822,7 +857,7 @@ For testing, you can disable authentication for a broker listener port. Disablin
822
857
# [Portal](#tab/portal)
823
858
824
859
1. In the Azure portal, navigate to your IoT Operations instance.
825
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
860
+
1. Under **Components**, select **MQTT Broker**.
826
861
1. Select the broker listener you want to edit from the list.
827
862
1. On the port you want to disable authentication, select **None** in the authentication dropdown.
828
863
@@ -859,3 +894,4 @@ Successful reauthentication updates the client's credential expiry with the expi
859
894
860
895
- About [BrokerListener resource](howto-configure-brokerlistener.md)
861
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-x509.md)
Copy file name to clipboardExpand all lines: articles/iot-operations/manage-mqtt-broker/howto-configure-authorization.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ The following example shows how to create a *BrokerAuthorization* resource using
37
37
# [Portal](#tab/portal)
38
38
39
39
1. In the Azure portal, navigate to your IoT Operations instance.
40
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
40
+
1. Under **Components**, select **MQTT Broker**.
41
41
1. Select the **Authorization** tab.
42
42
1. Choose an existing authentication policy or create a new one by selecting **Create authorization policy**.
43
43
@@ -333,7 +333,7 @@ For example, if a client has a certificate with subject `CN = smart-lock`, its u
333
333
334
334
## Authorize clients that use Kubernetes Service Account Tokens
335
335
336
-
Authorization attributes for SATs are set as part of the Service Account annotations. For example, to add an authorization attribute named `group` with value `authz-sat`, run the command:
336
+
Authorization attributes for SATs are set as part of the [Service Account annotations](./howto-configure-authentication.md#kubernetes-service-account-tokens). For example, to add an authorization attribute named `group` with value `authz-sat`, run the command:
Copy file name to clipboardExpand all lines: articles/iot-operations/manage-mqtt-broker/howto-configure-brokerlistener.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ To view or edit the default listener:
51
51
# [Portal](#tab/portal)
52
52
53
53
1. In the Azure portal, navigate to your IoT Operations instance.
54
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
54
+
1. Under **Components**, select **MQTT Broker**.
55
55
56
56
:::image type="content" source="media/howto-configure-brokerlistener/configure-broker-listener.png" alt-text="Screenshot using Azure portal to view Azure IoT Operations MQTT configuration.":::
57
57
@@ -202,7 +202,7 @@ This example shows how to create a new listener with load balancer service type.
202
202
# [Portal](#tab/portal)
203
203
204
204
1. In the Azure portal, navigate to your IoT Operations instance.
205
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
205
+
1. Under **Components**, select **MQTT Broker**.
206
206
1. Select **MQTT broker listener for LoadBalancer** > **Create**.
207
207
208
208
Enter the following settings:
@@ -537,7 +537,7 @@ The following is an example of a BrokerListener resource that enables TLS on por
537
537
# [Portal](#tab/portal)
538
538
539
539
1. In the Azure portal, go to your IoT Operations instance.
540
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
540
+
1. Under **Components**, select **MQTT Broker**.
541
541
1. Select or create a listener. You can only create one listener per service type. If you already have a listener of the same service type, you can add more ports to the existing listener.
542
542
1. You can add TLS settings to the listener by selecting the **TLS** on an existing port or by adding a new port.
543
543
@@ -751,7 +751,7 @@ The following is an example of a BrokerListener resource that enables TLS on por
751
751
# [Portal](#tab/portal)
752
752
753
753
1. In the Azure portal, navigate to your IoT Operations instance.
754
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
754
+
1. Under **Components**, select **MQTT Broker**.
755
755
1. Select or create a listener. You can only create one listener per service type. If you already have a listener of the same service type, you can add more ports to the existing listener. To follow the example, specify the listener service name as `mqtts-endpoint`.
756
756
1. You can add TLS settings to the listener by selecting the **TLS** on an existing port or by adding a new port.
757
757
@@ -921,3 +921,4 @@ From here, follow the same steps as previously to create a server certificate wi
Copy file name to clipboardExpand all lines: articles/iot-operations/manage-mqtt-broker/howto-test-connection.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,7 +154,7 @@ For example, to create a new broker listener with node port service type, servic
154
154
# [Portal](#tab/portal)
155
155
156
156
1. In the Azure portal, go to your IoT Operations instance.
157
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
157
+
1. Under **Components**, select **MQTT Broker**.
158
158
1. Select **MQTT broker listener for NodePort** > **Create**. You can only create one listener per service type. If you already have a listener of the same service type, you can add more ports to the existing listener.
159
159
160
160
> [!CAUTION]
@@ -314,7 +314,7 @@ For example, to create a new broker listener with load balancer service type, se
314
314
# [Portal](#tab/portal)
315
315
316
316
1. In the Azure portal, go to your IoT Operations instance.
317
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
317
+
1. Under **Components**, select **MQTT Broker**.
318
318
1. Select **MQTT broker listener for NodePort** > **Create**. You can only create one listener per service type. If you already have a listener of the same service type, you can add more ports to the existing listener.
319
319
320
320
> [!CAUTION]
@@ -521,7 +521,7 @@ The reason that MQTT broker uses TLS and service accounts authentication by defa
521
521
# [Portal](#tab/portal)
522
522
523
523
1. In the Azure portal, go to your IoT Operations instance.
524
-
1. Under **Azure IoT Operations resources**, select **MQTT Broker**.
524
+
1. Under **Components**, select **MQTT Broker**.
525
525
1. Select **MQTT broker listener for NodePort** or **MQTT broker listener for LoadBalancer** > **Create**. You can only create one listener per service type. If you already have a listener of the same service type, you can add more ports to the existing listener.
526
526
527
527
> [!CAUTION]
@@ -615,3 +615,4 @@ spec:
615
615
616
616
- [Configure TLS with manual certificate management to secure MQTT communication](howto-configure-tls-manual.md)
0 commit comments