edgexr / edge-cloud-platform

Apache License 2.0
1 stars 0 forks source link

cloudlet ssh key provider #350

Closed gainsley closed 1 month ago

gainsley commented 1 month ago

This adds a cloudlet ssh key provider which provides on-demand signed keys. This is intended to replace the code in pkg/platform/common/infracommon/common-ssh.go which forces each platform instance to maintain a pair of ssh keys, which require a persistent thread to refresh the signed keys every 24h. And this ssh key is always set up on platform init.

With the intent to move to CRM functionality into the CCRM, the platform instance needs to be ephermal and created on demand. The current ssh key handling means that, in the CCRM:

So instead, this library allows for replacing the forced, fixed ssh keys with an on-demand one. It only initializes keys when needed and doesn't need a refresh thread - it can detect if the current key is expired and refresh it automatically.

The other thing we will do here is share this ssh key signer between all platforms, so new platforms in the CCRM will not pay any overhead for setting up ssh keys.

gainsley commented 1 month ago

Hey Lev, I've addressed your review comments. I couldn't think of a way to use a channel that would help - note that there may be multiple threads waiting for a single refresh go thread to finish. To address the issue with the inline refresh ignoring a potential refresh thread already running, now the inlne refresh is also done using a go thread, we just need to wait for that thread to finish.