diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index c2077235f..942e833ca 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -281,7 +281,7 @@ module Vagrant info[:forward_agent] = @config.ssh.forward_agent info[:forward_x11] = @config.ssh.forward_x11 - # add in provided proxy command config + # Add in provided proxy command config info[:proxy_command] = @config.ssh.proxy_command if @config.ssh.proxy_command # Set the private key path. If a specific private key is given in diff --git a/lib/vagrant/util/ssh.rb b/lib/vagrant/util/ssh.rb index 353bb558d..321c4a2ac 100644 --- a/lib/vagrant/util/ssh.rb +++ b/lib/vagrant/util/ssh.rb @@ -122,6 +122,10 @@ module Vagrant "-o", "ForwardX11Trusted=yes"] end + if ssh_info[:proxy_command] + command_options += ["-o", "ProxyCommand=#{ssh_info[:proxy_command]}"] + end + # Configurables -- extra_args should always be last due to the way the # ssh args parser works. e.g. if the user wants to use the -t option, # any shell command(s) she'd like to run on the remote server would diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index 1c96481ca..f5e9b02de 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -209,7 +209,10 @@ module VagrantPlugins :logger => ssh_logger, :verbose => :debug }) - connect_opts[:proxy] = Net::SSH::Proxy::Command.new(ssh_info[:proxy_command]) if ssh_info[:proxy_command] + + if ssh_info[:proxy_command] + connect_opts[:proxy] = Net::SSH::Proxy::Command.new(ssh_info[:proxy_command]) + end @logger.info("Attempting to connect to SSH...") @logger.info(" - Host: #{ssh_info[:host]}") diff --git a/plugins/kernel_v2/config/ssh.rb b/plugins/kernel_v2/config/ssh.rb index 12aa576a6..883697acb 100644 --- a/plugins/kernel_v2/config/ssh.rb +++ b/plugins/kernel_v2/config/ssh.rb @@ -17,11 +17,12 @@ module VagrantPlugins def initialize super - @forward_agent = UNSET_VALUE - @forward_x11 = UNSET_VALUE - @guest_port = UNSET_VALUE - @keep_alive = UNSET_VALUE - @shell = UNSET_VALUE + @forward_agent = UNSET_VALUE + @forward_x11 = UNSET_VALUE + @guest_port = UNSET_VALUE + @keep_alive = UNSET_VALUE + @proxy_command = UNSET_VALUE + @shell = UNSET_VALUE @default = SSHConnectConfig.new end @@ -40,6 +41,7 @@ module VagrantPlugins @forward_x11 = false if @forward_x11 == UNSET_VALUE @guest_port = nil if @guest_port == UNSET_VALUE @keep_alive = false if @keep_alive == UNSET_VALUE + @proxy_command = nil if @proxy_command == UNSET_VALUE @shell = nil if @shell == UNSET_VALUE @default.finalize!