Skip to content

Commit b2fc9e1

Browse files
authored
Merge pull request #119737 from katriendg/patch-3
Update howto-configure-tls-manual.md - server chain
2 parents 95b5247 + 55f4d8d commit b2fc9e1

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

articles/iot-operations/manage-mqtt-connectivity/howto-configure-tls-manual.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,21 @@ Here, `mqtts-endpoint` and `localhost` are the Subject Alternative Names (SANs)
5858

5959
Both EC and RSA keys are supported, but all certificates in the chain must use the same key algorithm. If you import your own CA certificates, ensure that the server certificate uses the same key algorithm as the CAs.
6060

61-
## Import server certificate as a Kubernetes secret
61+
## Import server certificate chain as a Kubernetes secret
6262

63-
Create a Kubernetes secret with the certificate and key using kubectl.
63+
1. Create a full server certificate chain, where the order of the certificates matters: the server certificate is the first one in the file, the intermediate is the second.
6464

65-
```bash
66-
kubectl create secret tls server-cert-secret -n azure-iot-operations \
67-
--cert mqtts-endpoint.crt \
68-
--key mqtts-endpoint.key
69-
```
65+
```bash
66+
cat mqtts-endpoint.crt intermediate_ca.crt > server_chain.pem
67+
```
68+
69+
1. Create a Kubernetes secret with the server certificate chain and server key using kubectl.
70+
71+
```bash
72+
kubectl create secret tls server-cert-secret -n azure-iot-operations \
73+
--cert server_chain.crt \
74+
--key mqtts-endpoint.key
75+
```
7076

7177
## Enable TLS for a listener
7278

@@ -94,26 +100,23 @@ Once the BrokerListener resource is created, the operator automatically creates
94100

95101
## Connect to the broker with TLS
96102

97-
1. To test the TLS connection with mosquitto, first create a full certificate chain file with Step CLI.
103+
To test the TLS connection with mosquitto client, publish a message and pass the root CA certificate in the parameter `--cafile`.
98104

99-
```bash
100-
cat root_ca.crt intermediate_ca.crt > chain.pem
101-
```
102-
103-
1. Use mosquitto to publish a message.
104-
105-
```console
106-
$ mosquitto_pub -d -h localhost -p 8885 -i "my-client" -t "test-topic" -m "Hello" --cafile chain.pem
107-
Client my-client sending CONNECT
108-
Client my-client received CONNACK (0)
109-
Client my-client sending PUBLISH (d0, q0, r0, m1, 'test-topic', ... (5 bytes))
110-
Client my-client sending DISCONNECT
111-
```
105+
```console
106+
$ mosquitto_pub -d -h localhost -p 8885 -i "my-client" -t "test-topic" -m "Hello" --cafile root_ca.crt
107+
Client my-client sending CONNECT
108+
Client my-client received CONNACK (0)
109+
Client my-client sending PUBLISH (d0, q0, r0, m1, 'test-topic', ... (5 bytes))
110+
Client my-client sending DISCONNECT
111+
```
112112

113113
> [!TIP]
114114
> To use localhost, the port must be available on the host machine. For example, `kubectl port-forward svc/mqtts-endpoint 8885:8885 -n azure-iot-operations`. With some Kubernetes distributions like K3d, you can add a forwarded port with `k3d cluster edit $CLUSTER_NAME --port-add 8885:8885@loadbalancer`.
115115

116-
Remember to specify username, password, etc. if authentication is enabled.
116+
> [!NOTE]
117+
> To connect to the broker you need to distribute root of trust to the clients, also known as trust bundle. In this case the root of trust is the self-signed root CA created Step CLI. Distribution of root of trust is required for the client to verify the server certificate chain. If your MQTT clients are workloads on the Kubernetes cluster you also need to create a ConfigMap with the root CA and mount it in your Pod.
118+
119+
Remember to specify username, password, etc. if MQ authentication is enabled.
117120

118121
### Use external IP for the server certificate
119122

0 commit comments

Comments
 (0)