Skip to content

Commit

Permalink
Upgrade to latest net-ssh (7.0.0.beta1) (#2570)
Browse files Browse the repository at this point in the history
* Update to latest net-ssh (7.0.0.beta1)

* Force net-ssh to use all supported algorithms

* Update CHANGELOG.md
  • Loading branch information
domrcrel authored Jul 13, 2022
1 parent 6f96035 commit 9d67c03
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [Unreleased]

- Cumulus: added option to use NCLU as ia collecting method
- Update net-ssh to 7.0.0.beta1 (using `append_all_supported_algorithms: true`)

### Added

Expand Down
13 changes: 7 additions & 6 deletions lib/oxidized/input/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,13 @@ def expect(*regexps)
def make_ssh_opts
secure = Oxidized.config.input.ssh.secure?
ssh_opts = {
number_of_password_prompts: 0,
keepalive: vars(:ssh_no_keepalive) ? false : true,
verify_host_key: secure ? :always : :never,
password: @node.auth[:password],
timeout: Oxidized.config.timeout,
port: (vars(:ssh_port) || 22).to_i
number_of_password_prompts: 0,
keepalive: vars(:ssh_no_keepalive) ? false : true,
verify_host_key: secure ? :always : :never,
append_all_supported_algorithms: true,
password: @node.auth[:password],
timeout: Oxidized.config.timeout,
port: (vars(:ssh_port) || 22).to_i
}

auth_methods = vars(:auth_methods) || %w[none publickey password]
Expand Down
2 changes: 1 addition & 1 deletion oxidized.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'asetus', '~> 0.1'
s.add_runtime_dependency 'bcrypt_pbkdf', '~> 1.0'
s.add_runtime_dependency 'ed25519', '~> 1.2'
s.add_runtime_dependency 'net-ssh', '~> 5'
s.add_runtime_dependency 'net-ssh', '~> 7.0.0.beta1'
s.add_runtime_dependency 'net-telnet', '~> 0.2'
s.add_runtime_dependency 'rugged', '~> 0.28.0'
s.add_runtime_dependency 'slop', '~> 4.6'
Expand Down
34 changes: 18 additions & 16 deletions spec/input/ssh_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@

proxy = mock
Net::SSH::Proxy::Command.expects(:new).with("ssh test.com -W [%h]:%p").returns(proxy)
Net::SSH.expects(:start).with('93.184.216.34', 'alma', port: 22,
verify_host_key: Oxidized.config.input.ssh.secure ? :always : :never,
keepalive: true,
password: 'armud',
timeout: Oxidized.config.timeout,
number_of_password_prompts: 0,
auth_methods: %w[none publickey password],
proxy: proxy)
Net::SSH.expects(:start).with('93.184.216.34', 'alma', port: 22,
verify_host_key: Oxidized.config.input.ssh.secure ? :always : :never,
append_all_supported_algorithms: true,
keepalive: true,
password: 'armud',
timeout: Oxidized.config.timeout,
number_of_password_prompts: 0,
auth_methods: %w[none publickey password],
proxy: proxy)

ssh.instance_variable_set("@exec", true)
ssh.connect(@node)
Expand All @@ -62,14 +63,15 @@

proxy = mock
Net::SSH::Proxy::Command.expects(:new).with("ssh test.com -W [%h]:%p").returns(proxy)
Net::SSH.expects(:start).with('example.com', 'alma', port: 22,
verify_host_key: Oxidized.config.input.ssh.secure ? :always : :never,
keepalive: true,
password: 'armud',
timeout: Oxidized.config.timeout,
number_of_password_prompts: 0,
auth_methods: %w[none publickey password],
proxy: proxy)
Net::SSH.expects(:start).with('example.com', 'alma', port: 22,
verify_host_key: Oxidized.config.input.ssh.secure ? :always : :never,
append_all_supported_algorithms: true,
keepalive: true,
password: 'armud',
timeout: Oxidized.config.timeout,
number_of_password_prompts: 0,
auth_methods: %w[none publickey password],
proxy: proxy)

ssh.instance_variable_set("@exec", true)
ssh.connect(@node)
Expand Down

0 comments on commit 9d67c03

Please sign in to comment.