Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embedded ssh keys #74

Closed
linux-colonel opened this issue Sep 2, 2017 · 7 comments
Closed

embedded ssh keys #74

linux-colonel opened this issue Sep 2, 2017 · 7 comments

Comments

@linux-colonel
Copy link
Contributor

There is an ssh private key committed to the repo. There is a note in the readme about changing it, but it's not very visible. Is it possible to generate the keys on the fly and add them to a volume by default? I.e. the first time you run docker-compose it creates a volume, generates the keys on the volume, and mounts it in .ssh of all the containers?

@paunin paunin added the question label Sep 3, 2017
@paunin
Copy link
Owner

paunin commented Sep 3, 2017

Well, the first thing is that in all of your containers you should have the same set of keys...right? otherwise they will not be able to talk. So you can't generate keys independently in all containers.

Secondly you should not enable SSH by default. There are no points to have SSH running in all of your containers.

And the last thing is that there is possibility to populate keys from ENV... but recommended way is to mount those files in your containers from secrets, so it will not be visible from env command.
Example from kubernetes

@linux-colonel
Copy link
Contributor Author

I'm thinking about where someone uses this solution off the shelf and isn't paying attention. Unfortunately, that happens more than we'd like.

The defaults in the docker-compose.yml have ssh enabled using the keys in the repo for the pgpool, backup, and initial master containers. Would it be possible to define generating the keys in the docker-compose file and initially place them on a volume to be shared between the containers? That would give you a working setup out of the box without having default keys hardcoded.

@paunin
Copy link
Owner

paunin commented Sep 3, 2017

Good case when you should look on what you install in production 😄
But I got your point, unfortunately the maximum we can do here is to stop populating keys with docker build and don't allow to start SSH without keys. So it will enforce user of the system to create and put keys...

@paunin
Copy link
Owner

paunin commented Sep 3, 2017

Or alert him about default keys....

@tyldum
Copy link

tyldum commented Oct 26, 2017

Using env variables to control ssh-keys and passwords and then using the technique outlined in https://github.com/docker-library/postgres/blob/master/docker-entrypoint.sh#L4-L25

There would then be an env variable called, for example, SSH_PUBKEY which can be populated directly or the user can define a SSH_PUBKEY_FILE which will point to a file typically generated by some secrets manager. Or even by using volumes.

@paunin
Copy link
Owner

paunin commented May 28, 2018

#160

@paunin
Copy link
Owner

paunin commented May 28, 2018

1.8 released

@paunin paunin closed this as completed May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants