- Newest
- Most votes
- Most comments
The issue you're experiencing with the Greengrass V2 client discovery and cached credentials stopping working after multiple restarts is likely related to the core device's certificate rotation or endpoint changes.
AWS IoT Greengrass core devices periodically rotate their certificates for security reasons. When this happens, the cached credentials on the client device become invalid, leading to the TLS negotiation failure you're seeing.
To address this issue, consider the following approaches:
-
Implement a retry mechanism with exponential backoff in your client code. When you encounter the TLS negotiation failure, attempt to reconnect using the cached credentials a few times. If it continues to fail, trigger a new discovery process to fetch updated credentials.
-
Store multiple sets of discovered endpoints and certificates. When one set fails, try the others before initiating a new discovery.
-
Implement a local certificate authority (CA) on your core device. This would allow you to issue client certificates that remain valid for longer periods, reducing the frequency of credential invalidation.
-
Increase the rotation period for the core device's certificates if possible. This can be done through the AWS IoT Greengrass configuration, but be aware that longer rotation periods may have security implications.
-
Implement a mechanism to periodically refresh the cached credentials even when the client is offline. This could involve running a background process that attempts to update the cached information at regular intervals.
-
Ensure that the core device's IP address is stable and included in the MQTT broker certificate's subject alternative name (SAN) field. You can use the IP detector component to keep this information up-to-date.
Remember that while these solutions can help mitigate the issue, they may not completely eliminate it, especially in prolonged offline scenarios. The balance between security (frequent credential rotation) and offline functionality is a common challenge in IoT deployments, and the best approach often depends on your specific use case and security requirements.
Sources
Set up and troubleshoot AWS IoT Greengrass with client devices - AWS Prescriptive Guidance
Test client device communications - AWS IoT Greengrass
Troubleshooting client devices - AWS IoT Greengrass
Troubleshooting AWS IoT Greengrass - AWS IoT Greengrass
answered 2 years ago
Hi,
By default, the core device will trust the client device certificates (cache) for one minute only. So, when the core device is offline, it relies on the cached certificates of the client devices for upto a minute as it won't be able to verify the client device identity with the AWS IoT cloud.
If you'd like to extend this trust duration and allow client devices to connect when the core device if offline, you should update the client device auth component's configuration for clientDeviceTrustDurationMinutes under security.
answered 2 years ago
Relevant content
asked 5 years ago
asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
