Skip to content

Commit 547545c

Browse files
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.rb
1 parent ced5e82 commit 547545c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

smart_proxy_remote_execution_ssh.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Gem::Specification.new do |gem|
3030
gem.add_development_dependency('rack-test', '~> 0')
3131
gem.add_development_dependency('rubocop', '~> 0.82.0')
3232

33+
gem.add_runtime_dependency('ed25519', '>= 1.2', '< 2.0')
34+
gem.add_runtime_dependency('bcrypt_pbkdf', '>= 1.0', '< 2.0')
3335
gem.add_runtime_dependency('smart_proxy_dynflow', '~> 0.9', '>= 0.9.4')
3436
gem.add_runtime_dependency('net-ssh', '~> 7.2')
3537
gem.add_runtime_dependency('mqtt', '~> 0.5')

0 commit comments

Comments
 (0)