net-ssh 5.0.2 → 7.0.1
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/.dockerignore +6 -0
- data/.github/config/rubocop_linter_action.yml +4 -0
- data/.github/workflows/ci-with-docker.yml +44 -0
- data/.github/workflows/ci.yml +87 -0
- data/.github/workflows/rubocop.yml +13 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +19 -2
- data/.rubocop_todo.yml +623 -511
- data/CHANGES.txt +76 -0
- data/Dockerfile +27 -0
- data/Dockerfile.openssl3 +17 -0
- data/Gemfile +2 -0
- data/Gemfile.noed25519 +2 -0
- data/Manifest +0 -1
- data/README.md +293 -0
- data/Rakefile +6 -2
- data/appveyor.yml +4 -2
- data/docker-compose.yml +23 -0
- data/lib/net/ssh/authentication/agent.rb +36 -14
- data/lib/net/ssh/authentication/certificate.rb +19 -7
- data/lib/net/ssh/authentication/constants.rb +0 -1
- data/lib/net/ssh/authentication/ed25519.rb +83 -50
- data/lib/net/ssh/authentication/ed25519_loader.rb +5 -8
- data/lib/net/ssh/authentication/key_manager.rb +74 -33
- data/lib/net/ssh/authentication/methods/abstract.rb +12 -3
- data/lib/net/ssh/authentication/methods/hostbased.rb +3 -5
- data/lib/net/ssh/authentication/methods/keyboard_interactive.rb +5 -3
- data/lib/net/ssh/authentication/methods/none.rb +6 -9
- data/lib/net/ssh/authentication/methods/password.rb +2 -3
- data/lib/net/ssh/authentication/methods/publickey.rb +58 -16
- data/lib/net/ssh/authentication/pageant.rb +97 -97
- data/lib/net/ssh/authentication/pub_key_fingerprint.rb +2 -3
- data/lib/net/ssh/authentication/session.rb +27 -23
- data/lib/net/ssh/buffer.rb +91 -40
- data/lib/net/ssh/buffered_io.rb +24 -26
- data/lib/net/ssh/config.rb +99 -53
- data/lib/net/ssh/connection/channel.rb +101 -87
- data/lib/net/ssh/connection/constants.rb +0 -4
- data/lib/net/ssh/connection/event_loop.rb +30 -25
- data/lib/net/ssh/connection/keepalive.rb +12 -12
- data/lib/net/ssh/connection/session.rb +115 -111
- data/lib/net/ssh/connection/term.rb +56 -58
- data/lib/net/ssh/errors.rb +12 -12
- data/lib/net/ssh/key_factory.rb +108 -22
- data/lib/net/ssh/known_hosts.rb +120 -36
- data/lib/net/ssh/loggable.rb +10 -11
- data/lib/net/ssh/packet.rb +1 -1
- data/lib/net/ssh/prompt.rb +9 -11
- data/lib/net/ssh/proxy/command.rb +1 -2
- data/lib/net/ssh/proxy/errors.rb +2 -4
- data/lib/net/ssh/proxy/http.rb +18 -20
- data/lib/net/ssh/proxy/https.rb +8 -10
- data/lib/net/ssh/proxy/jump.rb +8 -10
- data/lib/net/ssh/proxy/socks4.rb +2 -4
- data/lib/net/ssh/proxy/socks5.rb +3 -6
- data/lib/net/ssh/service/forward.rb +9 -8
- data/lib/net/ssh/test/channel.rb +24 -26
- data/lib/net/ssh/test/extensions.rb +37 -35
- data/lib/net/ssh/test/kex.rb +6 -8
- data/lib/net/ssh/test/local_packet.rb +0 -2
- data/lib/net/ssh/test/packet.rb +3 -3
- data/lib/net/ssh/test/remote_packet.rb +6 -8
- data/lib/net/ssh/test/script.rb +25 -27
- data/lib/net/ssh/test/socket.rb +12 -15
- data/lib/net/ssh/test.rb +12 -12
- data/lib/net/ssh/transport/algorithms.rb +177 -118
- data/lib/net/ssh/transport/cipher_factory.rb +34 -50
- data/lib/net/ssh/transport/constants.rb +13 -9
- data/lib/net/ssh/transport/ctr.rb +8 -14
- data/lib/net/ssh/transport/hmac/abstract.rb +20 -5
- data/lib/net/ssh/transport/hmac/md5.rb +0 -2
- data/lib/net/ssh/transport/hmac/md5_96.rb +0 -2
- data/lib/net/ssh/transport/hmac/none.rb +0 -2
- data/lib/net/ssh/transport/hmac/ripemd160.rb +0 -2
- data/lib/net/ssh/transport/hmac/sha1.rb +0 -2
- data/lib/net/ssh/transport/hmac/sha1_96.rb +0 -2
- data/lib/net/ssh/transport/hmac/sha2_256.rb +7 -11
- data/lib/net/ssh/transport/hmac/sha2_256_96.rb +4 -8
- data/lib/net/ssh/transport/hmac/sha2_256_etm.rb +12 -0
- data/lib/net/ssh/transport/hmac/sha2_512.rb +6 -9
- data/lib/net/ssh/transport/hmac/sha2_512_96.rb +4 -8
- data/lib/net/ssh/transport/hmac/sha2_512_etm.rb +12 -0
- data/lib/net/ssh/transport/hmac.rb +13 -11
- data/lib/net/ssh/transport/identity_cipher.rb +11 -13
- data/lib/net/ssh/transport/kex/abstract.rb +130 -0
- data/lib/net/ssh/transport/kex/abstract5656.rb +72 -0
- data/lib/net/ssh/transport/kex/curve25519_sha256.rb +39 -0
- data/lib/net/ssh/transport/kex/curve25519_sha256_loader.rb +30 -0
- data/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +5 -19
- data/lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb +11 -0
- data/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +30 -139
- data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +1 -8
- data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +5 -9
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +20 -81
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +5 -4
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +5 -4
- data/lib/net/ssh/transport/kex.rb +15 -10
- data/lib/net/ssh/transport/key_expander.rb +7 -8
- data/lib/net/ssh/transport/openssl.rb +149 -111
- data/lib/net/ssh/transport/packet_stream.rb +53 -22
- data/lib/net/ssh/transport/server_version.rb +17 -16
- data/lib/net/ssh/transport/session.rb +35 -11
- data/lib/net/ssh/transport/state.rb +44 -44
- data/lib/net/ssh/verifiers/accept_new.rb +7 -2
- data/lib/net/ssh/verifiers/accept_new_or_local_tunnel.rb +1 -2
- data/lib/net/ssh/verifiers/always.rb +10 -4
- data/lib/net/ssh/verifiers/never.rb +4 -2
- data/lib/net/ssh/version.rb +2 -2
- data/lib/net/ssh.rb +17 -9
- data/net-ssh-public_cert.pem +18 -19
- data/net-ssh.gemspec +9 -7
- data/support/ssh_tunnel_bug.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +65 -41
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -52
- data/Gemfile.noed25519.lock +0 -41
- data/README.rdoc +0 -169
- data/lib/net/ssh/ruby_compat.rb +0 -13
- data/support/arcfour_check.rb +0 -20
data/README.rdoc
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
{<img src="https://badge.fury.io/rb/net-ssh.svg" alt="Gem Version" />}[https://badge.fury.io/rb/net-ssh]
|
2
|
-
{<img src="https://badges.gitter.im/net-ssh/net-ssh.svg" alt="Join the chat at https://gitter.im/net-ssh/net-ssh">}[https://gitter.im/net-ssh/net-ssh?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
|
3
|
-
{<img src="https://travis-ci.org/net-ssh/net-ssh.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/net-ssh/net-ssh]
|
4
|
-
{<img src="https://codecov.io/gh/net-ssh/net-ssh/branch/master/graph/badge.svg" alt="Coverage status" />}[https://codecov.io/gh/net-ssh/net-ssh]
|
5
|
-
|
6
|
-
= Net::SSH 5.x
|
7
|
-
|
8
|
-
* Docs: http://net-ssh.github.com/net-ssh
|
9
|
-
* Issues: https://github.com/net-ssh/net-ssh/issues
|
10
|
-
* Codes: https://github.com/net-ssh/net-ssh
|
11
|
-
* Email: net-ssh@solutious.com
|
12
|
-
|
13
|
-
<em>As of v2.6.4, all gem releases are signed. See INSTALL.</em>
|
14
|
-
|
15
|
-
== DESCRIPTION:
|
16
|
-
|
17
|
-
Net::SSH is a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2.
|
18
|
-
|
19
|
-
== FEATURES:
|
20
|
-
|
21
|
-
* Execute processes on remote servers and capture their output
|
22
|
-
* Run multiple processes in parallel over a single SSH connection
|
23
|
-
* Support for SSH subsystems
|
24
|
-
* Forward local and remote ports via an SSH connection
|
25
|
-
|
26
|
-
== SYNOPSIS:
|
27
|
-
|
28
|
-
In a nutshell:
|
29
|
-
|
30
|
-
require 'net/ssh'
|
31
|
-
|
32
|
-
Net::SSH.start('host', 'user', password: "password") do |ssh|
|
33
|
-
# capture all stderr and stdout output from a remote process
|
34
|
-
output = ssh.exec!("hostname")
|
35
|
-
puts output
|
36
|
-
|
37
|
-
# capture only stdout matching a particular pattern
|
38
|
-
stdout = ""
|
39
|
-
ssh.exec!("ls -l /home/jamis") do |channel, stream, data|
|
40
|
-
stdout << data if stream == :stdout
|
41
|
-
end
|
42
|
-
puts stdout
|
43
|
-
|
44
|
-
# run multiple processes in parallel to completion
|
45
|
-
ssh.exec "sed ..."
|
46
|
-
ssh.exec "awk ..."
|
47
|
-
ssh.exec "rm -rf ..."
|
48
|
-
ssh.loop
|
49
|
-
|
50
|
-
# open a new channel and configure a minimal set of callbacks, then run
|
51
|
-
# the event loop until the channel finishes (closes)
|
52
|
-
channel = ssh.open_channel do |ch|
|
53
|
-
ch.exec "/usr/local/bin/ruby /path/to/file.rb" do |ch, success|
|
54
|
-
raise "could not execute command" unless success
|
55
|
-
|
56
|
-
# "on_data" is called when the process writes something to stdout
|
57
|
-
ch.on_data do |c, data|
|
58
|
-
$stdout.print data
|
59
|
-
end
|
60
|
-
|
61
|
-
# "on_extended_data" is called when the process writes something to stderr
|
62
|
-
ch.on_extended_data do |c, type, data|
|
63
|
-
$stderr.print data
|
64
|
-
end
|
65
|
-
|
66
|
-
ch.on_close { puts "done!" }
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
channel.wait
|
71
|
-
|
72
|
-
# forward connections on local port 1234 to port 80 of www.capify.org
|
73
|
-
ssh.forward.local(1234, "www.capify.org", 80)
|
74
|
-
ssh.loop { true }
|
75
|
-
end
|
76
|
-
|
77
|
-
See Net::SSH for more documentation, and links to further information.
|
78
|
-
|
79
|
-
== REQUIREMENTS:
|
80
|
-
|
81
|
-
The only requirement you might be missing is the OpenSSL bindings for Ruby. These are built by default on most platforms, but you can verify that they're built and installed on your system by running the following command line:
|
82
|
-
|
83
|
-
ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
|
84
|
-
|
85
|
-
If that spits out something like "OpenSSL 0.9.8g 19 Oct 2007", then you're set. If you get an error, then you'll need to see about rebuilding ruby with OpenSSL support, or (if your platform supports it) installing the OpenSSL bindings separately.
|
86
|
-
|
87
|
-
Lastly, if you want to run the tests or use any of the Rake tasks, you'll need Mocha and other dependencies listed in Gemfile
|
88
|
-
|
89
|
-
|
90
|
-
== INSTALL:
|
91
|
-
|
92
|
-
* gem install net-ssh (might need sudo privileges)
|
93
|
-
|
94
|
-
NOTE: If you are running on jruby on windows you need to install jruby-pageant manually (gemspec doesn't allow for platform specific dependencies).
|
95
|
-
|
96
|
-
However, in order to be sure the code you're installing hasn't been tampered with, it's recommended that you verify the signature[http://docs.rubygems.org/read/chapter/21]. To do this, you need to add my public key as a trusted certificate (you only need to do this once):
|
97
|
-
|
98
|
-
# Add the public key as a trusted certificate
|
99
|
-
# (You only need to do this once)
|
100
|
-
$ curl -O https://raw.githubusercontent.com/net-ssh/net-ssh/master/net-ssh-public_cert.pem
|
101
|
-
$ gem cert --add net-ssh-public_cert.pem
|
102
|
-
|
103
|
-
Then, when install the gem, do so with high security:
|
104
|
-
|
105
|
-
$ gem install net-ssh -P HighSecurity
|
106
|
-
|
107
|
-
If you don't add the public key, you'll see an error like "Couldn't verify data signature". If you're still having trouble let me know and I'll give you a hand.
|
108
|
-
|
109
|
-
For ed25519 public key auth support your bundle file should contain ```ed25519```, ```bcrypt_pbkdf``` dependencies.
|
110
|
-
|
111
|
-
== RUBY SUPPORT
|
112
|
-
|
113
|
-
* Ruby 1.8.x is supported up until the net-ssh 2.5.1 release.
|
114
|
-
* Ruby 1.9.x is supported up until the net-ssh 2.9.x release.
|
115
|
-
* See {net-ssh.gemspec}[https://github.com/net-ssh/net-ssh/blob/master/net-ssh.gemspec] for current versions ruby requirements
|
116
|
-
|
117
|
-
== RUNNING TESTS
|
118
|
-
|
119
|
-
Run the test suite from the net-ssh directory with the following command:
|
120
|
-
|
121
|
-
bundle exec rake test
|
122
|
-
|
123
|
-
Run a single test file like this:
|
124
|
-
|
125
|
-
ruby -Ilib -Itest test/transport/test_server_version.rb
|
126
|
-
|
127
|
-
To run integration tests see test/integration/README.txt
|
128
|
-
|
129
|
-
=== BUILDING GEM
|
130
|
-
|
131
|
-
rake build
|
132
|
-
|
133
|
-
=== GEM SIGNING (for maintainers)
|
134
|
-
|
135
|
-
If you have the net-ssh private signing key, you will be able to create signed release builds. Make sure the private key path matches the `signing_key` path set in `net-ssh.gemspec` and tell rake to sign the gem by setting the `NET_SSH_BUILDGEM_SIGNED` flag:
|
136
|
-
|
137
|
-
NET_SSH_BUILDGEM_SIGNED=true rake build
|
138
|
-
|
139
|
-
For time to time, the public certificate associated to the private key needs to be renewed. You can do this with the following command:
|
140
|
-
|
141
|
-
gem cert --build netssh@solutious.com --private-key path/2/net-ssh-private_key.pem
|
142
|
-
mv gem-public_cert.pem net-ssh-public_cert.pem
|
143
|
-
gem cert --add net-ssh-public_cert.pem
|
144
|
-
|
145
|
-
|
146
|
-
== LICENSE:
|
147
|
-
|
148
|
-
(The MIT License)
|
149
|
-
|
150
|
-
Copyright (c) 2008 Jamis Buck
|
151
|
-
|
152
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
153
|
-
a copy of this software and associated documentation files (the
|
154
|
-
'Software'), to deal in the Software without restriction, including
|
155
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
156
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
157
|
-
permit persons to whom the Software is furnished to do so, subject to
|
158
|
-
the following conditions:
|
159
|
-
|
160
|
-
The above copyright notice and this permission notice shall be
|
161
|
-
included in all copies or substantial portions of the Software.
|
162
|
-
|
163
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
164
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
165
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
166
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
167
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
168
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
169
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/net/ssh/ruby_compat.rb
DELETED
data/support/arcfour_check.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'net/ssh'
|
3
|
-
|
4
|
-
# ARCFOUR CHECK
|
5
|
-
#
|
6
|
-
# Usage:
|
7
|
-
# $ ruby support/arcfour_check.rb
|
8
|
-
#
|
9
|
-
# Expected Output:
|
10
|
-
# arcfour128: [16, 8] OpenSSL::Cipher::Cipher
|
11
|
-
# arcfour256: [32, 8] OpenSSL::Cipher::Cipher
|
12
|
-
# arcfour512: [64, 8] OpenSSL::Cipher::Cipher
|
13
|
-
|
14
|
-
[['arcfour128', 16], ['arcfour256', 32], ['arcfour512', 64]].each do |cipher|
|
15
|
-
print "#{cipher[0]}: "
|
16
|
-
a = Net::SSH::Transport::CipherFactory.get_lengths(cipher[0])
|
17
|
-
b = Net::SSH::Transport::CipherFactory.get(cipher[0], key: ([].fill('x', 0, cipher[1]).join))
|
18
|
-
puts "#{a} #{b.class}"
|
19
|
-
end
|
20
|
-
|