IoT Edge certificate management

Makowiecki Adrian 0 Reputation points
2025-03-05T14:17:05.07+00:00

I want to find a way to renew IoT Edge certificates manually, to prevent automatic edge reboots.

I set up a test EST server as described on here and confirmed it is working by running openssl s_client -showcerts -connect localhost:8085 and getting a certificate in response.

When I tried to remove certificates to renew them new certificate files are not created and there are errors in iotedge system logs:

Mar 04 16:15:54 device-name aziot-certd[807771]: 2025-03-04T16:15:54Z [ERR!] - !!! internal error
Mar 04 16:15:54 device-name aziot-certd[807771]: 2025-03-04T16:15:54Z [ERR!] - !!! caused by: could not create cert
Mar 04 16:15:54 device-name aziot-certd[807771]: 2025-03-04T16:15:54Z [ERR!] - !!! caused by: EST endpoint did not return successful response: 401 Unauthorized b"Error 401: Unauthorized\nThe server was unable to authorize the request.\n"
Mar 04 16:15:54 device-name aziot-certd[807771]: 2025-03-04T16:15:54Z [INFO] - --> 500 {"content-type": "application/json"}
Mar 04 16:15:54 device-name aziot-identityd[810605]: 2025-03-04T16:15:54Z [ERR!] - Failed to provision with IoT Hub, and no valid device backup was found: internal error
Mar 04 16:15:54 device-name aziot-identityd[810605]: 2025-03-04T16:15:54Z [ERR!] - service encountered an error
Mar 04 16:15:54 device-name aziot-identityd[810605]: 2025-03-04T16:15:54Z [ERR!] - caused by: internal error
Mar 04 16:15:54 device-name aziot-identityd[810605]: 2025-03-04T16:15:54Z [ERR!] - caused by: could not create certificate
Mar 04 16:15:54 device-name aziot-identityd[810605]: 2025-03-04T16:15:54Z [ERR!] - caused by: internal error


My main goal is to avoid automatic restarts of the iotedge modules, I will appreciate help. Here is my config.toml

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
594 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VSawhney 115 Reputation points Microsoft External Staff
    2025-03-06T08:37:17.42+00:00

    Hello Makowiecki Adrian,

    The error logs mentioned suggests that the EST server does not recognize or trust the device’s credentials. You can follow the below steps to check and proceed:

    1. Confirm EST Server Authentication:    - Double-check the cert_issuance.est.auth section:    - Ensure the username and password fields are correct and match the credentials configured on your EST server.      - Verify that the EST server's access control lists (ACLs) allow the device to authenticate successfully.
    2. Certificate Chain Validation:    - The trusted_certs field points to cacert.crt.pem. Ensure that this file contains the correct root CA certificate for the EST server.    - Confirm the certificate chain is intact and the IoT Edge device can validate it.
    3. Test EST Endpoint:    - Use the curl command or openssl to test the EST URL manually and verify that the server responds correctly. Example:      bash      curl -u [username]:[password] [https://localhost:8085/.well-known/est/cert](https://localhost:8085/.well-known/est/cert"https://localhost:8085/.well-known/est/cert")         - Ensure the response does not show authentication errors.
    4. Verify Common Name:    - The common_name set to "device-name" should match the expected identity on the EST server. Check if there is a mismatch between the device registration and the EST server's settings.
    5. Adjust EST URL:    - The default URL for EST is set to [https://localhost:8085/.well-known/est.](https://localhost:8085/.well-known/est%60."https://localhost:8085/.well-known/est%60.") If the EST server is hosted on a different machine, replace localhost with its IP address or DNS name.
    6. Network Connectivity:    - Ensure the device can connect to the EST server (firewall and network rules might block communication).    - Confirm the port 8085 is open and accessible.
    7. Edge Runtime Restart:    - After making adjustments to the configuration, restart the Azure IoT Edge runtime:      bash      sudo iotedge system restart     

    Please go through this document for detailed information on how to manage trusted root certificates : https://learn.microsoft.com/en-us/azure/iot-edge/how-to-manage-device-certificates?form=MG0AV3&tabs=windows#manage-trusted-root-ca-trust-bundle

    If you have any further query do let us know.

    Thank you!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.