Skip to content

Commit 0bed7f7

Browse files
Merge pull request #209648 from jlian/patch-79
Some quick updates about cert renewal
2 parents 6cc99bc + 8924ec8 commit 0bed7f7

File tree

1 file changed

+46
-13
lines changed

1 file changed

+46
-13
lines changed

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

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,39 +209,55 @@ If you are using IoT Edge for Linux on Windows, you need to use the SSH key loca
209209
sudo iotedge config apply
210210
```
211211

212+
## Automatic certificate renewal
213+
214+
IoT Edge has built-in ability to renew certificates before expiry.
215+
216+
Certificates can only auto-renew if you have a certificate issuance method set, like EST. It must be configured per type of certificate. To configure, go to the relevant certificate configuration section in `config.toml` and add:
217+
218+
```toml
219+
# To use auto renew with other types of certs, swap `edge_ca` with other certificate types
220+
# And put into the relevant section
221+
[edge_ca.auto_renew]
222+
rotate_key = true
223+
threshold = "80%"
224+
retry = "4%"
225+
```
226+
227+
Here:
228+
- `rotate_key` controls if the private key should be rotated.
229+
- `threshold` sets when IoT Edge should start renewing the certificate . It can be specified as:
230+
- *Percentage* - integer between `0` and `100` followed by `%`. Renewal starts relative to the certificate lifetime. For example, when set to `80%`, a certificate that is valid for 100 days begins renewal at 20 days before its expiry.
231+
- *Absolute time* - integer followed by `m` (minutes) or `d` (days). Renewal starts relative to the certificate expiration time. For example, when set to `4d` for 4 days or `10m` for 10 minutes, the certificate begins renewing at that time before expiry. To avoid unintentional misconfiguration where the `threshold` is bigger than the certificate lifetime, we recommend to use *percentage* instead whenever possible.
232+
- `retry` controls how often renewal should be retried on failure. Like `threshold`, it can similarly be specified as a *percentage* or *absolute time* using the same format.
233+
212234
:::moniker-end
213235
<!-- end iotedge-2020-11 -->
214236

215237
## Customize certificate lifetime
216238

217239
IoT Edge automatically generates certificates on the device in several cases, including:
218240

219-
<!-- 1.2 -->
220-
:::moniker range=">=iotedge-2020-11"
221-
If you don't provide your own production certificates when you install and provision IoT Edge, the IoT Edge security manager automatically generates an **edge CA certificate**. This self-signed certificate is only meant for development and testing scenarios, not production. This certificate expires after 90 days.
222-
:::moniker-end
223-
<!-- end 1.2 -->
224-
225241
<!-- 1.1. -->
226242
:::moniker range="iotedge-2018-06"
227243
* If you don't provide your own production certificates when you install and provision IoT Edge, the IoT Edge security manager automatically generates a **device CA certificate**. This self-signed certificate is only meant for development and testing scenarios, not production. This certificate expires after 90 days.
228244
* The IoT Edge security manager also generates a **workload CA certificate** signed by the device CA certificate
229245
:::moniker-end
230246
<!-- end 1.1 -->
231247

248+
<!-- 1.2 -->
249+
:::moniker range=">=iotedge-2020-11"
250+
If you don't provide your own production certificates when you install and provision IoT Edge, the IoT Edge security manager automatically generates an **edge CA certificate**. This self-signed certificate is only meant for development and testing scenarios, not production. This certificate expires after 90 days.
251+
:::moniker-end
252+
<!-- end 1.2 -->
253+
232254
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).
233255

234-
For these two automatically generated certificates, you have the option of setting a flag in the config file to configure the number of days for the lifetime of the certificates.
256+
You have the option of setting a flag in the config file to configure the number of days for the lifetime of the certificates.
235257

236258
>[!NOTE]
237259
>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 30 day lifetime, but is automatically renewed before expiring. The auto-generated CA lifetime value set in the config file doesn't affect this certificate.
238260
239-
<!-- 1.2 -->
240-
:::moniker range=">=iotedge-2020-11"
241-
Upon expiry after the specified number of days, IoT Edge has to be restarted to regenerate the edge CA certificate. The edge CA certificate won't be renewed automatically.
242-
:::moniker-end
243-
<!-- end 1.2 -->
244-
245261
<!-- 1.1. -->
246262
:::moniker range="iotedge-2018-06"
247263
Upon expiry after the specified number of days, IoT Edge has to be restarted to regenerate the device CA certificate. The device CA certificate won't be renewed automatically.
@@ -347,6 +363,23 @@ Upon expiry after the specified number of days, IoT Edge has to be restarted to
347363
:::moniker-end
348364
<!-- end iotedge-2020-11 -->
349365

366+
<!-- 1.2 -->
367+
:::moniker range=">=iotedge-2020-11"
368+
### Renew Edge CA
369+
370+
By default, IoT Edge automatically regenerates the Edge CA certificate when at 80% of the certificate lifetime. So for certificate with 90 day lifetime, IoT Edge automatically regenerates the Edge CA certificate at 72 days from issuance.
371+
372+
To configure the auto-renewal logic, add this part to the "Edge CA certificate" section in `config.toml`.
373+
374+
```toml
375+
[edge_ca.auto_renew]
376+
rotate_key = true
377+
threshold = "70%"
378+
retry = "2%"
379+
```
380+
:::moniker-end
381+
<!-- end 1.2 -->
382+
350383
## Next steps
351384

352385
Installing certificates on an IoT Edge device is a necessary step before deploying your solution in production. Learn more about how to [Prepare to deploy your IoT Edge solution in production](production-checklist.md).

0 commit comments

Comments
 (0)