From efbaadb5598217cd215ece30bd7243bea4128ef2 Mon Sep 17 00:00:00 2001 From: Remco de Man Date: Thu, 5 Jan 2023 10:12:09 +0100 Subject: Accept pubkey_algorithms option when starting a new connection --- lib/net/ssh.rb | 7 ++++++- test/start/test_options.rb | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/net/ssh.rb b/lib/net/ssh.rb index b72ab7f..7578d40 100644 --- a/lib/net/ssh.rb +++ b/lib/net/ssh.rb @@ -73,7 +73,7 @@ module Net max_win_size send_env set_env use_agent number_of_password_prompts append_all_supported_algorithms non_interactive password_prompt agent_socket_factory minimum_dh_bits verify_host_key - fingerprint_hash check_host_ip + fingerprint_hash check_host_ip pubkey_algorithms ] # The standard means of starting a new SSH connection. When used with a @@ -170,6 +170,11 @@ module Net # * :properties => a hash of key/value pairs to add to the new connection's # properties (see Net::SSH::Connection::Session#properties) # * :proxy => a proxy instance (see Proxy) to use when connecting + # * :pubkey_algorithms => the public key authentication algorithms to use for + # this connection. Valid values are 'rsa-sha2-256-cert-v01@openssh.com', + # 'ssh-rsa-cert-v01@openssh.com', 'rsa-sha2-256', 'ssh-rsa'. Currently, this + # option is only used for RSA public key authentication and ignored for other + # types. # * :rekey_blocks_limit => the max number of blocks to process before rekeying # * :rekey_limit => the max number of bytes to process before rekeying # * :rekey_packet_limit => the max number of packets to process before rekeying diff --git a/test/start/test_options.rb b/test/start/test_options.rb index 43a88a7..601f3d5 100644 --- a/test/start/test_options.rb +++ b/test/start/test_options.rb @@ -60,6 +60,13 @@ module NetSSH end end + def test_start_should_accept_pubkey_algorithms_option + assert_nothing_raised do + options = { pubkey_algorithms: %w[ssh-rsa] } + Net::SSH.start('localhost', 'testuser', options) + end + end + def test_start_should_accept_remote_user_option assert_nothing_raised do options = { remote_user: 'foo' } -- cgit v1.2.1