Skip to content

Commit 139fa04

Browse files
authored
Merge pull request #103160 from onalante-msft/full-chain
[iot-edge] Use full-chain certificate file for `[edge_ca]` section
2 parents 0f9bec0 + 88c43f2 commit 139fa04

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

articles/iot-edge/how-to-connect-downstream-iot-edge-device.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ You should already have IoT Edge installed on your device. If not, follow the st
219219
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
220220
```
221221
222-
01. Find or add the **Edge CA certificate** section in the config file. Update the certificate `cert` and private key `pk` parameters with the file URI paths for the certificate and key files on the parent IoT Edge device. IoT Edge requires the certificate and private key to be in text-based privacy-enhanced mail (PEM) format. For example:
222+
01. Find or add the **Edge CA certificate** section in the config file. Update the certificate `cert` and private key `pk` parameters with the file URI paths for the full-chain certificate and key files on the parent IoT Edge device. IoT Edge requires the certificate and private key to be in text-based privacy-enhanced mail (PEM) format. For example:
223223
224224
```toml
225225
[edge_ca]
226-
cert = "file:///var/aziot/certs/iot-edge-device-ca-gateway.cert.pem"
226+
cert = "file:///var/aziot/certs/iot-edge-device-ca-gateway-full-chain.cert.pem"
227227
pk = "file:///var/aziot/secrets/iot-edge-device-ca-gateway.key.pem"
228228
```
229229
@@ -241,7 +241,7 @@ You should already have IoT Edge installed on your device. If not, follow the st
241241
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
242242
243243
[edge_ca]
244-
cert = "file:///var/aziot/certs/iot-edge-device-ca-gateway.cert.pem"
244+
cert = "file:///var/aziot/certs/iot-edge-device-ca-gateway-full-chain.cert.pem"
245245
pk = "file:///var/aziot/secrets/iot-edge-device-ca-gateway.key.pem"
246246
```
247247
@@ -386,11 +386,11 @@ You should already have IoT Edge installed on your device. If not, follow the st
386386
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
387387
```
388388
389-
01. Find or add the **Edge CA certificate** section in the configuration file. Update the certificate `cert` and private key `pk` parameters with the file URI paths for the certificate and key files on the IoT Edge downstream device. IoT Edge requires the certificate and private key to be in text-based privacy-enhanced mail (PEM) format. For example:
389+
01. Find or add the **Edge CA certificate** section in the configuration file. Update the certificate `cert` and private key `pk` parameters with the file URI paths for the full-chain certificate and key files on the IoT Edge downstream device. IoT Edge requires the certificate and private key to be in text-based privacy-enhanced mail (PEM) format. For example:
390390
391391
```toml
392392
[edge_ca]
393-
cert = "file:///var/aziot/certs/iot-edge-device-ca-downstream.cert.pem"
393+
cert = "file:///var/aziot/certs/iot-edge-device-ca-downstream-full-chain.cert.pem"
394394
pk = "file:///var/aziot/secrets/iot-edge-device-ca-downstream.key.pem"
395395
```
396396
@@ -408,7 +408,7 @@ You should already have IoT Edge installed on your device. If not, follow the st
408408
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
409409
410410
[edge_ca]
411-
cert = "file:///var/aziot/certs/iot-edge-device-ca-downstream.cert.pem"
411+
cert = "file:///var/aziot/certs/iot-edge-device-ca-downstream-full-chain.cert.pem"
412412
pk = "file:///var/aziot/secrets/iot-edge-device-ca-downstream.key.pem"
413413
```
414414
@@ -448,46 +448,46 @@ You should already have IoT Edge installed on your device. If not, follow the st
448448
01. Verify the TLS/SSL connection from the child to the parent by running the following `openssl` command on the downstream device. Replace `<parent hostname>` with the FQDN or IP address of the parent.
449449
450450
```bash
451-
echo | openssl s_client -connect <parent hostname>:8883 2>/dev/null | openssl x509 -text
451+
openssl s_client -connect <parent hostname>:8883 </dev/null 2>&1 >/dev/null
452452
```
453453
454-
The command should return the certificate chain similar to the following example.
454+
The command should assert successful validation of the parent certificate chain similar to the following example:
455455
456456
```Output
457-
azureUser@child-vm:~$ echo | openssl s_client -connect 10.0.0.4:8883 2>/dev/null | openssl x509 -text
458-
459-
Certificate:
460-
Data:
461-
Version: 3 (0x2)
462-
Serial Number: 0 (0x0)
463-
Signature Algorithm: sha256WithRSAEncryption
464-
Issuer: CN = gateway.ca
465-
Validity
466-
Not Before: Apr 27 16:25:44 2022 GMT
467-
Not After : May 26 14:43:24 2022 GMT
468-
Subject: CN = 10.0.0.4
469-
Subject Public Key Info:
470-
Public Key Algorithm: rsaEncryption
471-
RSA Public-Key: (2048 bit)
472-
Modulus:
473-
00:b2:a6:df:d9:91:43:4e:77:d8:2c:2a:f7:01:b1:
474-
...
475-
33:bd:c8:f0:de:07:36:2c:0d:06:9e:89:22:95:5e:
476-
3b:43
477-
Exponent: 65537 (0x10001)
478-
X509v3 extensions:
479-
X509v3 Extended Key Usage:
480-
TLS Web Server Authentication
481-
X509v3 Subject Alternative Name:
482-
DNS:edgehub, IP Address:10.0.0.4
483-
Signature Algorithm: sha256WithRSAEncryption
484-
76:d4:5b:4a:d5:c4:80:7d:32:bc:c0:a8:ce:4f:69:5d:4d:ee:
485-
...
486-
```
487-
488-
The `Subject: CN = ` value should match the **hostname** parameter specified in the parent's `config.toml` configuration file.
489-
490-
If the command times out, there may be blocked ports between the child and parent devices. Review the network configuration and settings for the devices.
457+
azureUser@child-vm:~$ openssl s_client -connect <parent hostname>:8883 </dev/null 2>&1 >/dev/null
458+
459+
Can't use SSL_get_servername
460+
depth=3 CN = Azure_IoT_Hub_CA_Cert_Test_Only
461+
verify return:1
462+
depth=2 CN = Azure_IoT_Hub_Intermediate_Cert_Test_Only
463+
verify return:1
464+
depth=1 CN = gateway.ca
465+
verify return:1
466+
depth=0 CN = <parent hostname>
467+
verify return:1
468+
DONE
469+
```
470+
471+
The "Can't use SSL_get_servername" message can be ignored.
472+
473+
The `depth=0 CN = ` value should match the **hostname** parameter specified in the parent's `config.toml` configuration file.
474+
475+
If the command times out, there may be blocked ports between the child and parent devices. Review the network configuration and settings for the devices.
476+
477+
> [!WARNING]
478+
> A previous version of this document directed users to copy the `iot-edge-device-ca-gateway.cert.pem` certificate for use in the gateway `[edge_ca]` section. This was incorrect, and results in certificate validation errors from the downstream device. For example, the `openssl s_client ...` command above will produce:
479+
>
480+
> ```
481+
> Can't use SSL_get_servername
482+
> depth=1 CN = gateway.ca
483+
> verify error:num=20:unable to get local issuer certificate
484+
> verify return:1
485+
> depth=0 CN = <parent hostname>
486+
> verify return:1
487+
> DONE
488+
> ```
489+
>
490+
> The same issue will appear for TLS-enabled devices connecting to the downstream Edge device if `iot-edge-device-ca-downstream.cert.pem` is copied to the device instead of `iot-edge-device-ca-downstream-full-chain.cert.pem`.
491491

492492
## Network isolate downstream devices
493493

0 commit comments

Comments
 (0)