Sha256: 19db7b2126264c65c2f276cb13f6b31fcbdd8e4f2d5009b99273f2cd776cc6c4

Contents?: true

Size: 557 Bytes

Versions: 5

Compression:

Stored size: 557 Bytes

Contents

require 'net/ssh/host-key-verifier'

module Net
  module SSH

    class LenientHostKeyVerifier < HostKeyVerifier
      def verify(arguments)
        return true if tunnelled?(arguments)
        super
      end

      private

        # A connection is potentially being tunnelled if the port is not 22,
        # and the ip refers to the localhost.
        def tunnelled?(args)
          return false if args[:peer][:port].to_i == 22
          
          ip = args[:peer][:ip]
          return ip == "127.0.0.1" || ip == "::1"
        end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
net-ssh-1.1.2 lib/net/ssh/lenient-host-key-verifier.rb
net-ssh-1.1.0 lib/net/ssh/lenient-host-key-verifier.rb
net-ssh-1.1.1 lib/net/ssh/lenient-host-key-verifier.rb
net-ssh-1.1.4 lib/net/ssh/lenient-host-key-verifier.rb
net-ssh-1.1.3 lib/net/ssh/lenient-host-key-verifier.rb