Skip to content

Commit

Permalink
Merge pull request #1655 from trevor-vaughan/BKR-1655_better_host_key…
Browse files Browse the repository at this point in the history
…_checking_fix

[BRK-1655] Better strict_host_key_checking fix
  • Loading branch information
highb committed Jun 18, 2020
2 parents 60b5ea0 + e77274a commit 5cb5adc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/beaker/ssh_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ def connect_block host, user, ssh_opts, options
begin
@logger.debug "Attempting ssh connection to #{host}, user: #{user}, opts: #{ssh_opts}"

# Work around net-ssh 6+ incompatibilities
if ssh_opts.include?(:strict_host_key_checking) && (Net::SSH::Version::CURRENT.major > 5)
ssh_opts[:paranoid] = ssh_opts.delete(:strict_host_key_checking)
strict_host_key_checking = ssh_opts.delete(:strict_host_key_checking)

unless ssh_opts[:verify_host_key].is_a?(Symbol)
ssh_opts[:verify_host_key] ||= strict_host_key_checking ? :always : :never
end
end

Net::SSH.start(host, user, ssh_opts)
Expand Down

0 comments on commit 5cb5adc

Please sign in to comment.