net-ssh 2.9.2 → 4.0.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/.gitignore +6 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +1129 -0
- data/.travis.yml +41 -5
- data/CHANGES.txt +133 -1
- data/Gemfile +13 -0
- data/Gemfile.norbnacl +10 -0
- data/Gemfile.norbnacl.lock +41 -0
- data/ISSUE_TEMPLATE.md +30 -0
- data/README.rdoc +26 -81
- data/Rakefile +63 -45
- data/appveyor.yml +51 -0
- data/lib/net/ssh/authentication/agent.rb +174 -14
- data/lib/net/ssh/authentication/ed25519.rb +137 -0
- data/lib/net/ssh/authentication/ed25519_loader.rb +21 -0
- data/lib/net/ssh/authentication/key_manager.rb +36 -30
- data/lib/net/ssh/authentication/methods/abstract.rb +4 -0
- data/lib/net/ssh/authentication/methods/keyboard_interactive.rb +16 -9
- data/lib/net/ssh/authentication/methods/password.rb +17 -4
- data/lib/net/ssh/authentication/pageant.rb +166 -45
- data/lib/net/ssh/authentication/session.rb +3 -2
- data/lib/net/ssh/buffer.rb +49 -10
- data/lib/net/ssh/buffered_io.rb +17 -12
- data/lib/net/ssh/config.rb +39 -8
- data/lib/net/ssh/connection/channel.rb +42 -20
- data/lib/net/ssh/connection/event_loop.rb +114 -0
- data/lib/net/ssh/connection/keepalive.rb +2 -2
- data/lib/net/ssh/connection/session.rb +120 -34
- data/lib/net/ssh/errors.rb +6 -6
- data/lib/net/ssh/key_factory.rb +49 -43
- data/lib/net/ssh/known_hosts.rb +49 -3
- data/lib/net/ssh/prompt.rb +47 -78
- data/lib/net/ssh/proxy/command.rb +31 -5
- data/lib/net/ssh/proxy/http.rb +15 -11
- data/lib/net/ssh/proxy/https.rb +49 -0
- data/lib/net/ssh/proxy/socks4.rb +2 -1
- data/lib/net/ssh/proxy/socks5.rb +3 -2
- data/lib/net/ssh/ruby_compat.rb +2 -29
- data/lib/net/ssh/service/forward.rb +2 -2
- data/lib/net/ssh/test/channel.rb +7 -0
- data/lib/net/ssh/test/extensions.rb +17 -0
- data/lib/net/ssh/test/kex.rb +4 -4
- data/lib/net/ssh/test/packet.rb +18 -2
- data/lib/net/ssh/test/script.rb +16 -2
- data/lib/net/ssh/test/socket.rb +1 -1
- data/lib/net/ssh/test.rb +5 -5
- data/lib/net/ssh/transport/algorithms.rb +92 -75
- data/lib/net/ssh/transport/cipher_factory.rb +19 -26
- data/lib/net/ssh/transport/ctr.rb +7 -9
- data/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +20 -9
- data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +5 -3
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +1 -1
- data/lib/net/ssh/transport/key_expander.rb +1 -0
- data/lib/net/ssh/transport/openssl.rb +1 -1
- data/lib/net/ssh/transport/packet_stream.rb +11 -3
- data/lib/net/ssh/transport/server_version.rb +13 -6
- data/lib/net/ssh/transport/session.rb +20 -10
- data/lib/net/ssh/transport/state.rb +1 -1
- data/lib/net/ssh/verifiers/secure.rb +8 -10
- data/lib/net/ssh/version.rb +4 -4
- data/lib/net/ssh.rb +62 -14
- data/net-ssh-public_cert.pem +19 -18
- data/net-ssh.gemspec +34 -194
- data/support/arcfour_check.rb +1 -1
- data/support/ssh_tunnel_bug.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +125 -109
- metadata.gz.sig +0 -0
- data/Rudyfile +0 -96
- data/lib/net/ssh/authentication/agent/java_pageant.rb +0 -85
- data/lib/net/ssh/authentication/agent/socket.rb +0 -178
- data/setup.rb +0 -1585
- data/test/README.txt +0 -47
- data/test/authentication/methods/common.rb +0 -28
- data/test/authentication/methods/test_abstract.rb +0 -51
- data/test/authentication/methods/test_hostbased.rb +0 -114
- data/test/authentication/methods/test_keyboard_interactive.rb +0 -100
- data/test/authentication/methods/test_none.rb +0 -41
- data/test/authentication/methods/test_password.rb +0 -95
- data/test/authentication/methods/test_publickey.rb +0 -148
- data/test/authentication/test_agent.rb +0 -224
- data/test/authentication/test_key_manager.rb +0 -227
- data/test/authentication/test_session.rb +0 -107
- data/test/common.rb +0 -108
- data/test/configs/auth_off +0 -5
- data/test/configs/auth_on +0 -4
- data/test/configs/empty +0 -0
- data/test/configs/eqsign +0 -3
- data/test/configs/exact_match +0 -8
- data/test/configs/host_plus +0 -10
- data/test/configs/multihost +0 -4
- data/test/configs/negative_match +0 -6
- data/test/configs/nohost +0 -19
- data/test/configs/numeric_host +0 -4
- data/test/configs/send_env +0 -2
- data/test/configs/substitutes +0 -8
- data/test/configs/wild_cards +0 -14
- data/test/connection/test_channel.rb +0 -467
- data/test/connection/test_session.rb +0 -543
- data/test/known_hosts/github +0 -1
- data/test/manual/test_forward.rb +0 -285
- data/test/manual/test_pageant.rb +0 -37
- data/test/start/test_connection.rb +0 -53
- data/test/start/test_options.rb +0 -43
- data/test/start/test_transport.rb +0 -28
- data/test/test_all.rb +0 -11
- data/test/test_buffer.rb +0 -433
- data/test/test_buffered_io.rb +0 -63
- data/test/test_config.rb +0 -221
- data/test/test_key_factory.rb +0 -191
- data/test/test_known_hosts.rb +0 -13
- data/test/transport/hmac/test_md5.rb +0 -41
- data/test/transport/hmac/test_md5_96.rb +0 -27
- data/test/transport/hmac/test_none.rb +0 -34
- data/test/transport/hmac/test_ripemd160.rb +0 -36
- data/test/transport/hmac/test_sha1.rb +0 -36
- data/test/transport/hmac/test_sha1_96.rb +0 -27
- data/test/transport/hmac/test_sha2_256.rb +0 -37
- data/test/transport/hmac/test_sha2_256_96.rb +0 -27
- data/test/transport/hmac/test_sha2_512.rb +0 -37
- data/test/transport/hmac/test_sha2_512_96.rb +0 -27
- data/test/transport/kex/test_diffie_hellman_group14_sha1.rb +0 -13
- data/test/transport/kex/test_diffie_hellman_group1_sha1.rb +0 -146
- data/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +0 -92
- data/test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb +0 -34
- data/test/transport/kex/test_ecdh_sha2_nistp256.rb +0 -161
- data/test/transport/kex/test_ecdh_sha2_nistp384.rb +0 -38
- data/test/transport/kex/test_ecdh_sha2_nistp521.rb +0 -38
- data/test/transport/test_algorithms.rb +0 -324
- data/test/transport/test_cipher_factory.rb +0 -443
- data/test/transport/test_hmac.rb +0 -34
- data/test/transport/test_identity_cipher.rb +0 -40
- data/test/transport/test_packet_stream.rb +0 -1761
- data/test/transport/test_server_version.rb +0 -78
- data/test/transport/test_session.rb +0 -331
- data/test/transport/test_state.rb +0 -181
data/.travis.yml
CHANGED
@@ -1,10 +1,46 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
3
|
-
|
4
|
-
- "2.0.0"
|
2
|
+
sudo: true
|
3
|
+
dist: trusty
|
5
4
|
|
5
|
+
rvm:
|
6
|
+
- 2.0
|
7
|
+
- 2.1
|
8
|
+
- 2.2
|
9
|
+
- 2.3.0
|
10
|
+
- 2.4.0
|
11
|
+
- jruby-9.1.6.0
|
12
|
+
- rbx-3.69
|
13
|
+
- ruby-head
|
14
|
+
env:
|
15
|
+
NET_SSH_RUN_INTEGRATION_TESTS=1
|
6
16
|
|
7
|
-
|
17
|
+
matrix:
|
18
|
+
exclude:
|
19
|
+
- rvm: rbx-3.69
|
20
|
+
- rvm: jruby-9.1.6.0
|
21
|
+
include:
|
22
|
+
- rvm: rbx-3.69
|
23
|
+
env: NET_SSH_RUN_INTEGRATION_TESTS=
|
24
|
+
- rvm: jruby-9.1.6.0
|
25
|
+
env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -Xcext.enabled=false -J-Xss2m -Xcompile.invokedynamic=false' NET_SSH_RUN_INTEGRATION_TESTS=
|
26
|
+
fast_finish: true
|
27
|
+
allow_failures:
|
28
|
+
- rvm: rbx-3.69
|
29
|
+
- rvm: jruby-9.1.6.0
|
30
|
+
- rvm: ruby-head
|
8
31
|
|
9
|
-
|
32
|
+
install:
|
33
|
+
- export JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -Xcext.enabled=false -J-Xss2m -Xcompile.invokedynamic=false'
|
34
|
+
- sudo pip install ansible
|
35
|
+
- gem install bundler -v "= 1.11.2"
|
36
|
+
- bundle _1.11.2_ install
|
37
|
+
- BUNDLE_GEMFILE=./Gemfile.norbnacl bundle _1.11.2_ install
|
38
|
+
- sudo ansible-galaxy install rvm_io.ruby
|
39
|
+
- sudo chown -R travis:travis /home/travis/.ansible
|
40
|
+
- ansible-playbook ./test/integration/playbook.yml -i "localhost," --become -c local -e 'no_rvm=true' -e 'myuser=travis' -e 'mygroup=travis' -e 'homedir=/home/travis'
|
10
41
|
|
42
|
+
script:
|
43
|
+
- bundle _1.11.2_ exec rake test
|
44
|
+
- BUNDLE_GEMFILE=./Gemfile.norbnacl bundle _1.11.2_ exec rake test
|
45
|
+
- bundle _1.11.2_ exec rake test_test
|
46
|
+
- bundle _1.11.2_ exec rubocop
|
data/CHANGES.txt
CHANGED
@@ -1,3 +1,135 @@
|
|
1
|
+
=== 4.0.0.rc3
|
2
|
+
|
3
|
+
* parse `+` character in config files [Christoph Lupprich, #470, #314]
|
4
|
+
|
5
|
+
=== 4.0.0.rc2
|
6
|
+
|
7
|
+
* Fixed OpenSSL 2.0/Ruby 2.4.0 warnings [Miklós Fazekas, #468]
|
8
|
+
* Added ssh-ed25519 to KnownHosts:SUPPORTED_TYPE [detatka-kuzlatka-otevrete, Miklós Fazekas, #459]
|
9
|
+
* Allow nil for :passhrase and passing in nil option is now a depreaction warning [Miklós Fazekas, #465]
|
10
|
+
|
11
|
+
=== 4.0.0.rc1
|
12
|
+
|
13
|
+
* Allow :password to be nil for capistrano v2 compatibility [Will Bryant, #357]
|
14
|
+
* In next_packet if prefer consuming buffer before filling it again if we have enough data [Miklós Fazekas, #454]
|
15
|
+
|
16
|
+
=== 4.0.0.beta4
|
17
|
+
|
18
|
+
* Added exitstatus method to exec's return [Miklós Fazekas, #452]
|
19
|
+
* Don't raise from exec if server closes transport just after channel close [Miklós Fazekas, #450]
|
20
|
+
* Removed java_pageant, as jruby should be using regular pagent impl [Miklós Fazekas, ]
|
21
|
+
* Use SSH_AUTH_SOCK if possible on windows (cygwin) [Miklós Fazekas, Martin Dürst, #365, #361]
|
22
|
+
* HTTPS proxy support [Marcus Ilgner, #432]
|
23
|
+
* Supports ruby 2.4.0.dev new exception type from OpenSSL::PKey.read
|
24
|
+
|
25
|
+
=== 4.0.0.beta3
|
26
|
+
|
27
|
+
* Fix Net::SSH::Disconnect exceptions when channels are closed cleanly [Miklos Fazekas, #421, #422]
|
28
|
+
|
29
|
+
=== 4.0.0.beta2
|
30
|
+
|
31
|
+
* Fix raiseUnlessLoaded undefined ERROR issue [Miklos Fazekas, #418]
|
32
|
+
|
33
|
+
=== 4.0.0.beta1
|
34
|
+
|
35
|
+
* Fix pageant [elconas, #235]
|
36
|
+
* Relaxed rbnacl,rbnacl-selenium contstraints ang give better errors about them [Miklos Fazekas, #398]
|
37
|
+
* Fix UTF-8 encoding issues [Ethan J. Brown, #407]
|
38
|
+
|
39
|
+
=== 4.0.0.alpha4
|
40
|
+
|
41
|
+
* Experimental event loop abstraction [Miklos Fazekas]
|
42
|
+
* RbNacl dependency is optional [Miklos Fazekas]
|
43
|
+
* agent_socket_factory option [Alon Goldboim]
|
44
|
+
* client sends KEXINIT, it doesn't have to wait for server [Miklos Fazekas]
|
45
|
+
* better error message when option is nil [Kane Morgan]
|
46
|
+
* prompting can be customized [Miklos Fazekas]
|
47
|
+
|
48
|
+
=== 4.0.0.alpha3
|
49
|
+
|
50
|
+
* added max_select_wait_time [Eugene Kenny]
|
51
|
+
|
52
|
+
=== 4.0.0.alpha2
|
53
|
+
|
54
|
+
* when transport closes we're cleaning up channels [Miklos Fazekas]
|
55
|
+
|
56
|
+
=== 4.0.0.alpha1
|
57
|
+
|
58
|
+
* ed25519 key support [Miklos Fazekas]
|
59
|
+
* removed camellia [Miklos Fazekas]
|
60
|
+
|
61
|
+
=== 3.1.0
|
62
|
+
=== 3.1.0.rc1
|
63
|
+
|
64
|
+
* fix Secure#verify [Jean Boussier]
|
65
|
+
* use the smallest of don't spend longer time than keepalive if it's configured [Eugene Kenny]
|
66
|
+
|
67
|
+
=== 3.1.0.beta3
|
68
|
+
|
69
|
+
* forward/on_open_failed should stop listning closed socket otherwise it locks #269 [Miklos Fazekas,Scott McGillivray]
|
70
|
+
* fix incorrect pattern handling in config files #310 [Miklos Fazekas]
|
71
|
+
|
72
|
+
=== 3.1.0.beta2
|
73
|
+
|
74
|
+
* trying to execute something on a not yet opend channel throws nicer messag [Miklos Fazekas]
|
75
|
+
* calling close on a not opened channel marks the channel for close [Miklos Fazekas]
|
76
|
+
* read keepalive configuration from ssh config files [Miklos Fazekas]
|
77
|
+
* send client version on hadshake before waiting for server to reduce handshake time [Miklos Fazekas]
|
78
|
+
* allow custom Net::SSH::KnownHosts implementations [Jean Boussier]
|
79
|
+
* memoize known host so we only search it once per session [Jean Boussier, Miklos Fazekas]
|
80
|
+
|
81
|
+
=== 3.0.2
|
82
|
+
=== 3.0.2.rc1
|
83
|
+
|
84
|
+
* fixed rare WaitWritable error with proxy commands [Miklos Fazkas, Andre Meij]]
|
85
|
+
* if Net::SSH.start user is nil and config has no entry we default to Etc.getlogin
|
86
|
+
* Bugfix: CHANNEL_CLOSE was sent before draining ouput buffer #280 [Christopher F. Auston]
|
87
|
+
|
88
|
+
=== 3.0.1
|
89
|
+
=== 3.0.1.rc1
|
90
|
+
|
91
|
+
* Breaking change from 2.* series: exec! without block now returns empty string instread of nil if command has no output [https://github.com/net-ssh/net-ssh/pull/273]
|
92
|
+
* Support remote_user as %r in proxy commands [Dominic Scheirlinck]
|
93
|
+
* Raise Net::SSH::ConnectionTimeout from connection timeout [Carl Hoerberg]
|
94
|
+
|
95
|
+
=== 3.0.0.rc1
|
96
|
+
|
97
|
+
* SemVer: Major version change because of dropping of ruby 1.9
|
98
|
+
|
99
|
+
=== 2.10.1.rc2
|
100
|
+
|
101
|
+
* Win: Use fiddle on ruby 2.1 too [Charlie Savage]
|
102
|
+
|
103
|
+
=== 2.10.1.rc1
|
104
|
+
|
105
|
+
* Added ruby 2.0 requirement to gemspec [Alex Schultz]
|
106
|
+
|
107
|
+
=== 2.10.0
|
108
|
+
|
109
|
+
=== 2.10.0-beta2
|
110
|
+
|
111
|
+
* Fix :passphrase option with :non_interactive [Jeremy Stanley]
|
112
|
+
* Use Socket.tcp with connect_timeout instead of Timeout::timeout [Carl Hörberg]
|
113
|
+
* Support for hostname hashes [Jef Mathiot]
|
114
|
+
* Ruby 1.9.3 is no longer supported but should moslty work expect for stuff like connect_timeout
|
115
|
+
|
116
|
+
=== 2.10.0-beta1
|
117
|
+
|
118
|
+
* Fix could not parse PKey error. [Andrey Voronkov]
|
119
|
+
* Workaround for threading issue in MRI + singleton method declaration [Matt Brictson]
|
120
|
+
* Configuration change: we no longer append all supported algorithms, this is so you can exclude insecure algorithms. If you want to use the old behaviour specify append_all_supported_algorithms => true [voidus, mfazekas]
|
121
|
+
* New configuration option: :non_interactive => true in case you prefer an authmethod to fail rather than prompt. [mfazekas]
|
122
|
+
* Configuration change: password will now ask for password up to the :number_of_password_prompts times. If you want the
|
123
|
+
2.9.1 behaviour of never asking password please set number_of_password_prompts to 0.
|
124
|
+
|
125
|
+
=== 2.9.4-beta1
|
126
|
+
|
127
|
+
* Use sysread and syswrite on Windows instead of read_nonblock and write [marc-etienne]
|
128
|
+
* Windows/peagant: use fiddle on ruby 2.2+/windows [Charlie Savage]
|
129
|
+
* Check if ssh key is a file [kiela]
|
130
|
+
|
131
|
+
=== 2.9.3
|
132
|
+
|
1
133
|
=== 2.9.2-rc3
|
2
134
|
|
3
135
|
* Remove advertised algorithms that were not working (curve25519-sha256@libssh.org) [mfazekas]
|
@@ -14,7 +146,7 @@
|
|
14
146
|
|
15
147
|
* Remove advertised algorithms that were not working (ssh-rsa-cert-* *ed25519 acm*-gcm@openssh.com) [mfazekas]
|
16
148
|
* Unkown algorithms now ignored instead of failed [mfazekas]
|
17
|
-
* Asks for password with password auth (up to number_of_password_prompts) [mfazekas]
|
149
|
+
* Configuration change: Asks for password with password auth (up to number_of_password_prompts) [mfazekas]
|
18
150
|
* Removed warnings [amatsuda]
|
19
151
|
|
20
152
|
=== 2.9.1 / 13 May 2014
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in mygem.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
if !Gem.win_platform? && RUBY_ENGINE == "mri"
|
7
|
+
gem 'byebug', group: [:development, :test]
|
8
|
+
end
|
9
|
+
|
10
|
+
if ENV["CI"]
|
11
|
+
gem 'codecov', require: false, group: :test
|
12
|
+
gem 'simplecov', require: false, group: :test
|
13
|
+
end
|
data/Gemfile.norbnacl
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
ENV['NET_SSH_NO_RBNACL'] = 'true'
|
4
|
+
# Specify your gem's dependencies in mygem.gemspec
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
if ENV["CI"] && !Gem.win_platform?
|
8
|
+
gem 'simplecov', require: false, group: :test
|
9
|
+
gem 'codecov', require: false, group: :test
|
10
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
net-ssh (4.0.0.rc1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.2.0)
|
10
|
+
metaclass (0.0.4)
|
11
|
+
minitest (5.8.4)
|
12
|
+
mocha (1.1.0)
|
13
|
+
metaclass (~> 0.0.1)
|
14
|
+
parser (2.3.1.0)
|
15
|
+
ast (~> 2.2)
|
16
|
+
powerpack (0.1.1)
|
17
|
+
rainbow (2.1.0)
|
18
|
+
rake (11.1.2)
|
19
|
+
rubocop (0.39.0)
|
20
|
+
parser (>= 2.3.0.7, < 3.0)
|
21
|
+
powerpack (~> 0.1)
|
22
|
+
rainbow (>= 1.99.1, < 3.0)
|
23
|
+
ruby-progressbar (~> 1.7)
|
24
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
25
|
+
ruby-progressbar (1.8.0)
|
26
|
+
unicode-display_width (1.0.5)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
x86-mingw32
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (~> 1.11)
|
34
|
+
minitest (~> 5.0)
|
35
|
+
mocha (>= 1.1.0)
|
36
|
+
net-ssh!
|
37
|
+
rake (~> 11.1)
|
38
|
+
rubocop (~> 0.39.0)
|
39
|
+
|
40
|
+
BUNDLED WITH
|
41
|
+
1.13.6
|
data/ISSUE_TEMPLATE.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
### Expected behavior
|
2
|
+
|
3
|
+
Tell us what should happen
|
4
|
+
|
5
|
+
### Actual behavior
|
6
|
+
|
7
|
+
Tell us what happens instead.
|
8
|
+
|
9
|
+
### System configuration
|
10
|
+
|
11
|
+
- net-ssh version
|
12
|
+
- Ruby version
|
13
|
+
|
14
|
+
### Example App
|
15
|
+
|
16
|
+
Please provide an example script that reproduces the problem. This will save maintainers time so they can spend it fixing your issues instead of trying to build a reproduction case from sparse instructions.
|
17
|
+
|
18
|
+
You can use this as stating point:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'net-ssh', '= 4.0.0.beta3'
|
22
|
+
require 'net/ssh'
|
23
|
+
puts Net::SSH::Version::CURRENT
|
24
|
+
|
25
|
+
@host = 'localhost'
|
26
|
+
@user = ENV['USER']
|
27
|
+
Net::SSH.start(@host, @user) do |ssh|
|
28
|
+
puts ssh.exec!('echo "hello"')
|
29
|
+
end
|
30
|
+
```
|
data/README.rdoc
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
<
|
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]
|
4
5
|
|
6
|
+
= Net::SSH 4.x
|
5
7
|
|
6
8
|
* Docs: http://net-ssh.github.com/net-ssh
|
7
9
|
* Issues: https://github.com/net-ssh/net-ssh/issues
|
8
10
|
* Codes: https://github.com/net-ssh/net-ssh
|
9
11
|
* Email: net-ssh@solutious.com
|
10
12
|
|
11
|
-
|
12
13
|
<em>As of v2.6.4, all gem releases are signed. See INSTALL.</em>
|
13
14
|
|
14
|
-
|
15
15
|
== DESCRIPTION:
|
16
16
|
|
17
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.
|
@@ -32,6 +32,7 @@ In a nutshell:
|
|
32
32
|
Net::SSH.start('host', 'user', :password => "password") do |ssh|
|
33
33
|
# capture all stderr and stdout output from a remote process
|
34
34
|
output = ssh.exec!("hostname")
|
35
|
+
puts output
|
35
36
|
|
36
37
|
# capture only stdout matching a particular pattern
|
37
38
|
stdout = ""
|
@@ -83,26 +84,21 @@ The only requirement you might be missing is the OpenSSL bindings for Ruby. Thes
|
|
83
84
|
|
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.
|
85
86
|
|
86
|
-
|
87
|
-
|
88
|
-
Lastly, if you want to run the tests or use any of the Rake tasks, you'll need:
|
89
|
-
|
90
|
-
* Echoe (for the Rakefile)
|
91
|
-
* Mocha (for the tests)
|
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
|
92
88
|
|
93
89
|
|
94
90
|
== INSTALL:
|
95
91
|
|
96
92
|
* gem install net-ssh (might need sudo privileges)
|
97
93
|
|
98
|
-
NOTE: If you are running on jruby you need to install jruby-pageant manually (gemspec doesn't allow for platform specific dependencies).
|
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).
|
99
95
|
|
100
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):
|
101
97
|
|
102
98
|
# Add the public key as a trusted certificate
|
103
99
|
# (You only need to do this once)
|
104
|
-
$ curl -O https://raw.
|
105
|
-
$ gem cert --add
|
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
|
106
102
|
|
107
103
|
Then, when install the gem, do so with high security:
|
108
104
|
|
@@ -110,92 +106,41 @@ Then, when install the gem, do so with high security:
|
|
110
106
|
|
111
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.
|
112
108
|
|
113
|
-
|
114
|
-
|
115
|
-
net-ssh supports Ruby 1.8.x up until the 2.5.1 release. Later releases will work but the test suite is no longer guaranteed to pass all tests.
|
116
|
-
|
117
|
-
== JRUBY 1.6
|
118
|
-
|
119
|
-
There is an issue with jruby-openssl that produces the following error in jruby 1.6:
|
120
|
-
|
121
|
-
<ArgumentError> wrong number of arguments (2 for 1)
|
122
|
-
/home/offers/tracking/shared/bundle/jruby/1.8/gems/net-ssh-2.6.0/lib/net/ssh/key_factory.rb:77:in `load_data_private_key'
|
123
|
-
|
124
|
-
You can downgrade jruby-openssl to version 0.7.4 (before they added the PKey.read method) to resolve it or upgrade jruby to 1.7. See issue #61 for more info: https://github.com/net-ssh/net-ssh/issues/61.
|
125
|
-
|
126
|
-
|
127
|
-
== ARCFOUR SUPPORT:
|
128
|
-
|
129
|
-
from Karl Varga:
|
130
|
-
|
131
|
-
Ruby's OpenSSL bindings always return a key length of 16 for RC4 ciphers, which means that when we try to use ARCFOUR256 or higher, Net::SSH generates keys which are consistently too short - 16 bytes as opposed to 32 bytes - resulting in the following error:
|
132
|
-
|
133
|
-
OpenSSL::CipherError: key length too short
|
134
|
-
|
135
|
-
My patch simply instructs Net::SSH to build keys of the the proper length, regardless of the required key length reported by OpenSSL.
|
109
|
+
For ed25519 public key auth support your bundle file should contain ```rbnacl-libsodium```, ```rbnacl```, ```bcrypt_pbkdf``` dependencies.
|
136
110
|
|
137
|
-
|
138
|
-
|
139
|
-
To see your OpenSSL version:
|
140
|
-
|
141
|
-
$ openssl version
|
142
|
-
OpenSSL 0.9.8k 25 Mar 2009
|
143
|
-
|
144
|
-
After installing this gem, verify that Net::SSH is generating keys of the correct length by running the script <tt>support/arcfour_check.rb</tt>:
|
145
|
-
|
146
|
-
$ ruby arcfour_support.rb
|
147
|
-
|
148
|
-
which should produce the following:
|
149
|
-
|
150
|
-
arcfour128: [16, 8] OpenSSL::Cipher::Cipher
|
151
|
-
arcfour256: [32, 8] OpenSSL::Cipher::Cipher
|
152
|
-
arcfour512: [64, 8] OpenSSL::Cipher::Cipher
|
111
|
+
== RUBY SUPPORT
|
153
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
|
+
* Current net-ssh releases require Ruby 2.0 or later.
|
154
116
|
|
155
117
|
== RUNNING TESTS
|
156
118
|
|
157
119
|
Run the test suite from the net-ssh directory with the following command:
|
158
120
|
|
159
|
-
|
121
|
+
bundle exec rake test
|
160
122
|
|
161
123
|
Run a single test file like this:
|
162
124
|
|
163
|
-
ruby -Ilib -Itest
|
164
|
-
|
165
|
-
|
166
|
-
=== EXPECTED RESULTS
|
125
|
+
ruby -Ilib -Itest test/transport/test_server_version.rb
|
167
126
|
|
168
|
-
|
169
|
-
|
170
|
-
* Ruby 1.9: all tests pass
|
171
|
-
|
172
|
-
* JRuby 1.5: 99% tests pass (448 tests, 1846 assertions, 1 failures)
|
127
|
+
To run integration tests see test/integration/README.txt
|
173
128
|
|
174
129
|
=== BUILDING GEM
|
175
130
|
|
176
|
-
|
177
|
-
|
178
|
-
rake build NET_SSH_NOKEY=1
|
179
|
-
|
180
|
-
=== PORT FORWARDING TESTS
|
181
|
-
|
182
|
-
ruby -Ilib -Itest -rrubygems test/manual/test_forward.rb
|
183
|
-
|
184
|
-
test_forward.rb must be run separately from the test suite because
|
185
|
-
it requires authorizing your public SSH keys on you localhost.
|
186
|
-
|
187
|
-
If you already have keys you can do this:
|
131
|
+
rake build
|
188
132
|
|
189
|
-
|
133
|
+
=== GEM SIGNING (for maintainers)
|
190
134
|
|
191
|
-
If you
|
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:
|
192
136
|
|
193
|
-
|
137
|
+
NET_SSH_BUILDGEM_SIGNED=true rake build
|
194
138
|
|
195
|
-
|
196
|
-
bring prompted for a password:
|
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:
|
197
140
|
|
198
|
-
ssh
|
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
|
199
144
|
|
200
145
|
|
201
146
|
== LICENSE:
|
data/Rakefile
CHANGED
@@ -8,59 +8,28 @@
|
|
8
8
|
require "rubygems"
|
9
9
|
require "rake"
|
10
10
|
require "rake/clean"
|
11
|
-
require "
|
12
|
-
|
13
|
-
task :default => ["build"]
|
14
|
-
CLEAN.include [ 'pkg', 'rdoc' ]
|
15
|
-
name = "net-ssh"
|
11
|
+
require "bundler/gem_tasks"
|
16
12
|
|
17
|
-
|
18
|
-
require "net/ssh"
|
19
|
-
version = Net::SSH::Version::CURRENT
|
13
|
+
require "rdoc/task"
|
20
14
|
|
21
|
-
begin
|
22
|
-
require "jeweler"
|
23
|
-
Jeweler::Tasks.new do |s|
|
24
|
-
s.version = version
|
25
|
-
s.name = name
|
26
|
-
s.rubyforge_project = s.name
|
27
|
-
s.summary = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol."
|
28
|
-
s.description = s.summary + " It allows you to write programs that invoke and interact with processes on remote servers, via SSH2."
|
29
|
-
s.email = "net-ssh@solutious.com"
|
30
|
-
s.homepage = "https://github.com/net-ssh/net-ssh"
|
31
|
-
s.authors = ["Jamis Buck", "Delano Mandelbaum", "Miklós Fazekas"]
|
32
15
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
16
|
+
desc "When releasing make sure NET_SSH_BUILDGEM_SIGNED is set"
|
17
|
+
task :check_NET_SSH_BUILDGEM_SIGNED do
|
18
|
+
raise "NET_SSH_BUILDGEM_SIGNED should be set to release" unless ENV['NET_SSH_BUILDGEM_SIGNED']
|
19
|
+
end
|
38
20
|
|
39
|
-
|
40
|
-
|
21
|
+
Rake::Task[:release].enhance [:check_NET_SSH_BUILDGEM_SIGNED]
|
22
|
+
Rake::Task[:release].prerequisites.unshift(:check_NET_SSH_BUILDGEM_SIGNED)
|
41
23
|
|
42
|
-
s.license = "MIT"
|
43
24
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
s.cert_chain = ['net-ssh-public_cert.pem']
|
48
|
-
unless (Rake.application.top_level_tasks & ['build','install']).empty?
|
49
|
-
raise "No key found at #{signing_key} for signing, use rake <taskname> NET_SSH_NOKEY=1 to build without key" unless File.exist?(signing_key)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
Jeweler::RubygemsDotOrgTasks.new
|
54
|
-
rescue LoadError
|
55
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
56
|
-
end
|
25
|
+
task default: ["build"]
|
26
|
+
CLEAN.include [ 'pkg', 'rdoc' ]
|
27
|
+
name = "net-ssh"
|
57
28
|
|
58
|
-
|
59
|
-
|
60
|
-
t.libs = ["lib", "test"]
|
61
|
-
end
|
29
|
+
require_relative "lib/net/ssh/version"
|
30
|
+
version = Net::SSH::Version::CURRENT
|
62
31
|
|
63
|
-
extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt
|
32
|
+
extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt]
|
64
33
|
RDoc::Task.new do |rdoc|
|
65
34
|
rdoc.rdoc_dir = "rdoc"
|
66
35
|
rdoc.title = "#{name} #{version}"
|
@@ -73,3 +42,52 @@ RDoc::Task.new do |rdoc|
|
|
73
42
|
rdoc.rdoc_files.include(file) if File.exists?(file)
|
74
43
|
}
|
75
44
|
end
|
45
|
+
|
46
|
+
namespace :rdoc do
|
47
|
+
desc "Update gh-pages branch"
|
48
|
+
task :publish do
|
49
|
+
# copy/checkout
|
50
|
+
rm_rf "/tmp/net-ssh-rdoc"
|
51
|
+
rm_rf "/tmp/net-ssh-gh-pages"
|
52
|
+
cp_r "./rdoc", "/tmp/net-ssh-rdoc"
|
53
|
+
mkdir "/tmp/net-ssh-gh-pages"
|
54
|
+
Dir.chdir "/tmp/net-ssh-gh-pages" do
|
55
|
+
sh "git clone --branch gh-pages --single-branch https://github.com/net-ssh/net-ssh"
|
56
|
+
rm_rf "/tmp/net-ssh-gh-pages/net-ssh/*"
|
57
|
+
end
|
58
|
+
# update
|
59
|
+
sh "cp -rf ./rdoc/* /tmp/net-ssh-gh-pages/net-ssh/"
|
60
|
+
Dir.chdir "/tmp/net-ssh-gh-pages/net-ssh" do
|
61
|
+
sh "git add -A ."
|
62
|
+
sh "git commit -m \"Update docs\""
|
63
|
+
end
|
64
|
+
# publish
|
65
|
+
Dir.chdir "/tmp/net-ssh-gh-pages/net-ssh" do
|
66
|
+
sh "git push origin gh-pages"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
require 'rake/testtask'
|
72
|
+
|
73
|
+
Rake::TestTask.new do |t|
|
74
|
+
t.libs = ["lib", "test"]
|
75
|
+
t.libs << "test/integration" if ENV['NET_SSH_RUN_INTEGRATION_TESTS']
|
76
|
+
t.libs << "test/win_integration" if ENV['NET_SSH_RUN_WIN_INTEGRATION_TESTS']
|
77
|
+
test_files = FileList['test/**/test_*.rb']
|
78
|
+
test_files -= FileList['test/integration/**/test_*.rb'] unless ENV['NET_SSH_RUN_INTEGRATION_TESTS']
|
79
|
+
test_files -= FileList['test/win_integration/**/test_*.rb'] unless ENV['NET_SSH_RUN_WIN_INTEGRATION_TESTS']
|
80
|
+
test_files -= FileList['test/manual/test_*.rb']
|
81
|
+
test_files -= FileList['test/test_pageant.rb']
|
82
|
+
test_files -= FileList['test/test/**/test_*.rb']
|
83
|
+
t.test_files = test_files
|
84
|
+
end
|
85
|
+
|
86
|
+
desc "Run tests of Net::SSH:Test"
|
87
|
+
Rake::TestTask.new do |t|
|
88
|
+
t.name = "test_test"
|
89
|
+
# we need to run test/test separatedly as it hacks io + other modules
|
90
|
+
t.libs = ["lib", "test"]
|
91
|
+
test_files = FileList['test/test/**/test_*.rb']
|
92
|
+
t.test_files = test_files
|
93
|
+
end
|
data/appveyor.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
version: '{build}'
|
2
|
+
|
3
|
+
skip_tags: true
|
4
|
+
|
5
|
+
environment:
|
6
|
+
matrix:
|
7
|
+
- ruby_version: "jruby-9.1.2.0"
|
8
|
+
- ruby_version: "23"
|
9
|
+
- ruby_version: "23-x64"
|
10
|
+
|
11
|
+
#init:
|
12
|
+
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
13
|
+
|
14
|
+
#on_finish:
|
15
|
+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
16
|
+
|
17
|
+
|
18
|
+
platform:
|
19
|
+
- x86
|
20
|
+
|
21
|
+
install:
|
22
|
+
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
23
|
+
- if "%ruby_version%" == "jruby-9.1.2.0" ( cinst javaruntime -i )
|
24
|
+
- if "%ruby_version%" == "jruby-9.1.2.0" ( cinst jruby --version 9.1.2.0 -i )
|
25
|
+
- if "%ruby_version%" == "jruby-9.1.2.0" ( SET "PATH=C:\jruby-9.1.2.0\bin\;%PATH%" )
|
26
|
+
- ruby --version
|
27
|
+
- gem install bundler --no-document -v 1.13.5
|
28
|
+
- SET BUNDLE_GEMFILE=Gemfile.norbnacl
|
29
|
+
- bundle _1.13.5_ install --retry=3
|
30
|
+
- cinst freesshd
|
31
|
+
- cinst putty
|
32
|
+
- ps: |
|
33
|
+
if ($env:Processor_Architecture -eq "x86")
|
34
|
+
{
|
35
|
+
dir 'C:\Program Files\'
|
36
|
+
dir 'C:\Program Files\freeSSHd'
|
37
|
+
cp 'test\win_integration\FreeSSHDService.ini' 'C:\Program Files\freeSSHd\FreeSSHDService.ini'
|
38
|
+
& 'C:\Program Files\freeSSHd\FreeSSHDService.exe'
|
39
|
+
} else {
|
40
|
+
dir 'C:\Program Files (x86)\'
|
41
|
+
dir 'C:\Program Files (x86)\freeSSHd'
|
42
|
+
cp 'test\win_integration\FreeSSHDService32.ini' 'C:\Program Files (x86)\freeSSHd\FreeSSHDService.ini'
|
43
|
+
& 'C:\Program Files (x86)\freeSSHd\FreeSSHDService.exe'
|
44
|
+
}
|
45
|
+
|
46
|
+
test_script:
|
47
|
+
- SET BUNDLE_GEMFILE=Gemfile.norbnacl
|
48
|
+
- SET NET_SSH_RUN_WIN_INTEGRATION_TESTS=YES
|
49
|
+
- bundle _1.13.5_ exec rake test
|
50
|
+
|
51
|
+
build: off
|