net-ssh 4.1.0 → 6.1.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.
Files changed (111) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +5 -0
  5. data/.rubocop.yml +8 -2
  6. data/.rubocop_todo.yml +405 -552
  7. data/.travis.yml +23 -22
  8. data/CHANGES.txt +112 -1
  9. data/Gemfile +1 -7
  10. data/{Gemfile.norbnacl → Gemfile.noed25519} +1 -1
  11. data/Manifest +4 -5
  12. data/README.md +287 -0
  13. data/Rakefile +40 -29
  14. data/appveyor.yml +12 -6
  15. data/lib/net/ssh.rb +68 -32
  16. data/lib/net/ssh/authentication/agent.rb +234 -222
  17. data/lib/net/ssh/authentication/certificate.rb +175 -164
  18. data/lib/net/ssh/authentication/constants.rb +17 -14
  19. data/lib/net/ssh/authentication/ed25519.rb +162 -141
  20. data/lib/net/ssh/authentication/ed25519_loader.rb +32 -29
  21. data/lib/net/ssh/authentication/key_manager.rb +40 -9
  22. data/lib/net/ssh/authentication/methods/abstract.rb +53 -47
  23. data/lib/net/ssh/authentication/methods/hostbased.rb +32 -33
  24. data/lib/net/ssh/authentication/methods/keyboard_interactive.rb +1 -1
  25. data/lib/net/ssh/authentication/methods/none.rb +10 -10
  26. data/lib/net/ssh/authentication/methods/password.rb +13 -13
  27. data/lib/net/ssh/authentication/methods/publickey.rb +56 -55
  28. data/lib/net/ssh/authentication/pageant.rb +468 -465
  29. data/lib/net/ssh/authentication/pub_key_fingerprint.rb +43 -0
  30. data/lib/net/ssh/authentication/session.rb +130 -122
  31. data/lib/net/ssh/buffer.rb +345 -312
  32. data/lib/net/ssh/buffered_io.rb +163 -163
  33. data/lib/net/ssh/config.rb +316 -238
  34. data/lib/net/ssh/connection/channel.rb +670 -650
  35. data/lib/net/ssh/connection/constants.rb +30 -26
  36. data/lib/net/ssh/connection/event_loop.rb +108 -105
  37. data/lib/net/ssh/connection/keepalive.rb +54 -50
  38. data/lib/net/ssh/connection/session.rb +682 -671
  39. data/lib/net/ssh/connection/term.rb +180 -176
  40. data/lib/net/ssh/errors.rb +101 -99
  41. data/lib/net/ssh/key_factory.rb +195 -108
  42. data/lib/net/ssh/known_hosts.rb +161 -152
  43. data/lib/net/ssh/loggable.rb +57 -55
  44. data/lib/net/ssh/packet.rb +82 -78
  45. data/lib/net/ssh/prompt.rb +55 -53
  46. data/lib/net/ssh/proxy/command.rb +104 -89
  47. data/lib/net/ssh/proxy/errors.rb +12 -8
  48. data/lib/net/ssh/proxy/http.rb +93 -91
  49. data/lib/net/ssh/proxy/https.rb +42 -39
  50. data/lib/net/ssh/proxy/jump.rb +50 -47
  51. data/lib/net/ssh/proxy/socks4.rb +0 -2
  52. data/lib/net/ssh/proxy/socks5.rb +11 -12
  53. data/lib/net/ssh/service/forward.rb +370 -317
  54. data/lib/net/ssh/test.rb +83 -77
  55. data/lib/net/ssh/test/channel.rb +146 -142
  56. data/lib/net/ssh/test/extensions.rb +150 -146
  57. data/lib/net/ssh/test/kex.rb +35 -31
  58. data/lib/net/ssh/test/local_packet.rb +48 -44
  59. data/lib/net/ssh/test/packet.rb +87 -84
  60. data/lib/net/ssh/test/remote_packet.rb +35 -31
  61. data/lib/net/ssh/test/script.rb +173 -171
  62. data/lib/net/ssh/test/socket.rb +59 -55
  63. data/lib/net/ssh/transport/algorithms.rb +430 -364
  64. data/lib/net/ssh/transport/cipher_factory.rb +95 -91
  65. data/lib/net/ssh/transport/constants.rb +33 -25
  66. data/lib/net/ssh/transport/ctr.rb +33 -11
  67. data/lib/net/ssh/transport/hmac.rb +15 -13
  68. data/lib/net/ssh/transport/hmac/abstract.rb +82 -63
  69. data/lib/net/ssh/transport/hmac/sha2_256.rb +7 -11
  70. data/lib/net/ssh/transport/hmac/sha2_256_96.rb +4 -8
  71. data/lib/net/ssh/transport/hmac/sha2_256_etm.rb +12 -0
  72. data/lib/net/ssh/transport/hmac/sha2_512.rb +6 -9
  73. data/lib/net/ssh/transport/hmac/sha2_512_96.rb +4 -8
  74. data/lib/net/ssh/transport/hmac/sha2_512_etm.rb +12 -0
  75. data/lib/net/ssh/transport/identity_cipher.rb +55 -51
  76. data/lib/net/ssh/transport/kex.rb +14 -13
  77. data/lib/net/ssh/transport/kex/abstract.rb +123 -0
  78. data/lib/net/ssh/transport/kex/abstract5656.rb +72 -0
  79. data/lib/net/ssh/transport/kex/curve25519_sha256.rb +38 -0
  80. data/lib/net/ssh/transport/kex/curve25519_sha256_loader.rb +30 -0
  81. data/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +33 -40
  82. data/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +112 -217
  83. data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +53 -62
  84. data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +5 -9
  85. data/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +36 -90
  86. data/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +18 -10
  87. data/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +18 -10
  88. data/lib/net/ssh/transport/key_expander.rb +29 -25
  89. data/lib/net/ssh/transport/openssl.rb +116 -116
  90. data/lib/net/ssh/transport/packet_stream.rb +223 -190
  91. data/lib/net/ssh/transport/server_version.rb +64 -66
  92. data/lib/net/ssh/transport/session.rb +306 -257
  93. data/lib/net/ssh/transport/state.rb +198 -196
  94. data/lib/net/ssh/verifiers/accept_new.rb +35 -0
  95. data/lib/net/ssh/verifiers/accept_new_or_local_tunnel.rb +34 -0
  96. data/lib/net/ssh/verifiers/always.rb +56 -0
  97. data/lib/net/ssh/verifiers/never.rb +21 -0
  98. data/lib/net/ssh/version.rb +55 -53
  99. data/net-ssh-public_cert.pem +18 -19
  100. data/net-ssh.gemspec +12 -11
  101. data/support/ssh_tunnel_bug.rb +2 -2
  102. metadata +86 -75
  103. metadata.gz.sig +0 -0
  104. data/Gemfile.norbnacl.lock +0 -41
  105. data/README.rdoc +0 -169
  106. data/lib/net/ssh/ruby_compat.rb +0 -24
  107. data/lib/net/ssh/verifiers/lenient.rb +0 -30
  108. data/lib/net/ssh/verifiers/null.rb +0 -12
  109. data/lib/net/ssh/verifiers/secure.rb +0 -52
  110. data/lib/net/ssh/verifiers/strict.rb +0 -24
  111. data/support/arcfour_check.rb +0 -20
@@ -7,45 +7,46 @@ addon:
7
7
  gateway.netssh
8
8
 
9
9
  rvm:
10
- - 2.0
11
- - 2.1
12
- - 2.2
13
- - 2.3.0
14
- - 2.4.0
15
- - jruby-9.1.6.0
16
- - rbx-3.69
10
+ - 2.3.8
11
+ - 2.4.8
12
+ - 2.5.7
13
+ - 2.6.5
14
+ - 2.7.0
15
+ - jruby-9.2.11.1
16
+ - rbx-3.107
17
17
  - ruby-head
18
18
  env:
19
19
  NET_SSH_RUN_INTEGRATION_TESTS=1
20
20
 
21
21
  matrix:
22
22
  exclude:
23
- - rvm: rbx-3.69
24
- - rvm: jruby-9.1.6.0
23
+ - rvm: rbx-3.107
25
24
  include:
26
- - rvm: rbx-3.69
25
+ - rvm: rbx-3.107
27
26
  env: NET_SSH_RUN_INTEGRATION_TESTS=
28
- - rvm: jruby-9.1.6.0
27
+ - rvm: jruby-9.2.11.1
29
28
  env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -Xcext.enabled=false -J-Xss2m -Xcompile.invokedynamic=false' NET_SSH_RUN_INTEGRATION_TESTS=
30
29
  fast_finish: true
31
30
  allow_failures:
32
- - rvm: rbx-3.69
33
- - rvm: jruby-9.1.6.0
31
+ - rvm: rbx-3.107
32
+ - rvm: jruby-9.2.11.1
34
33
  - rvm: ruby-head
35
34
 
36
35
  install:
37
36
  - export JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -Xcext.enabled=false -J-Xss2m -Xcompile.invokedynamic=false'
38
- - sudo pip install ansible
39
- - gem install bundler -v "= 1.13.7"
40
- - bundle _1.13.7_ install
41
- - BUNDLE_GEMFILE=./Gemfile.norbnacl bundle _1.13.7_ install
42
- - sudo ansible-galaxy install rvm_io.ruby
37
+ - sudo pip install ansible urllib3 pyOpenSSL ndg-httpsclient pyasn1
38
+ - gem install bundler -v "= 1.17"
39
+ - gem list bundler
40
+ - bundle _1.17_ install
41
+ - bundle _1.17_ -v
42
+ - BUNDLE_GEMFILE=./Gemfile.noed25519 bundle _1.17_ install
43
+ - sudo ansible-galaxy install rvm.ruby
43
44
  - sudo chown -R travis:travis /home/travis/.ansible
44
45
  - 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'
45
46
 
46
47
  script:
47
48
  - ssh -V
48
- - bundle _1.13.7_ exec rake test
49
- - BUNDLE_GEMFILE=./Gemfile.norbnacl bundle _1.13.7_ exec rake test
50
- - bundle _1.13.7_ exec rake test_test
51
- - bundle _1.13.7_ exec rubocop
49
+ - bundle _1.17_ exec rake test
50
+ - BUNDLE_GEMFILE=./Gemfile.noed25519 bundle _1.17_ exec rake test
51
+ - bundle _1.17_ exec rake test_test
52
+ - bundle _1.17_ exec rubocop
@@ -1,3 +1,114 @@
1
+ === 6.1.0
2
+
3
+ * adapt to ssh's default bahaviors when no username is provided.
4
+ When Net::SSH.start user is nil and config has no entry
5
+ we default to Etc.getpwuid.name() instead of Etc.getlogin(). [#749]
6
+
7
+ === 6.1.0.rc1
8
+
9
+ * Make sha2-{256,512}-etm@openssh.com MAC default again [#761]
10
+ * Support algorithm subtraction syntax from ssh_config [#751]
11
+
12
+ === 6.0.2
13
+
14
+ * Fix corrupted hmac issue in etm hmac [#759]
15
+
16
+ === 6.0.1
17
+
18
+ * Make sha2-{256,512}-etm@openssh.com MAC opt-in as they seems to have issues [#757]
19
+
20
+ === 6.0.0
21
+
22
+ * Support empty lines and comments in known_hosts [donoghuc, #742]
23
+ * Add sha2-{256,512}-etm@openssh.com MAC algorithms [graaff, #714]
24
+
25
+ === 6.0.0 beta2
26
+
27
+ * Support :certkeys and CertificateFile configuration option [Anders Carling, #722]
28
+
29
+ === 6.0.0 beta1
30
+
31
+ * curve25519sha256 support [Florian Wininger ,#690]
32
+ * disabled insecure algs [Florian Wininger , #709]
33
+
34
+ === 5.2.0
35
+
36
+ === 5.2.0.rc3
37
+
38
+ * Fix check_host_ip read from config
39
+ * Support ssh-ed25519 in kown hosts
40
+
41
+ === 5.2.0.rc2
42
+
43
+ * Read check_host_ip from ssh config files
44
+
45
+ === 5.2.0.rc1
46
+
47
+ * Interpret * and ? in know_hosts file [Romain Tartière, #660]
48
+ * New :check_host_ip so ip checking can be disabled in known hosts [Romain Tartière, #656]
49
+
50
+ === 5.1.0
51
+
52
+ === 5.1.0.rc1
53
+
54
+ * Support new OpenSSH private key format for rsa - bcrypt for rsa (ed25519 already supported) [#646]
55
+ * Support IdentityAgent is ssh config [Frank Groeneveld, #645]
56
+ * Improve Match processing in ssh config [Aleksandrs Ļedovskis, #642]
57
+ * Ignore signature verification when verify_host_key is never [Piotr Kliczewski, #641]
58
+ * Alg preference was changed to prefer stronger encryptions [Tray, #637]
59
+
60
+ === 5.0.2
61
+
62
+ * fix ctr for jruby [#612]
63
+
64
+ === 5.0.1
65
+
66
+ * default_keys were not loaded even if no keys or key_data options specified [#607]
67
+
68
+ === 5.0.0
69
+
70
+ * Breaking change: ed25519 now requires ed25519 gem instead of RbNaCl gem [#563]
71
+ * Verify_host_key options rename (true, false, :very, :secure depreacted new equivalents are :never, :accept_new_or_local_tunnel :accept_new :always) [Jared Beck, #595]
72
+
73
+ === 5.0.0.rc2
74
+
75
+ * Add .dll extensions to dlopen on cygwin [#603]
76
+ * Fix host certificate validation [#601]
77
+
78
+ === 5.0.0.rc1
79
+
80
+ * Fix larger than 4GB file transfers [#599]
81
+ * Update HTTP proxy to version 1.1 [Connor Dunn, #597]
82
+
83
+ === 5.0.0.beta2
84
+
85
+ * Support for sha256 pubkey fingerprint [Tom Maher, #585]
86
+ * Don't try to load default_keys if key_data option is used [Josh Larson, #589]
87
+ * Added fingerprint_hash defaulting to SHA256 as fingerprint format, and MD5 can be used as an option [Miklós Fazekas, #591]
88
+
89
+ === 5.0.0.beta1
90
+
91
+ * Don't leave proxy command as zombie on timeout [DimitriosLisenko, #560]
92
+ * Use OpenSSL for aes*-ctr for up to 5x throughput improvement [Miklós Fazekas, Harald Sitter, #570]
93
+ * Optimize slice! usage in CTR for up to 2x throughput improvement [Harald Sitter, #569]
94
+ * Replace RbNaCl dependency with ed25519 gem [Tony Arcieri ,#563]
95
+ * Add initial Match support [Kasumi Hanazuki, #553]
96
+
97
+ === 4.2.0.rc2
98
+
99
+ * Fix double close bug on auth failure (or ruby 2.2 or earlier) [#538]
100
+
101
+ === 4.2.0.rc1
102
+
103
+ * Improved logging with proxy command [Dmitriy Ivliev, #530]
104
+ * Close transport on proxy error [adamruzicka, #526]
105
+ * Support multiple identity files [Kimura Masayuki, #528]
106
+ * Move `none` cipher to end of cipher list [Brian Cain, #525]
107
+ * Deprecate `:paranoid` in favor of `:verify_host_key` [Jared Beck, #524]
108
+ * Support Multile Include ssh config files [Kasumi Hanazuki, #516]
109
+ * Support Relative path in ssh confif files [Akinori MUSHA, #510]
110
+ * add direct-streamlocal@openssh.com support in Forward class [Harald Sitter, #502]
111
+
1
112
  === 4.1.0
2
113
  === 4.1.0.rc1
3
114
 
@@ -168,7 +279,7 @@
168
279
  === 2.9.2-beta
169
280
 
170
281
  * Remove advertised algorithms that were not working (ssh-rsa-cert-* *ed25519 acm*-gcm@openssh.com) [mfazekas]
171
- * Unkown algorithms now ignored instead of failed [mfazekas]
282
+ * Unknown algorithms now ignored instead of failed [mfazekas]
172
283
  * Configuration change: Asks for password with password auth (up to number_of_password_prompts) [mfazekas]
173
284
  * Removed warnings [amatsuda]
174
285
 
data/Gemfile CHANGED
@@ -3,13 +3,7 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in mygem.gemspec
4
4
  gemspec
5
5
 
6
- if !Gem.win_platform? && RUBY_ENGINE == "mri"
7
- gem 'byebug', group: [:development, :test]
8
- end
9
-
10
- if (Gem::Version.new(RUBY_VERSION) <=> Gem::Version.new("2.2.6")) < 0
11
- gem 'rbnacl', '< 4.0'
12
- end
6
+ gem 'byebug', group: %i[development test] if !Gem.win_platform? && RUBY_ENGINE == "ruby"
13
7
 
14
8
  if ENV["CI"]
15
9
  gem 'codecov', require: false, group: :test
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- ENV['NET_SSH_NO_RBNACL'] = 'true'
3
+ ENV['NET_SSH_NO_ED25519'] = 'true'
4
4
  # Specify your gem's dependencies in mygem.gemspec
5
5
  gemspec
6
6
 
data/Manifest CHANGED
@@ -33,7 +33,6 @@ lib/net/ssh/proxy/errors.rb
33
33
  lib/net/ssh/proxy/http.rb
34
34
  lib/net/ssh/proxy/socks4.rb
35
35
  lib/net/ssh/proxy/socks5.rb
36
- lib/net/ssh/ruby_compat.rb
37
36
  lib/net/ssh/service/forward.rb
38
37
  lib/net/ssh/test.rb
39
38
  lib/net/ssh/test/channel.rb
@@ -75,10 +74,10 @@ lib/net/ssh/transport/packet_stream.rb
75
74
  lib/net/ssh/transport/server_version.rb
76
75
  lib/net/ssh/transport/session.rb
77
76
  lib/net/ssh/transport/state.rb
78
- lib/net/ssh/verifiers/lenient.rb
79
- lib/net/ssh/verifiers/null.rb
80
- lib/net/ssh/verifiers/secure.rb
81
- lib/net/ssh/verifiers/strict.rb
77
+ lib/net/ssh/verifiers/accept_new.rb
78
+ lib/net/ssh/verifiers/accept_new_or_local_tunnel.rb
79
+ lib/net/ssh/verifiers/always.rb
80
+ lib/net/ssh/verifiers/never.rb
82
81
  lib/net/ssh/version.rb
83
82
  net-ssh.gemspec
84
83
  setup.rb
@@ -0,0 +1,287 @@
1
+ [![Gem Version](https://badge.fury.io/rb/net-ssh.svg)](https://badge.fury.io/rb/net-ssh)
2
+ [![Join the chat at https://gitter.im/net-ssh/net-ssh](https://badges.gitter.im/net-ssh/net-ssh.svg)](https://gitter.im/net-ssh/net-ssh?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
+ [![Build Status](https://travis-ci.org/net-ssh/net-ssh.svg?branch=master)](https://travis-ci.org/net-ssh/net-ssh)
4
+ [![Coverage status](https://codecov.io/gh/net-ssh/net-ssh/branch/master/graph/badge.svg)](https://codecov.io/gh/net-ssh/net-ssh)
5
+ [![Backers on Open Collective](https://opencollective.com/net-ssh/backers/badge.svg)](#backers])
6
+ [![Sponsors on Open Collective](https://opencollective.com/net-ssh/sponsors/badge.svg)](#sponsors)
7
+
8
+ # Net::SSH 6.x
9
+
10
+ * Docs: http://net-ssh.github.com/net-ssh
11
+ * Issues: https://github.com/net-ssh/net-ssh/issues
12
+ * Codes: https://github.com/net-ssh/net-ssh
13
+ * Email: net-ssh@solutious.com
14
+
15
+ *As of v2.6.4, all gem releases are signed. See [INSTALL](#install).*
16
+
17
+ ## DESCRIPTION:
18
+
19
+ Net::SSH is a pure-Ruby implementation of the SSH2 client protocol.
20
+ It allows you to write programs that invoke and interact with processes on remote servers, via SSH2.
21
+
22
+ ## FEATURES:
23
+
24
+ * Execute processes on remote servers and capture their output
25
+ * Run multiple processes in parallel over a single SSH connection
26
+ * Support for SSH subsystems
27
+ * Forward local and remote ports via an SSH connection
28
+
29
+ ## Supported Algorithms
30
+
31
+ Net::SSH 6.0 disables by default the usage of weak algorithms.
32
+ We strongly recommend that you install a servers's version that supports the latest algorithms.
33
+
34
+ It is possible to return to the previous behavior by adding the option : `append_all_supported_algorithms: true`
35
+
36
+ Unsecure algoritms will definitely be removed in Net::SSH 7.*.
37
+
38
+ ### Host Keys
39
+
40
+ | Name | Support | Details |
41
+ |----------------------|-----------------------|----------|
42
+ | ssh-rsa | OK | |
43
+ | ssh-ed25519 | OK | Require the gem `ed25519` |
44
+ | ecdsa-sha2-nistp521 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
45
+ | ecdsa-sha2-nistp384 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
46
+ | ecdsa-sha2-nistp256 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
47
+ | ssh-dss | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
48
+
49
+ ### Key Exchange
50
+
51
+ | Name | Support | Details |
52
+ |--------------------------------------|-----------------------|----------|
53
+ | curve25519-sha256 | OK | Require the gem `x25519` |
54
+ | ecdh-sha2-nistp521 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
55
+ | ecdh-sha2-nistp384 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
56
+ | ecdh-sha2-nistp256 | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
57
+ | diffie-hellman-group1-sha1 | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
58
+ | diffie-hellman-group14-sha1 | OK | |
59
+ | diffie-hellman-group-exchange-sha1 | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
60
+ | diffie-hellman-group-exchange-sha256 | OK | |
61
+
62
+ ### Encryption algorithms (ciphers)
63
+
64
+ | Name | Support | Details |
65
+ |--------------------------------------|-----------------------|----------|
66
+ | aes256-ctr / aes192-ctr / aes128-ctr | OK | |
67
+ | aes256-cbc / aes192-cbc / aes128-cbc | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
68
+ | rijndael-cbc@lysator.liu.se | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
69
+ | blowfish-ctr blowfish-cbc | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
70
+ | cast128-ctr cast128-cbc | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
71
+ | 3des-ctr 3des-cbc | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
72
+ | idea-cbc | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
73
+ | none | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
74
+
75
+ ### Message Authentication Code algorithms
76
+
77
+ | Name | Support | Details |
78
+ |----------------------|-----------------------|----------|
79
+ | hmac-sha2-512-etm | OK | |
80
+ | hmac-sha2-256-etm | OK | |
81
+ | hmac-sha2-512 | OK | |
82
+ | hmac-sha2-256 | OK | |
83
+ | hmac-sha2-512-96 | Deprecated in 6.0 | removed from the specification, will be removed in 7.0 |
84
+ | hmac-sha2-256-96 | Deprecated in 6.0 | removed from the specification, will be removed in 7.0 |
85
+ | hmac-sha1 | OK | for backward compatibility |
86
+ | hmac-sha1-96 | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
87
+ | hmac-ripemd160 | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
88
+ | hmac-md5 | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
89
+ | hmac-md5-96 | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
90
+ | none | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
91
+
92
+ ## SYNOPSIS:
93
+
94
+ In a nutshell:
95
+
96
+ ```ruby
97
+ require 'net/ssh'
98
+
99
+ Net::SSH.start('host', 'user', password: "password") do |ssh|
100
+
101
+ # capture all stderr and stdout output from a remote process
102
+ output = ssh.exec!("hostname")
103
+ puts output
104
+
105
+ # capture only stdout matching a particular pattern
106
+ stdout = ""
107
+ ssh.exec!("ls -l /home/jamis") do |channel, stream, data|
108
+ stdout << data if stream == :stdout && /foo/.match(data)
109
+ end
110
+ puts stdout
111
+
112
+ # run multiple processes in parallel to completion
113
+ ssh.exec "sed ..."
114
+ ssh.exec "awk ..."
115
+ ssh.exec "rm -rf ..."
116
+ ssh.loop
117
+
118
+ # open a new channel and configure a minimal set of callbacks, then run
119
+ # the event loop until the channel finishes (closes)
120
+ channel = ssh.open_channel do |ch|
121
+ ch.exec "/usr/local/bin/ruby /path/to/file.rb" do |ch, success|
122
+ raise "could not execute command" unless success
123
+
124
+ # "on_data" is called when the process writes something to stdout
125
+ ch.on_data do |c, data|
126
+ $stdout.print data
127
+ end
128
+
129
+ # "on_extended_data" is called when the process writes something to stderr
130
+ ch.on_extended_data do |c, type, data|
131
+ $stderr.print data
132
+ end
133
+
134
+ ch.on_close { puts "done!" }
135
+ end
136
+ end
137
+
138
+ channel.wait
139
+
140
+ # forward connections on local port 1234 to port 80 of www.capify.org
141
+ ssh.forward.local(1234, "www.capify.org", 80)
142
+ ssh.loop { true }
143
+ end
144
+ ```
145
+
146
+ See Net::SSH for more documentation, and links to further information.
147
+
148
+ ## REQUIREMENTS:
149
+
150
+ The only requirement you might be missing is the OpenSSL bindings for Ruby with a version greather than `1.0.1`.
151
+ 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:
152
+
153
+ ```sh
154
+ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
155
+ ```
156
+
157
+ If that spits out something like `OpenSSL 1.0.1 14 Mar 2012`, then you're set.
158
+ If you get an error, then you'll need to see about rebuilding ruby with OpenSSL support,
159
+ or (if your platform supports it) installing the OpenSSL bindings separately.
160
+
161
+ ## INSTALL:
162
+
163
+ ```sh
164
+ gem install net-ssh # might need sudo privileges
165
+ ```
166
+
167
+ NOTE: If you are running on jruby on windows you need to install `jruby-pageant` manually
168
+ (gemspec doesn't allow for platform specific dependencies at gem installation time).
169
+
170
+ However, in order to be sure the code you're installing hasn't been tampered with,
171
+ it's recommended that you verify the [signature](http://docs.rubygems.org/read/chapter/21).
172
+ To do this, you need to add my public key as a trusted certificate (you only need to do this once):
173
+
174
+ ```sh
175
+ # Add the public key as a trusted certificate
176
+ # (You only need to do this once)
177
+ curl -O https://raw.githubusercontent.com/net-ssh/net-ssh/master/net-ssh-public_cert.pem
178
+ gem cert --add net-ssh-public_cert.pem
179
+ ```
180
+
181
+ Then, when install the gem, do so with high security:
182
+
183
+ ```sh
184
+ gem install net-ssh -P HighSecurity
185
+ ```
186
+
187
+ If you don't add the public key, you'll see an error like "Couldn't verify data signature".
188
+ If you're still having trouble let me know and I'll give you a hand.
189
+
190
+ For ed25519 public key auth support your bundle file should contain `ed25519`, `bcrypt_pbkdf` dependencies.
191
+
192
+ ```sh
193
+ gem install ed25519
194
+ gem install bcrypt_pbkdf
195
+ ```
196
+
197
+ For curve25519-sha256 kex exchange support your bundle file should contain `x25519` dependency.
198
+
199
+ ## RUBY SUPPORT
200
+
201
+ * See [net-ssh.gemspec](https://github.com/net-ssh/net-ssh/blob/master/net-ssh.gemspec) for current versions ruby requirements
202
+
203
+ ## RUNNING TESTS
204
+
205
+ If you want to run the tests or use any of the Rake tasks, you'll need Mocha and
206
+ other dependencies listed in Gemfile
207
+
208
+ Run the test suite from the net-ssh directory with the following command:
209
+
210
+ ```sh
211
+ bundle exec rake test
212
+ ```
213
+
214
+ Run a single test file like this:
215
+
216
+ ```sh
217
+ ruby -Ilib -Itest test/transport/test_server_version.rb
218
+ ```
219
+
220
+ To run integration tests see test/integration/README.txt
221
+
222
+ ### BUILDING GEM
223
+
224
+ ```sh
225
+ rake build
226
+ ```
227
+
228
+ ### GEM SIGNING (for maintainers)
229
+
230
+ 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:
231
+
232
+ ```sh
233
+ NET_SSH_BUILDGEM_SIGNED=true rake build
234
+ ```
235
+
236
+ For time to time, the public certificate associated to the private key needs to be renewed. You can do this with the following command:
237
+
238
+ ```sh
239
+ gem cert --build netssh@solutious.com --private-key path/2/net-ssh-private_key.pem
240
+ mv gem-public_cert.pem net-ssh-public_cert.pem
241
+ gem cert --add net-ssh-public_cert.pem
242
+ ```
243
+
244
+ ## CREDITS
245
+
246
+ ### Contributors
247
+
248
+ This project exists thanks to all the people who contribute.
249
+
250
+ [![contributors](https://opencollective.com/net-ssh/contributors.svg?width=890&button=false)](graphs/contributors)
251
+
252
+ ### Backers
253
+
254
+ Thank you to all our backers! 🙏 [Become a backer](https://opencollective.com/net-ssh#backer)
255
+
256
+ [![backers](https://opencollective.com/net-ssh/backers.svg?width=890)](https://opencollective.com/net-ssh#backers)
257
+
258
+ ### Sponsors
259
+
260
+ Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor](https://opencollective.com/net-ssh#sponsor)
261
+
262
+ [![Sponsor](https://opencollective.com/net-ssh/sponsor/0/avatar.svg)](https://opencollective.com/net-ssh/sponsor/0/website)
263
+
264
+ ## LICENSE:
265
+
266
+ (The MIT License)
267
+
268
+ Copyright (c) 2008 Jamis Buck
269
+
270
+ Permission is hereby granted, free of charge, to any person obtaining
271
+ a copy of this software and associated documentation files (the
272
+ 'Software'), to deal in the Software without restriction, including
273
+ without limitation the rights to use, copy, modify, merge, publish,
274
+ distribute, sublicense, and/or sell copies of the Software, and to
275
+ permit persons to whom the Software is furnished to do so, subject to
276
+ the following conditions:
277
+
278
+ The above copyright notice and this permission notice shall be
279
+ included in all copies or substantial portions of the Software.
280
+
281
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
282
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
283
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
284
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
285
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
286
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
287
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.