net-ssh 7.2.0 → 7.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +3 -2
- data/.gitignore +2 -0
- data/.rubocop_todo.yml +1 -1
- data/CHANGES.txt +13 -0
- data/Dockerfile +3 -1
- data/README.md +5 -0
- data/Rakefile +51 -18
- data/docker-compose.yml +2 -0
- data/lib/net/ssh/authentication/ed25519.rb +2 -4
- data/lib/net/ssh/authentication/key_manager.rb +19 -2
- data/lib/net/ssh/authentication/pub_key_fingerprint.rb +1 -1
- data/lib/net/ssh/authentication/session.rb +7 -0
- data/lib/net/ssh/buffered_io.rb +1 -1
- data/lib/net/ssh/known_hosts.rb +2 -3
- data/lib/net/ssh/transport/aes128_gcm.rb +40 -0
- data/lib/net/ssh/transport/aes256_gcm.rb +40 -0
- data/lib/net/ssh/transport/algorithms.rb +8 -1
- data/lib/net/ssh/transport/cipher_factory.rb +9 -7
- data/lib/net/ssh/transport/gcm_cipher.rb +207 -0
- data/lib/net/ssh/transport/hmac/abstract.rb +16 -0
- data/lib/net/ssh/transport/packet_stream.rb +3 -3
- data/lib/net/ssh/transport/state.rb +1 -1
- data/lib/net/ssh/version.rb +1 -1
- data/lib/net/ssh.rb +3 -1
- data/net-ssh-public_cert.pem +19 -18
- data/net-ssh.gemspec +1 -0
- data.tar.gz.sig +0 -0
- metadata +38 -21
- metadata.gz.sig +0 -0
- data/lib/net/ssh/version.rb.old +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e941174d3093fe012c56708a9c23e0b86715e7aa0508b59c60e61279ff136fcd
|
4
|
+
data.tar.gz: '02289d4900c6bd52679c65d70715e1038163ba54c61bd9d8257e837305204c1a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f9db58c86854a20d4d483129501795292ac9fcb9fe1405250536a6a66577e127ca8fbd287da888642acb2929240c7327663100abe70c0808c319b67a11ccc2a
|
7
|
+
data.tar.gz: 189d3ba6b2e53b0910941b7b866d0d8f18c94024f061876b20c59f35ae48bd1edbd57d313bbb35efa1f7a99878a1751ee71a49cc602bb83f0204a82feb9afac1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -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]
|
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
data/.rubocop_todo.yml
CHANGED
@@ -235,7 +235,7 @@ Lint/UselessTimes:
|
|
235
235
|
# Offense count: 205
|
236
236
|
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
237
237
|
Metrics/AbcSize:
|
238
|
-
Max:
|
238
|
+
Max: 75
|
239
239
|
|
240
240
|
# Offense count: 16
|
241
241
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
data/CHANGES.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 7.3.0 rc0
|
2
|
+
|
3
|
+
* aes(128|256)gcm [#946]
|
4
|
+
|
5
|
+
=== 7.2.2
|
6
|
+
|
7
|
+
* ruby 3.3.0: base64 fix
|
8
|
+
|
9
|
+
=== 7.2.1 rc1
|
10
|
+
|
11
|
+
* feat: allow load of certkey from string [#926]
|
12
|
+
* fix: fix for Socket#recv returning nil on ruby 3.3.0 [#928]
|
13
|
+
|
1
14
|
=== 7.2.0
|
2
15
|
|
3
16
|
* 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/README.md
CHANGED
@@ -248,6 +248,8 @@ mv gem-public_cert.pem net-ssh-public_cert.pem
|
|
248
248
|
gem cert --add net-ssh-public_cert.pem
|
249
249
|
```
|
250
250
|
|
251
|
+
or `rake cert:update_public_when_expired`
|
252
|
+
|
251
253
|
## Security contact information
|
252
254
|
|
253
255
|
See [SECURITY.md](SECURITY.md)
|
@@ -272,6 +274,9 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
272
274
|
|
273
275
|
[![Sponsor](https://opencollective.com/net-ssh/sponsor/0/avatar.svg)](https://opencollective.com/net-ssh/sponsor/0/website)
|
274
276
|
|
277
|
+
[<img src="https://github.com/net-ssh/net-ssh/assets/52435/9690bf3e-34ea-4c52-8aea-1cc4cb5bcb6d" width="320">](https://ubicloud.com)
|
278
|
+
|
279
|
+
|
275
280
|
## LICENSE:
|
276
281
|
|
277
282
|
(The MIT License)
|
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
|
-
|
63
|
-
|
62
|
+
tiny = Net::SSH::Version::TINY
|
63
|
+
result = block[pre: pre, tiny: Net::SSH::Version::TINY]
|
64
|
+
raise ArgumentError, "Version change logic should always return a pre" unless result.key?(:pre)
|
64
65
|
|
65
66
|
new_pre = result[:pre]
|
66
|
-
|
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 =
|
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
|
-
|
74
|
-
|
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
|
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] || new_tiny == tiny
|
85
104
|
end
|
86
105
|
|
87
106
|
FileUtils.mv version_file, "#{version_file}.old"
|
@@ -91,20 +110,34 @@ end
|
|
91
110
|
namespace :vbump do
|
92
111
|
desc "Final release"
|
93
112
|
task :final do
|
94
|
-
change_version do |pre:|
|
95
|
-
|
96
|
-
|
97
|
-
|
113
|
+
change_version do |pre:, tiny:|
|
114
|
+
_ = tiny
|
115
|
+
if pre.nil?
|
116
|
+
{ tiny: tiny + 1, pre: nil }
|
117
|
+
else
|
118
|
+
raise ArgumentError, "Unexpected pre: #{pre}" if pre.nil?
|
119
|
+
|
120
|
+
{ pre: nil }
|
121
|
+
end
|
98
122
|
end
|
99
123
|
end
|
100
124
|
|
101
125
|
desc "Increment prerelease"
|
102
|
-
task :pre do
|
103
|
-
change_version do |pre:|
|
126
|
+
task :pre, [:type] do |_t, args|
|
127
|
+
change_version do |pre:, tiny:|
|
128
|
+
puts " PRE => #{pre.inspect}"
|
104
129
|
match = /^([a-z]+)(\d+)/.match(pre)
|
105
|
-
raise ArgumentError, "Unexpected pre: #{pre}" if match.nil?
|
130
|
+
raise ArgumentError, "Unexpected pre: #{pre}" if match.nil? && args[:type].nil?
|
106
131
|
|
107
|
-
|
132
|
+
if match.nil? || (!args[:type].nil? && args[:type] != match[1])
|
133
|
+
if pre.nil?
|
134
|
+
{ pre: "#{args[:type]}1", tiny: tiny + 1 }
|
135
|
+
else
|
136
|
+
{ pre: "#{args[:type]}1" }
|
137
|
+
end
|
138
|
+
else
|
139
|
+
{ pre: "#{match[1]}#{match[2].to_i + 1}" }
|
140
|
+
end
|
108
141
|
end
|
109
142
|
end
|
110
143
|
end
|
data/docker-compose.yml
CHANGED
@@ -3,8 +3,6 @@ gem 'bcrypt_pbkdf', '~> 1.0' unless RUBY_PLATFORM == "java"
|
|
3
3
|
|
4
4
|
require 'ed25519'
|
5
5
|
|
6
|
-
require 'base64'
|
7
|
-
|
8
6
|
require 'net/ssh/transport/cipher_factory'
|
9
7
|
require 'net/ssh/authentication/pub_key_fingerprint'
|
10
8
|
require 'bcrypt_pbkdf' unless RUBY_PLATFORM == "java"
|
@@ -46,7 +44,7 @@ module Net
|
|
46
44
|
raise ArgumentError.new("Expected #{MEND} at end of private key") unless datafull.end_with?(MEND)
|
47
45
|
|
48
46
|
datab64 = datafull[MBEGIN.size...-MEND.size]
|
49
|
-
data =
|
47
|
+
data = datab64.unpack1("m")
|
50
48
|
raise ArgumentError.new("Expected #{MAGIC} at start of decoded private key") unless data.start_with?(MAGIC)
|
51
49
|
|
52
50
|
buffer = Net::SSH::Buffer.new(data[MAGIC.size + 1..-1])
|
@@ -134,7 +132,7 @@ module Net
|
|
134
132
|
|
135
133
|
def to_pem
|
136
134
|
# TODO this is not pem
|
137
|
-
ssh_type +
|
135
|
+
ssh_type + [@verify_key.to_bytes].pack("m")
|
138
136
|
end
|
139
137
|
end
|
140
138
|
|
@@ -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
|
-
|
136
|
-
|
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|
|
@@ -32,7 +32,7 @@ module Net
|
|
32
32
|
when 'MD5'
|
33
33
|
OpenSSL::Digest.hexdigest(algorithm, blob).scan(/../).join(":")
|
34
34
|
when 'SHA256'
|
35
|
-
"SHA256:#{
|
35
|
+
"SHA256:#{[OpenSSL::Digest.digest(algorithm, blob)].pack('m').chomp.gsub(/=+\z/, '')}"
|
36
36
|
else
|
37
37
|
raise OpenSSL::Digest::DigestError, "unsupported ssh key digest #{algorithm}"
|
38
38
|
end
|
@@ -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
|
data/lib/net/ssh/buffered_io.rb
CHANGED
data/lib/net/ssh/known_hosts.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'strscan'
|
2
2
|
require 'openssl'
|
3
|
-
require 'base64'
|
4
3
|
require 'delegate'
|
5
4
|
require 'net/ssh/buffer'
|
6
5
|
require 'net/ssh/authentication/ed25519_loader'
|
@@ -241,11 +240,11 @@ module Net
|
|
241
240
|
def known_host_hash?(hostlist, entries)
|
242
241
|
if hostlist.size == 1 && hostlist.first =~ /\A\|1(\|.+){2}\z/
|
243
242
|
chunks = hostlist.first.split(/\|/)
|
244
|
-
salt =
|
243
|
+
salt = chunks[2].unpack1("m")
|
245
244
|
digest = OpenSSL::Digest.new('sha1')
|
246
245
|
entries.each do |entry|
|
247
246
|
hmac = OpenSSL::HMAC.digest(digest, salt, entry)
|
248
|
-
return true if
|
247
|
+
return true if [hmac].pack("m").chomp == chunks[3]
|
249
248
|
end
|
250
249
|
end
|
251
250
|
false
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'net/ssh/transport/hmac/abstract'
|
2
|
+
require 'net/ssh/transport/gcm_cipher'
|
3
|
+
|
4
|
+
module Net::SSH::Transport
|
5
|
+
## Implements the aes128-gcm@openssh cipher
|
6
|
+
class AES128_GCM
|
7
|
+
extend ::Net::SSH::Transport::GCMCipher
|
8
|
+
|
9
|
+
## Implicit HMAC, do need to do anything
|
10
|
+
class ImplicitHMac < ::Net::SSH::Transport::HMAC::Abstract
|
11
|
+
def aead
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
def key_length
|
16
|
+
16
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def implicit_mac
|
21
|
+
ImplicitHMac.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def algo_name
|
25
|
+
'aes-128-gcm'
|
26
|
+
end
|
27
|
+
|
28
|
+
def name
|
29
|
+
'aes128-gcm@openssh.com'
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# --- RFC 5647 ---
|
34
|
+
# K_LEN AES key length 16 octets
|
35
|
+
#
|
36
|
+
def self.key_length
|
37
|
+
16
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'net/ssh/transport/hmac/abstract'
|
2
|
+
require 'net/ssh/transport/gcm_cipher'
|
3
|
+
|
4
|
+
module Net::SSH::Transport
|
5
|
+
## Implements the aes256-gcm@openssh cipher
|
6
|
+
class AES256_GCM
|
7
|
+
extend ::Net::SSH::Transport::GCMCipher
|
8
|
+
|
9
|
+
## Implicit HMAC, do need to do anything
|
10
|
+
class ImplicitHMac < ::Net::SSH::Transport::HMAC::Abstract
|
11
|
+
def aead
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
def key_length
|
16
|
+
32
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def implicit_mac
|
21
|
+
ImplicitHMac.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def algo_name
|
25
|
+
'aes-256-gcm'
|
26
|
+
end
|
27
|
+
|
28
|
+
def name
|
29
|
+
'aes256-gcm@openssh.com'
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# --- RFC 5647 ---
|
34
|
+
# K_LEN AES key length 32 octets
|
35
|
+
#
|
36
|
+
def self.key_length
|
37
|
+
32
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -44,7 +44,11 @@ module Net
|
|
44
44
|
diffie-hellman-group14-sha256
|
45
45
|
diffie-hellman-group14-sha1],
|
46
46
|
|
47
|
-
encryption: %w[aes256-ctr
|
47
|
+
encryption: %w[aes256-ctr
|
48
|
+
aes192-ctr
|
49
|
+
aes128-ctr
|
50
|
+
aes256-gcm@openssh.com
|
51
|
+
aes128-gcm@openssh.com],
|
48
52
|
|
49
53
|
hmac: %w[hmac-sha2-512-etm@openssh.com hmac-sha2-256-etm@openssh.com
|
50
54
|
hmac-sha2-512 hmac-sha2-256
|
@@ -492,6 +496,9 @@ module Net
|
|
492
496
|
HMAC.get(hmac_server, mac_key_server, parameters)
|
493
497
|
end
|
494
498
|
|
499
|
+
cipher_client.nonce = iv_client if mac_client.respond_to?(:aead) && mac_client.aead
|
500
|
+
cipher_server.nonce = iv_server if mac_server.respond_to?(:aead) && mac_client.aead
|
501
|
+
|
495
502
|
session.configure_client cipher: cipher_client, hmac: mac_client,
|
496
503
|
compression: normalize_compression_name(compression_client),
|
497
504
|
compression_level: options[:compression_level],
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'openssl'
|
2
2
|
require 'net/ssh/transport/ctr.rb'
|
3
|
+
require 'net/ssh/transport/aes128_gcm'
|
4
|
+
require 'net/ssh/transport/aes256_gcm'
|
3
5
|
require 'net/ssh/transport/key_expander'
|
4
6
|
require 'net/ssh/transport/identity_cipher'
|
5
7
|
require 'net/ssh/transport/chacha20_poly1305_cipher_loader'
|
@@ -31,15 +33,15 @@ module Net
|
|
31
33
|
'none' => 'none'
|
32
34
|
}
|
33
35
|
|
34
|
-
SSH_TO_CLASS =
|
36
|
+
SSH_TO_CLASS = {
|
37
|
+
'aes256-gcm@openssh.com' => Net::SSH::Transport::AES256_GCM,
|
38
|
+
'aes128-gcm@openssh.com' => Net::SSH::Transport::AES128_GCM
|
39
|
+
}.tap do |hash|
|
35
40
|
if Net::SSH::Transport::ChaCha20Poly1305CipherLoader::LOADED
|
36
|
-
|
37
|
-
|
38
|
-
}
|
39
|
-
else
|
40
|
-
{
|
41
|
-
}
|
41
|
+
hash['chacha20-poly1305@openssh.com'] =
|
42
|
+
Net::SSH::Transport::ChaCha20Poly1305Cipher
|
42
43
|
end
|
44
|
+
end
|
43
45
|
|
44
46
|
# Returns true if the underlying OpenSSL library supports the given cipher,
|
45
47
|
# and false otherwise.
|
@@ -0,0 +1,207 @@
|
|
1
|
+
require 'net/ssh/loggable'
|
2
|
+
|
3
|
+
module Net
|
4
|
+
module SSH
|
5
|
+
module Transport
|
6
|
+
## Extension module for aes(128|256)gcm ciphers
|
7
|
+
module GCMCipher
|
8
|
+
# rubocop:disable Metrics/AbcSize
|
9
|
+
def self.extended(orig)
|
10
|
+
# rubocop:disable Metrics/BlockLength
|
11
|
+
orig.class_eval do
|
12
|
+
include Net::SSH::Loggable
|
13
|
+
|
14
|
+
attr_reader :cipher
|
15
|
+
attr_reader :key
|
16
|
+
attr_accessor :nonce
|
17
|
+
|
18
|
+
#
|
19
|
+
# Semantically gcm cipher supplies the OpenSSL iv interface with a nonce
|
20
|
+
# as it is not randomly generated due to being supplied from a counter.
|
21
|
+
# The RFC's use IV and nonce interchangeably.
|
22
|
+
#
|
23
|
+
def initialize(encrypt:, key:)
|
24
|
+
@cipher = OpenSSL::Cipher.new(algo_name)
|
25
|
+
@key = key
|
26
|
+
key_len = @cipher.key_len
|
27
|
+
if key.size != key_len
|
28
|
+
error_message = "#{cipher_name}: keylength does not match"
|
29
|
+
error { error_message }
|
30
|
+
raise error_message
|
31
|
+
end
|
32
|
+
encrypt ? @cipher.encrypt : @cipher.decrypt
|
33
|
+
@cipher.key = key
|
34
|
+
|
35
|
+
@nonce = {
|
36
|
+
fixed: nil,
|
37
|
+
invocation_counter: 0
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def update_cipher_mac(payload, _sequence_number)
|
42
|
+
#
|
43
|
+
# --- RFC 5647 7.3 ---
|
44
|
+
# When using AES-GCM with secure shell, the packet_length field is to
|
45
|
+
# be treated as additional authenticated data, not as plaintext.
|
46
|
+
#
|
47
|
+
length_data = [payload.bytesize].pack('N')
|
48
|
+
|
49
|
+
cipher.auth_data = length_data
|
50
|
+
|
51
|
+
encrypted_data = cipher.update(payload) << cipher.final
|
52
|
+
|
53
|
+
mac = cipher.auth_tag
|
54
|
+
|
55
|
+
incr_nonce
|
56
|
+
length_data + encrypted_data + mac
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# --- RFC 5647 ---
|
61
|
+
# uint32 packet_length; // 0 <= packet_length < 2^32
|
62
|
+
#
|
63
|
+
def read_length(data, _sequence_number)
|
64
|
+
data.unpack1('N')
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# --- RFC 5647 ---
|
69
|
+
# In AES-GCM secure shell, the inputs to the authenticated encryption
|
70
|
+
# are:
|
71
|
+
# PT (Plain Text)
|
72
|
+
# byte padding_length; // 4 <= padding_length < 256
|
73
|
+
# byte[n1] payload; // n1 = packet_length-padding_length-1
|
74
|
+
# byte[n2] random_padding; // n2 = padding_length
|
75
|
+
# AAD (Additional Authenticated Data)
|
76
|
+
# uint32 packet_length; // 0 <= packet_length < 2^32
|
77
|
+
# IV (Initialization Vector)
|
78
|
+
# As described in section 7.1.
|
79
|
+
# BK (Block Cipher Key)
|
80
|
+
# The appropriate Encryption Key formed during the Key Exchange.
|
81
|
+
#
|
82
|
+
def read_and_mac(data, mac, _sequence_number)
|
83
|
+
# The authentication tag will be placed in the MAC field at the end of the packet
|
84
|
+
|
85
|
+
# OpenSSL does not verify auth tag length
|
86
|
+
# GCM mode allows arbitrary sizes for the auth_tag up to 128 bytes and a single
|
87
|
+
# byte allows authentication to pass. If single byte auth tags are possible
|
88
|
+
# an attacker would require no more than 256 attempts to forge a valid tag.
|
89
|
+
#
|
90
|
+
raise 'incorrect auth_tag length' unless mac.to_s.length == mac_length
|
91
|
+
|
92
|
+
packet_length = data.unpack1('N')
|
93
|
+
|
94
|
+
cipher.auth_tag = mac.to_s
|
95
|
+
cipher.auth_data = [packet_length].pack('N')
|
96
|
+
|
97
|
+
result = cipher.update(data[4...]) << cipher.final
|
98
|
+
incr_nonce
|
99
|
+
result
|
100
|
+
end
|
101
|
+
|
102
|
+
def mac_length
|
103
|
+
16
|
104
|
+
end
|
105
|
+
|
106
|
+
def block_size
|
107
|
+
16
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.block_size
|
111
|
+
16
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
# --- RFC 5647 ---
|
116
|
+
# N_MIN minimum nonce (IV) length 12 octets
|
117
|
+
# N_MAX maximum nonce (IV) length 12 octets
|
118
|
+
#
|
119
|
+
def iv_len
|
120
|
+
12
|
121
|
+
end
|
122
|
+
|
123
|
+
#
|
124
|
+
# --- RFC 5288 ---
|
125
|
+
# Each value of the nonce_explicit MUST be distinct for each distinct
|
126
|
+
# invocation of the GCM encrypt function for any fixed key. Failure to
|
127
|
+
# meet this uniqueness requirement can significantly degrade security.
|
128
|
+
# The nonce_explicit MAY be the 64-bit sequence number.
|
129
|
+
#
|
130
|
+
# --- RFC 5116 ---
|
131
|
+
# (2.1) Applications that can generate distinct nonces SHOULD use the nonce
|
132
|
+
# formation method defined in Section 3.2, and MAY use any
|
133
|
+
# other method that meets the uniqueness requirement.
|
134
|
+
#
|
135
|
+
# (3.2) The following method to construct nonces is RECOMMENDED.
|
136
|
+
#
|
137
|
+
# <- variable -> <- variable ->
|
138
|
+
# - - - - - - - - - - - - - -
|
139
|
+
# | fixed | counter |
|
140
|
+
#
|
141
|
+
# Initial octets consist of a fixed field and final octets consist of a
|
142
|
+
# Counter field. Implementations SHOULD support 12-octet nonces in which
|
143
|
+
# the Counter field is four octets long.
|
144
|
+
# The Counter fields of successive nonces form a monotonically increasing
|
145
|
+
# sequence, when those fields are regarded as unsignd integers in network
|
146
|
+
# byte order.
|
147
|
+
# The Counter part SHOULD be equal to zero for the first nonce and increment
|
148
|
+
# by one for each successive nonce that is generated.
|
149
|
+
# The Fixed field MUST remain constant for all nonces that are generated for
|
150
|
+
# a given encryption device.
|
151
|
+
#
|
152
|
+
# --- RFC 5647 ---
|
153
|
+
# The invocation field is treated as a 64-bit integer and is increment after
|
154
|
+
# each invocation of AES-GCM to process a binary packet.
|
155
|
+
# AES-GCM produces a keystream in blocks of 16-octets that is used to
|
156
|
+
# encrypt the plaintext. This keystream is produced by encrypting the
|
157
|
+
# following 16-octet data structure:
|
158
|
+
#
|
159
|
+
# uint32 fixed; // 4 octets
|
160
|
+
# uint64 invocation_counter; // 8 octets
|
161
|
+
# unit32 block_counter; // 4 octets
|
162
|
+
#
|
163
|
+
# The block_counter is initially set to one (1) and increment as each block
|
164
|
+
# of key is produced.
|
165
|
+
#
|
166
|
+
# The reader is reminded that SSH requires that the data to be encrypted
|
167
|
+
# MUST be padded out to a multiple of the block size (16-octets for AES-GCM).
|
168
|
+
#
|
169
|
+
def incr_nonce
|
170
|
+
return if nonce[:fixed].nil?
|
171
|
+
|
172
|
+
nonce[:invocation_counter] = [nonce[:invocation_counter].to_s.unpack1('B*').to_i(2) + 1].pack('Q>*')
|
173
|
+
|
174
|
+
apply_nonce
|
175
|
+
end
|
176
|
+
|
177
|
+
def nonce=(iv_s)
|
178
|
+
return if nonce[:fixed]
|
179
|
+
|
180
|
+
nonce[:fixed] = iv_s[0...4]
|
181
|
+
nonce[:invocation_counter] = iv_s[4...12]
|
182
|
+
|
183
|
+
apply_nonce
|
184
|
+
end
|
185
|
+
|
186
|
+
def apply_nonce
|
187
|
+
cipher.iv = "#{nonce[:fixed]}#{nonce[:invocation_counter]}"
|
188
|
+
end
|
189
|
+
|
190
|
+
#
|
191
|
+
# --- RFC 5647 ---
|
192
|
+
# If AES-GCM is selected as the encryption algorithm for a given
|
193
|
+
# tunnel, AES-GCM MUST also be selected as the Message Authentication
|
194
|
+
# Code (MAC) algorithm. Conversely, if AES-GCM is selected as the MAC
|
195
|
+
# algorithm, it MUST also be selected as the encryption algorithm.
|
196
|
+
#
|
197
|
+
def implicit_mac?
|
198
|
+
true
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
# rubocop:enable Metrics/BlockLength
|
203
|
+
end
|
204
|
+
# rubocop:enable Metrics/AbcSize
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
@@ -8,6 +8,18 @@ module Net
|
|
8
8
|
# The base class of all OpenSSL-based HMAC algorithm wrappers.
|
9
9
|
class Abstract
|
10
10
|
class << self
|
11
|
+
def aead(*v)
|
12
|
+
@aead = false if !defined?(@aead)
|
13
|
+
if v.empty?
|
14
|
+
@aead = superclass.aead if @aead.nil? && superclass.respond_to?(:aead)
|
15
|
+
return @aead
|
16
|
+
elsif v.length == 1
|
17
|
+
@aead = v.first
|
18
|
+
else
|
19
|
+
raise ArgumentError, "wrong number of arguments (#{v.length} for 1)"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
11
23
|
def etm(*v)
|
12
24
|
@etm = false if !defined?(@etm)
|
13
25
|
if v.empty?
|
@@ -57,6 +69,10 @@ module Net
|
|
57
69
|
end
|
58
70
|
end
|
59
71
|
|
72
|
+
def aead
|
73
|
+
self.class.aead
|
74
|
+
end
|
75
|
+
|
60
76
|
def etm
|
61
77
|
self.class.etm
|
62
78
|
end
|
@@ -128,7 +128,7 @@ module Net
|
|
128
128
|
payload = client.compress(payload)
|
129
129
|
|
130
130
|
# the length of the packet, minus the padding
|
131
|
-
actual_length = (client.hmac.etm ? 0 : 4) + payload.bytesize + 1
|
131
|
+
actual_length = (client.hmac.etm || client.hmac.aead ? 0 : 4) + payload.bytesize + 1
|
132
132
|
|
133
133
|
# compute the padding length
|
134
134
|
padding_length = client.block_size - (actual_length % client.block_size)
|
@@ -151,7 +151,7 @@ module Net
|
|
151
151
|
debug { "using encrypt-then-mac" }
|
152
152
|
|
153
153
|
# Encrypt padding_length, payload, and padding. Take MAC
|
154
|
-
# from the unencrypted
|
154
|
+
# from the unencrypted packet_length and the encrypted
|
155
155
|
# data.
|
156
156
|
length_data = [packet_length].pack("N")
|
157
157
|
|
@@ -219,7 +219,7 @@ module Net
|
|
219
219
|
# new Packet object.
|
220
220
|
# rubocop:disable Metrics/AbcSize
|
221
221
|
def poll_next_packet
|
222
|
-
aad_length = server.hmac.etm ? 4 : 0
|
222
|
+
aad_length = server.hmac.etm || server.hmac.aead ? 4 : 0
|
223
223
|
|
224
224
|
if @packet.nil?
|
225
225
|
minimum = server.block_size < 4 ? 4 : server.block_size
|
@@ -125,7 +125,7 @@ module Net
|
|
125
125
|
compressor.deflate(data, Zlib::SYNC_FLUSH)
|
126
126
|
end
|
127
127
|
|
128
|
-
#
|
128
|
+
# Decompresses the data. If no compression is in effect, this will just return
|
129
129
|
# the data unmodified, otherwise it uses #decompressor to decompress the data.
|
130
130
|
def decompress(data)
|
131
131
|
data = data.to_s
|
data/lib/net/ssh/version.rb
CHANGED
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/net-ssh-public_cert.pem
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
2
|
+
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
|
3
|
+
c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
|
4
|
+
b20wHhcNMjQwNDAxMDk1NjIxWhcNMjUwNDAxMDk1NjIxWjBBMQ8wDQYDVQQDDAZu
|
5
|
+
ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
|
6
|
+
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ9H+qZ08
|
7
|
+
pQfJhPJTHaDCyQvCsKTFrL5O9z3tllQ7B/zksMMM+qFBpNYu9HCcg4yBATacE/PB
|
8
|
+
qVVyUrpr6lbH/XwoN5ljXm+bdCfmnjZvTCL2FTE6o+bcnaF0IsJyC0Q2B1fbWdXN
|
9
|
+
6Off1ZWoUk6We2BIM1bn6QJLxBpGyYhvOPXsYoqSuzDf2SJDDsWFZ8kV5ON13Ohm
|
10
|
+
JbBzn0oD8HF8FuYOewwsC0C1q4w7E5GtvHcQ5juweS7+RKsyDcVcVrLuNzoGRttS
|
11
|
+
KP4yMn+TzaXijyjRg7gECfJr3TGASaA4bQsILFGG5dAWcwO4OMrZedR7SHj/o0Kf
|
12
|
+
3gL7P0axAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
13
|
+
BBQF8qLA7Z4zg0SJGtUbv3eoQ8tjIzAfBgNVHREEGDAWgRRuZXRzc2hAc29sdXRp
|
14
|
+
b3VzLmNvbTAfBgNVHRIEGDAWgRRuZXRzc2hAc29sdXRpb3VzLmNvbTANBgkqhkiG
|
15
|
+
9w0BAQsFAAOCAQEAfY2WbsBKwRtBep4l+Y2/84H1BKH9UVOsFxqQzYkvM2LFDyup
|
16
|
+
UkjYf8nPSjg3mquhaiA5KSoSVUPpNDfQo+UvY3+mlxRs96ttWiUGwz27fy82rx1B
|
17
|
+
ZnfKjsWOntemNON6asOD0mtv0xsNBfOB2VNIKW/uqHsiPpa0OaVy5uENhX+5OFan
|
18
|
+
2P1Uy+WcMiv38RlRkn4cdEIZUFupDgKFsguYlaJy473/wsae4exUgc5bvi3Splob
|
19
|
+
1uE/LmB/qWBVSNW8e9KDtJynhDDZBlpESyQHFQCZj6UapzxlnC46LaDncPoAtJPc
|
20
|
+
MlWxJ8mKghIcyXc5y4cSyGypNG5BralqnvQUyg==
|
20
21
|
-----END CERTIFICATE-----
|
data/net-ssh.gemspec
CHANGED
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
|
39
39
|
spec.add_development_dependency('rbnacl', '~> 7.1') unless ENV['NET_SSH_NO_RBNACL']
|
40
40
|
|
41
|
+
spec.add_development_dependency "base64"
|
41
42
|
spec.add_development_dependency "bundler", ">= 1.17"
|
42
43
|
spec.add_development_dependency "minitest", "~> 5.19"
|
43
44
|
spec.add_development_dependency "mocha", "~> 2.1.0"
|
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.
|
4
|
+
version: 7.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -12,26 +12,27 @@ bindir: exe
|
|
12
12
|
cert_chain:
|
13
13
|
- |
|
14
14
|
-----BEGIN CERTIFICATE-----
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
15
|
+
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
|
16
|
+
c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
|
17
|
+
b20wHhcNMjQwNDAxMDk1NjIxWhcNMjUwNDAxMDk1NjIxWjBBMQ8wDQYDVQQDDAZu
|
18
|
+
ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
|
19
|
+
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ9H+qZ08
|
20
|
+
pQfJhPJTHaDCyQvCsKTFrL5O9z3tllQ7B/zksMMM+qFBpNYu9HCcg4yBATacE/PB
|
21
|
+
qVVyUrpr6lbH/XwoN5ljXm+bdCfmnjZvTCL2FTE6o+bcnaF0IsJyC0Q2B1fbWdXN
|
22
|
+
6Off1ZWoUk6We2BIM1bn6QJLxBpGyYhvOPXsYoqSuzDf2SJDDsWFZ8kV5ON13Ohm
|
23
|
+
JbBzn0oD8HF8FuYOewwsC0C1q4w7E5GtvHcQ5juweS7+RKsyDcVcVrLuNzoGRttS
|
24
|
+
KP4yMn+TzaXijyjRg7gECfJr3TGASaA4bQsILFGG5dAWcwO4OMrZedR7SHj/o0Kf
|
25
|
+
3gL7P0axAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
26
|
+
BBQF8qLA7Z4zg0SJGtUbv3eoQ8tjIzAfBgNVHREEGDAWgRRuZXRzc2hAc29sdXRp
|
27
|
+
b3VzLmNvbTAfBgNVHRIEGDAWgRRuZXRzc2hAc29sdXRpb3VzLmNvbTANBgkqhkiG
|
28
|
+
9w0BAQsFAAOCAQEAfY2WbsBKwRtBep4l+Y2/84H1BKH9UVOsFxqQzYkvM2LFDyup
|
29
|
+
UkjYf8nPSjg3mquhaiA5KSoSVUPpNDfQo+UvY3+mlxRs96ttWiUGwz27fy82rx1B
|
30
|
+
ZnfKjsWOntemNON6asOD0mtv0xsNBfOB2VNIKW/uqHsiPpa0OaVy5uENhX+5OFan
|
31
|
+
2P1Uy+WcMiv38RlRkn4cdEIZUFupDgKFsguYlaJy473/wsae4exUgc5bvi3Splob
|
32
|
+
1uE/LmB/qWBVSNW8e9KDtJynhDDZBlpESyQHFQCZj6UapzxlnC46LaDncPoAtJPc
|
33
|
+
MlWxJ8mKghIcyXc5y4cSyGypNG5BralqnvQUyg==
|
33
34
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
35
|
+
date: 2024-10-02 00:00:00.000000000 Z
|
35
36
|
dependencies:
|
36
37
|
- !ruby/object:Gem::Dependency
|
37
38
|
name: bcrypt_pbkdf
|
@@ -89,6 +90,20 @@ dependencies:
|
|
89
90
|
- - "~>"
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '7.1'
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: base64
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
92
107
|
- !ruby/object:Gem::Dependency
|
93
108
|
name: bundler
|
94
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,12 +258,15 @@ files:
|
|
243
258
|
- lib/net/ssh/test/remote_packet.rb
|
244
259
|
- lib/net/ssh/test/script.rb
|
245
260
|
- lib/net/ssh/test/socket.rb
|
261
|
+
- lib/net/ssh/transport/aes128_gcm.rb
|
262
|
+
- lib/net/ssh/transport/aes256_gcm.rb
|
246
263
|
- lib/net/ssh/transport/algorithms.rb
|
247
264
|
- lib/net/ssh/transport/chacha20_poly1305_cipher.rb
|
248
265
|
- lib/net/ssh/transport/chacha20_poly1305_cipher_loader.rb
|
249
266
|
- lib/net/ssh/transport/cipher_factory.rb
|
250
267
|
- lib/net/ssh/transport/constants.rb
|
251
268
|
- lib/net/ssh/transport/ctr.rb
|
269
|
+
- lib/net/ssh/transport/gcm_cipher.rb
|
252
270
|
- lib/net/ssh/transport/hmac.rb
|
253
271
|
- lib/net/ssh/transport/hmac/abstract.rb
|
254
272
|
- lib/net/ssh/transport/hmac/md5.rb
|
@@ -289,7 +307,6 @@ files:
|
|
289
307
|
- lib/net/ssh/verifiers/always.rb
|
290
308
|
- lib/net/ssh/verifiers/never.rb
|
291
309
|
- lib/net/ssh/version.rb
|
292
|
-
- lib/net/ssh/version.rb.old
|
293
310
|
- net-ssh-public_cert.pem
|
294
311
|
- net-ssh.gemspec
|
295
312
|
- support/ssh_tunnel_bug.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/net/ssh/version.rb.old
DELETED
@@ -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
|