-
Notifications
You must be signed in to change notification settings - Fork 26
Fixes #38425 - Make prune_known_hosts work on ip addresses #125
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
Conversation
|
As to how to actually properly include the packages, I am not sure whether I did it correctly since this is my first time doing something like this. Even though I included the packages in the Gemfile, I still had to run |
It seems odd that connect_by_ip would have any effect on this. I seem to be getting |
Adding them to both the Gemfile and gemspec shouldn't be necessary, having them in gemspec should be enough.
In general you should never have to install things with |
Currently, prune_known_hosts does not work on ed25519 type SSH keys. This causes issues for example when rebuilding a provisioned host with the same ip address that uses ed25519 type keys. The rex jobs run on the host fail becase of a conflicting ssh key in the known_hosts smart proxy file. Normally, prune_known_hosts method is expected to take of such keys. prune_known_hosts uses the KnownHosts.search_for method from the net-ssh gem to find the associated keys. While ssh-ed25519 is among the supported types, for the method to process these keys additional gems need to be present. You can confirm this by examining the links below which point to the relevant parts of code in net-ssh. With the inclusion of new gems the issue is no longer present. [1]: https://github.com/net-ssh/net-ssh/blob/d9549e4226dc3aed12efcca24a8b6d349143f398/lib/net/ssh/known_hosts.rb#L106 [2]: https://github.com/net-ssh/net-ssh/blob/d9549e4226dc3aed12efcca24a8b6d349143f398/lib/net/ssh/authentication/ed25519_loader.rb
|
@adamruzicka Thanks for the review, I will keep the gems only in gemspec, then. I also reworded the commit message. |
adamruzicka
left a comment
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.
Looks good on my end
|
Thank you @adamlazik1 ! |
|
Since it already shells out to call |
|
The actual cleanup is done by |
|
Ah ok. I didn't expect the check because it would trim down on the dependencies. That looks like the only reason |
Currently, prune_known_hosts does not work on ed25519 type SSH keys.
This causes issues for example when rebuilding a provisioned host with
the same ip address that uses ed25519 type keys. The rex jobs run on the
host fail becase of a conflicting ssh key in the known_hosts smart proxy
file. Normally, prune_known_hosts method is expected to take of such
keys.
prune_known_hosts uses the KnownHosts.search_for method from the net-ssh
gem to find the associated keys. While ssh-ed25519 is among the
supported types, for the method to process these keys additional gems
need to be present. You can confirm this by examining the links below
which point to the relevant parts of code in net-ssh. With the inclusion
of new gems the issue is no longer present.
1: https://github.com/net-ssh/net-ssh/blob/d9549e4226dc3aed12efcca24a8b6d349143f398/lib/net/ssh/known_hosts.rb#L106
2: https://github.com/net-ssh/net-ssh/blob/d9549e4226dc3aed12efcca24a8b6d349143f398/lib/net/ssh/authentication/ed25519_loader.rb