-
Notifications
You must be signed in to change notification settings - Fork 301
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
Resolve ssh hostname aliases before running ssh-keyscan #889
Conversation
Co-Authored-By: ticky <[email protected]>
Co-Authored-By: ticky <[email protected]>
This looks awesome @ticky! I was wondering when that github alias stuff would bite us. |
I’m sort of delighted that my new code has basically not needed an edit, it was only supporting stuff and tests 😃 |
You are also the first other human to use |
Looks good to go to me @ticky! |
return fmt.Sprintf("%s:%s", hostname, port) | ||
} | ||
|
||
// if we got here, either the `-G` flag was unsupported, or ssh -G |
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 wonder if we should emit a warning here… 🧐
This is a PoC to improve compatibility with ssh aliases which don’t conform to our special-casing behaviour.
For any incoming ssh host, this asks
ssh
for what host it will connect to. This allowsssh-keyscan
to connect to that host, rather than whatever the alias name is, which may or may not match.It also supersedes the older behaviour wherein our special-case aliases were stripped, and on agents which are already correctly configured, should work the same.
I haven’t been able to get the test suite working to confirm this works, but I figured putting the sketch up would be better than doing nothing! 😃I’ve updated this to pass, and add new, tests, and it’s looking good!
For reference,
ssh -G
appears to have been added in OpenSSH in 6.0 (released April 22, 2012, sadly no source link as this took gripping multiple tgz files to bisect), but it appears to be turned off in some OS’ distributions of 6.x (one of our virtual servers is running a version from 2014, but it’s missing) so the existence of the fallback remains potentially important.