-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
[ADD] ssh key text as env variable #31
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the changes requested.
Additionally, please add an additional test to validate this configuration.
README.md
Outdated
@@ -190,6 +190,12 @@ the `known_hosts` file is provided. This can help avoid issues for hosts with | |||
dynamic IP addresses, but removes some additional protection against DNS | |||
spoofing attacks. Host IP Checking is enabled by default. | |||
|
|||
#### ENV_SSH_KEY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Standard _FILE
convention for VARIABLE
is VARIABLE_FILE
. Please use VARIABLE
, not ENV_VARIABLE
.
Additionally, VARIABLE_FILE
is an override for VARIABLE
, not VARIABLE
being an override for VARIABLE_FILE
. Thus, if VARIABLE_FILE
exists, it shall override VARIABLE
, always.
rootfs/entrypoint.sh
Outdated
@@ -1,8 +1,11 @@ | |||
#!/usr/bin/dumb-init /bin/sh | |||
source version.sh | |||
|
|||
if [ -n "${ENV_SSH_KEY}" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
rootfs/entrypoint.sh
Outdated
if [ -n "${ENV_SSH_KEY}" ]; then | ||
echo "$ENV_SSH_KEY" > /id_rsa/custom_rsa | ||
KEY_FILE=/id_rsa/custom_rsa | ||
else KEY_FILE=${SSH_KEY_FILE:=/id_rsa} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split into two lines and indent
Thanks for your comments ! Thanks for your help and work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not forget to run your test before committing.
README.md
Outdated
#### SSH_KEY | ||
|
||
You can specify the SSH key using Environnement variable, please note | ||
that SSH_KEY_FILE parameter will be ignored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is the opposite. If SSH_KEY_FILE
is specified, SSH_KEY
is ignored.
_FILE
takes precedence (unless I'm wrong here, in which case show me an app where non _FILE
takes precedence over _FILE
).
rootfs/entrypoint.sh
Outdated
SSH_KEY_FILE=/id_rsa/custom_rsa | ||
else | ||
KEY_FILE=${SSH_KEY_FILE:=/id_rsa} | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your order is backwards here. Since SSH_KEY_FILE
overrides SSH_KEY
, the logic has to flow differently.
Why set KEY_FILE
twice? KEY_FILE
is set to SSH_KEY_FILE
if and only if it exists, use that logic.
rootfs/entrypoint.sh
Outdated
@@ -1,8 +1,14 @@ | |||
#!/usr/bin/dumb-init /bin/sh | |||
source version.sh | |||
|
|||
if [ -n "${SSH_KEY}" ]; then | |||
echo "$SSH_KEY" > /id_rsa/custom_rsa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no reason to have an extra file on disk.
We've already defined /id_rsa
as the custom to file to use, (a) why create another, and (b) why use a completely non-standard directory?
docker-compose.test.yml
Outdated
@@ -80,6 +80,45 @@ services: | |||
- SSH_TARGET_PORT=22 | |||
- SSH_TUNNEL_PORT=11111 | |||
- SSH_KEY_FILE=/opt/id_rsa | |||
- SSH_KEY= |- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One always overrides the other. You cannot test both in the same container. In fact, you need a third test to test that one does properly override the other.
Thanks for you time, I will work on it the week , not a lot a spare time actually |
hello @jnovack, I'm a colleague of @vrenaville who's been busy on other topics lately and was not able to follow up on this PR. I'll take over from him as this issue is still important for us (we are migrating away from Rancher but this migration won't be complete for some time, and so we need to patch our way around to keep this tunnel up for one of our customers. I'll update the PR next week. Thanks for you patience. |
6746fff
to
d589794
Compare
I just updated that PR, taking your remarks into account. |
@gurneyalex Thanks for your time and work, It seems LGTM to me |
d589794
to
2ed374f
Compare
Hi @jnovack, I'm also interested on this feature to be merged, there is anything else to do or where I can help after latest @gurneyalex changes, so this can be merged? |
@arsa-dev we lost interest in getting this merged, and I won't be touching the PR anymore. Feel free to fork our code and try to resubmit the PR, maybe you will have success. |
If you'd like to help, the huge thing is the tests are not passing. This does not look close to functional. For some reason, there was an
|
Hi @jnovack, thanks you for your time reviewing again this old PR. Unfortunately I'm currently really busy but having this idea working and released would be great! I'll really try to manage it to free some time and fork this PR, review the reason behind the failing tests and resubmit in a new PR. |
We need to use an old rancher, that do not support secrets deploy with CLI, we want to use environment variable instead
ssh key was only available with secret or volume
ssh key can be define with a secret, volume or env variable