diff options
author | Jamis Buck <jamis@37signals.com> | 2008-03-22 16:18:35 -0600 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2008-03-22 16:18:35 -0600 |
commit | dbc084691d1f64931f8659b2baa3bb1df6aba700 (patch) | |
tree | 0d220b25bc02756ecbe880e71da940059822bf96 /lib/net/ssh/verifiers | |
parent | bccc80a7ef7bf824723bc748ddb53ffcea3bb76e (diff) | |
download | net-ssh-dbc084691d1f64931f8659b2baa3bb1df6aba700.tar.gz |
support for :host_key_alias
Diffstat (limited to 'lib/net/ssh/verifiers')
-rw-r--r-- | lib/net/ssh/verifiers/strict.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/net/ssh/verifiers/strict.rb b/lib/net/ssh/verifiers/strict.rb index d42c32a..ef8edfd 100644 --- a/lib/net/ssh/verifiers/strict.rb +++ b/lib/net/ssh/verifiers/strict.rb @@ -11,7 +11,8 @@ module Net; module SSH; module Verifiers # Otherwise, this returns true. class Strict def verify(arguments) - host = arguments[:session].host_as_string + options = arguments[:session].options + host = options[:host_key_alias] || arguments[:session].host_as_string matches = Net::SSH::KnownHosts.search_for(host, arguments[:session].options) # we've never seen this host before, so just automatically add the key. @@ -42,7 +43,9 @@ module Net; module SSH; module Verifiers def process_cache_miss(host, args) exception = HostKeyMismatch.new("fingerprint #{args[:fingerprint]} does not match for #{host.inspect}") exception.data = args - exception.callback = Proc.new { Net::SSH::KnownHosts.add(host, args[:key], args[:session].options) } + exception.callback = Proc.new do + Net::SSH::KnownHosts.add(host, args[:key], args[:session].options) + end raise exception end end |