lib/vagrant/patches/net-ssh.rb in vagrant-unbundled-2.2.19.0 vs lib/vagrant/patches/net-ssh.rb in vagrant-unbundled-2.3.2.0
- old
+ new
@@ -1,6 +1,6 @@
-require "net/ssh"
+require "net/ssh/version"
# Only patch if we have version 6.1.0 loaded as
# these patches pull 6.1.0 up to the as of now
# current 6.2.0 beta
if Net::SSH::Version::STRING == "6.1.0"
@@ -113,10 +113,22 @@
super
end
end
end
+ require "net/ssh/transport/algorithms"
+ # net/ssh/transport/algorithms
+ [:kex, :host_key].each do |key|
+ idx = Net::SSH::Transport::Algorithms::ALGORITHMS[key].index(
+ Net::SSH::Transport::Algorithms::DEFAULT_ALGORITHMS[key].last
+ )
+ Net::SSH::Transport::Algorithms::DEFAULT_ALGORITHMS[key].push("rsa-sha2-512")
+ Net::SSH::Transport::Algorithms::DEFAULT_ALGORITHMS[key].push("rsa-sha2-256")
+ Net::SSH::Transport::Algorithms::ALGORITHMS[key].insert(idx, "rsa-sha2-256")
+ Net::SSH::Transport::Algorithms::ALGORITHMS[key].insert(idx, "rsa-sha2-512")
+ end
+
require "net/ssh/authentication/key_manager"
Net::SSH::Authentication::KeyManager.prepend(DeprecatedRsaSha1::KeyManager)
require "net/ssh/authentication/session"
Net::SSH::Authentication::Session.prepend(DeprecatedRsaSha1::AuthenticationSession)
@@ -153,17 +165,10 @@
def ssh_do_verify(sig, data, options = {})
@verify_key.verify(sig,data)
end
end
- require "net/ssh/transport/algorithms"
- # net/ssh/transport/algorithms
- Net::SSH::Transport::Algorithms::DEFAULT_ALGORITHMS[:host_key].insert(
- Net::SSH::Transport::Algorithms::DEFAULT_ALGORITHMS[:host_key].size - 1, "rsa-sha2-256")
- Net::SSH::Transport::Algorithms::DEFAULT_ALGORITHMS[:host_key].insert(
- Net::SSH::Transport::Algorithms::DEFAULT_ALGORITHMS[:host_key].size - 1, "rsa-sha2-512")
-
require "net/ssh/transport/cipher_factory"
# net/ssh/transport/cipher_factory
Net::SSH::Transport::CipherFactory::SSH_TO_OSSL["aes256-ctr"] = ::OpenSSL::Cipher.ciphers.include?("aes-256-ctr") ? "aes-256-ctr" : "aes-256-ecb"
Net::SSH::Transport::CipherFactory::SSH_TO_OSSL["aes192-ctr"] = ::OpenSSL::Cipher.ciphers.include?("aes-192-ctr") ? "aes-192-ctr" : "aes-192-ecb"
Net::SSH::Transport::CipherFactory::SSH_TO_OSSL["aes128-ctr"] = ::OpenSSL::Cipher.ciphers.include?("aes-128-ctr") ? "aes-128-ctr" : "aes-128-ecb"
@@ -275,5 +280,7 @@
dsa_verify_asn1(digest, a1sig.to_der)
end
end
end
end
+
+require "net/ssh"