Commit 547545c
committed
Fixes #38425 - Make prune_known_hosts work on ip addresses
Currently, prune_known_hosts only works on keys associated with
hostnames. This causes an issue when deleting and rebuilding a
provisioned host with the same ip address. 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 takes care of such keys, but
not when the keys are associated with ip adresses instead of hostnames.
It seems that when the setting connect_by_ip is set to yes, the key
associated with the ip that is stored in the known_hosts smart proxy
file while running the first rex job on the host is of type ssh-ed25519.
This differs from the type of key that is stored while running the first
rex job on the host when connect_by_ip is set to no:
ecdsa-sha2-nistp256. 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.rb1 parent ced5e82 commit 547545c
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
0 commit comments