coopdevs / devenv

Simple script to create LXC development environments
8 stars 6 forks source link

Unsafe assumptions about location of ssh key #16

Closed raneq closed 5 years ago

raneq commented 5 years ago

https://github.com/coopdevs/devenv/blob/d424f7507c7ef327a774bf737d5c789fbedc0322/create-container.sh#L104

User may want to use another ssh key, create a new one, or have their own key with another crypto algorithm, like elliptic curve, so that id_rsa.pub may not be found.

Should this be interactive, read the option as a parameter, as an environment variable?

In case of environment variable, this is useful to use a default if the var is unset or "":

# Assign the default path to ssh_path or leave it intact if it is already set.
${ssh_path:="$HOME/.ssh/id_rsa.pub"}

More on this syntax

It should be also prompted to user at some time to make them aware of the possibility.

enricostano commented 5 years ago

What about adding this stuff in some config file. .devenv is at project level, maybe some /etc/devenv or something like that at system/user level would be nice.

raneq commented 5 years ago

Yes, taking into account that devenv gets installed system wide available for many projects, I think it makes sense to place the config at /etc . Some tools look also into equivalent directories inside user home, but it may be not worth it. I can do that, there may be other system user preferences to extract.