net-ssh 2.5.1 → 2.5.2
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.
- data/CHANGELOG.rdoc +4 -0
- data/LICENSE.rdoc +19 -0
- data/Rakefile +2 -0
- data/lib/net/ssh/known_hosts.rb +11 -9
- data/lib/net/ssh/version.rb +1 -1
- data/net-ssh.gemspec +20 -10
- data/test/README.txt +43 -0
- data/test/configs/nohost +19 -0
- data/test/configs/numeric_host +4 -0
- data/test/known_hosts/github +1 -0
- data/test/manual/test_forward.rb +223 -0
- data/test/start/test_transport.rb +28 -0
- data/test/test_known_hosts.rb +13 -0
- metadata +17 -19
data/CHANGELOG.rdoc
CHANGED
data/LICENSE.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright © 2008 Jamis Buck
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the ‘Software’), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/Rakefile
CHANGED
@@ -19,6 +19,7 @@ task :default => :package
|
|
19
19
|
README = "README.rdoc"
|
20
20
|
CHANGES = "CHANGELOG.rdoc"
|
21
21
|
THANKS = 'THANKS.rdoc'
|
22
|
+
LICENSE = "LICENSE.rdoc"
|
22
23
|
|
23
24
|
# Files and directories to be deleted when you run "rake clean"
|
24
25
|
CLEAN.include [ 'pkg', '*.gem', '.config', 'doc']
|
@@ -81,6 +82,7 @@ Rake::RDocTask.new do |t|
|
|
81
82
|
t.rdoc_files.include(README)
|
82
83
|
t.rdoc_files.include(CHANGES)
|
83
84
|
t.rdoc_files.include(THANKS)
|
85
|
+
t.rdoc_files.include(LICENSE)
|
84
86
|
t.rdoc_files.include('lib/**/*.rb')
|
85
87
|
end
|
86
88
|
|
data/lib/net/ssh/known_hosts.rb
CHANGED
@@ -10,16 +10,18 @@ module Net; module SSH
|
|
10
10
|
# This is used internally by Net::SSH, and will never need to be used directly
|
11
11
|
# by consumers of the library.
|
12
12
|
class KnownHosts
|
13
|
-
class <<self
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
if defined?(OpenSSL::PKey::EC)
|
15
|
+
SUPPORTED_TYPE = %w(ssh-rsa ssh-dss
|
16
|
+
ecdsa-sha2-nistp256
|
17
|
+
ecdsa-sha2-nistp384
|
18
|
+
ecdsa-sha2-nistp521)
|
19
|
+
else
|
20
|
+
SUPPORTED_TYPE = %w(ssh-rsa ssh-dss)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
class <<self
|
23
25
|
|
24
26
|
# Searches all known host files (see KnownHosts.hostfiles) for all keys
|
25
27
|
# of the given host. Returns an array of keys found.
|
data/lib/net/ssh/version.rb
CHANGED
data/net-ssh.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "net-ssh"
|
3
3
|
s.rubyforge_project = 'net-ssh'
|
4
|
-
s.version = "2.5.
|
4
|
+
s.version = "2.5.2"
|
5
5
|
s.summary = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol."
|
6
6
|
s.description = s.summary + " It allows you to write programs that invoke and interact with processes on remote servers, via SSH2."
|
7
7
|
s.authors = ["Jamis Buck", "Delano Mandelbaum"]
|
@@ -14,10 +14,12 @@
|
|
14
14
|
s.require_paths = %w[lib]
|
15
15
|
s.rubygems_version = '1.3.2'
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
if RUBY_PLATFORM == "java"
|
18
|
+
# This has two flavours with java one actually doing something and other
|
19
|
+
# one just raising error. This is a workaround for no ability to specify
|
20
|
+
# platform specific dependencies in gemspecs.
|
21
|
+
s.add_dependency 'jruby-pageant', ">=1.0.2"
|
22
|
+
end
|
21
23
|
|
22
24
|
s.executables = %w[]
|
23
25
|
|
@@ -26,11 +28,14 @@
|
|
26
28
|
CHANGELOG.rdoc
|
27
29
|
Manifest
|
28
30
|
README.rdoc
|
31
|
+
LICENSE.rdoc
|
29
32
|
Rakefile
|
30
33
|
Rudyfile
|
31
34
|
THANKS.rdoc
|
32
35
|
lib/net/ssh.rb
|
33
36
|
lib/net/ssh/authentication/agent.rb
|
37
|
+
lib/net/ssh/authentication/agent/java_pageant.rb
|
38
|
+
lib/net/ssh/authentication/agent/socket.rb
|
34
39
|
lib/net/ssh/authentication/constants.rb
|
35
40
|
lib/net/ssh/authentication/key_manager.rb
|
36
41
|
lib/net/ssh/authentication/methods/abstract.rb
|
@@ -40,8 +45,6 @@
|
|
40
45
|
lib/net/ssh/authentication/methods/publickey.rb
|
41
46
|
lib/net/ssh/authentication/pageant.rb
|
42
47
|
lib/net/ssh/authentication/session.rb
|
43
|
-
lib/net/ssh/authentication/agent/java_pageant.rb
|
44
|
-
lib/net/ssh/authentication/agent/socket.rb
|
45
48
|
lib/net/ssh/buffer.rb
|
46
49
|
lib/net/ssh/buffered_io.rb
|
47
50
|
lib/net/ssh/config.rb
|
@@ -88,15 +91,15 @@
|
|
88
91
|
lib/net/ssh/transport/hmac/sha2_512.rb
|
89
92
|
lib/net/ssh/transport/hmac/sha2_512_96.rb
|
90
93
|
lib/net/ssh/transport/identity_cipher.rb
|
91
|
-
lib/net/ssh/transport/key_expander.rb
|
92
94
|
lib/net/ssh/transport/kex.rb
|
93
|
-
lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
|
94
95
|
lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb
|
96
|
+
lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
|
95
97
|
lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb
|
96
98
|
lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb
|
97
99
|
lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb
|
98
100
|
lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb
|
99
101
|
lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb
|
102
|
+
lib/net/ssh/transport/key_expander.rb
|
100
103
|
lib/net/ssh/transport/openssl.rb
|
101
104
|
lib/net/ssh/transport/packet_stream.rb
|
102
105
|
lib/net/ssh/transport/server_version.rb
|
@@ -110,6 +113,7 @@
|
|
110
113
|
setup.rb
|
111
114
|
support/arcfour_check.rb
|
112
115
|
support/ssh_tunnel_bug.rb
|
116
|
+
test/README.txt
|
113
117
|
test/authentication/methods/common.rb
|
114
118
|
test/authentication/methods/test_abstract.rb
|
115
119
|
test/authentication/methods/test_hostbased.rb
|
@@ -124,14 +128,20 @@
|
|
124
128
|
test/configs/exact_match
|
125
129
|
test/configs/host_plus
|
126
130
|
test/configs/multihost
|
131
|
+
test/configs/nohost
|
132
|
+
test/configs/numeric_host
|
127
133
|
test/configs/wild_cards
|
128
134
|
test/connection/test_channel.rb
|
129
135
|
test/connection/test_session.rb
|
136
|
+
test/manual/test_forward.rb
|
137
|
+
test/start/test_transport.rb
|
138
|
+
test/known_hosts/github
|
130
139
|
test/test_all.rb
|
131
140
|
test/test_buffer.rb
|
132
141
|
test/test_buffered_io.rb
|
133
142
|
test/test_config.rb
|
134
143
|
test/test_key_factory.rb
|
144
|
+
test/test_known_hosts.rb
|
135
145
|
test/transport/hmac/test_md5.rb
|
136
146
|
test/transport/hmac/test_md5_96.rb
|
137
147
|
test/transport/hmac/test_none.rb
|
@@ -142,8 +152,8 @@
|
|
142
152
|
test/transport/hmac/test_sha2_256_96.rb
|
143
153
|
test/transport/hmac/test_sha2_512.rb
|
144
154
|
test/transport/hmac/test_sha2_512_96.rb
|
145
|
-
test/transport/kex/test_diffie_hellman_group1_sha1.rb
|
146
155
|
test/transport/kex/test_diffie_hellman_group14_sha1.rb
|
156
|
+
test/transport/kex/test_diffie_hellman_group1_sha1.rb
|
147
157
|
test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
|
148
158
|
test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb
|
149
159
|
test/transport/kex/test_ecdh_sha2_nistp256.rb
|
data/test/README.txt
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
2011-01-19
|
2
|
+
|
3
|
+
RUNNING TESTS
|
4
|
+
|
5
|
+
Run the test suite from the net-ssh directory with the following command:
|
6
|
+
|
7
|
+
ruby -Ilib -Itest -rrubygems test/test_all.rb
|
8
|
+
|
9
|
+
Run a single test file like this:
|
10
|
+
|
11
|
+
ruby -Ilib -Itest -rrubygems test/transport/test_server_version.rb
|
12
|
+
|
13
|
+
|
14
|
+
EXPECTED RESULTS
|
15
|
+
|
16
|
+
* Ruby 1.8: all tests pass
|
17
|
+
|
18
|
+
* Ruby 1.9: all tests pass
|
19
|
+
|
20
|
+
* JRuby 1.5: 99% tests pass (448 tests, 1846 assertions, 1 failures)
|
21
|
+
|
22
|
+
|
23
|
+
PORT FORWARDING TESTS
|
24
|
+
|
25
|
+
ruby -Ilib -Itest -rrubygems test/manual/test_forward.rb
|
26
|
+
|
27
|
+
test_forward.rb must be run separately from the test suite because
|
28
|
+
it requires authorizing your public SSH keys on you localhost.
|
29
|
+
|
30
|
+
If you already have keys you can do this:
|
31
|
+
|
32
|
+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
|
33
|
+
|
34
|
+
If you don't have keys see:
|
35
|
+
|
36
|
+
http://kimmo.suominen.com/docs/ssh/#ssh-keygen
|
37
|
+
|
38
|
+
You should now be able to login to your localhost with out
|
39
|
+
bring prompted for a password:
|
40
|
+
|
41
|
+
ssh localhost
|
42
|
+
|
43
|
+
-Delano
|
data/test/configs/nohost
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# $ ruby -Ilib -Itest -rrubygems test/test_forward.rb
|
2
|
+
|
3
|
+
# Tests for the following patch:
|
4
|
+
#
|
5
|
+
# http://github.com/net-ssh/net-ssh/tree/portfwfix
|
6
|
+
#
|
7
|
+
# It fixes 3 issues, regarding closing forwarded ports:
|
8
|
+
#
|
9
|
+
# 1.) if client closes a forwarded connection, but the server is reading, net-ssh terminates with IOError socket closed.
|
10
|
+
# 2.) if client force closes (RST) a forwarded connection, but server is reading, net-ssh terminates with
|
11
|
+
# 3.) if server closes the sending side, the on_eof is not handled.
|
12
|
+
#
|
13
|
+
# More info:
|
14
|
+
#
|
15
|
+
# http://net-ssh.lighthouseapp.com/projects/36253/tickets/7
|
16
|
+
|
17
|
+
require 'common'
|
18
|
+
require 'net/ssh/buffer'
|
19
|
+
require 'net/ssh'
|
20
|
+
require 'timeout'
|
21
|
+
require 'tempfile'
|
22
|
+
|
23
|
+
class TestForward < Test::Unit::TestCase
|
24
|
+
|
25
|
+
def localhost
|
26
|
+
'localhost'
|
27
|
+
end
|
28
|
+
|
29
|
+
def ssh_start_params
|
30
|
+
[localhost ,ENV['USER'], {:keys => "~/.ssh/id_rsa", :verbose => :debug}]
|
31
|
+
end
|
32
|
+
|
33
|
+
def find_free_port
|
34
|
+
server = TCPServer.open(0)
|
35
|
+
server.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR,true)
|
36
|
+
port = server.addr[1]
|
37
|
+
server.close
|
38
|
+
port
|
39
|
+
end
|
40
|
+
|
41
|
+
def start_server_sending_lot_of_data(exceptions)
|
42
|
+
server = TCPServer.open(0)
|
43
|
+
Thread.start do
|
44
|
+
loop do
|
45
|
+
Thread.start(server.accept) do |client|
|
46
|
+
begin
|
47
|
+
10000.times do |i|
|
48
|
+
client.puts "item#{i}"
|
49
|
+
end
|
50
|
+
client.close
|
51
|
+
rescue
|
52
|
+
exceptions << $!
|
53
|
+
raise
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
return server
|
59
|
+
end
|
60
|
+
|
61
|
+
def start_server_closing_soon(exceptions=nil)
|
62
|
+
server = TCPServer.open(0)
|
63
|
+
Thread.start do
|
64
|
+
loop do
|
65
|
+
Thread.start(server.accept) do |client|
|
66
|
+
begin
|
67
|
+
client.recv(1024)
|
68
|
+
client.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, [1, 0].pack("ii"))
|
69
|
+
client.close
|
70
|
+
rescue
|
71
|
+
exceptions << $!
|
72
|
+
raise
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
return server
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_loop_should_not_abort_when_local_side_of_forward_is_closed
|
81
|
+
session = Net::SSH.start(*ssh_start_params)
|
82
|
+
server_exc = Queue.new
|
83
|
+
server = start_server_sending_lot_of_data(server_exc)
|
84
|
+
remote_port = server.addr[1]
|
85
|
+
local_port = find_free_port
|
86
|
+
session.forward.local(local_port, localhost, remote_port)
|
87
|
+
client_done = Queue.new
|
88
|
+
Thread.start do
|
89
|
+
begin
|
90
|
+
client = TCPSocket.new(localhost, local_port)
|
91
|
+
client.recv(1024)
|
92
|
+
client.close
|
93
|
+
sleep(0.2)
|
94
|
+
ensure
|
95
|
+
client_done << true
|
96
|
+
end
|
97
|
+
end
|
98
|
+
session.loop(0.1) { client_done.empty? }
|
99
|
+
assert_equal "Broken pipe", "#{server_exc.pop}" unless server_exc.empty?
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_loop_should_not_abort_when_local_side_of_forward_is_reset
|
103
|
+
session = Net::SSH.start(*ssh_start_params)
|
104
|
+
server_exc = Queue.new
|
105
|
+
server = start_server_sending_lot_of_data(server_exc)
|
106
|
+
remote_port = server.addr[1]
|
107
|
+
local_port = find_free_port
|
108
|
+
session.forward.local(local_port, localhost, remote_port)
|
109
|
+
client_done = Queue.new
|
110
|
+
Thread.start do
|
111
|
+
begin
|
112
|
+
client = TCPSocket.new(localhost, local_port)
|
113
|
+
client.recv(1024)
|
114
|
+
client.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, [1, 0].pack("ii"))
|
115
|
+
client.close
|
116
|
+
sleep(0.1)
|
117
|
+
ensure
|
118
|
+
client_done << true
|
119
|
+
end
|
120
|
+
end
|
121
|
+
session.loop(0.1) { client_done.empty? }
|
122
|
+
assert_equal "Broken pipe", "#{server_exc.pop}" unless server_exc.empty?
|
123
|
+
end
|
124
|
+
|
125
|
+
def create_local_socket(&blk)
|
126
|
+
tempfile = Tempfile.new("net_ssh_forward_test")
|
127
|
+
path = tempfile.path
|
128
|
+
tempfile.delete
|
129
|
+
yield UNIXServer.open(path)
|
130
|
+
File.delete(path)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_forward_local_unix_socket_to_remote_port
|
134
|
+
session = Net::SSH.start(*ssh_start_params)
|
135
|
+
server_exc = Queue.new
|
136
|
+
server = start_server_sending_lot_of_data(server_exc)
|
137
|
+
remote_port = server.addr[1]
|
138
|
+
client_data = nil
|
139
|
+
|
140
|
+
create_local_socket do |local_socket|
|
141
|
+
session.forward.local(local_socket, localhost, remote_port)
|
142
|
+
client_done = Queue.new
|
143
|
+
|
144
|
+
Thread.start do
|
145
|
+
begin
|
146
|
+
client = UNIXSocket.new(local_socket.path)
|
147
|
+
client_data = client.recv(1024)
|
148
|
+
client.close
|
149
|
+
sleep(0.2)
|
150
|
+
ensure
|
151
|
+
client_done << true
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
session.loop(0.1) { client_done.empty? }
|
156
|
+
end
|
157
|
+
|
158
|
+
assert_not_nil(client_data, "client should have received data")
|
159
|
+
assert(client_data.match(/item\d/), 'client should have received the string item')
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_loop_should_not_abort_when_server_side_of_forward_is_closed
|
163
|
+
session = Net::SSH.start(*ssh_start_params)
|
164
|
+
server = start_server_closing_soon
|
165
|
+
remote_port = server.addr[1]
|
166
|
+
local_port = find_free_port
|
167
|
+
session.forward.local(local_port, localhost, remote_port)
|
168
|
+
client_done = Queue.new
|
169
|
+
Thread.start do
|
170
|
+
begin
|
171
|
+
client = TCPSocket.new(localhost, local_port)
|
172
|
+
1.times do |i|
|
173
|
+
client.puts "item#{i}"
|
174
|
+
end
|
175
|
+
client.close
|
176
|
+
sleep(0.1)
|
177
|
+
ensure
|
178
|
+
client_done << true
|
179
|
+
end
|
180
|
+
end
|
181
|
+
session.loop(0.1) { client_done.empty? }
|
182
|
+
end
|
183
|
+
|
184
|
+
def start_server
|
185
|
+
server = TCPServer.open(0)
|
186
|
+
Thread.start do
|
187
|
+
loop do
|
188
|
+
Thread.start(server.accept) do |client|
|
189
|
+
yield(client)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
return server
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_server_eof_should_be_handled
|
197
|
+
session = Net::SSH.start(*ssh_start_params)
|
198
|
+
server = start_server do |client|
|
199
|
+
client.write "This is a small message!"
|
200
|
+
client.close
|
201
|
+
end
|
202
|
+
client_done = Queue.new
|
203
|
+
client_exception = Queue.new
|
204
|
+
client_data = Queue.new
|
205
|
+
remote_port = server.addr[1]
|
206
|
+
local_port = find_free_port
|
207
|
+
session.forward.local(local_port, localhost, remote_port)
|
208
|
+
Thread.start do
|
209
|
+
begin
|
210
|
+
client = TCPSocket.new(localhost, local_port)
|
211
|
+
data = client.read(4096)
|
212
|
+
client.close
|
213
|
+
client_done << data
|
214
|
+
rescue
|
215
|
+
client_done << $!
|
216
|
+
end
|
217
|
+
end
|
218
|
+
timeout(5) do
|
219
|
+
session.loop(0.1) { client_done.empty? }
|
220
|
+
assert_equal "This is a small message!", client_done.pop
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'net/ssh'
|
3
|
+
|
4
|
+
module NetSSH
|
5
|
+
class TestStart < Test::Unit::TestCase
|
6
|
+
attr_reader :transport_session
|
7
|
+
attr_reader :authentication_session
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@transport_session = mock('transport_session')
|
11
|
+
@authentication_session = mock('authentication_session')
|
12
|
+
Net::SSH::Transport::Session.expects(:new => transport_session)
|
13
|
+
Net::SSH::Authentication::Session.expects(:new => authentication_session)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_close_transport_when_authentication_fails
|
17
|
+
authentication_session.expects(:authenticate => false)
|
18
|
+
|
19
|
+
transport_session.expects(:close).at_least_once
|
20
|
+
|
21
|
+
begin
|
22
|
+
Net::SSH.start('localhost', 'testuser') {}
|
23
|
+
rescue Net::SSH::AuthenticationFailed
|
24
|
+
# Authentication should fail, as it is part of the context
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'common'
|
2
|
+
|
3
|
+
class TestKnownHosts < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_key_for_when_all_hosts_are_recognized
|
6
|
+
source = File.join(File.dirname(__FILE__),"known_hosts/github")
|
7
|
+
kh = Net::SSH::KnownHosts.new(source)
|
8
|
+
keys = kh.keys_for("github.com")
|
9
|
+
assert_equal(1, keys.count)
|
10
|
+
assert_equal("ssh-rsa", keys[0].ssh_type)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: net-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.5.
|
5
|
+
version: 2.5.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jamis Buck
|
@@ -11,19 +11,9 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2012-05-
|
15
|
-
dependencies:
|
16
|
-
|
17
|
-
name: jruby-pageant
|
18
|
-
prerelease: false
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
-
none: false
|
21
|
-
requirements:
|
22
|
-
- - ">="
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 1.0.2
|
25
|
-
type: :runtime
|
26
|
-
version_requirements: *id001
|
14
|
+
date: 2012-05-25 00:00:00 Z
|
15
|
+
dependencies: []
|
16
|
+
|
27
17
|
description: "Net::SSH: 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."
|
28
18
|
email:
|
29
19
|
- net-ssh@solutious.com
|
@@ -39,11 +29,14 @@ files:
|
|
39
29
|
- CHANGELOG.rdoc
|
40
30
|
- Manifest
|
41
31
|
- README.rdoc
|
32
|
+
- LICENSE.rdoc
|
42
33
|
- Rakefile
|
43
34
|
- Rudyfile
|
44
35
|
- THANKS.rdoc
|
45
36
|
- lib/net/ssh.rb
|
46
37
|
- lib/net/ssh/authentication/agent.rb
|
38
|
+
- lib/net/ssh/authentication/agent/java_pageant.rb
|
39
|
+
- lib/net/ssh/authentication/agent/socket.rb
|
47
40
|
- lib/net/ssh/authentication/constants.rb
|
48
41
|
- lib/net/ssh/authentication/key_manager.rb
|
49
42
|
- lib/net/ssh/authentication/methods/abstract.rb
|
@@ -53,8 +46,6 @@ files:
|
|
53
46
|
- lib/net/ssh/authentication/methods/publickey.rb
|
54
47
|
- lib/net/ssh/authentication/pageant.rb
|
55
48
|
- lib/net/ssh/authentication/session.rb
|
56
|
-
- lib/net/ssh/authentication/agent/java_pageant.rb
|
57
|
-
- lib/net/ssh/authentication/agent/socket.rb
|
58
49
|
- lib/net/ssh/buffer.rb
|
59
50
|
- lib/net/ssh/buffered_io.rb
|
60
51
|
- lib/net/ssh/config.rb
|
@@ -101,15 +92,15 @@ files:
|
|
101
92
|
- lib/net/ssh/transport/hmac/sha2_512.rb
|
102
93
|
- lib/net/ssh/transport/hmac/sha2_512_96.rb
|
103
94
|
- lib/net/ssh/transport/identity_cipher.rb
|
104
|
-
- lib/net/ssh/transport/key_expander.rb
|
105
95
|
- lib/net/ssh/transport/kex.rb
|
106
|
-
- lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
|
107
96
|
- lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb
|
97
|
+
- lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
|
108
98
|
- lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb
|
109
99
|
- lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb
|
110
100
|
- lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb
|
111
101
|
- lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb
|
112
102
|
- lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb
|
103
|
+
- lib/net/ssh/transport/key_expander.rb
|
113
104
|
- lib/net/ssh/transport/openssl.rb
|
114
105
|
- lib/net/ssh/transport/packet_stream.rb
|
115
106
|
- lib/net/ssh/transport/server_version.rb
|
@@ -123,6 +114,7 @@ files:
|
|
123
114
|
- setup.rb
|
124
115
|
- support/arcfour_check.rb
|
125
116
|
- support/ssh_tunnel_bug.rb
|
117
|
+
- test/README.txt
|
126
118
|
- test/authentication/methods/common.rb
|
127
119
|
- test/authentication/methods/test_abstract.rb
|
128
120
|
- test/authentication/methods/test_hostbased.rb
|
@@ -137,14 +129,20 @@ files:
|
|
137
129
|
- test/configs/exact_match
|
138
130
|
- test/configs/host_plus
|
139
131
|
- test/configs/multihost
|
132
|
+
- test/configs/nohost
|
133
|
+
- test/configs/numeric_host
|
140
134
|
- test/configs/wild_cards
|
141
135
|
- test/connection/test_channel.rb
|
142
136
|
- test/connection/test_session.rb
|
137
|
+
- test/manual/test_forward.rb
|
138
|
+
- test/start/test_transport.rb
|
139
|
+
- test/known_hosts/github
|
143
140
|
- test/test_all.rb
|
144
141
|
- test/test_buffer.rb
|
145
142
|
- test/test_buffered_io.rb
|
146
143
|
- test/test_config.rb
|
147
144
|
- test/test_key_factory.rb
|
145
|
+
- test/test_known_hosts.rb
|
148
146
|
- test/transport/hmac/test_md5.rb
|
149
147
|
- test/transport/hmac/test_md5_96.rb
|
150
148
|
- test/transport/hmac/test_none.rb
|
@@ -155,8 +153,8 @@ files:
|
|
155
153
|
- test/transport/hmac/test_sha2_256_96.rb
|
156
154
|
- test/transport/hmac/test_sha2_512.rb
|
157
155
|
- test/transport/hmac/test_sha2_512_96.rb
|
158
|
-
- test/transport/kex/test_diffie_hellman_group1_sha1.rb
|
159
156
|
- test/transport/kex/test_diffie_hellman_group14_sha1.rb
|
157
|
+
- test/transport/kex/test_diffie_hellman_group1_sha1.rb
|
160
158
|
- test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
|
161
159
|
- test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb
|
162
160
|
- test/transport/kex/test_ecdh_sha2_nistp256.rb
|