class Net::SSH::Proxy::Jump
end
…
Net::SSH.start(‘host’, ‘user’, :proxy => proxy) do |ssh|
proxy = Net::SSH::Proxy::Jump.new(‘user@proxy’)
require ‘net/ssh/proxy/jump’
Net::SSH.start:
then pass the instantiated object via the :proxy key to
An implementation of a jump proxy. To use it, instantiate it,
def build_proxy_command_equivalent(connection_options = nil)
We cannot build the ProxyCommand template until we know if the :config
def build_proxy_command_equivalent(connection_options = nil) first_jump, extra_jumps = jump_proxies.split(",", 2) config = connection_options && connection_options[:config] uri = URI.parse("ssh://#{first_jump}") template = "ssh".dup template << " -l #{uri.user}" if uri.user template << " -p #{uri.port}" if uri.port template << " -J #{extra_jumps}" if extra_jumps template << " -F #{config}" if config != true && config template << " -W %h:%p " template << uri.host @command_line_template = template end
def initialize(jump_proxies)
Create a new socket factory that tunnels via multiple jump proxes as
def initialize(jump_proxies) @jump_proxies = jump_proxies end
def open(host, port, connection_options = nil)
Return a new socket connected to the given host and port via the jump
def open(host, port, connection_options = nil) build_proxy_command_equivalent(connection_options) super end