Skip to content

Commit 97c1a3e

Browse files
authored
Merge pull request #106072 from kgremban/release-certexpiry
Updates to cert expiry config section
2 parents abf85a9 + 5c2dc03 commit 97c1a3e

File tree

1 file changed

+41
-25
lines changed

1 file changed

+41
-25
lines changed

articles/iot-edge/how-to-manage-device-certificates.md

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -91,52 +91,68 @@ For example, if you used the sample scripts to [Create demo certificates](how-to
9191

9292
* Linux: `/var/lib/iotedge/hsm/certs` and `/var/lib/iotedge/hsm/cert_keys`
9393

94-
## Design customization certificate lifetime
94+
## Customize certificate lifetime
9595

96-
If you are not providing your own production certificates, you will need to restart the IoT-Edge device to renew the temporary certificates before they expire at the end of 90 days. However, you have the option of setting the **auto_generated_ca_lifetime_days** flag in config.yaml to specify the number of days for the lifetime of the certificates.
96+
IoT Edge automatically generates certificates on the device in several cases, including:
9797

98-
Add the following line to the **certificate** properties in the config.yaml file with the desired number of days:
98+
* If you don't provide your own production certificates when you install and provision IoT Edge, the IoT Edge security manager auto-generates a **device CA certificate**. This auto-generated and self-signed certificate is only meant for development and testing scenarios, not production. This certificate expires after 90 days.
99+
* The IoT Edge security manager also generates a **workload CA certificate** signed by the device CA certificate
99100

100-
```yaml
101-
auto_generated_ca_lifetime_days: \<number of days>
102-
```
101+
For more information about the function of the different certificates on an IoT Edge device, see [Understand how Azure IoT Edge uses certificates](iot-edge-certs.md).
102+
103+
For these two auto-generated certificates, you have the option of setting the **auto_generated_ca_lifetime_days** flag in config.yaml to configure the number of days for the lifetime of the certificates.
104+
105+
>[!NOTE]
106+
>There is a third auto-generated certificate that the IoT Edge security manager creates, the **IoT Edge hub server certificate**. This certificate always has a 90 day, but is automatically renewed before expiring. The **auto_generated_ca_lifetime_days** value doesn't affect this certificate.
107+
108+
To configure the certificate expiration to something other than the default 90 days, add the value in days to the **certificates** section of the config.yaml file.
109+
110+
```yaml
111+
certificates:
112+
device_ca_cert: "<ADD URI TO DEVICE CA CERTIFICATE HERE>"
113+
device_ca_pk: "<ADD URI TO DEVICE CA PRIVATE KEY HERE>"
114+
trusted_ca_certs: "<ADD URI TO TRUSTED CA CERTIFICATES HERE>"
115+
auto_generated_ca_lifetime_days: <value>
116+
```
103117

104-
This setting honors both temporary certificates and production certificates. If the **device_ca_cert** and **device_ca_pk** certificates are not specified in the config.yaml file, then the flag will be honored on temporary certificates. If they are specified, then this flag will override the expiration settings on the production certificates.
118+
If you provided your own device CA certificates, then this value still applies to the workload CA certificate, as long as the lifetime value you set is shorter than the lifetime of the device CA certificate.
105119

106120
After you specify the flag in the config.yaml file, do the following:
107121

108122
1. Delete the contents of the hsm folder.
109123

110-
Windows: C:\ProgramData\iotedge\hsm\certs and C:\ProgramData\iotedge\hsm\cert_keys
111-
Linux: /var/lib/iotedge/hsm/certs and /var/lib/iotedge/hsm/cert_keys
124+
Windows: `C:\ProgramData\iotedge\hsm\certs and C:\ProgramData\iotedge\hsm\cert_keys`
125+
Linux: `/var/lib/iotedge/hsm/certs and /var/lib/iotedge/hsm/cert_keys`
112126

113127
1. Restart the IoT Edge service.
114128

115-
Windows:
129+
Windows:
116130

117-
```azurecli
118-
Restart-Service iotedge
119-
```
131+
```powershell
132+
Restart-Service iotedge
133+
```
120134

121-
Linux:
135+
Linux:
122136

123-
```bash
124-
sudo systemctl restart iotedge
125-
```
137+
```bash
138+
sudo systemctl restart iotedge
139+
```
126140

127141
1. Confirm the lifetime setting.
128142

129-
Windows:
143+
Windows:
130144

131-
```azurecli
132-
iotedge check --verbose
133-
```
145+
```powershell
146+
iotedge check --verbose
147+
```
134148

135-
Linux:
149+
Linux:
150+
151+
```bash
152+
sudo iotedge check --verbose
153+
```
136154

137-
```bash
138-
sudo iotedge check --verbose
139-
```
155+
Check the output of the **production readiness: certificates** check, which lists the number of days until the auto-generated device CA certificates expire.
140156

141157
## Next steps
142158

0 commit comments

Comments
 (0)