net-ssh 8.0.0 → 8.0.2

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
  SHA256:
3
- metadata.gz: fc22933c7ce50930b6118479820acb8d978d855baade0499b94065d7e245c016
4
- data.tar.gz: 3340e9bd30ac3781da55ffdc0362626e32ad8b0c2db0b2352bf879dc6fe743bc
3
+ metadata.gz: 96690db72c35721670d94d15faf150030ae24a696b2eecc9f9b174eadaa892a2
4
+ data.tar.gz: b5d55d232f256442dfdc344b6a18384872fdc1f7c2d7ced93f7e6dec1890f02c
5
5
  SHA512:
6
- metadata.gz: 226a157e20beb49c008e4a3eb3e15a93ea23b7d0b2935f3c0fa4111d4e43815f6a77b0ef2f22e2bab7123f9410f99655459dc42b94c30ce63a295be77dc3b2ce
7
- data.tar.gz: fb9269c31afc40374ef1b30cc58008d916cf41f3a633596e2fb04f924917f33e966c3b556df56f3cb10fbc24190d956ac9b59b2d57cb7b23204bded86f5316c6
6
+ metadata.gz: e6ebb241e5088fd5b25402bafca4c6152e56da239a3e6bb0124ab84b9944ba7bb91506c6aef17bcb84e021f92335440d8e08f1fce4726189179d65c61150098f
7
+ data.tar.gz: ff9a4c3de691cce2a5cf9e1bb6a647b98663351ab6f896198ee519c6f040e0b767382ad499b7d3907446e52afbc98f485df2a126612da78aaba2d76fc80e563f
checksums.yaml.gz.sig CHANGED
Binary file
data/.rubocop.yml CHANGED
@@ -20,3 +20,7 @@ Layout/LineLength:
20
20
 
21
21
  Style/EmptyLiteral:
22
22
  Enabled: false
23
+
24
+ # CI runs the suite with RUBYOPT=--enable=frozen-string-literal instead of a magic comment in every file.
25
+ Style/FrozenStringLiteralComment:
26
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -587,13 +587,6 @@ Style/FormatString:
587
587
  - 'lib/net/ssh/authentication/pageant.rb'
588
588
  - 'lib/net/ssh/loggable.rb'
589
589
 
590
- # Offense count: 174
591
- # This cop supports safe auto-correction (--auto-correct).
592
- # Configuration parameters: EnforcedStyle.
593
- # SupportedStyles: always, always_true, never
594
- Style/FrozenStringLiteralComment:
595
- Enabled: false
596
-
597
590
  # Offense count: 1
598
591
  # This cop supports safe auto-correction (--auto-correct).
599
592
  Style/GlobalStdStream:
data/CHANGES.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 8.0.2
2
+
3
+ * Fixed `Session#close` raising `EOFError: cannot send data if channel has declared eof` when a forwarded connection still had unread data from its local client; data net-ssh had already read is still sent before the EOF and, as in OpenSSH, the rest is dropped; a regression in 8.0.0 [#1066, #1067]
4
+
5
+ === 8.0.1
6
+
7
+ * Fixed `unexpected packet type 94 during initial key exchange` (or 93) when channel data arrives during a client-initiated re-key, which broke bulk transfers at the first re-key (e.g. with `rekey_limit`, or after about 1 GB); a regression in 7.3.5 and 8.0.0 [#1063]
8
+ * `control_master: :auto` now ignores `forward_agent` (logged at info level) instead of raising ArgumentError, and logs the ignored connection options at info instead of warn level, so it works with sshkit (Kamal, Capistrano), which always passes `forward_agent: true`, `keys`, `known_hosts` and `keepalive` [#1062]
9
+
1
10
  === 8.0.0
2
11
 
3
12
  * No changes since 8.0.0 rc5.
@@ -32,13 +32,9 @@ module Net
32
32
  VALUES = [:auto, false, nil].freeze
33
33
 
34
34
  def self.validate_options!(options)
35
- unless VALUES.include?(options[:control_master])
36
- raise ArgumentError, "control_master must be :auto or false, got #{options[:control_master].inspect}"
37
- end
38
- return unless options[:control_master] && options[:forward_agent]
35
+ return if VALUES.include?(options[:control_master])
39
36
 
40
- raise ArgumentError, "forward_agent can't be used with control_master: the ControlMaster serves agent requests " \
41
- "from its own agent only if it has ForwardAgent enabled itself, and rejects them otherwise"
37
+ raise ArgumentError, "control_master must be :auto or false, got #{options[:control_master].inspect}"
42
38
  end
43
39
 
44
40
  # Returns a Connection::Session running through the ControlMaster for
@@ -55,7 +51,7 @@ module Net
55
51
  return nil unless socket
56
52
 
57
53
  logger.info { "control_master: using ControlMaster at #{path}" }
58
- warn_master_owned(logger, explicit)
54
+ log_master_owned(logger, explicit)
59
55
  begin
60
56
  transport = ProxyTransport.new(socket, host: host, control_path: path, options: options)
61
57
  Connection::Session.new(transport, session_options(logger, options))
@@ -108,23 +104,23 @@ module Net
108
104
  ControlPath.jump_host(proxy.jump_proxies)
109
105
  end
110
106
 
111
- def self.warn_master_owned(logger, explicit)
107
+ def self.log_master_owned(logger, explicit)
112
108
  bypassed = explicit & MASTER_OWNED_OPTIONS
113
109
  return if bypassed.empty?
114
110
 
115
- logger.warn { "control_master: ignoring #{bypassed.join(', ')}, the ControlMaster's own settings apply" }
111
+ logger.info { "control_master: ignoring #{bypassed.join(', ')}, the ControlMaster's own settings apply" }
116
112
  end
117
113
 
118
114
  # Keepalive is a global request, which the master doesn't allow; it
119
- # watches its own connection anyway. ForwardAgent from ssh_config is
120
- # dropped for the reason given in validate_options!.
115
+ # watches its own connection anyway. The master serves agent requests
116
+ # from its own agent only if it has ForwardAgent enabled itself.
121
117
  def self.session_options(logger, options)
122
118
  logger.info { "control_master: keepalive is left to the ControlMaster" } if options[:keepalive]
123
119
  logger.info { "control_master: ignoring ForwardAgent, the ControlMaster's own ForwardAgent setting applies" } if options[:forward_agent]
124
120
  options.merge(keepalive: false, forward_agent: false)
125
121
  end
126
122
 
127
- private_class_method :open_proxy, :socket_path, :jump_host, :warn_master_owned, :session_options
123
+ private_class_method :open_proxy, :socket_path, :jump_host, :log_master_owned, :session_options
128
124
  end
129
125
  end
130
126
  end
@@ -346,6 +346,10 @@ module Net
346
346
  ch.info { "#{type} forwarded connection closed" }
347
347
  session.stop_listening_to(socket)
348
348
  ch.close
349
+ elsif ch.eof?
350
+ # Like OpenSSH's chan_shutdown_read: data already read still goes out before CHANNEL_EOF, the rest is dropped.
351
+ ch.output.append(socket.read_available) if socket.available > 0
352
+ session.pause_reading(socket)
349
353
  else
350
354
  if socket.available > 0
351
355
  data = socket.read_available(8192)
@@ -376,6 +380,8 @@ module Net
376
380
  end
377
381
 
378
382
  channel.on_process do |ch|
383
+ next if ch.eof?
384
+
379
385
  data = ch[:socket].read(8192)
380
386
  if data
381
387
  ch.debug { "read #{data.length} bytes from client, sending over #{type} forwarded connection" }
@@ -228,7 +228,8 @@ module Net
228
228
 
229
229
  else
230
230
  return packet if algorithms.allow?(packet)
231
- raise Net::SSH::Exception, "unexpected packet type #{packet.type} during initial key exchange" unless algorithms.initialized?
231
+ # Algorithms#rekey! clears initialized?, so the session id is what marks the first key exchange as done.
232
+ raise Net::SSH::Exception, "unexpected packet type #{packet.type} during initial key exchange" unless algorithms.session_id
232
233
 
233
234
  push(packet)
234
235
  end
@@ -52,7 +52,7 @@ module Net
52
52
  MINOR = 0
53
53
 
54
54
  # The tiny component of this version of the Net::SSH library
55
- TINY = 0
55
+ TINY = 2
56
56
 
57
57
  # The prerelease component of this version of the Net::SSH library
58
58
  # nil allowed
data/lib/net/ssh.rb CHANGED
@@ -125,21 +125,21 @@ module Net
125
125
  # for setting up a connection (:keys, :key_data, :password, :passphrase,
126
126
  # :auth_methods, :verify_host_key, :known_hosts, :host_key, :kex,
127
127
  # :encryption, :hmac, :compression, :rekey_*, :proxy, :keepalive and the
128
- # like); explicitly passed ones are named in a logger warning. Over the
128
+ # like); explicitly passed ones are named at info level. Over the
129
129
  # master, remote port forwarding (Service::Forward#remote and
130
130
  # #cancel_remote) raises Net::SSH::NotSupportedOverControlMaster, as the
131
131
  # master consumes the global request reply, so success, failure and the
132
132
  # port allocated for port 0 can't be observed; other global requests
133
133
  # raise it too. Agent and X11 forwarding requests raise it
134
- # too, and :forward_agent can't be combined with it, because the master
135
- # serves them from its own agent or display only if it has ForwardAgent
136
- # or ForwardX11 enabled itself, and rejects them otherwise. Keepalive and
137
- # rekeying are left to the master. ssh_config's ControlMaster is
138
- # ignored, only this option enables it. An invalid ControlPath raises
139
- # ArgumentError. A missing or stale socket is logged at info level, a
140
- # socket that can't be used (another owner, refused, wrong protocol,
141
- # timed out) at warn level. Has no effect on Windows. Defaults to
142
- # +false+.
134
+ # too, and :forward_agent is ignored (logged at info level), because the
135
+ # master serves them from its own agent or display only if it has
136
+ # ForwardAgent or ForwardX11 enabled itself, and rejects them otherwise.
137
+ # Keepalive and rekeying are left to the master. ssh_config's
138
+ # ControlMaster is ignored, only this option enables it. An invalid
139
+ # ControlPath raises ArgumentError. A missing or stale socket is logged
140
+ # at info level, a socket that can't be used (another owner, refused,
141
+ # wrong protocol, timed out) at warn level. Has no effect on Windows.
142
+ # Defaults to +false+.
143
143
  # * :control_path => the ControlMaster socket to use with
144
144
  # :control_master, with the same ~, ${ENV} and % tokens as ssh_config's
145
145
  # ControlPath (%C, %d, %h, %i, %j, %k, %L, %l, %n, %p, %r, %u, %%).
@@ -154,7 +154,8 @@ module Net
154
154
  # files. Defaults to +true+.
155
155
  # * :encryption => the encryption cipher (or ciphers) to use
156
156
  # * :forward_agent => set to true if you want the SSH agent connection to
157
- # be forwarded
157
+ # be forwarded. Ignored for a session through a ControlMaster (see
158
+ # :control_master).
158
159
  # * :known_hosts => a custom object holding known hosts records.
159
160
  # It must implement #search_for and `add` in a similiar manner as KnownHosts.
160
161
  # * :global_known_hosts_file => the location of the global known hosts
data.tar.gz.sig CHANGED
Binary file
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: 8.0.0
4
+ version: 8.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -32,7 +32,7 @@ cert_chain:
32
32
  ufHf4AX2UIkJbh7zCPkiNCqIr7MSWLNFG/9lOlHYsEJM8XujT1ofPobYx6YSFx/C
33
33
  7HBrI7UX7awt6UvBZebhcHzyMHxg/B5PVQllPA==
34
34
  -----END CERTIFICATE-----
35
- date: 2026-10-21 00:00:00.000000000 Z
35
+ date: 2026-10-22 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: logger
metadata.gz.sig CHANGED
Binary file