net-ssh 7.2.0 → 7.2.1.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
  SHA256:
3
- metadata.gz: b2bf895a7938d352a745eed7114d1d0a93fae0395b1d00b34712f34522d79bea
4
- data.tar.gz: 80ccfad64254bd076b8536e17a61dab87f11f975573815ad830e7708309087cc
3
+ metadata.gz: a17dfe9f90130318edc6753cf4f4a203a840425f3b08ba3c9613c2d64f619d00
4
+ data.tar.gz: d8b3be6e4d44328462c85dd423cf29a7089aae1ea2fe838859b8be798915a234
5
5
  SHA512:
6
- metadata.gz: ec21151a75da6a5320875e1bb193855dd443ef58357e2ac42a22f2dd25814e138bf9b3a34ce0d9a96d8094ee6c919818d40da867dc2a22176a98152ed347c427
7
- data.tar.gz: cf01f42c62fce31dade5490fa59cadf7fa904d7bdc420ab5eb8974d96ccf9382a683648b244966b342429bb86073630d4cfd7e4c6bfd6dae0b6189295b543e9e
6
+ metadata.gz: 86f2886564ba68702ae6e82ed911af1912688b5104d79455510654109b72971ede576e2255bf88ef756a03be00f815c7f5320d5a1e24f63cac8261940e1bbad8
7
+ data.tar.gz: 6262e90adef7ef84d991295a6ba53bb0f4504b9ad3587674149a6cb619426f03ce578ab5032097b0bbdcfc4424252bdf3138a4bca98debae4dbc9f03e19f0b4a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-22.04
8
8
  strategy:
9
9
  matrix:
10
- ruby-version: [2.6.10, 2.7.7, 3.0.6, 3.1.3, 3.2.1]
10
+ ruby-version: [2.6.10, 2.7.7, 3.0.6, 3.1.3, 3.2.1, '3.3.0-rc1']
11
11
  steps:
12
12
  - uses: actions/checkout@v3
13
13
 
@@ -39,13 +39,14 @@ jobs:
39
39
  ${{ runner.os }}-pip-v1
40
40
  - name: Bundle install
41
41
  run: |
42
- gem install bundler
42
+ gem install bundler ${{ (startsWith(matrix.ruby-version, '2.6.') || startsWith(matrix.ruby-version, '2.7.')) && '-v 2.4.22' || '' }}
43
43
  bundle config set path 'vendor/bundle'
44
44
  bundle config set --local path 'vendor/bundle'
45
45
  bundle install --jobs 4 --retry 3 --path vendor/bundle
46
46
  BUNDLE_GEMFILE=./Gemfile.noed25519 bundle install --jobs 4 --retry 3 --path vendor/bundle
47
47
  env:
48
48
  BUNDLE_PATH: vendor/bundle
49
+
49
50
 
50
51
  - name: Add to etc/hosts
51
52
  run: |
data/.gitignore CHANGED
@@ -8,6 +8,8 @@ pkg
8
8
  test/integration/.vagrant
9
9
  test/integration/playbook.retry
10
10
 
11
+ lib/net/ssh/version.rb.old
12
+
11
13
  .byebug_history
12
14
 
13
15
  tryout
data/CHANGES.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 7.2.1 rc1
2
+
3
+ * feat: allow load of certkey from string [#926]
4
+ * fix: fix for Socket#recv returning nil on ruby 3.3.0 [#928]
5
+
1
6
  === 7.2.0
2
7
 
3
8
  * Add debugging information for algorithm of pubkey in use [#918]
data/Dockerfile CHANGED
@@ -1,6 +1,8 @@
1
1
  ARG RUBY_VERSION=3.1
2
2
  FROM ruby:${RUBY_VERSION}
3
3
 
4
+ ARG BUNDLERV=
5
+
4
6
  RUN apt update && apt install -y openssh-server sudo netcat-openbsd \
5
7
  && useradd --create-home --shell '/bin/bash' --comment 'NetSSH' 'net_ssh_1' \
6
8
  && useradd --create-home --shell '/bin/bash' --comment 'NetSSH' 'net_ssh_2' \
@@ -20,7 +22,7 @@ COPY Gemfile net-ssh.gemspec $INSTALL_PATH/
20
22
 
21
23
  COPY lib/net/ssh/version.rb $INSTALL_PATH/lib/net/ssh/version.rb
22
24
 
23
- RUN gem install bundler && bundle install
25
+ RUN gem install bundler ${BUNDLERV} && bundle install
24
26
 
25
27
  COPY . $INSTALL_PATH/
26
28
 
data/Rakefile CHANGED
@@ -59,29 +59,48 @@ def change_version(&block)
59
59
  version_file = 'lib/net/ssh/version.rb'
60
60
  require_relative version_file
61
61
  pre = Net::SSH::Version::PRE
62
- result = block[pre: pre]
62
+ tiny = Net::SSH::Version::TINY
63
+ result = block[pre: pre, tiny: Net::SSH::Version::TINY]
63
64
  raise "Version change logic should always return a pre", ArgumentError unless result.key?(:pre)
64
65
 
65
66
  new_pre = result[:pre]
66
- found = false
67
+ new_tiny = result[:tiny] || tiny
68
+ found = { pre: false, tiny: false }
67
69
  File.open("#{version_file}.new", "w") do |f|
68
70
  File.readlines(version_file).each do |line|
69
- match = /^(\s+PRE\s+=\s+")#{pre}("\s*)$/.match(line)
71
+ match =
72
+ if pre.nil?
73
+ /^(\s+PRE\s+=\s+)nil(\s*)$/.match(line)
74
+ else
75
+ /^(\s+PRE\s+=\s+")#{pre}("\s*)$/.match(line)
76
+ end
70
77
  if match
71
78
  prefix = match[1]
72
79
  postfix = match[2]
73
- if new_pre.nil?
74
- prefix.delete_suffix!('"')
75
- postfix.delete_prefix!('"')
76
- end
80
+ prefix.delete_suffix!('"')
81
+ postfix.delete_prefix!('"')
77
82
  new_line = "#{prefix}#{new_pre.inspect}#{postfix}"
78
83
  puts "Changing:\n - #{line} + #{new_line}"
79
84
  line = new_line
80
- found = true
85
+ found[:pre] = true
86
+ end
87
+
88
+ if new_tiny != tiny
89
+ match = /^(\s+TINY\s+=\s+)#{tiny}(\s*)$/.match(line)
90
+ if match
91
+ prefix = match[1]
92
+ postfix = match[2]
93
+ new_line = "#{prefix}#{new_tiny}#{postfix}"
94
+ puts "Changing:\n - #{line} + #{new_line}"
95
+ line = new_line
96
+ found[:tiny] = true
97
+ end
81
98
  end
99
+
82
100
  f.write(line)
83
101
  end
84
- raise ArugmentError, "Cound not find line: PRE = \"#{pre}\" in #{version_file}" unless found
102
+ raise ArgumentError, "Cound not find line: PRE = \"#{pre}\" in #{version_file}" unless found[:pre]
103
+ raise ArgumentError, "Cound not find line: TINY = \"#{tiny}\" in #{version_file}" unless found[:tiny]
85
104
  end
86
105
 
87
106
  FileUtils.mv version_file, "#{version_file}.old"
@@ -99,12 +118,21 @@ namespace :vbump do
99
118
  end
100
119
 
101
120
  desc "Increment prerelease"
102
- task :pre do
103
- change_version do |pre:|
121
+ task :pre, [:type] do |_t, args|
122
+ change_version do |pre:, tiny:|
123
+ puts " PRE => #{pre.inspect}"
104
124
  match = /^([a-z]+)(\d+)/.match(pre)
105
- raise ArgumentError, "Unexpected pre: #{pre}" if match.nil?
125
+ raise ArgumentError, "Unexpected pre: #{pre}" if match.nil? && args[:type].nil?
106
126
 
107
- { pre: "#{match[1]}#{match[2].to_i + 1}" }
127
+ if match.nil? || (!args[:type].nil? && args[:type] != match[1])
128
+ if pre.nil?
129
+ { pre: "#{args[:type]}1", tiny: tiny + 1 }
130
+ else
131
+ { pre: "#{args[:type]}1" }
132
+ end
133
+ else
134
+ { pre: "#{match[1]}#{match[2].to_i + 1}" }
135
+ end
108
136
  end
109
137
  end
110
138
  end
data/docker-compose.yml CHANGED
@@ -16,8 +16,10 @@ services:
16
16
  context: .
17
17
  args:
18
18
  RUBY_VERSION: 2.7
19
+ BUNDLERV: "-v 2.2.28"
19
20
  ruby-2.6:
20
21
  build:
21
22
  context: .
22
23
  args:
23
24
  RUBY_VERSION: 2.6
25
+ BUNDLERV: "-v 2.4.22"
@@ -32,6 +32,9 @@ module Net
32
32
  # The list of user key certificate files that will be examined
33
33
  attr_reader :keycert_files
34
34
 
35
+ # The list of user key certificate data that will be examined
36
+ attr_reader :keycert_data
37
+
35
38
  # The map of loaded identities
36
39
  attr_reader :known_identities
37
40
 
@@ -46,6 +49,7 @@ module Net
46
49
  @key_files = []
47
50
  @key_data = []
48
51
  @keycert_files = []
52
+ @keycert_data = []
49
53
  @use_agent = options[:use_agent] != false
50
54
  @known_identities = {}
51
55
  @agent = nil
@@ -59,6 +63,7 @@ module Net
59
63
  def clear!
60
64
  key_files.clear
61
65
  key_data.clear
66
+ keycert_data.clear
62
67
  known_identities.clear
63
68
  self
64
69
  end
@@ -75,6 +80,12 @@ module Net
75
80
  self
76
81
  end
77
82
 
83
+ # Add the given keycert_data to the list of keycerts that will be used.
84
+ def add_keycert_data(keycert_data_)
85
+ keycert_data.push(keycert_data_).uniq!
86
+ self
87
+ end
88
+
78
89
  # Add the given key_file to the list of keys that will be used.
79
90
  def add_key_data(key_data_)
80
91
  key_data.push(key_data_).uniq!
@@ -132,8 +143,8 @@ module Net
132
143
  end
133
144
 
134
145
  known_identity_blobs = known_identities.keys.map(&:to_blob)
135
- keycert_files.each do |keycert_file|
136
- keycert = KeyFactory.load_public_key(keycert_file)
146
+
147
+ keycerts.each do |keycert|
137
148
  next if known_identity_blobs.include?(keycert.to_blob)
138
149
 
139
150
  (_, corresponding_identity) = known_identities.detect { |public_key, _|
@@ -227,6 +238,12 @@ module Net
227
238
 
228
239
  private
229
240
 
241
+ # Load keycerts from files and data.
242
+ def keycerts
243
+ keycert_files.map { |keycert_file| KeyFactory.load_public_key(keycert_file) } +
244
+ keycert_data.map { |data| KeyFactory.load_data_public_key(data) }
245
+ end
246
+
230
247
  # Prepares identities from user key_files for loading, preserving their order and sources.
231
248
  def prepare_identities_from_files
232
249
  key_files.map do |file|
@@ -63,6 +63,7 @@ module Net
63
63
  key_manager = KeyManager.new(logger, options)
64
64
  keys.each { |key| key_manager.add(key) } unless keys.empty?
65
65
  keycerts.each { |keycert| key_manager.add_keycert(keycert) } unless keycerts.empty?
66
+ keycert_data.each { |data| key_manager.add_keycert_data(data) } unless keycert_data.empty?
66
67
  key_data.each { |key2| key_manager.add_key_data(key2) } unless key_data.empty?
67
68
  default_keys.each { |key| key_manager.add(key) } unless options.key?(:keys) || options.key?(:key_data)
68
69
 
@@ -154,6 +155,12 @@ module Net
154
155
  Array(options[:keycerts])
155
156
  end
156
157
 
158
+ # Returns an array of the keycert data that should be used when
159
+ # attempting any key-based authentication mechanism.
160
+ def keycert_data
161
+ Array(options[:keycert_data])
162
+ end
163
+
157
164
  # Returns an array of the key data that should be used when
158
165
  # attempting any key-based authentication mechanism.
159
166
  def key_data
@@ -61,7 +61,7 @@ module Net
61
61
  # if no data was available to be read.
62
62
  def fill(n = 8192)
63
63
  input.consume!
64
- data = recv(n)
64
+ data = recv(n) || ""
65
65
  debug { "read #{data.length} bytes" }
66
66
  input.append(data)
67
67
  return data.length
@@ -52,11 +52,11 @@ module Net
52
52
  MINOR = 2
53
53
 
54
54
  # The tiny component of this version of the Net::SSH library
55
- TINY = 0
55
+ TINY = 1
56
56
 
57
57
  # The prerelease component of this version of the Net::SSH library
58
58
  # nil allowed
59
- PRE = nil
59
+ PRE = "rc1"
60
60
 
61
61
  # The current version of the Net::SSH library as a Version instance
62
62
  CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
data/lib/net/ssh.rb CHANGED
@@ -66,7 +66,7 @@ module Net
66
66
  auth_methods bind_address compression compression_level config
67
67
  encryption forward_agent hmac host_key identity_agent remote_user
68
68
  keepalive keepalive_interval keepalive_maxcount kex keys key_data
69
- keycerts languages logger paranoid password port proxy
69
+ keycerts keycert_data languages logger paranoid password port proxy
70
70
  rekey_blocks_limit rekey_limit rekey_packet_limit timeout verbose
71
71
  known_hosts global_known_hosts_file user_known_hosts_file host_key_alias
72
72
  host_name user properties passphrase keys_only max_pkt_size
@@ -146,6 +146,8 @@ module Net
146
146
  # and hostbased authentication
147
147
  # * :keycerts => an array of file names of key certificates to use
148
148
  # with publickey authentication
149
+ # * :keycert_data => an array of strings, which each element of the array
150
+ # being a key certificate to use with publickey authentication
149
151
  # * :key_data => an array of strings, with each element of the array being
150
152
  # a raw private key in PEM format.
151
153
  # * :keys_only => set to +true+ to use only private keys from +keys+ and
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: 7.2.0
4
+ version: 7.2.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -31,7 +31,7 @@ cert_chain:
31
31
  v84waVXQ2i5M7pJaHVBF7DxxeW/q8W3VCnsq8vmmvULSThD18QqYGaFDJeN8sTR4
32
32
  6tfjgZ6OvGSScvbCMHkCE9XjonE=
33
33
  -----END CERTIFICATE-----
34
- date: 2023-07-30 00:00:00.000000000 Z
34
+ date: 2023-12-16 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bcrypt_pbkdf
@@ -289,7 +289,6 @@ files:
289
289
  - lib/net/ssh/verifiers/always.rb
290
290
  - lib/net/ssh/verifiers/never.rb
291
291
  - lib/net/ssh/version.rb
292
- - lib/net/ssh/version.rb.old
293
292
  - net-ssh-public_cert.pem
294
293
  - net-ssh.gemspec
295
294
  - support/ssh_tunnel_bug.rb
@@ -309,9 +308,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
308
  version: '2.6'
310
309
  required_rubygems_version: !ruby/object:Gem::Requirement
311
310
  requirements:
312
- - - ">="
311
+ - - ">"
313
312
  - !ruby/object:Gem::Version
314
- version: '0'
313
+ version: 1.3.1
315
314
  requirements: []
316
315
  rubygems_version: 3.3.3
317
316
  signing_key:
metadata.gz.sig CHANGED
Binary file
@@ -1,68 +0,0 @@
1
- module Net
2
- module SSH
3
- # A class for describing the current version of a library. The version
4
- # consists of three parts: the +major+ number, the +minor+ number, and the
5
- # +tiny+ (or +patch+) number.
6
- #
7
- # Two Version instances may be compared, so that you can test that a version
8
- # of a library is what you require:
9
- #
10
- # require 'net/ssh/version'
11
- #
12
- # if Net::SSH::Version::CURRENT < Net::SSH::Version[2,1,0]
13
- # abort "your software is too old!"
14
- # end
15
- class Version
16
- include Comparable
17
-
18
- # A convenience method for instantiating a new Version instance with the
19
- # given +major+, +minor+, and +tiny+ components.
20
- def self.[](major, minor, tiny, pre = nil)
21
- new(major, minor, tiny, pre)
22
- end
23
-
24
- attr_reader :major, :minor, :tiny
25
-
26
- # Create a new Version object with the given components.
27
- def initialize(major, minor, tiny, pre = nil)
28
- @major, @minor, @tiny, @pre = major, minor, tiny, pre
29
- end
30
-
31
- # Compare this version to the given +version+ object.
32
- def <=>(version)
33
- to_i <=> version.to_i
34
- end
35
-
36
- # Converts this version object to a string, where each of the three
37
- # version components are joined by the '.' character. E.g., 2.0.0.
38
- def to_s
39
- @to_s ||= [@major, @minor, @tiny, @pre].compact.join(".")
40
- end
41
-
42
- # Converts this version to a canonical integer that may be compared
43
- # against other version objects.
44
- def to_i
45
- @to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
46
- end
47
-
48
- # The major component of this version of the Net::SSH library
49
- MAJOR = 7
50
-
51
- # The minor component of this version of the Net::SSH library
52
- MINOR = 2
53
-
54
- # The tiny component of this version of the Net::SSH library
55
- TINY = 0
56
-
57
- # The prerelease component of this version of the Net::SSH library
58
- # nil allowed
59
- PRE = "rc1"
60
-
61
- # The current version of the Net::SSH library as a Version instance
62
- CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
63
-
64
- # The current version of the Net::SSH library as a String
65
- STRING = CURRENT.to_s
66
- end
67
- end
68
- end