Class: Net::SSH::Verifiers::AcceptNew

Inherits:
Always
  • Object
show all
Defined in:
lib/net/ssh/verifiers/accept_new.rb

Overview

Does a strict host verification, looking the server up in the known host files to see if a key has already been seen for this server. If this server does not appear in any host file, this will silently add the server. If the server does appear at least once, but the key given does not match any known for the server, an exception will be raised (HostKeyMismatch). Otherwise, this returns true.

Direct Known Subclasses

AcceptNewOrLocalTunnel

Instance Method Summary collapse

Instance Method Details

#verify(arguments) ⇒ Object


16
17
18
19
20
21
22
23
# File 'lib/net/ssh/verifiers/accept_new.rb', line 16

def verify(arguments)
  begin
    super
  rescue HostKeyUnknown => err
    err.remember_host!
    return true
  end
end

#verify_signature(&block) ⇒ Object


25
26
27
28
29
30
# File 'lib/net/ssh/verifiers/accept_new.rb', line 25

def verify_signature(&block)
  yield
rescue HostKeyUnknown => err
  err.remember_host!
  return true
end