Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharing SSH Keys across multiple hosts

I am building a service that is distributed across multiple machines that logs into other target machines and does an action (write to a file, run a shell script, etc.).

Currently, I have this service configured to use username and password as a form of authentication for ssh-ing to the target machines, but it requires some additional bootstrapping on the target machine to get it working. I want to move to a public/private key authentication model.

My question is, since this service is distributed across multiple hosts, is it bad practice to store the private key in a secure location (say using AWS KMS or some similar service), and have each of my machines read from that secured location, or should I have a private key for each of my machines?

like image 744
Allen Suner Avatar asked Jan 02 '26 05:01

Allen Suner


1 Answers

Having all of your machines get the ssh keys from a central location is not inherently worse than their all getting their username and password from a central location. However, the connection over which they get the ssh keys should be secure, which may mean that you have to have at least one key - the one that gets to your central location - stored locally on each machine.

like image 183
Warren Dew Avatar answered Jan 06 '26 10:01

Warren Dew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!