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-edge/how-to-manage-device-certificates.md
+41-25Lines changed: 41 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,52 +91,68 @@ For example, if you used the sample scripts to [Create demo certificates](how-to
91
91
92
92
* Linux: `/var/lib/iotedge/hsm/certs` and `/var/lib/iotedge/hsm/cert_keys`
93
93
94
-
## Design customization certificate lifetime
94
+
## Customize certificate lifetime
95
95
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:
97
97
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
99
100
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
+
```
103
117
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.
105
119
106
120
After you specify the flag in the config.yaml file, do the following:
107
121
108
122
1. Delete the contents of the hsm folder.
109
123
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`
112
126
113
127
1. Restart the IoT Edge service.
114
128
115
-
Windows:
129
+
Windows:
116
130
117
-
```azurecli
118
-
Restart-Service iotedge
119
-
```
131
+
```powershell
132
+
Restart-Service iotedge
133
+
```
120
134
121
-
Linux:
135
+
Linux:
122
136
123
-
```bash
124
-
sudo systemctl restart iotedge
125
-
```
137
+
```bash
138
+
sudo systemctl restart iotedge
139
+
```
126
140
127
141
1. Confirm the lifetime setting.
128
142
129
-
Windows:
143
+
Windows:
130
144
131
-
```azurecli
132
-
iotedge check --verbose
133
-
```
145
+
```powershell
146
+
iotedge check --verbose
147
+
```
134
148
135
-
Linux:
149
+
Linux:
150
+
151
+
```bash
152
+
sudo iotedge check --verbose
153
+
```
136
154
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.
0 commit comments