summaryrefslogtreecommitdiff
path: root/lib/chef/knife/ssh.rb
diff options
context:
space:
mode:
authorbrettcave <brett@cave.za.net>2014-06-26 04:35:04 +0200
committerGrant Ridder <shortdudey123@gmail.com>2017-02-21 14:03:43 -0800
commit1c0d4f3e05c3adb88bef0a2302dcca90e885181d (patch)
tree003c5d53147476cea52fd8788f6941964a210347 /lib/chef/knife/ssh.rb
parent8f318ae3a874f0708cbde3855096d110bb75e5bb (diff)
downloadchef-1c0d4f3e05c3adb88bef0a2302dcca90e885181d.tar.gz
CHEF-4538 - add an option for gateway_identity_file that will allow key-based authentication on the gateway.
CHEF-4538 - rename option to be consistent with knife-ec2 option. CHEF-4538 - added parameter to config. Added config merge from parameter for ssh. Added ssh test for gateway identity. CHEF-4538 - bootstrap parameter for gateway identity
Diffstat (limited to 'lib/chef/knife/ssh.rb')
-rw-r--r--lib/chef/knife/ssh.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index e206f72630..825160756f 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -92,6 +92,11 @@ class Chef
:description => "The ssh gateway",
:proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key.strip }
+ option :ssh_gateway_identity,
+ :long => "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
+ :description => "The SSH identity file used for gateway authentication",
+ :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key.strip }
+
option :forward_agent,
:short => "-A",
:long => "--forward-agent",
@@ -250,7 +255,10 @@ class Chef
{}.tap do |opts|
# Chef::Config[:knife][:ssh_user] is parsed in #configure_user and written to config[:ssh_user]
opts[:user] = user || config[:ssh_user] || ssh_config[:user]
- if config[:ssh_identity_file]
+ if config[:ssh_gateway_identity]
+ opts[:keys] = File.expand_path(config[:ssh_gateway_identity])
+ opts[:keys_only] = true
+ elsif config[:ssh_identity_file]
opts[:keys] = File.expand_path(config[:ssh_identity_file])
opts[:keys_only] = true
elsif config[:ssh_password]