From 6258797d966ebc38c05c10c3bf86a23e2008c54e Mon Sep 17 00:00:00 2001 From: Sylvain Tissot Date: Mon, 4 Nov 2013 22:28:25 -0500 Subject: [PATCH] [COOK-3765] - ssh-keyscan using an alternative port number Signed-off-by: Sean OMeara --- README.md | 6 ++++++ providers/entry.rb | 2 +- resources/entry.rb | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c3e826f..a66d8a2 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,12 @@ end ssh-rsa ... ssh-keyscan -H #{host} + + port + (optional) the server port that ssh-keyscan will use to gather the public key + 2222 + 22 + diff --git a/providers/entry.rb b/providers/entry.rb index 9a4213a..b83f906 100644 --- a/providers/entry.rb +++ b/providers/entry.rb @@ -18,7 +18,7 @@ # action :create do - key = (new_resource.key || `ssh-keyscan -H #{new_resource.host} 2>&1`) + key = (new_resource.key || `ssh-keyscan -H -p #{new_resource.port} #{new_resource.host} 2>&1`) comment = key.split("\n").first || "" Chef::Application.fatal! "Could not resolve #{new_resource.host}" if key =~ /getaddrinfo/ diff --git a/resources/entry.rb b/resources/entry.rb index 1cf4df3..ff54094 100644 --- a/resources/entry.rb +++ b/resources/entry.rb @@ -21,6 +21,7 @@ attribute :host, :kind_of => String, :name_attribute => true attribute :key, :kind_of => String +attribute :port, :kind_of => Fixnum, :default => 22 def initialize(*args) super