Class Net::SSH::HostKeyMismatch
In: lib/net/ssh/errors.rb
lib/net/ssh/errors.rb
Parent: Exception

Raised when the cached key for a particular host does not match the key given by the host, which can be indicative of a man-in-the-middle attack. 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

[]   []   fingerprint   fingerprint   host   host   ip   ip   key   key   port   port   remember_host!   remember_host!  

Public Instance methods

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

[Source]

    # File lib/net/ssh/errors.rb, line 49
49:     def [](key)
50:       @data && @data[key]
51:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 49
49:     def [](key)
50:       @data && @data[key]
51:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 55
55:     def fingerprint
56:       @data && @data[:fingerprint]
57:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 55
55:     def fingerprint
56:       @data && @data[:fingerprint]
57:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 60
60:     def host
61:       @data && @data[:peer] && @data[:peer][:host]
62:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 60
60:     def host
61:       @data && @data[:peer] && @data[:peer][:host]
62:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 70
70:     def ip
71:       @data && @data[:peer] && @data[:peer][:ip]
72:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 70
70:     def ip
71:       @data && @data[:peer] && @data[:peer][:ip]
72:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 75
75:     def key
76:       @data && @data[:key]
77:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 75
75:     def key
76:       @data && @data[:key]
77:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 65
65:     def port
66:       @data && @data[:peer] && @data[:peer][:port]
67:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 65
65:     def port
66:       @data && @data[:peer] && @data[:peer][:port]
67:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 81
81:     def remember_host!
82:       @callback.call
83:     end

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

[Source]

    # File lib/net/ssh/errors.rb, line 81
81:     def remember_host!
82:       @callback.call
83:     end

[Validate]