net-ssh 4.2.0 → 7.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data/.dockerignore +6 -0
  4. data/.github/config/rubocop_linter_action.yml +4 -0
  5. data/.github/workflows/ci-with-docker.yml +44 -0
  6. data/.github/workflows/ci.yml +87 -0
  7. data/.github/workflows/rubocop.yml +13 -0
  8. data/.gitignore +7 -0
  9. data/.rubocop.yml +19 -2
  10. data/.rubocop_todo.yml +619 -667
  11. data/CHANGES.txt +110 -1
  12. data/Dockerfile +27 -0
  13. data/Dockerfile.openssl3 +17 -0
  14. data/Gemfile +3 -7
  15. data/{Gemfile.norbnacl → Gemfile.noed25519} +3 -1
  16. data/Manifest +4 -5
  17. data/README.md +293 -0
  18. data/Rakefile +45 -29
  19. data/appveyor.yml +8 -6
  20. data/docker-compose.yml +23 -0
  21. data/lib/net/ssh/authentication/agent.rb +248 -223
  22. data/lib/net/ssh/authentication/certificate.rb +178 -164
  23. data/lib/net/ssh/authentication/constants.rb +17 -15
  24. data/lib/net/ssh/authentication/ed25519.rb +141 -116
  25. data/lib/net/ssh/authentication/ed25519_loader.rb +28 -28
  26. data/lib/net/ssh/authentication/key_manager.rb +79 -36
  27. data/lib/net/ssh/authentication/methods/abstract.rb +62 -47
  28. data/lib/net/ssh/authentication/methods/hostbased.rb +34 -37
  29. data/lib/net/ssh/authentication/methods/keyboard_interactive.rb +3 -3
  30. data/lib/net/ssh/authentication/methods/none.rb +16 -19
  31. data/lib/net/ssh/authentication/methods/password.rb +15 -16
  32. data/lib/net/ssh/authentication/methods/publickey.rb +96 -55
  33. data/lib/net/ssh/authentication/pageant.rb +468 -465
  34. data/lib/net/ssh/authentication/pub_key_fingerprint.rb +43 -0
  35. data/lib/net/ssh/authentication/session.rb +131 -122
  36. data/lib/net/ssh/buffer.rb +385 -332
  37. data/lib/net/ssh/buffered_io.rb +150 -151
  38. data/lib/net/ssh/config.rb +316 -239
  39. data/lib/net/ssh/connection/channel.rb +635 -613
  40. data/lib/net/ssh/connection/constants.rb +29 -29
  41. data/lib/net/ssh/connection/event_loop.rb +104 -95
  42. data/lib/net/ssh/connection/keepalive.rb +55 -51
  43. data/lib/net/ssh/connection/session.rb +614 -611
  44. data/lib/net/ssh/connection/term.rb +125 -123
  45. data/lib/net/ssh/errors.rb +101 -99
  46. data/lib/net/ssh/key_factory.rb +194 -108
  47. data/lib/net/ssh/known_hosts.rb +212 -134
  48. data/lib/net/ssh/loggable.rb +50 -49
  49. data/lib/net/ssh/packet.rb +83 -79
  50. data/lib/net/ssh/prompt.rb +51 -51
  51. data/lib/net/ssh/proxy/command.rb +105 -91
  52. data/lib/net/ssh/proxy/errors.rb +12 -10
  53. data/lib/net/ssh/proxy/http.rb +81 -81
  54. data/lib/net/ssh/proxy/https.rb +37 -36
  55. data/lib/net/ssh/proxy/jump.rb +49 -48
  56. data/lib/net/ssh/proxy/socks4.rb +2 -6
  57. data/lib/net/ssh/proxy/socks5.rb +14 -17
  58. data/lib/net/ssh/service/forward.rb +365 -362
  59. data/lib/net/ssh/test/channel.rb +145 -143
  60. data/lib/net/ssh/test/extensions.rb +131 -127
  61. data/lib/net/ssh/test/kex.rb +34 -32
  62. data/lib/net/ssh/test/local_packet.rb +46 -44
  63. data/lib/net/ssh/test/packet.rb +87 -84
  64. data/lib/net/ssh/test/remote_packet.rb +32 -30
  65. data/lib/net/ssh/test/script.rb +155 -155
  66. data/lib/net/ssh/test/socket.rb +49 -48
  67. data/lib/net/ssh/test.rb +82 -80
  68. data/lib/net/ssh/transport/algorithms.rb +433 -364
  69. data/lib/net/ssh/transport/cipher_factory.rb +95 -91
  70. data/lib/net/ssh/transport/constants.rb +32 -24
  71. data/lib/net/ssh/transport/ctr.rb +37 -15
  72. data/lib/net/ssh/transport/hmac/abstract.rb +81 -63
  73. data/lib/net/ssh/transport/hmac/md5.rb +0 -2
  74. data/lib/net/ssh/transport/hmac/md5_96.rb +0 -2
  75. data/lib/net/ssh/transport/hmac/none.rb +0 -2
  76. data/lib/net/ssh/transport/hmac/ripemd160.rb +0 -2
  77. data/lib/net/ssh/transport/hmac/sha1.rb +0 -2
  78. data/lib/net/ssh/transport/hmac/sha1_96.rb +0 -2
  79. data/lib/net/ssh/transport/hmac/sha2_256.rb +7 -11
  80. data/lib/net/ssh/transport/hmac/sha2_256_96.rb +4 -8
  81. data/lib/net/ssh/transport/hmac/sha2_256_etm.rb +12 -0
  82. data/lib/net/ssh/transport/hmac/sha2_512.rb +6 -9
  83. data/lib/net/ssh/transport/hmac/sha2_512_96.rb +4 -8
  84. data/lib/net/ssh/transport/hmac/sha2_512_etm.rb +12 -0
  85. data/lib/net/ssh/transport/hmac.rb +14 -12
  86. data/lib/net/ssh/transport/identity_cipher.rb +54 -52
  87. data/lib/net/ssh/transport/kex/abstract.rb +130 -0
  88. data/lib/net/ssh/transport/kex/abstract5656.rb +72 -0
  89. data/lib/net/ssh/transport/kex/curve25519_sha256.rb +39 -0
  90. data/lib/net/ssh/transport/kex/curve25519_sha256_loader.rb +30 -0
  91. data/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +33 -40
  92. data/lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb +11 -0
  93. data/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +112 -217
  94. data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +53 -63
  95. data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +5 -9
  96. data/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +36 -90
  97. data/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +18 -10
  98. data/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +18 -10
  99. data/lib/net/ssh/transport/kex.rb +15 -12
  100. data/lib/net/ssh/transport/key_expander.rb +24 -21
  101. data/lib/net/ssh/transport/openssl.rb +158 -133
  102. data/lib/net/ssh/transport/packet_stream.rb +223 -191
  103. data/lib/net/ssh/transport/server_version.rb +55 -56
  104. data/lib/net/ssh/transport/session.rb +306 -259
  105. data/lib/net/ssh/transport/state.rb +178 -176
  106. data/lib/net/ssh/verifiers/accept_new.rb +33 -0
  107. data/lib/net/ssh/verifiers/accept_new_or_local_tunnel.rb +33 -0
  108. data/lib/net/ssh/verifiers/always.rb +58 -0
  109. data/lib/net/ssh/verifiers/never.rb +19 -0
  110. data/lib/net/ssh/version.rb +55 -53
  111. data/lib/net/ssh.rb +47 -34
  112. data/net-ssh-public_cert.pem +18 -19
  113. data/net-ssh.gemspec +12 -11
  114. data/support/ssh_tunnel_bug.rb +5 -5
  115. data.tar.gz.sig +0 -0
  116. metadata +78 -73
  117. metadata.gz.sig +0 -0
  118. data/.travis.yml +0 -51
  119. data/Gemfile.norbnacl.lock +0 -41
  120. data/README.rdoc +0 -169
  121. data/lib/net/ssh/ruby_compat.rb +0 -24
  122. data/lib/net/ssh/verifiers/lenient.rb +0 -30
  123. data/lib/net/ssh/verifiers/null.rb +0 -12
  124. data/lib/net/ssh/verifiers/secure.rb +0 -52
  125. data/lib/net/ssh/verifiers/strict.rb +0 -24
  126. data/support/arcfour_check.rb +0 -20
data/.travis.yml DELETED
@@ -1,51 +0,0 @@
1
- language: ruby
2
- sudo: true
3
- dist: trusty
4
-
5
- addon:
6
- hosts:
7
- gateway.netssh
8
-
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
17
- - ruby-head
18
- env:
19
- NET_SSH_RUN_INTEGRATION_TESTS=1
20
-
21
- matrix:
22
- exclude:
23
- - rvm: rbx-3.69
24
- - rvm: jruby-9.1.6.0
25
- include:
26
- - rvm: rbx-3.69
27
- env: NET_SSH_RUN_INTEGRATION_TESTS=
28
- - rvm: jruby-9.1.6.0
29
- 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
- fast_finish: true
31
- allow_failures:
32
- - rvm: rbx-3.69
33
- - rvm: jruby-9.1.6.0
34
- - rvm: ruby-head
35
-
36
- install:
37
- - 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
43
- - sudo chown -R travis:travis /home/travis/.ansible
44
- - 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
- script:
47
- - 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
@@ -1,41 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- net-ssh (4.0.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.3.0)
10
- metaclass (0.0.4)
11
- minitest (5.10.1)
12
- mocha (1.2.1)
13
- metaclass (~> 0.0.1)
14
- parser (2.3.3.1)
15
- ast (~> 2.2)
16
- powerpack (0.1.1)
17
- rainbow (2.1.0)
18
- rake (12.0.0)
19
- rubocop (0.46.0)
20
- parser (>= 2.3.1.1, < 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.1)
26
- unicode-display_width (1.1.2)
27
-
28
- PLATFORMS
29
- ruby
30
- x86-mingw32
31
-
32
- DEPENDENCIES
33
- bundler (~> 1.11)
34
- minitest (~> 5.10)
35
- mocha (>= 1.2.1)
36
- net-ssh!
37
- rake (~> 12.0)
38
- rubocop (~> 0.46.0)
39
-
40
- BUNDLED WITH
41
- 1.13.6
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 4.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 ```rbnacl-libsodium```, ```rbnacl```, ```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
- * Current net-ssh releases require Ruby 2.0 or later.
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.
@@ -1,24 +0,0 @@
1
- require 'thread'
2
-
3
- class String
4
- if RUBY_VERSION < "1.9"
5
- def getbyte(index)
6
- self[index]
7
- end
8
- def setbyte(index, c)
9
- self[index] = c
10
- end
11
- end
12
- end
13
-
14
- module Net; module SSH
15
-
16
- # This class contains miscellaneous patches and workarounds
17
- # for different ruby implementations.
18
- class Compat
19
- def self.io_select(*params)
20
- IO.select(*params)
21
- end
22
- end
23
-
24
- end; end
@@ -1,30 +0,0 @@
1
- require 'net/ssh/verifiers/strict'
2
-
3
- module Net; module SSH; module Verifiers
4
-
5
- # Basically the same as the Strict verifier, but does not try to actually
6
- # verify a connection if the server is the localhost and the port is a
7
- # nonstandard port number. Those two conditions will typically mean the
8
- # connection is being tunnelled through a forwarded port, so the known-hosts
9
- # file will not be helpful (in general).
10
- class Lenient < Strict
11
- # Tries to determine if the connection is being tunnelled, and if so,
12
- # returns true. Otherwise, performs the standard strict verification.
13
- def verify(arguments)
14
- return true if tunnelled?(arguments)
15
- super
16
- end
17
-
18
- private
19
-
20
- # A connection is potentially being tunnelled if the port is not 22,
21
- # and the ip refers to the localhost.
22
- def tunnelled?(args)
23
- return false if args[:session].port == Net::SSH::Transport::Session::DEFAULT_PORT
24
-
25
- ip = args[:session].peer[:ip]
26
- return ip == "127.0.0.1" || ip == "::1"
27
- end
28
- end
29
-
30
- end; end; end
@@ -1,12 +0,0 @@
1
- module Net; module SSH; module Verifiers
2
-
3
- # The Null host key verifier simply allows every key it sees, without
4
- # bothering to verify. This is simple, but is not particularly secure.
5
- class Null
6
- # Returns true.
7
- def verify(arguments)
8
- true
9
- end
10
- end
11
-
12
- end; end; end
@@ -1,52 +0,0 @@
1
- require 'net/ssh/errors'
2
- require 'net/ssh/known_hosts'
3
-
4
- module Net; module SSH; module Verifiers
5
-
6
- # Does a strict host verification, looking the server up in the known
7
- # host files to see if a key has already been seen for this server. If this
8
- # server does not appear in any host file, an exception will be raised
9
- # (HostKeyUnknown). This is in contrast to the "Strict" class, which will
10
- # silently add the key to your known_hosts file. If the server does appear at
11
- # least once, but the key given does not match any known for the server, an
12
- # exception will be raised (HostKeyMismatch).
13
- # Otherwise, this returns true.
14
- class Secure
15
- def verify(arguments)
16
- host_keys = arguments[:session].host_keys
17
-
18
- # We've never seen this host before, so raise an exception.
19
- if host_keys.empty?
20
- process_cache_miss(host_keys, arguments, HostKeyUnknown, "is unknown")
21
- end
22
-
23
- # If we found any matches, check to see that the key type and
24
- # blob also match.
25
- found = host_keys.any? do |key|
26
- key.ssh_type == arguments[:key].ssh_type &&
27
- key.to_blob == arguments[:key].to_blob
28
- end
29
-
30
- # If a match was found, return true. Otherwise, raise an exception
31
- # indicating that the key was not recognized.
32
- unless found
33
- process_cache_miss(host_keys, arguments, HostKeyMismatch, "does not match")
34
- end
35
-
36
- found
37
- end
38
-
39
- private
40
-
41
- def process_cache_miss(host_keys, args, exc_class, message)
42
- exception = exc_class.new("fingerprint #{args[:fingerprint]} " +
43
- "#{message} for #{host_keys.host.inspect}")
44
- exception.data = args
45
- exception.callback = Proc.new do
46
- host_keys.add_host_key(args[:key])
47
- end
48
- raise exception
49
- end
50
- end
51
-
52
- end; end; end
@@ -1,24 +0,0 @@
1
- require 'net/ssh/errors'
2
- require 'net/ssh/known_hosts'
3
- require 'net/ssh/verifiers/secure'
4
-
5
- module Net; module SSH; module Verifiers
6
-
7
- # Does a strict host verification, looking the server up in the known
8
- # host files to see if a key has already been seen for this server. If this
9
- # server does not appear in any host file, this will silently add the
10
- # server. If the server does appear at least once, but the key given does
11
- # not match any known for the server, an exception will be raised (HostKeyMismatch).
12
- # Otherwise, this returns true.
13
- class Strict < Secure
14
- def verify(arguments)
15
- begin
16
- super
17
- rescue HostKeyUnknown => err
18
- err.remember_host!
19
- return true
20
- end
21
- end
22
- end
23
-
24
- end; end; end
@@ -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
-