net-ssh 7.2.0 → 8.0.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.dockerignore +3 -0
- data/.github/pull_request_template.md +1 -0
- data/.github/workflows/changelog.yml +43 -0
- data/.github/workflows/ci-with-docker.yml +20 -9
- data/.github/workflows/ci.yml +11 -20
- data/.github/workflows/rubocop.yml +3 -1
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +4 -1
- data/CHANGES.txt +114 -0
- data/CONTRIBUTING.md +35 -0
- data/Dockerfile +7 -2
- data/Dockerfile.openssl3 +1 -1
- data/Dockerfile.zlib_ng +29 -0
- data/README.md +76 -57
- data/Rakefile +117 -30
- data/appveyor.yml +4 -16
- data/changelog.d/README.md +1 -0
- data/docker-compose.yml +2 -8
- data/lib/net/ssh/authentication/agent.rb +35 -11
- data/lib/net/ssh/authentication/ed25519.rb +141 -40
- data/lib/net/ssh/authentication/ed25519_loader.rb +14 -9
- data/lib/net/ssh/authentication/key_manager.rb +61 -18
- data/lib/net/ssh/authentication/methods/abstract.rb +2 -8
- data/lib/net/ssh/authentication/methods/publickey.rb +3 -1
- data/lib/net/ssh/authentication/pub_key_fingerprint.rb +1 -1
- data/lib/net/ssh/authentication/security_key.rb +71 -0
- data/lib/net/ssh/authentication/session.rb +34 -15
- data/lib/net/ssh/buffer.rb +6 -1
- data/lib/net/ssh/buffered_io.rb +41 -4
- data/lib/net/ssh/config.rb +30 -13
- data/lib/net/ssh/connection/channel.rb +49 -2
- data/lib/net/ssh/connection/session.rb +58 -8
- data/lib/net/ssh/errors.rb +24 -6
- data/lib/net/ssh/key_factory.rb +11 -4
- data/lib/net/ssh/known_hosts.rb +64 -11
- data/lib/net/ssh/multiplex/client.rb +162 -0
- data/lib/net/ssh/multiplex/control_path.rb +120 -0
- data/lib/net/ssh/multiplex/proxy_transport.rb +218 -0
- data/lib/net/ssh/multiplex.rb +130 -0
- data/lib/net/ssh/prompt.rb +3 -3
- data/lib/net/ssh/proxy/command.rb +28 -3
- data/lib/net/ssh/proxy/jump.rb +52 -4
- data/lib/net/ssh/service/forward.rb +38 -27
- data/lib/net/ssh/test/extensions.rb +3 -2
- data/lib/net/ssh/test/socket.rb +1 -1
- data/lib/net/ssh/test.rb +2 -1
- 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 +96 -34
- data/lib/net/ssh/transport/chacha20_poly1305_cipher.rb +89 -16
- data/lib/net/ssh/transport/chacha20_poly1305_cipher_loader.rb +20 -1
- data/lib/net/ssh/transport/cipher_factory.rb +32 -8
- data/lib/net/ssh/transport/constants.rb +1 -0
- data/lib/net/ssh/transport/gcm_cipher.rb +228 -0
- data/lib/net/ssh/transport/hmac/abstract.rb +16 -0
- data/lib/net/ssh/transport/hmac/sha1_etm.rb +12 -0
- data/lib/net/ssh/transport/hmac.rb +2 -0
- data/lib/net/ssh/transport/kex/curve25519_sha256.rb +41 -9
- data/lib/net/ssh/transport/kex/curve25519_sha256_loader.rb +14 -6
- data/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +8 -0
- data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +45 -15
- data/lib/net/ssh/transport/openssl.rb +2 -1
- data/lib/net/ssh/transport/packet_stream.rb +19 -3
- data/lib/net/ssh/transport/server_version.rb +33 -13
- data/lib/net/ssh/transport/session.rb +60 -46
- data/lib/net/ssh/transport/state.rb +1 -1
- data/lib/net/ssh/verifiers/always.rb +43 -8
- data/lib/net/ssh/version.rb +2 -2
- data/lib/net/ssh.rb +142 -62
- data/net-ssh-public_cert.pem +19 -18
- data/net-ssh.gemspec +7 -8
- data/rakelib/changelog.rb +229 -0
- data.tar.gz.sig +0 -0
- metadata +86 -53
- metadata.gz.sig +1 -1
- data/Gemfile.noed25519 +0 -12
- data/Gemfile.norbnacl +0 -12
- data/lib/net/ssh/version.rb.old +0 -68
data/README.md
CHANGED
|
@@ -28,67 +28,75 @@ It allows you to write programs that invoke and interact with processes on remot
|
|
|
28
28
|
|
|
29
29
|
## Supported Algorithms
|
|
30
30
|
|
|
31
|
-
Net::SSH
|
|
32
|
-
We strongly recommend that you install a
|
|
31
|
+
Net::SSH only offers secure algorithms by default.
|
|
32
|
+
We strongly recommend that you install a server version that supports the latest algorithms.
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Unsecure algoritms will definitely be removed in Net::SSH 8.*.
|
|
34
|
+
Weak algorithms are still supported as opt-ins, so legacy servers such as embedded routers and old network gear stay reachable. To enable one, prefix it with `+` in the matching option, e.g. `encryption: '+aes256-cbc'`, `hmac: '+hmac-sha1-96'`, `kex: '+diffie-hellman-group1-sha1'`, `host_key: '+ssh-dss'`, or in ssh_config with `Ciphers`, `MACs`, `KexAlgorithms`, `HostKeyAlgorithms` and `PubkeyAcceptedAlgorithms` (e.g. `Ciphers +aes256-cbc`). Passing `append_all_supported_algorithms: true` appends every supported algorithm except the `none` cipher and MAC, which are only used when named explicitly (e.g. `encryption: '+none'`, `hmac: '+none'`).
|
|
37
35
|
|
|
38
36
|
### Host Keys
|
|
39
37
|
|
|
40
|
-
| Name
|
|
41
|
-
|
|
42
|
-
| ssh-
|
|
43
|
-
| ssh-ed25519
|
|
44
|
-
| ecdsa-sha2-nistp521
|
|
45
|
-
| ecdsa-sha2-
|
|
46
|
-
|
|
|
47
|
-
|
|
|
38
|
+
| Name | Support | Details |
|
|
39
|
+
|------------------------------------------|------------------------|----------|
|
|
40
|
+
| ssh-ed25519 | OK | Backed by Ruby OpenSSL raw Ed25519 APIs (`openssl >= 3.2.0`) |
|
|
41
|
+
| ssh-ed25519-cert-v01@openssh.com | OK | Backed by Ruby OpenSSL raw Ed25519 APIs (`openssl >= 3.2.0`) |
|
|
42
|
+
| ecdsa-sha2-nistp521/384/256 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
|
|
43
|
+
| ecdsa-sha2-nistp521/384/256-cert-v01@openssh.com | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
|
|
44
|
+
| rsa-sha2-512 | OK | |
|
|
45
|
+
| rsa-sha2-256 | OK | |
|
|
46
|
+
| ssh-rsa | Not offered by default | SHA-1 signatures, off by default as in OpenSSH 8.8; opt-in for legacy servers with `HostKeyAlgorithms +ssh-rsa` or `host_key: '+ssh-rsa'` |
|
|
47
|
+
| ssh-rsa-cert-v01@openssh.com | Not offered by default | SHA-1 signatures; opt-in for legacy servers |
|
|
48
|
+
| ssh-rsa-cert-v00@openssh.com | Deprecated | not offered by default, warns when used and will be removed; net-ssh cannot parse v00 certificates, use ssh-rsa-cert-v01@openssh.com or a modern key type |
|
|
49
|
+
| ssh-dss | Not offered by default | unsecure, off by default as in OpenSSH 7.0; opt-in for legacy servers |
|
|
50
|
+
|
|
51
|
+
RSA public key authentication likewise uses rsa-sha2-512 or rsa-sha2-256 by default; ssh-rsa and ssh-dss keys are only offered when enabled, e.g. with `PubkeyAcceptedAlgorithms +ssh-rsa` or `pubkey_algorithms: %w[+ssh-rsa]`.
|
|
48
52
|
|
|
49
53
|
### Key Exchange
|
|
50
54
|
|
|
51
|
-
| Name | Support
|
|
52
|
-
|
|
53
|
-
| curve25519-sha256 | OK
|
|
54
|
-
|
|
|
55
|
-
| ecdh-sha2-
|
|
56
|
-
| ecdh-sha2-
|
|
57
|
-
|
|
|
58
|
-
| diffie-hellman-
|
|
59
|
-
| diffie-hellman-
|
|
60
|
-
| diffie-hellman-
|
|
55
|
+
| Name | Support | Details |
|
|
56
|
+
|--------------------------------------|------------------------|----------|
|
|
57
|
+
| curve25519-sha256 | OK | Backed by Ruby OpenSSL raw X25519 APIs (`openssl >= 3.2.0`) |
|
|
58
|
+
| curve25519-sha256@libssh.org | OK | Backed by Ruby OpenSSL raw X25519 APIs (`openssl >= 3.2.0`) |
|
|
59
|
+
| ecdh-sha2-nistp521 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
|
|
60
|
+
| ecdh-sha2-nistp384 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
|
|
61
|
+
| ecdh-sha2-nistp256 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
|
|
62
|
+
| diffie-hellman-group-exchange-sha256 | OK | |
|
|
63
|
+
| diffie-hellman-group14-sha256 | OK | |
|
|
64
|
+
| diffie-hellman-group14-sha1 | Not offered by default | SHA-1, off by default as in OpenSSH 8.2; opt-in for legacy servers with `KexAlgorithms +diffie-hellman-group14-sha1` or `kex: '+diffie-hellman-group14-sha1'` |
|
|
65
|
+
| diffie-hellman-group-exchange-sha1 | Not offered by default | unsecure; opt-in for legacy servers |
|
|
66
|
+
| diffie-hellman-group1-sha1 | Not offered by default | unsecure; opt-in for legacy servers |
|
|
61
67
|
|
|
62
68
|
### Encryption algorithms (ciphers)
|
|
63
69
|
|
|
64
|
-
| Name
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
| aes256-
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
70
|
+
| Name | Support | Details |
|
|
71
|
+
|-----------------------------------------|------------------------|----------|
|
|
72
|
+
| chacha20-poly1305@openssh.com | OK | Backed by Ruby OpenSSL ChaCha20 and Poly1305 APIs (`openssl >= 3.2.0`) |
|
|
73
|
+
| aes256-ctr / aes192-ctr / aes128-ctr | OK | |
|
|
74
|
+
| aes256-gcm@openssh.com / aes128-gcm@openssh.com | OK | |
|
|
75
|
+
| aes256-cbc / aes192-cbc / aes128-cbc | Not offered by default | unsecure; opt-in for legacy servers |
|
|
76
|
+
| rijndael-cbc@lysator.liu.se | Not offered by default | unsecure; opt-in for legacy servers |
|
|
77
|
+
| blowfish-ctr blowfish-cbc | Not offered by default | unsecure; opt-in for legacy servers |
|
|
78
|
+
| cast128-ctr cast128-cbc | Not offered by default | unsecure; opt-in for legacy servers |
|
|
79
|
+
| 3des-ctr 3des-cbc | Not offered by default | unsecure; opt-in for legacy servers |
|
|
80
|
+
| idea-cbc | Not offered by default | unsecure; opt-in for legacy servers |
|
|
81
|
+
| none | Not offered by default | no encryption; only used when named explicitly, not added by `append_all_supported_algorithms` |
|
|
75
82
|
|
|
76
83
|
### Message Authentication Code algorithms
|
|
77
84
|
|
|
78
|
-
| Name
|
|
79
|
-
|
|
80
|
-
| hmac-sha2-512-etm
|
|
81
|
-
| hmac-sha2-256-etm
|
|
82
|
-
| hmac-
|
|
83
|
-
| hmac-sha2-
|
|
84
|
-
| hmac-sha2-
|
|
85
|
-
| hmac-
|
|
86
|
-
| hmac-
|
|
87
|
-
| hmac-
|
|
88
|
-
| hmac-
|
|
89
|
-
| hmac-
|
|
90
|
-
| hmac-md5
|
|
91
|
-
|
|
|
85
|
+
| Name | Support | Details |
|
|
86
|
+
|-------------------------------|------------------------|----------|
|
|
87
|
+
| hmac-sha2-512-etm@openssh.com | OK | |
|
|
88
|
+
| hmac-sha2-256-etm@openssh.com | OK | |
|
|
89
|
+
| hmac-sha1-etm@openssh.com | OK | for backward compatibility |
|
|
90
|
+
| hmac-sha2-512 | OK | |
|
|
91
|
+
| hmac-sha2-256 | OK | |
|
|
92
|
+
| hmac-sha1 | OK | for backward compatibility |
|
|
93
|
+
| hmac-sha2-512-96 | Not offered by default | removed from the specification; opt-in for legacy servers |
|
|
94
|
+
| hmac-sha2-256-96 | Not offered by default | removed from the specification; opt-in for legacy servers |
|
|
95
|
+
| hmac-sha1-96 | Not offered by default | unsecure; opt-in for legacy servers |
|
|
96
|
+
| hmac-ripemd160 / hmac-ripemd160@openssh.com | Not offered by default | unsecure; opt-in for legacy servers |
|
|
97
|
+
| hmac-md5 | Not offered by default | unsecure; opt-in for legacy servers |
|
|
98
|
+
| hmac-md5-96 | Not offered by default | unsecure; opt-in for legacy servers |
|
|
99
|
+
| none | Not offered by default | no integrity protection; only used when named explicitly, not added by `append_all_supported_algorithms` |
|
|
92
100
|
|
|
93
101
|
## SYNOPSIS:
|
|
94
102
|
|
|
@@ -148,16 +156,16 @@ See Net::SSH for more documentation, and links to further information.
|
|
|
148
156
|
|
|
149
157
|
## REQUIREMENTS:
|
|
150
158
|
|
|
151
|
-
|
|
152
|
-
|
|
159
|
+
Net::SSH requires Ruby 2.7 or newer and the Ruby `openssl` gem version `3.2.0` or newer.
|
|
160
|
+
The `openssl` gem uses the OpenSSL library Ruby is built against. You can verify the loaded gem and library with:
|
|
153
161
|
|
|
154
162
|
```sh
|
|
155
|
-
ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
|
|
163
|
+
ruby -ropenssl -e 'puts OpenSSL::VERSION; puts OpenSSL::OPENSSL_VERSION'
|
|
156
164
|
```
|
|
157
165
|
|
|
158
|
-
If
|
|
159
|
-
|
|
160
|
-
|
|
166
|
+
If `openssl` cannot be required, rebuild Ruby with OpenSSL support or install the Ruby `openssl` gem separately.
|
|
167
|
+
|
|
168
|
+
Ed25519, curve25519-sha256, and chacha20-poly1305@openssh.com support also require an OpenSSL backend with Ed25519, X25519, ChaCha20, and Poly1305 enabled.
|
|
161
169
|
|
|
162
170
|
## INSTALL:
|
|
163
171
|
|
|
@@ -188,14 +196,16 @@ gem install net-ssh -P HighSecurity
|
|
|
188
196
|
If you don't add the public key, you'll see an error like "Couldn't verify data signature".
|
|
189
197
|
If you're still having trouble let me know and I'll give you a hand.
|
|
190
198
|
|
|
191
|
-
|
|
199
|
+
Ed25519 public key auth is backed by Ruby OpenSSL. The `bcrypt_pbkdf` gem is only needed when loading bcrypt-encrypted OpenSSH private keys.
|
|
192
200
|
|
|
193
201
|
```sh
|
|
194
|
-
gem install ed25519
|
|
195
202
|
gem install bcrypt_pbkdf
|
|
196
203
|
```
|
|
197
204
|
|
|
198
|
-
|
|
205
|
+
### FIDO/U2F security keys
|
|
206
|
+
|
|
207
|
+
`sk-ecdsa-sha2-nistp256@openssh.com` and `sk-ssh-ed25519@openssh.com` keys work when held in `ssh-agent`.
|
|
208
|
+
Loading `sk-*` private key files from disk is not supported.
|
|
199
209
|
|
|
200
210
|
## RUBY SUPPORT
|
|
201
211
|
|
|
@@ -248,6 +258,12 @@ mv gem-public_cert.pem net-ssh-public_cert.pem
|
|
|
248
258
|
gem cert --add net-ssh-public_cert.pem
|
|
249
259
|
```
|
|
250
260
|
|
|
261
|
+
or `rake cert:update_public_when_expired`
|
|
262
|
+
|
|
263
|
+
## CONTRIBUTING
|
|
264
|
+
|
|
265
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md), including how to add a changelog entry.
|
|
266
|
+
|
|
251
267
|
## Security contact information
|
|
252
268
|
|
|
253
269
|
See [SECURITY.md](SECURITY.md)
|
|
@@ -272,6 +288,9 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
|
272
288
|
|
|
273
289
|
[](https://opencollective.com/net-ssh/sponsor/0/website)
|
|
274
290
|
|
|
291
|
+
[<img src="https://github.com/net-ssh/net-ssh/assets/52435/9690bf3e-34ea-4c52-8aea-1cc4cb5bcb6d" width="320">](https://ubicloud.com)
|
|
292
|
+
|
|
293
|
+
|
|
275
294
|
## LICENSE:
|
|
276
295
|
|
|
277
296
|
(The MIT License)
|
data/Rakefile
CHANGED
|
@@ -9,7 +9,11 @@ require "rake"
|
|
|
9
9
|
require "rake/clean"
|
|
10
10
|
require "bundler/gem_tasks"
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
begin
|
|
13
|
+
require "rdoc/task"
|
|
14
|
+
rescue LoadError
|
|
15
|
+
# rdoc is no longer a default gem as of Ruby 4.0; the rest of the Rakefile works without it.
|
|
16
|
+
end
|
|
13
17
|
|
|
14
18
|
desc "When releasing make sure NET_SSH_BUILDGEM_SIGNED is set"
|
|
15
19
|
task :check_NET_SSH_BUILDGEM_SIGNED do
|
|
@@ -24,20 +28,23 @@ CLEAN.include ['pkg', 'rdoc']
|
|
|
24
28
|
name = "net-ssh"
|
|
25
29
|
|
|
26
30
|
require_relative "lib/net/ssh/version"
|
|
31
|
+
require_relative "rakelib/changelog"
|
|
27
32
|
version = Net::SSH::Version::CURRENT
|
|
28
33
|
|
|
29
34
|
extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt]
|
|
30
|
-
RDoc::Task
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
if defined?(RDoc::Task)
|
|
36
|
+
RDoc::Task.new do |rdoc|
|
|
37
|
+
rdoc.rdoc_dir = "rdoc"
|
|
38
|
+
rdoc.title = "#{name} #{version}"
|
|
39
|
+
rdoc.generator = 'hanna' # gem install hanna-nouveau
|
|
40
|
+
rdoc.main = 'README.md'
|
|
41
|
+
rdoc.rdoc_files.include("README*")
|
|
42
|
+
rdoc.rdoc_files.include("bin/*.rb")
|
|
43
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
|
44
|
+
extra_files.each { |file|
|
|
45
|
+
rdoc.rdoc_files.include(file) if File.exist?(file)
|
|
46
|
+
}
|
|
47
|
+
end
|
|
41
48
|
end
|
|
42
49
|
|
|
43
50
|
namespace :cert do
|
|
@@ -59,30 +66,58 @@ def change_version(&block)
|
|
|
59
66
|
version_file = 'lib/net/ssh/version.rb'
|
|
60
67
|
require_relative version_file
|
|
61
68
|
pre = Net::SSH::Version::PRE
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
tiny = Net::SSH::Version::TINY
|
|
70
|
+
result = block[pre: pre, tiny: Net::SSH::Version::TINY]
|
|
71
|
+
raise ArgumentError, "Version change logic should always return a pre" unless result.key?(:pre)
|
|
64
72
|
|
|
65
73
|
new_pre = result[:pre]
|
|
66
|
-
|
|
74
|
+
new_tiny = result[:tiny] || tiny
|
|
75
|
+
found = { pre: false, tiny: false }
|
|
67
76
|
File.open("#{version_file}.new", "w") do |f|
|
|
68
77
|
File.readlines(version_file).each do |line|
|
|
69
|
-
match =
|
|
78
|
+
match =
|
|
79
|
+
if pre.nil?
|
|
80
|
+
/^(\s+PRE\s+=\s+)nil(\s*)$/.match(line)
|
|
81
|
+
else
|
|
82
|
+
/^(\s+PRE\s+=\s+")#{pre}("\s*)$/.match(line)
|
|
83
|
+
end
|
|
70
84
|
if match
|
|
71
85
|
prefix = match[1]
|
|
72
86
|
postfix = match[2]
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
postfix.delete_prefix!('"')
|
|
76
|
-
end
|
|
87
|
+
prefix.delete_suffix!('"')
|
|
88
|
+
postfix.delete_prefix!('"')
|
|
77
89
|
new_line = "#{prefix}#{new_pre.inspect}#{postfix}"
|
|
78
90
|
puts "Changing:\n - #{line} + #{new_line}"
|
|
79
91
|
line = new_line
|
|
80
|
-
found = true
|
|
92
|
+
found[:pre] = true
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if new_tiny != tiny
|
|
96
|
+
match = /^(\s+TINY\s+=\s+)#{tiny}(\s*)$/.match(line)
|
|
97
|
+
if match
|
|
98
|
+
prefix = match[1]
|
|
99
|
+
postfix = match[2]
|
|
100
|
+
new_line = "#{prefix}#{new_tiny}#{postfix}"
|
|
101
|
+
puts "Changing:\n - #{line} + #{new_line}"
|
|
102
|
+
line = new_line
|
|
103
|
+
found[:tiny] = true
|
|
104
|
+
end
|
|
81
105
|
end
|
|
106
|
+
|
|
82
107
|
f.write(line)
|
|
83
108
|
end
|
|
84
|
-
raise
|
|
109
|
+
raise ArgumentError, "Cound not find line: PRE = \"#{pre}\" in #{version_file}" unless found[:pre]
|
|
110
|
+
raise ArgumentError, "Cound not find line: TINY = \"#{tiny}\" in #{version_file}" unless found[:tiny] || new_tiny == tiny
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
begin
|
|
114
|
+
heading = Changelog.heading(Net::SSH::Version::MAJOR, Net::SSH::Version::MINOR, new_tiny, new_pre)
|
|
115
|
+
section = Changelog.new(__dir__).release(heading)
|
|
116
|
+
rescue StandardError
|
|
117
|
+
FileUtils.rm_f "#{version_file}.new"
|
|
118
|
+
raise
|
|
85
119
|
end
|
|
120
|
+
puts section ? "Added to CHANGES.txt:\n#{section}" : "Nothing to release for a pre-release, CHANGES.txt unchanged"
|
|
86
121
|
|
|
87
122
|
FileUtils.mv version_file, "#{version_file}.old"
|
|
88
123
|
FileUtils.mv "#{version_file}.new", version_file
|
|
@@ -91,24 +126,76 @@ end
|
|
|
91
126
|
namespace :vbump do
|
|
92
127
|
desc "Final release"
|
|
93
128
|
task :final do
|
|
94
|
-
change_version do |pre:|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
change_version do |pre:, tiny:|
|
|
130
|
+
_ = tiny
|
|
131
|
+
if pre.nil?
|
|
132
|
+
{ tiny: tiny + 1, pre: nil }
|
|
133
|
+
else
|
|
134
|
+
raise ArgumentError, "Unexpected pre: #{pre}" if pre.nil?
|
|
135
|
+
|
|
136
|
+
{ pre: nil }
|
|
137
|
+
end
|
|
98
138
|
end
|
|
99
139
|
end
|
|
100
140
|
|
|
101
141
|
desc "Increment prerelease"
|
|
102
|
-
task :pre do
|
|
103
|
-
change_version do |pre:|
|
|
142
|
+
task :pre, [:type] do |_t, args|
|
|
143
|
+
change_version do |pre:, tiny:|
|
|
144
|
+
puts " PRE => #{pre.inspect}"
|
|
104
145
|
match = /^([a-z]+)(\d+)/.match(pre)
|
|
105
|
-
raise ArgumentError, "Unexpected pre: #{pre}" if match.nil?
|
|
146
|
+
raise ArgumentError, "Unexpected pre: #{pre}" if match.nil? && args[:type].nil?
|
|
106
147
|
|
|
107
|
-
|
|
148
|
+
if match.nil? || (!args[:type].nil? && args[:type] != match[1])
|
|
149
|
+
if pre.nil?
|
|
150
|
+
{ pre: "#{args[:type]}1", tiny: tiny + 1 }
|
|
151
|
+
else
|
|
152
|
+
{ pre: "#{args[:type]}1" }
|
|
153
|
+
end
|
|
154
|
+
else
|
|
155
|
+
{ pre: "#{match[1]}#{match[2].to_i + 1}" }
|
|
156
|
+
end
|
|
108
157
|
end
|
|
109
158
|
end
|
|
110
159
|
end
|
|
111
160
|
|
|
161
|
+
namespace :changelog do
|
|
162
|
+
changelog = Changelog.new(__dir__)
|
|
163
|
+
|
|
164
|
+
desc "Validate the fragments in changelog.d/"
|
|
165
|
+
task :check do
|
|
166
|
+
count = changelog.check.size
|
|
167
|
+
puts "#{count} valid changelog fragment#{'s' unless count == 1}"
|
|
168
|
+
rescue Changelog::Error => e
|
|
169
|
+
abort e.message
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
desc "Print the CHANGES.txt section the next version bump would write"
|
|
173
|
+
task :preview, [:heading] do |_t, args|
|
|
174
|
+
puts changelog.section(args[:heading] || "Unreleased") || "Nothing to release"
|
|
175
|
+
rescue Changelog::Error => e
|
|
176
|
+
abort e.message
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
desc "Create a fragment: rake \"changelog:new[1234,change,Text of the entry]\""
|
|
180
|
+
task :new, [:number, :type] do |_t, args|
|
|
181
|
+
abort "Usage: rake \"changelog:new[<PR number>,<#{Changelog::TYPES.keys.join('|')}>,<text>]\"" unless args[:number] && args[:type]
|
|
182
|
+
# Rake splits arguments on commas and strips the spaces around them, so take the text from the raw task string.
|
|
183
|
+
raw = Rake.application.top_level_tasks.find { |t| t.start_with?("changelog:new[") }
|
|
184
|
+
text = raw&.[](/\A[^\[]*\[[^,]*,[^,]*,\s*(.*)\]\z/m, 1) || args.extras.join(", ")
|
|
185
|
+
puts "Created #{changelog.new_fragment(args[:number], args[:type], text)}"
|
|
186
|
+
rescue Changelog::Error => e
|
|
187
|
+
abort e.message
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
desc "Write the fragments to CHANGES.txt under a heading, e.g. rake \"changelog:release[7.3.4]\" (vbump does this)"
|
|
191
|
+
task :release, [:heading] do |_t, args|
|
|
192
|
+
abort "Usage: rake \"changelog:release[<version heading>]\"" unless args[:heading]
|
|
193
|
+
puts changelog.release(args[:heading]) || "Nothing to release"
|
|
194
|
+
rescue Changelog::Error => e
|
|
195
|
+
abort e.message
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
112
199
|
namespace :rdoc do
|
|
113
200
|
desc "Update gh-pages branch"
|
|
114
201
|
task :publish do
|
data/appveyor.yml
CHANGED
|
@@ -4,16 +4,9 @@ skip_tags: true
|
|
|
4
4
|
|
|
5
5
|
environment:
|
|
6
6
|
matrix:
|
|
7
|
-
- ruby_version: "
|
|
8
|
-
- ruby_version: "
|
|
9
|
-
- ruby_version: "
|
|
10
|
-
- ruby_version: "24-x64"
|
|
11
|
-
- ruby_version: "23"
|
|
12
|
-
- ruby_version: "23-x64"
|
|
13
|
-
|
|
14
|
-
matrix:
|
|
15
|
-
allow_failures:
|
|
16
|
-
- ruby_version: "jruby-9.1.2.0"
|
|
7
|
+
- ruby_version: "31-x64"
|
|
8
|
+
- ruby_version: "30-x64"
|
|
9
|
+
- ruby_version: "27-x64"
|
|
17
10
|
|
|
18
11
|
#init:
|
|
19
12
|
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
@@ -27,12 +20,8 @@ platform:
|
|
|
27
20
|
|
|
28
21
|
install:
|
|
29
22
|
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
|
30
|
-
- if "%ruby_version%" == "jruby-9.1.2.0" ( cinst javaruntime -i )
|
|
31
|
-
- if "%ruby_version%" == "jruby-9.1.2.0" ( cinst jruby --version 9.1.2.0 -i --allow-empty-checksums )
|
|
32
|
-
- if "%ruby_version%" == "jruby-9.1.2.0" ( SET "PATH=C:\jruby-9.1.2.0\bin\;%PATH%" )
|
|
33
23
|
- ruby --version
|
|
34
|
-
- gem install bundler --no-document --user-install -v
|
|
35
|
-
- SET BUNDLE_GEMFILE=Gemfile.noed25519
|
|
24
|
+
- gem install bundler --no-document --user-install -v 2.4.22
|
|
36
25
|
- bundle install --retry=3
|
|
37
26
|
- cinst freesshd
|
|
38
27
|
- cinst putty --allow-empty-checksums
|
|
@@ -51,7 +40,6 @@ install:
|
|
|
51
40
|
}
|
|
52
41
|
|
|
53
42
|
test_script:
|
|
54
|
-
- SET BUNDLE_GEMFILE=Gemfile.noed25519
|
|
55
43
|
- SET NET_SSH_RUN_WIN_INTEGRATION_TESTS=YES
|
|
56
44
|
- bundle exec rake test
|
|
57
45
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Changelog fragments: one `<PR number>.<type>.txt` file per user-visible change, assembled into `CHANGES.txt` when the version is bumped. See [CONTRIBUTING.md](../CONTRIBUTING.md#changelog).
|
data/docker-compose.yml
CHANGED
|
@@ -17,6 +17,9 @@ module Net
|
|
|
17
17
|
# An exception for indicating that the SSH agent is not available.
|
|
18
18
|
class AgentNotAvailable < AgentError; end
|
|
19
19
|
|
|
20
|
+
# Raised when the agent closes the connection before replying.
|
|
21
|
+
class AgentClosedConnection < AgentError; end
|
|
22
|
+
|
|
20
23
|
# This class implements a simple client for the ssh-agent protocol. It
|
|
21
24
|
# does not implement any specific protocol, but instead copies the
|
|
22
25
|
# behavior of the ssh-agent functions in the OpenSSH library (3.8).
|
|
@@ -83,12 +86,18 @@ module Net
|
|
|
83
86
|
# socket reports that it is an SSH2-compatible agent, this will fail
|
|
84
87
|
# (it only supports the ssh-agent distributed by OpenSSH).
|
|
85
88
|
def connect!(agent_socket_factory = nil, identity_agent = nil)
|
|
89
|
+
@agent_socket_factory = agent_socket_factory
|
|
90
|
+
@identity_agent = identity_agent
|
|
91
|
+
open_agent_socket!
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def open_agent_socket!
|
|
86
95
|
debug { "connecting to ssh-agent" }
|
|
87
96
|
@socket =
|
|
88
|
-
if agent_socket_factory
|
|
89
|
-
agent_socket_factory.call
|
|
90
|
-
elsif identity_agent
|
|
91
|
-
unix_socket_class.open(File.expand_path(identity_agent))
|
|
97
|
+
if @agent_socket_factory
|
|
98
|
+
@agent_socket_factory.call
|
|
99
|
+
elsif @identity_agent
|
|
100
|
+
unix_socket_class.open(File.expand_path(@identity_agent))
|
|
92
101
|
elsif ENV['SSH_AUTH_SOCK'] && unix_socket_class
|
|
93
102
|
unix_socket_class.open(File.expand_path(ENV['SSH_AUTH_SOCK']))
|
|
94
103
|
elsif Gem.win_platform? && RUBY_ENGINE != "jruby"
|
|
@@ -100,6 +109,7 @@ module Net
|
|
|
100
109
|
error { "could not connect to ssh-agent: #{e.message}" }
|
|
101
110
|
raise AgentNotAvailable, $!.message
|
|
102
111
|
end
|
|
112
|
+
private :open_agent_socket!
|
|
103
113
|
|
|
104
114
|
# Attempts to negotiate the SSH agent protocol version. Raises an error
|
|
105
115
|
# if the version could not be negotiated successfully.
|
|
@@ -114,6 +124,11 @@ module Net
|
|
|
114
124
|
elsif type != SSH_AGENT_RSA_IDENTITIES_ANSWER1 && type != SSH_AGENT_RSA_IDENTITIES_ANSWER2
|
|
115
125
|
raise AgentNotAvailable, "unknown response from agent: #{type}, #{body.to_s.inspect}"
|
|
116
126
|
end
|
|
127
|
+
rescue AgentClosedConnection
|
|
128
|
+
# Agents built on ssh-agent-lib <= 0.6.0 (e.g. older Proton Pass) drop the connection on
|
|
129
|
+
# this legacy request but handle the rest of the protocol (#1008).
|
|
130
|
+
debug { "ssh-agent closed the connection on the version request; assuming a modern agent and reconnecting" }
|
|
131
|
+
open_agent_socket!
|
|
117
132
|
end
|
|
118
133
|
|
|
119
134
|
# Return an array of all identities (public keys) known to the agent.
|
|
@@ -137,7 +152,7 @@ module Net
|
|
|
137
152
|
key.extend(Comment)
|
|
138
153
|
key.comment = comment_str
|
|
139
154
|
identities.push key
|
|
140
|
-
rescue NotImplementedError => e
|
|
155
|
+
rescue Net::SSH::UnsupportedKeyType, NotImplementedError => e
|
|
141
156
|
error { "ignoring unimplemented key:#{e.message} #{comment_str}" }
|
|
142
157
|
end
|
|
143
158
|
end
|
|
@@ -223,8 +238,14 @@ module Net
|
|
|
223
238
|
# tuple consisting of the packet type, and the packet's body (which
|
|
224
239
|
# is returned as a Net::SSH::Buffer).
|
|
225
240
|
def read_packet
|
|
226
|
-
|
|
227
|
-
|
|
241
|
+
header = @socket.read(4)
|
|
242
|
+
raise AgentClosedConnection, "agent closed the connection" if header.nil?
|
|
243
|
+
|
|
244
|
+
buffer = Net::SSH::Buffer.new(header)
|
|
245
|
+
body = @socket.read(buffer.read_long)
|
|
246
|
+
raise AgentClosedConnection, "agent closed the connection" if body.nil?
|
|
247
|
+
|
|
248
|
+
buffer.append(body)
|
|
228
249
|
type = buffer.read_byte
|
|
229
250
|
debug { "received agent packet #{type} len #{buffer.length - 4}" }
|
|
230
251
|
return type, buffer
|
|
@@ -235,6 +256,9 @@ module Net
|
|
|
235
256
|
def send_and_wait(type, *args)
|
|
236
257
|
send_packet(type, *args)
|
|
237
258
|
read_packet
|
|
259
|
+
rescue Errno::ECONNRESET, Errno::EPIPE => e
|
|
260
|
+
# Linux reports an agent that closes with our request unread as a reset, not EOF.
|
|
261
|
+
raise AgentClosedConnection, "agent closed the connection (#{e.class})"
|
|
238
262
|
end
|
|
239
263
|
|
|
240
264
|
# Returns +true+ if the parameter indicates a "failure" response from
|
|
@@ -261,13 +285,13 @@ module Net
|
|
|
261
285
|
when /^ecdsa\-sha2\-(\w*)-cert-v01@openssh\.com$/
|
|
262
286
|
Net::SSH::Buffer.from(:string, priv_key.to_blob, :bignum, priv_key.key.private_key).to_s
|
|
263
287
|
when /^ssh-ed25519$/
|
|
264
|
-
Net::SSH::Buffer.from(:string, priv_key.
|
|
265
|
-
:string, priv_key.
|
|
288
|
+
Net::SSH::Buffer.from(:string, priv_key.public_key_bytes,
|
|
289
|
+
:string, priv_key.private_key_bytes_for_agent).to_s
|
|
266
290
|
when /^ssh-ed25519-cert-v01@openssh\.com$/
|
|
267
291
|
# Unlike the other certificate types, the public key is included after the certifiate.
|
|
268
292
|
Net::SSH::Buffer.from(:string, priv_key.to_blob,
|
|
269
|
-
:string, priv_key.key.
|
|
270
|
-
:string, priv_key.key.
|
|
293
|
+
:string, priv_key.key.public_key_bytes,
|
|
294
|
+
:string, priv_key.key.private_key_bytes_for_agent).to_s
|
|
271
295
|
when /^ssh-rsa$/
|
|
272
296
|
# `n` and `e` are reversed compared to the ordering in `OpenSSL::PKey::RSA#to_blob`.
|
|
273
297
|
Net::SSH::Buffer.from(:bignum, priv_key.n, :bignum, priv_key.e, :bignum, priv_key.d,
|