net-ssh 2.9.2.beta → 2.9.2.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4b83671580de0bd2d63e112c605feaefe41a5b0
4
- data.tar.gz: f29b3c1c885a9868b09f18d03d988683e1c351d5
3
+ metadata.gz: de2e4d03d9a33f009679b7da843529f74cfb49cf
4
+ data.tar.gz: 9e9d79e59836127851a007d06b315037784d1fd6
5
5
  SHA512:
6
- metadata.gz: 97088cea6fb2f3b47c09e6911c2b52d0e79b97a1b1dc7e6033b44f44531dbef8751677acb7f03b63a0c4ff9978422c20beeafdb61ab8e36435e20e1aafbf0d5b
7
- data.tar.gz: 228621bcee2649a0e05d38483ce4f74376116544e6db2a0edc326c63d9be9ea85e4a5e828f0a171382792cdda4763b9a5f3771ab480b8b5ae4b67a7572a7ced5
6
+ metadata.gz: c94eb4321f98a3e218818a44dc34c0b9444a7afbdcbd6f766ff73cb1882c2d748a5f39e73091be305a9a24a4aae90da23205bffff9a1a45053d3763bca65e252
7
+ data.tar.gz: c53db580ff1bc9ec76bc953aaabaa22aba4c65edec20bb82425a4aef4cc1388c3690775aa8d339c217ff6c690a8988dd637653a49c1f365434494e84a91717e3
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,7 @@
1
+ === 2.9.2-rc1
2
+
3
+ * Documentation fixes and refactoring to keepalive [detiber, mfazekas]
4
+
1
5
  === 2.9.2-beta
2
6
 
3
7
  * Remove advertised algorithms that were not working (ssh-rsa-cert-* *ed25519 acm*-gcm@openssh.com) [mfazekas]
data/Rakefile CHANGED
@@ -1,3 +1,10 @@
1
+ # coding: UTF-8
2
+ #
3
+ # Also in your terminal environment run:
4
+ # $ export LANG=en_US.UTF-8
5
+ # $ export LANGUAGE=en_US.UTF-8
6
+ # $ export LC_ALL=en_US.UTF-8
7
+
1
8
  require "rubygems"
2
9
  require "rake"
3
10
  require "rake/clean"
@@ -21,7 +28,7 @@ begin
21
28
  s.description = s.summary + " It allows you to write programs that invoke and interact with processes on remote servers, via SSH2."
22
29
  s.email = "net-ssh@solutious.com"
23
30
  s.homepage = "https://github.com/net-ssh/net-ssh"
24
- s.authors = ["Jamis Buck", "Delano Mandelbaum"]
31
+ s.authors = ["Jamis Buck", "Delano Mandelbaum", "Miklós Fazekas"]
25
32
 
26
33
  # Note: this is run at package time not install time so if you are
27
34
  # running on jruby, you need to install jruby-pageant manually.
@@ -125,12 +125,12 @@ module Net
125
125
  # specified in an SSH configuration file. It lets you specify an
126
126
  # "alias", similarly to adding an entry in /etc/hosts but without needing
127
127
  # to modify /etc/hosts.
128
- # :keepalive => set to +true+ to send a keepalive packet to the SSH server
128
+ # * :keepalive => set to +true+ to send a keepalive packet to the SSH server
129
129
  # when there's no traffic between the SSH server and Net::SSH client for
130
130
  # the keepalive_interval seconds. Defaults to +false+.
131
- # :keepalive_interval => the interval seconds for keepalive.
131
+ # * :keepalive_interval => the interval seconds for keepalive.
132
132
  # Defaults to +300+ seconds.
133
- # :keepalive_countmax => the maximun number of keepalive packet miss allowed.
133
+ # * :keepalive_maxcount => the maximun number of keepalive packet miss allowed.
134
134
  # * :kex => the key exchange algorithm (or algorithms) to use
135
135
  # * :keys => an array of file names of private keys to use for publickey
136
136
  # and hostbased authentication
@@ -147,7 +147,11 @@ module Net
147
147
  # * :max_win_size => maximum size we tell the other side that is supported for
148
148
  # the window.
149
149
  # * :paranoid => either false, true, :very, or :secure specifying how
150
- # strict host-key verification should be (in increasing order here)
150
+ # strict host-key verification should be (in increasing order here).
151
+ # You can also provide an own Object which responds to +verify+. The argument
152
+ # given to +verify+ is a hash consisting of the +:key+, the +:key_blob+,
153
+ # the +:fingerprint+ and the +:session+. Returning true accepts the host key,
154
+ # returning false declines it and closes the connection.
151
155
  # * :passphrase => the passphrase to use when loading a private key (default
152
156
  # is +nil+, for no passphrase)
153
157
  # * :password => the password to use to login
@@ -523,7 +523,7 @@ module Net; module SSH; module Connection
523
523
  @on_open_failed.call(self, reason_code, description)
524
524
  else
525
525
  raise ChannelOpenFailed.new(reason_code, description)
526
- end
526
+ end
527
527
  end
528
528
 
529
529
  # Invoked when the server sends a CHANNEL_WINDOW_ADJUST packet, and
@@ -1,48 +1,55 @@
1
+ require 'net/ssh/loggable'
1
2
  module Net; module SSH; module Connection
2
3
 
3
- module Keepalive
4
- # Default IO.select timeout threshold
5
- DEFAULT_IO_SELECT_TIMEOUT = 300
4
+ class Keepalive
5
+ include Loggable
6
6
 
7
- def initialize_keepalive
7
+ def initialize(session)
8
8
  @last_keepalive_sent_at = nil
9
9
  @unresponded_keepalive_count = 0
10
+ @session = session
11
+ self.logger = session.logger
10
12
  end
11
13
 
12
- def keepalive_enabled?
14
+ def options
15
+ @session.options
16
+ end
17
+
18
+ def enabled?
13
19
  options[:keepalive]
14
20
  end
15
21
 
16
- def keepalive_interval
17
- options[:keepalive_interval] || DEFAULT_IO_SELECT_TIMEOUT
22
+ def interval
23
+ options[:keepalive_interval] || Session::DEFAULT_IO_SELECT_TIMEOUT
18
24
  end
19
25
 
20
- def should_send_keepalive?
21
- return false unless keepalive_enabled?
26
+ def should_send?
27
+ return false unless enabled?
22
28
  return true unless @last_keepalive_sent_at
23
- Time.now - @last_keepalive_sent_at >= keepalive_interval
29
+ Time.now - @last_keepalive_sent_at >= interval
24
30
  end
25
31
 
26
32
  def keepalive_maxcount
27
33
  (options[:keepalive_maxcount] || 3).to_i
28
34
  end
29
35
 
30
- def send_keepalive_as_needed(readers, writers)
36
+ def send_as_needed(readers, writers)
31
37
  return unless readers.nil? && writers.nil?
32
- return unless should_send_keepalive?
38
+ return unless should_send?
33
39
  info { "sending keepalive #{@unresponded_keepalive_count}" }
34
40
 
35
41
  @unresponded_keepalive_count += 1
36
- send_global_request("keepalive@openssh.com") { |success, response|
37
- puts "before zero => #{@unresponded_keepalive_count}"
42
+ @session.send_global_request("keepalive@openssh.com") { |success, response|
43
+ debug { "keepalive response successful. Missed #{@unresponded_keepalive_count-1} keepalives" }
38
44
  @unresponded_keepalive_count = 0
39
45
  }
40
46
  @last_keepalive_sent_at = Time.now
41
47
  if keepalive_maxcount > 0 && @unresponded_keepalive_count > keepalive_maxcount
42
- error { "Timeout, server #{host} not responding. Missed #{@unresponded_keepalive_count-1} timeouts." }
43
- raise Net::SSH::Timeout, "Timeout, server #{host} not responding."
48
+ error { "Timeout, server #{@session.host} not responding. Missed #{@unresponded_keepalive_count-1} timeouts." }
49
+ @unresponded_keepalive_count = 0
50
+ raise Net::SSH::Timeout, "Timeout, server #{@session.host} not responding."
44
51
  end
45
52
  end
46
53
  end
47
54
 
48
- end; end; end
55
+ end; end; end
@@ -24,7 +24,10 @@ module Net; module SSH; module Connection
24
24
  # ssh.exec! "/etc/init.d/some_process start"
25
25
  # end
26
26
  class Session
27
- include Constants, Loggable, Keepalive
27
+ include Constants, Loggable
28
+
29
+ # Default IO.select timeout threshold
30
+ DEFAULT_IO_SELECT_TIMEOUT = 300
28
31
 
29
32
  # The underlying transport layer abstraction (see Net::SSH::Transport::Session).
30
33
  attr_reader :transport
@@ -77,7 +80,7 @@ module Net; module SSH; module Connection
77
80
  @max_pkt_size = (options.has_key?(:max_pkt_size) ? options[:max_pkt_size] : 0x8000)
78
81
  @max_win_size = (options.has_key?(:max_win_size) ? options[:max_win_size] : 0x20000)
79
82
 
80
- initialize_keepalive
83
+ @keepalive = Keepalive.new(self)
81
84
  end
82
85
 
83
86
  # Retrieves a custom property from this instance. This can be used to
@@ -242,7 +245,7 @@ module Net; module SSH; module Connection
242
245
  writer.send_pending
243
246
  end
244
247
 
245
- send_keepalive_as_needed(readers, writers)
248
+ @keepalive.send_as_needed(readers, writers)
246
249
  transport.rekey_as_needed
247
250
 
248
251
  return true
@@ -596,8 +599,8 @@ module Net; module SSH; module Connection
596
599
 
597
600
  def io_select_wait(wait)
598
601
  return wait if wait
599
- return wait unless keepalive_enabled?
600
- keepalive_interval
602
+ return wait unless @keepalive.enabled?
603
+ @keepalive.interval
601
604
  end
602
605
 
603
606
  MAP = Constants.constants.inject({}) do |memo, name|
@@ -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 = "beta"
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)
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: net-ssh 2.9.2.beta ruby lib
5
+ # stub: net-ssh 2.9.2.rc1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "net-ssh"
9
- s.version = "2.9.2.beta"
9
+ s.version = "2.9.2.rc1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
- s.authors = ["Jamis Buck", "Delano Mandelbaum"]
13
+ s.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
14
14
  s.cert_chain = ["net-ssh-public_cert.pem"]
15
- s.date = "2014-12-02"
15
+ s.date = "2014-12-24"
16
16
  s.description = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2."
17
17
  s.email = "net-ssh@solutious.com"
18
18
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.2.beta
4
+ version: 2.9.2.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
8
8
  - Delano Mandelbaum
9
+ - Miklós Fazekas
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain:
@@ -30,7 +31,7 @@ cert_chain:
30
31
  MbvRpzgROzyfw1qYi4dnIyMwTtXFFcZ0a2jpxHPkcTYFK6TzvFgDLAP0Y/u9jqUQ
31
32
  eZ7/3CdSi/isZHEw
32
33
  -----END CERTIFICATE-----
33
- date: 2014-12-02 00:00:00.000000000 Z
34
+ date: 2014-12-24 00:00:00.000000000 Z
34
35
  dependencies:
35
36
  - !ruby/object:Gem::Dependency
36
37
  name: test-unit
metadata.gz.sig CHANGED
Binary file