class Net::SSH::HostKeyError

  1. lib/net/ssh/errors.rb
Parent: SSH

Base class for host key exceptions. When rescuing this exception, you can inspect the key fingerprint and, if you want to proceed anyway, simply call the remember_host! method on the exception, and then retry.

Methods

Public Instance

  1. []
  2. fingerprint
  3. host
  4. ip
  5. key
  6. port
  7. remember_host!

Public Instance methods

[] (key)

An accessor for getting at the data that was used to look up the host (see also fingerprint, host, port, ip, and key).

[show source]
# File lib/net/ssh/errors.rb, line 50
def [](key)
  @data && @data[key]
end
fingerprint ()

Returns the fingerprint of the key for the host, which either was not found or did not match.

[show source]
# File lib/net/ssh/errors.rb, line 56
def fingerprint
  @data && @data[:fingerprint]
end
host ()

Returns the host name for the remote host, as reported by the socket.

[show source]
# File lib/net/ssh/errors.rb, line 61
def host
  @data && @data[:peer] && @data[:peer][:host]
end
ip ()

Returns the IP address of the remote host, as reported by the socket.

[show source]
# File lib/net/ssh/errors.rb, line 71
def ip
  @data && @data[:peer] && @data[:peer][:ip]
end
key ()

Returns the key itself, as reported by the remote host.

[show source]
# File lib/net/ssh/errors.rb, line 76
def key
  @data && @data[:key]
end
port ()

Returns the port number for the remote host, as reported by the socket.

[show source]
# File lib/net/ssh/errors.rb, line 66
def port
  @data && @data[:peer] && @data[:peer][:port]
end
remember_host! ()

Tell Net::SSH to record this host and key in the known hosts file, so that subsequent connections will remember them.

[show source]
# File lib/net/ssh/errors.rb, line 82
def remember_host!
  @callback.call
end