summaryrefslogtreecommitdiff
path: root/lib/net/ssh/authentication/session.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/ssh/authentication/session.rb')
-rw-r--r--lib/net/ssh/authentication/session.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/net/ssh/authentication/session.rb b/lib/net/ssh/authentication/session.rb
index 4470650..f3f18e7 100644
--- a/lib/net/ssh/authentication/session.rb
+++ b/lib/net/ssh/authentication/session.rb
@@ -128,13 +128,21 @@ module Net; module SSH; module Authentication
private
+ # Returns an array of paths to the key files usually defined
+ # by system default.
+ def default_keys
+ if defined?(OpenSSL::PKey::EC)
+ %w(~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh/id_ecdsa
+ ~/.ssh2/id_dsa ~/.ssh2/id_rsa ~/.ssh2/id_ecdsa)
+ else
+ %w(~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh2/id_dsa ~/.ssh2/id_rsa)
+ end
+ end
+
# Returns an array of paths to the key files that should be used when
# attempting any key-based authentication mechanism.
def keys
- Array(
- options[:keys] ||
- %w(~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh2/id_dsa ~/.ssh2/id_rsa)
- )
+ Array(options[:keys] || default_keys)
end
# Returns an array of the key data that should be used when