net-ssh 4.1.0.beta1 → 4.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ddb17acb82519ed776b8253f91d7ce18fefdf51
4
- data.tar.gz: 15b3ed1a09ac2284404592c7aa75258960acd0db
3
+ metadata.gz: b8e122ba1d132741655fe9c8eef7c1944fbe32da
4
+ data.tar.gz: f51ce5fc9dbe822a5b0841d8c557dc51dfa45bf4
5
5
  SHA512:
6
- metadata.gz: 929f76416e948641680d7355c1e86d8614799b6ed874de172111a1d66d0dcfe2b5ef715e4d4bf10c2bc3d8268e5ffcbd9b487544e00c802d3c5069549789cb48
7
- data.tar.gz: 8fefcbc82dc35a448abe499a5656245c1d7c3959abea95e1629bbbe390bb7f73cd53bd3b0c96cc18e6d03f831c370ad0d4a1af9cc699e48f564621e5e52b3d07
6
+ metadata.gz: 36a6fe3552dd86088280b12d59c725448a677b778709bada2bed8b1ede1660b29ea0018aace99d288ab8231e4f60fa9f2a4826b969218f4d6e646f46e60402e2
7
+ data.tar.gz: 4f3129e8b6521debd7810977089cfb6fafb5bcff397cae1f045c673bac30157e9aa0be3e3fd722602975b44272af198e3238c70afddcd0a42b21710e307b55dd
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -2,6 +2,10 @@ language: ruby
2
2
  sudo: true
3
3
  dist: trusty
4
4
 
5
+ addon:
6
+ hosts:
7
+ gateway.netssh
8
+
5
9
  rvm:
6
10
  - 2.0
7
11
  - 2.1
@@ -40,6 +44,7 @@ install:
40
44
  - ansible-playbook ./test/integration/playbook.yml -i "localhost," --become -c local -e 'no_rvm=true' -e 'myuser=travis' -e 'mygroup=travis' -e 'homedir=/home/travis'
41
45
 
42
46
  script:
47
+ - ssh -V
43
48
  - bundle _1.13.7_ exec rake test
44
49
  - BUNDLE_GEMFILE=./Gemfile.norbnacl bundle _1.13.7_ exec rake test
45
50
  - bundle _1.13.7_ exec rake test_test
@@ -1,3 +1,8 @@
1
+ === 4.1.0.rc1
2
+
3
+ * ProxyJump support [Ryan McGeary, #500]
4
+ * Fix agent detection on Windows [Christian Koehler, #495]
5
+
1
6
  === 4.1.0.beta1
2
7
 
3
8
  * Fix nil error when libsodium is not there [chapmajs ,#488]
@@ -79,7 +79,7 @@ module Net; module SSH; module Authentication
79
79
  @socket =
80
80
  if agent_socket_factory
81
81
  agent_socket_factory.call
82
- elsif ENV['SSH_AUTH_SOCK'] && defined?(unix_socket_class)
82
+ elsif ENV['SSH_AUTH_SOCK'] && unix_socket_class
83
83
  unix_socket_class.open(ENV['SSH_AUTH_SOCK'])
84
84
  elsif Gem.win_platform? && RUBY_ENGINE != "jruby"
85
85
  Pageant::Socket.open
@@ -181,7 +181,7 @@ module Net; module SSH; module Authentication
181
181
  private
182
182
 
183
183
  def unix_socket_class
184
- UNIXSocket
184
+ defined?(UNIXSocket) && UNIXSocket
185
185
  end
186
186
 
187
187
  # Send a new packet of the given type, with the associated data.
@@ -27,6 +27,7 @@ module Net; module SSH
27
27
  # * Port => :port
28
28
  # * PreferredAuthentications => maps to the :auth_methods option
29
29
  # * ProxyCommand => maps to the :proxy option
30
+ # * ProxyJump => maps to the :proxy option
30
31
  # * PubKeyAuthentication => maps to the :auth_methods option
31
32
  # * RekeyLimit => :rekey_limit
32
33
  # * User => :user
@@ -156,93 +157,7 @@ module Net; module SSH
156
157
  auth_methods = default_auth_methods.clone
157
158
  (auth_methods << 'challenge-response').uniq!
158
159
  ret = settings.inject({auth_methods: auth_methods}) do |hash, (key, value)|
159
- case key
160
- when 'bindaddress' then
161
- hash[:bind_address] = value
162
- when 'ciphers' then
163
- hash[:encryption] = value.split(/,/)
164
- when 'compression' then
165
- hash[:compression] = value
166
- when 'compressionlevel' then
167
- hash[:compression_level] = value
168
- when 'connecttimeout' then
169
- hash[:timeout] = value
170
- when 'forwardagent' then
171
- hash[:forward_agent] = value
172
- when 'identitiesonly' then
173
- hash[:keys_only] = value
174
- when 'globalknownhostsfile'
175
- hash[:global_known_hosts_file] = value
176
- when 'hostbasedauthentication' then
177
- if value
178
- (hash[:auth_methods] << "hostbased").uniq!
179
- else
180
- hash[:auth_methods].delete("hostbased")
181
- end
182
- when 'hostkeyalgorithms' then
183
- hash[:host_key] = value.split(/,/)
184
- when 'hostkeyalias' then
185
- hash[:host_key_alias] = value
186
- when 'hostname' then
187
- hash[:host_name] = value.gsub(/%h/, settings['host'])
188
- when 'identityfile' then
189
- hash[:keys] = value
190
- when 'macs' then
191
- hash[:hmac] = value.split(/,/)
192
- when 'serveralivecountmax'
193
- hash[:keepalive_maxcount] = value.to_i if value
194
- when 'serveraliveinterval'
195
- if value && value.to_i > 0
196
- hash[:keepalive] = true
197
- hash[:keepalive_interval] = value.to_i
198
- else
199
- hash[:keepalive] = false
200
- end
201
- when 'passwordauthentication'
202
- if value
203
- (hash[:auth_methods] << 'password').uniq!
204
- else
205
- hash[:auth_methods].delete('password')
206
- end
207
- when 'challengeresponseauthentication'
208
- if value
209
- (hash[:auth_methods] << 'challenge-response').uniq!
210
- else
211
- hash[:auth_methods].delete('challenge-response')
212
- end
213
- when 'kbdinteractiveauthentication'
214
- if value
215
- (hash[:auth_methods] << 'keyboard-interactive').uniq!
216
- else
217
- hash[:auth_methods].delete('keyboard-interactive')
218
- end
219
- when 'port'
220
- hash[:port] = value
221
- when 'preferredauthentications'
222
- hash[:auth_methods] = value.split(/,/) # TODO we should place to preferred_auth_methods rather than auth_methods
223
- when 'proxycommand'
224
- if value and !(value =~ /^none$/)
225
- require 'net/ssh/proxy/command'
226
- hash[:proxy] = Net::SSH::Proxy::Command.new(value)
227
- end
228
- when 'pubkeyauthentication'
229
- if value
230
- (hash[:auth_methods] << 'publickey').uniq!
231
- else
232
- hash[:auth_methods].delete('publickey')
233
- end
234
- when 'rekeylimit'
235
- hash[:rekey_limit] = interpret_size(value)
236
- when 'user'
237
- hash[:user] = value
238
- when 'userknownhostsfile'
239
- hash[:user_known_hosts_file] = value
240
- when 'sendenv'
241
- multi_send_env = value.to_s.split(/\s+/)
242
- hash[:send_env] = multi_send_env.map { |e| Regexp.new pattern2regex(e).source, false }
243
- when 'numberofpasswordprompts'
244
- hash[:number_of_password_prompts] = value.to_i
245
- end
160
+ translate_config_key(hash, key.to_sym, value, settings)
246
161
  hash
247
162
  end
248
163
  merge_challenge_response_with_keyboard_interactive(ret)
@@ -262,6 +177,93 @@ module Net; module SSH
262
177
 
263
178
  private
264
179
 
180
+ def translate_config_key(hash, key, value, settings)
181
+ rename = {
182
+ bindaddress: :bind_address,
183
+ compression: :compression,
184
+ compressionlevel: :compression_level,
185
+ connecttimeout: :timeout,
186
+ forwardagent: :forward_agent,
187
+ identitiesonly: :keys_only,
188
+ globalknownhostsfile: :global_known_hosts_file,
189
+ hostkeyalias: :host_key_alias,
190
+ identityfile: :keys,
191
+ port: :port,
192
+ user: :user,
193
+ userknownhostsfile: :user_known_hosts_file
194
+ }
195
+ case key
196
+ when :ciphers
197
+ hash[:encryption] = value.split(/,/)
198
+ when :hostbasedauthentication
199
+ if value
200
+ (hash[:auth_methods] << "hostbased").uniq!
201
+ else
202
+ hash[:auth_methods].delete("hostbased")
203
+ end
204
+ when :hostkeyalgorithms
205
+ hash[:host_key] = value.split(/,/)
206
+ when :hostname
207
+ hash[:host_name] = value.gsub(/%h/, settings['host'])
208
+ when :macs
209
+ hash[:hmac] = value.split(/,/)
210
+ when :serveralivecountmax
211
+ hash[:keepalive_maxcount] = value.to_i if value
212
+ when :serveraliveinterval
213
+ if value && value.to_i > 0
214
+ hash[:keepalive] = true
215
+ hash[:keepalive_interval] = value.to_i
216
+ else
217
+ hash[:keepalive] = false
218
+ end
219
+ when :passwordauthentication
220
+ if value
221
+ (hash[:auth_methods] << 'password').uniq!
222
+ else
223
+ hash[:auth_methods].delete('password')
224
+ end
225
+ when :challengeresponseauthentication
226
+ if value
227
+ (hash[:auth_methods] << 'challenge-response').uniq!
228
+ else
229
+ hash[:auth_methods].delete('challenge-response')
230
+ end
231
+ when :kbdinteractiveauthentication
232
+ if value
233
+ (hash[:auth_methods] << 'keyboard-interactive').uniq!
234
+ else
235
+ hash[:auth_methods].delete('keyboard-interactive')
236
+ end
237
+ when :preferredauthentications
238
+ hash[:auth_methods] = value.split(/,/) # TODO we should place to preferred_auth_methods rather than auth_methods
239
+ when :proxycommand
240
+ if value and !(value =~ /^none$/)
241
+ require 'net/ssh/proxy/command'
242
+ hash[:proxy] = Net::SSH::Proxy::Command.new(value)
243
+ end
244
+ when :proxyjump
245
+ if value
246
+ require 'net/ssh/proxy/jump'
247
+ hash[:proxy] = Net::SSH::Proxy::Jump.new(value)
248
+ end
249
+ when :pubkeyauthentication
250
+ if value
251
+ (hash[:auth_methods] << 'publickey').uniq!
252
+ else
253
+ hash[:auth_methods].delete('publickey')
254
+ end
255
+ when :rekeylimit
256
+ hash[:rekey_limit] = interpret_size(value)
257
+ when :sendenv
258
+ multi_send_env = value.to_s.split(/\s+/)
259
+ hash[:send_env] = multi_send_env.map { |e| Regexp.new pattern2regex(e).source, false }
260
+ when :numberofpasswordprompts
261
+ hash[:number_of_password_prompts] = value.to_i
262
+ when *rename.keys
263
+ hash[rename[key]] = value
264
+ end
265
+ end
266
+
265
267
  # Converts an ssh_config pattern into a regex for matching against
266
268
  # host names.
267
269
  def pattern2regex(pattern)
@@ -613,7 +613,7 @@ module Net; module SSH; module Connection
613
613
  if callback = pending_requests.shift
614
614
  callback.call(self, false)
615
615
  else
616
- error { "channel failure recieved with no pending request to handle it (bug?)" }
616
+ error { "channel failure received with no pending request to handle it (bug?)" }
617
617
  end
618
618
  end
619
619
 
@@ -623,7 +623,7 @@ module Net; module SSH; module Connection
623
623
  if callback = pending_requests.shift
624
624
  callback.call(self, true)
625
625
  else
626
- error { "channel success recieved with no pending request to handle it (bug?)" }
626
+ error { "channel success received with no pending request to handle it (bug?)" }
627
627
  end
628
628
  end
629
629
 
@@ -0,0 +1,53 @@
1
+ require 'uri'
2
+ require 'net/ssh/proxy/command'
3
+
4
+ module Net; module SSH; module Proxy
5
+
6
+ # An implementation of a jump proxy. To use it, instantiate it,
7
+ # then pass the instantiated object via the :proxy key to
8
+ # Net::SSH.start:
9
+ #
10
+ # require 'net/ssh/proxy/jump'
11
+ #
12
+ # proxy = Net::SSH::Proxy::Jump.new('user@proxy')
13
+ # Net::SSH.start('host', 'user', :proxy => proxy) do |ssh|
14
+ # ...
15
+ # end
16
+ class Jump < Command
17
+
18
+ # The jump proxies
19
+ attr_reader :jump_proxies
20
+
21
+ # Create a new socket factory that tunnels via multiple jump proxes as
22
+ # [user@]host[:port].
23
+ def initialize(jump_proxies)
24
+ @jump_proxies = jump_proxies
25
+ end
26
+
27
+ # Return a new socket connected to the given host and port via the jump
28
+ # proxy that was requested when the socket factory was instantiated.
29
+ def open(host, port, connection_options = nil)
30
+ build_proxy_command_equivalent(connection_options)
31
+ super
32
+ end
33
+
34
+ # We cannot build the ProxyCommand template until we know if the :config
35
+ # option was specified during `Net::SSH.start`.
36
+ def build_proxy_command_equivalent(connection_options = nil)
37
+ first_jump, extra_jumps = jump_proxies.split(",", 2)
38
+ config = connection_options && connection_options[:config]
39
+ uri = URI.parse("ssh://#{first_jump}")
40
+
41
+ template = "ssh"
42
+ template << " -l #{uri.user}" if uri.user
43
+ template << " -p #{uri.port}" if uri.port
44
+ template << " -J #{extra_jumps}" if extra_jumps
45
+ template << " -F #{config}" if config != true && config
46
+ template << " -W %h:%p "
47
+ template << uri.host
48
+
49
+ @command_line_template = template
50
+ end
51
+ end
52
+
53
+ end; end; end
@@ -121,7 +121,7 @@ module Net; module SSH; module Transport
121
121
 
122
122
  # Start the algorithm negotation
123
123
  def start
124
- raise ArgumentError, "Cannot call start if it's negoitation started or done" if @pending || @initialized
124
+ raise ArgumentError, "Cannot call start if it's negotiation started or done" if @pending || @initialized
125
125
  send_kexinit
126
126
  end
127
127
 
@@ -135,7 +135,7 @@ module Net; module SSH; module Transport
135
135
  send_kexinit
136
136
  end
137
137
 
138
- # Called by the transport layer when a KEXINIT packet is recieved, indicating
138
+ # Called by the transport layer when a KEXINIT packet is received, indicating
139
139
  # that the server wants to exchange keys. This can be spontaneous, or it
140
140
  # can be in response to a client-initiated rekey request (see #rekey!). Either
141
141
  # way, this will block until the key exchange completes.
@@ -198,7 +198,7 @@ module Net; module SSH; module Transport
198
198
  raise Net::SSH::Disconnect, "disconnected: #{packet[:description]} (#{packet[:reason_code]})"
199
199
 
200
200
  when IGNORE
201
- debug { "IGNORE packet recieved: #{packet[:data].inspect}" }
201
+ debug { "IGNORE packet received: #{packet[:data].inspect}" }
202
202
 
203
203
  when UNIMPLEMENTED
204
204
  lwarn { "UNIMPLEMENTED: #{packet[:number]}" }
@@ -55,7 +55,7 @@ module Net; module SSH
55
55
 
56
56
  # The prerelease component of this version of the Net::SSH library
57
57
  # nil allowed
58
- PRE = "beta1"
58
+ PRE = "rc1"
59
59
 
60
60
  # The current version of the Net::SSH library as a Version instance
61
61
  CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0.beta1
4
+ version: 4.1.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -32,7 +32,7 @@ cert_chain:
32
32
  L4d54WIy4HkZCqQXoTSiK5HZMIdXkPk3F1bZdJ8Dy1sMRru0rUkkM5mW7TQ75mfW
33
33
  Zp0QrZyNZhtitrXFbZneGRrIA/8G2Krft5Ly/A==
34
34
  -----END CERTIFICATE-----
35
- date: 2017-01-20 00:00:00.000000000 Z
35
+ date: 2017-02-15 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
38
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +198,7 @@ files:
198
198
  - lib/net/ssh/proxy/errors.rb
199
199
  - lib/net/ssh/proxy/http.rb
200
200
  - lib/net/ssh/proxy/https.rb
201
+ - lib/net/ssh/proxy/jump.rb
201
202
  - lib/net/ssh/proxy/socks4.rb
202
203
  - lib/net/ssh/proxy/socks5.rb
203
204
  - lib/net/ssh/ruby_compat.rb
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ����*� '�C��Y�D��lD*���h�GE����YL�;�H9<��8��kj�����|���x�����^��� 4K{���?t4�\���Q�Gn�c@����P��$�P"�y��D�*Yl5N���4����;_t9�>{nO���"��~�2:�:>UGK�2aap_�~��v��K��zu3�� ��}٠?����� Ч[�D$�����=�0z��h\uD$|�JiS�%W7T�SHPg
1
+ �C�� e-��w@*���-QW}0d�c>�˭+:�<�xYg��O��ge��� �/ U����V��0ڤfO)S��z�
2
+ �.C ��