net-ssh-backports 6.3.2.backports → 6.3.4.backports
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/net/ssh/authentication/session.rb +25 -22
- data/lib/net/ssh/known_hosts.rb +8 -6
- data/lib/net/ssh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4b789946bcf65642f7c7bfcfca48f1a01900826fc934d30a3e5626f67d484d6
|
4
|
+
data.tar.gz: 8f7282bb62e397fe3bc348a04936c8384481fba3fbd3378983402fee654aa14e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eee9be83f4313adb451351c7b353f163c635d837e2f327ca400647317a3d3d5b2a1f76ddb123718c8fba029e1f5a196ee93dfd7aef23ba8e11ed8e159d5e4b9
|
7
|
+
data.tar.gz: 67af2e5b3f775c55686ca7ed8aa353a1df2a01b1ce29c1ae5dc87a046a9d45d8f977a5d884333607d30b0da09228fc629c8c1d2d677e008085aeea9dfa37e074
|
@@ -55,35 +55,38 @@ module Net
|
|
55
55
|
# service request. Returns true if an authentication method succeeds in
|
56
56
|
# authenticating the user, and false otherwise.
|
57
57
|
def authenticate(next_service, username, password=nil)
|
58
|
-
|
58
|
+
begin
|
59
|
+
debug { "beginning authentication of `#{username}'" }
|
59
60
|
|
60
|
-
|
61
|
-
|
61
|
+
transport.send_message(transport.service_request("ssh-userauth"))
|
62
|
+
expect_message(SERVICE_ACCEPT)
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
key_manager = KeyManager.new(logger, options)
|
65
|
+
keys.each { |key| key_manager.add(key) } unless keys.empty?
|
66
|
+
keycerts.each { |keycert| key_manager.add_keycert(keycert) } unless keycerts.empty?
|
67
|
+
key_data.each { |key2| key_manager.add_key_data(key2) } unless key_data.empty?
|
68
|
+
default_keys.each { |key| key_manager.add(key) } unless options.key?(:keys) || options.key?(:key_data)
|
68
69
|
|
69
|
-
|
70
|
+
attempted = []
|
70
71
|
|
71
|
-
|
72
|
-
|
72
|
+
@auth_methods.each do |name|
|
73
|
+
next unless @allowed_auth_methods.include?(name)
|
73
74
|
|
74
|
-
|
75
|
+
attempted << name
|
75
76
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
77
|
+
debug { "trying #{name}" }
|
78
|
+
begin
|
79
|
+
auth_class = Methods.const_get(name.split(/\W+/).map { |p| p.capitalize }.join)
|
80
|
+
method = auth_class.new(self, key_manager: key_manager, password_prompt: options[:password_prompt])
|
81
|
+
rescue NameError
|
82
|
+
debug {"Mechanism #{name} was requested, but isn't a known type. Ignoring it."}
|
83
|
+
next
|
84
|
+
end
|
84
85
|
|
85
|
-
|
86
|
-
|
86
|
+
return true if method.authenticate(next_service, username, password)
|
87
|
+
rescue Net::SSH::Authentication::DisallowedMethod => e
|
88
|
+
raise e
|
89
|
+
end
|
87
90
|
end
|
88
91
|
|
89
92
|
error { "all authorization methods failed (tried #{attempted.join(', ')})" }
|
data/lib/net/ssh/known_hosts.rb
CHANGED
@@ -143,12 +143,14 @@ module Net
|
|
143
143
|
# add an entry for the given host and key to the first file it is able
|
144
144
|
# to.
|
145
145
|
def add(host, key, options={})
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
146
|
+
begin
|
147
|
+
hostfiles(options, :user).each do |file|
|
148
|
+
KnownHosts.new(file).add(host, key)
|
149
|
+
return
|
150
|
+
end
|
151
|
+
rescue SystemCallError
|
152
|
+
# try the next hostfile
|
153
|
+
end
|
152
154
|
end
|
153
155
|
end
|
154
156
|
|
data/lib/net/ssh/version.rb
CHANGED