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