jnovack / autossh

Heavily customizable AutoSSH Docker container
https://hub.docker.com/r/jnovack/autossh/
MIT License
180 stars 80 forks source link

SSH_KEY_FILE default doesn't work #18

Closed matthew-banning closed 4 years ago

matthew-banning commented 4 years ago

KEY_FILE is given a default of /id_rsa if SSH_KEY_FILE is not set:

# Set up key file
KEY_FILE=${SSH_KEY_FILE:=/id_rsa}

But then when the key is added to the SSH agent SSH_KEY_FILE is used rather than KEY_FILE:

eval $(ssh-agent -s)
cat "${SSH_KEY_FILE}" | ssh-add -k -

This means that if SSH_KEY_FILE is not set and a key is mounted to /id_rsa it will not be used in authentication.

This issue seems to have originated in 2295b907ff53559813ee4e2857b7e4721670d2fe

matthew-banning commented 4 years ago

Nevermind, didn't realise ${SSH_KEY_FILE:=/id_rsa} also set SSH_KEY_FILE

jnovack commented 4 years ago

Happy to help! :)