added ssh.proxy_command to handle waiting for aws ssh connection when ssh proxy in place. use config.ssh.proxy_command = "ssh -q <user>@<proxy_host> nc %h %p"

This commit is contained in:
Matt Wormley 2013-04-03 13:54:21 -07:00
parent 932f15665b
commit 00c9f2c973
3 changed files with 6 additions and 0 deletions

View File

@ -281,6 +281,9 @@ module Vagrant
info[:forward_agent] = @config.ssh.forward_agent info[:forward_agent] = @config.ssh.forward_agent
info[:forward_x11] = @config.ssh.forward_x11 info[:forward_x11] = @config.ssh.forward_x11
# 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 # Set the private key path. If a specific private key is given in
# the Vagrantfile we set that. Otherwise, we use the default (insecure) # the Vagrantfile we set that. Otherwise, we use the default (insecure)
# private key, but only if the provider didn't give us one. # private key, but only if the provider didn't give us one.

View File

@ -5,6 +5,7 @@ require 'timeout'
require 'log4r' require 'log4r'
require 'net/ssh' require 'net/ssh'
require 'net/ssh/proxy/command'
require 'net/scp' require 'net/scp'
require 'vagrant/util/ansi_escape_code_remover' require 'vagrant/util/ansi_escape_code_remover'
@ -193,6 +194,7 @@ module VagrantPlugins
:logger => ssh_logger, :logger => ssh_logger,
:verbose => :debug :verbose => :debug
}) })
connect_opts[:proxy] = Net::SSH::Proxy::Command.new(ssh_info[:proxy_command]) if ssh_info[:proxy_command]
@logger.info("Attempting to connect to SSH: #{ssh_info[:host]}:#{ssh_info[:port]}") @logger.info("Attempting to connect to SSH: #{ssh_info[:host]}:#{ssh_info[:port]}")
Net::SSH.start(ssh_info[:host], ssh_info[:username], connect_opts) Net::SSH.start(ssh_info[:host], ssh_info[:username], connect_opts)

View File

@ -13,6 +13,7 @@ module VagrantPlugins
attr_accessor :forward_agent attr_accessor :forward_agent
attr_accessor :forward_x11 attr_accessor :forward_x11
attr_accessor :shell attr_accessor :shell
attr_accessor :proxy_command
def validate(machine) def validate(machine)
errors = [] errors = []