This is not really a programming question, but please hear me out. I am building a deployment tool, So using my application others can deploy their own application to their own servers. (just like forge.laravel.com),

Following are the use cases for this particular question

  1. I need to store each of my user's public ssh keys because I need to insert this key in each of the provisioned servers. so that users can log into their servers via ssh without any manual authorizations.
  2. Also, I need to authorize my applications ssh key (ie: my servers public key) into customers servers so that I can execute commands on my user's server on their behalf.
  3. I need to generate a new key on the newly provisioned customer server and authorize it in github/gitlab of the customer so that when I push/pull from the server I don't need to enter any username or password.

Coming to the question, Where/how do I store these keys (securely)? can I store them in a specific directory in my server? This makes me think that my server can be a big target for hackers since if they are able to hack, it opens doors to a multitude of servers.

What are the steps I can take to make this setup more secure?

Considering use case 2, does it make any difference if I generate separate keys for separate customers?

1 Answer 1


The only key here that seems reasonably sensitive is the priv/pub key pair that you generate for each server that needs Github access.

The rest of the keys you mentioned are public keys. I'm not saying you should publish them and make them public, but they are public keys and don't need to be stored particularly safely.

Also, since the private key that's generated is being stored on the server only, it's going to be as secure as that lone system. Here you have a few things to consider:

  1. Keep each system as secure as possible.
  2. Make sure that if a single key is compromised, its access is already restricted and easy to revoke.
  • cool. Any opinion about using hashicop's vault or something similiar?
    – Shobi
    Jun 24, 2019 at 19:24
  • Seems like it could be overkill just for public keys, but if it works how you need it to work, it'll be just fine.
    – d1str0
    Jun 24, 2019 at 19:25
  • Nice, Can you check my use case 2? because my servers public key will give access to all of those customer servers right?
    – Shobi
    Jun 24, 2019 at 19:29
  • You're going to be storing your public key on their servers. Public key doesn't provide anyone access to anything. It's supposed to be public. Just make sure your private keys don't leave your orchestration servers.
    – d1str0
    Jun 24, 2019 at 19:39
  • Yes, You are right, as long as the server is not hacked; no problem at all. But if it happens, The private key is in my server, and that gives access to all of my customer servers, that's what I am sceptical about. Do you have any inputs on that? Sorry for bugging :| (In my previous comment, I said public key what I mean was private key)
    – Shobi
    Jun 24, 2019 at 19:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .