net-ssh 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +545 -0
- data/LICENSE +7 -0
- data/NEWS +146 -0
- data/README +14 -0
- data/THANKS +19 -0
- data/bin/rb-keygen +1 -1
- data/doc/manual-html/chapter-1.html +2 -2
- data/doc/manual-html/chapter-2.html +2 -2
- data/doc/manual-html/chapter-3.html +2 -2
- data/doc/manual-html/chapter-4.html +2 -2
- data/doc/manual-html/chapter-5.html +2 -2
- data/doc/manual-html/chapter-6.html +2 -2
- data/doc/manual-html/chapter-7.html +2 -2
- data/doc/manual-html/index.html +2 -2
- data/lib/net/ssh/connection/channel.rb +4 -4
- data/lib/net/ssh/connection/driver.rb +1 -1
- data/lib/net/ssh/host-key-verifier.rb +17 -73
- data/lib/net/ssh/known-hosts.rb +96 -0
- data/lib/net/ssh/proxy/socks5.rb +1 -1
- data/lib/net/ssh/service/agentforward/driver.rb +1 -1
- data/lib/net/ssh/service/process/open.rb +6 -6
- data/lib/net/ssh/service/process/popen3.rb +2 -2
- data/lib/net/ssh/service/shell/shell.rb +9 -0
- data/lib/net/ssh/session.rb +1 -1
- data/lib/net/ssh/transport/algorithm-negotiator.rb +10 -2
- data/lib/net/ssh/transport/packet-stream.rb +1 -1
- data/lib/net/ssh/transport/session.rb +6 -0
- data/lib/net/ssh/userauth/methods/keyboard-interactive.rb +1 -1
- data/lib/net/ssh/userauth/services.rb +1 -1
- data/lib/net/ssh/version.rb +1 -1
- data/test/proxy/tc_socks5.rb +2 -2
- data/test/service/forward/tc_driver.rb +1 -1
- data/test/transport/tc_algorithm_negotiator.rb +1 -0
- data/test/transport/tc_session.rb +1 -1
- data/test/userauth/tc_driver.rb +1 -1
- metadata +9 -3
data/lib/net/ssh/proxy/socks5.rb
CHANGED
@@ -127,8 +127,8 @@ module Net
|
|
127
127
|
# server. This is where the command to execute will be sent to the
|
128
128
|
# server.
|
129
129
|
def do_confirm( channel )
|
130
|
-
channel.on_success
|
131
|
-
channel.on_failure
|
130
|
+
channel.on_success(&method(:do_exec_success))
|
131
|
+
channel.on_failure(&method(:do_exec_failure))
|
132
132
|
channel.exec @command, true
|
133
133
|
end
|
134
134
|
|
@@ -136,10 +136,10 @@ module Net
|
|
136
136
|
# This registers various callbacks, and then calls the +on_success+
|
137
137
|
# callback (if registered).
|
138
138
|
def do_exec_success( channel )
|
139
|
-
channel.on_data
|
140
|
-
channel.on_extended_data
|
141
|
-
channel.on_close
|
142
|
-
channel.on_request
|
139
|
+
channel.on_data(&method(:do_data))
|
140
|
+
channel.on_extended_data(&method(:do_extended_data))
|
141
|
+
channel.on_close(&method(:do_close))
|
142
|
+
channel.on_request(&method(:do_request))
|
143
143
|
@on_success.call( self ) if @on_success
|
144
144
|
end
|
145
145
|
|
@@ -140,7 +140,7 @@ module Net
|
|
140
140
|
# pipe should ever be associated with a channel.
|
141
141
|
def initialize( channel )
|
142
142
|
super( channel )
|
143
|
-
channel.on_data
|
143
|
+
channel.on_data(&method(:do_data))
|
144
144
|
end
|
145
145
|
|
146
146
|
# Invoked when data is recieved from the channel. It simply
|
@@ -159,7 +159,7 @@ module Net
|
|
159
159
|
# pipe should ever be associated with a channel.
|
160
160
|
def initialize( channel )
|
161
161
|
super( channel )
|
162
|
-
channel.on_extended_data
|
162
|
+
channel.on_extended_data(&method(:do_data))
|
163
163
|
end
|
164
164
|
|
165
165
|
# Invoked when data is recieved from the channel. It simply
|
@@ -15,12 +15,15 @@
|
|
15
15
|
#++
|
16
16
|
|
17
17
|
require 'stringio'
|
18
|
+
require 'net/ssh/errors'
|
18
19
|
|
19
20
|
module Net
|
20
21
|
module SSH
|
21
22
|
module Service
|
22
23
|
module Shell
|
23
24
|
|
25
|
+
class OpenFailed < Net::SSH::Exception; end
|
26
|
+
|
24
27
|
# A service class for interacting with a user's shell on a remote
|
25
28
|
# machine. The shell may be interacted with either with or without a
|
26
29
|
# pty.
|
@@ -128,6 +131,7 @@ module Net
|
|
128
131
|
def on_confirm( channel )
|
129
132
|
@channel = channel
|
130
133
|
|
134
|
+
@channel.on_confirm_failed( &method( :on_confirm_failed ) )
|
131
135
|
@channel.on_close( &method( :on_close ) )
|
132
136
|
@channel.on_data( &method( :on_data ) )
|
133
137
|
@channel.on_eof( &method( :on_eof ) )
|
@@ -156,6 +160,11 @@ module Net
|
|
156
160
|
@channel.send_request "shell", nil, true
|
157
161
|
end
|
158
162
|
|
163
|
+
# Called when the channel could not be opened for some reason.
|
164
|
+
def on_confirm_failed( channel, reason, description, *args )
|
165
|
+
raise OpenFailed, "#{reason} (#{description})"
|
166
|
+
end
|
167
|
+
|
159
168
|
# Invoked when the channel closes. Changes the shell's state to
|
160
169
|
# closed.
|
161
170
|
def on_close( channel )
|
data/lib/net/ssh/session.rb
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
require 'net/ssh/errors'
|
18
18
|
require 'net/ssh/transport/constants'
|
19
|
+
require 'net/ssh/known-hosts'
|
19
20
|
|
20
21
|
module Net
|
21
22
|
module SSH
|
@@ -68,9 +69,16 @@ module Net
|
|
68
69
|
|
69
70
|
# Builds the @algorithms hash from the values specified in the
|
70
71
|
# +options+ hash.
|
71
|
-
def prepare_preferred_algorithms( options )
|
72
|
+
def prepare_preferred_algorithms( session, options )
|
72
73
|
@algorithms = Hash.new
|
73
74
|
|
75
|
+
if !options.key?(:host_key)
|
76
|
+
keys = Net::SSH::KnownHosts.search_for(Net::SSH::KnownHosts.canonize(session.host, session.port))
|
77
|
+
preferred_order = []
|
78
|
+
preferred_order << keys.first.ssh_type if keys.any?
|
79
|
+
options = options.merge(:host_key => preferred_order)
|
80
|
+
end
|
81
|
+
|
74
82
|
prepare_preferred_algorithm options, :host_key
|
75
83
|
prepare_preferred_algorithm options, :kex
|
76
84
|
prepare_preferred_algorithm options, :encryption
|
@@ -99,7 +107,7 @@ module Net
|
|
99
107
|
# cannot be reached between what the client wants and what the server
|
100
108
|
# can provide, this will fail.
|
101
109
|
def negotiate( session, options )
|
102
|
-
prepare_preferred_algorithms options
|
110
|
+
prepare_preferred_algorithms session, options
|
103
111
|
|
104
112
|
# first, discover what the server can do
|
105
113
|
type, buffer = session.wait_for_message
|
@@ -170,7 +170,7 @@ module Net
|
|
170
170
|
# then validate it.
|
171
171
|
hmac = @hmac.mac_length > 0 ? read( @hmac.mac_length ) : ""
|
172
172
|
|
173
|
-
reader.append @cipher.update( data )
|
173
|
+
reader.append @cipher.update( data ) unless data.empty?
|
174
174
|
reader.append @cipher.final
|
175
175
|
|
176
176
|
padding_length = reader.read_byte
|
@@ -36,6 +36,12 @@ module Net
|
|
36
36
|
# the collection of algorithms currently being used
|
37
37
|
attr_reader :algorithms
|
38
38
|
|
39
|
+
# the hostname that was requested
|
40
|
+
attr_reader :host
|
41
|
+
|
42
|
+
# the port that was requested
|
43
|
+
attr_reader :port
|
44
|
+
|
39
45
|
attr_writer :logger
|
40
46
|
attr_writer :default_port
|
41
47
|
attr_writer :version_negotiator
|
@@ -126,7 +126,7 @@ module Net
|
|
126
126
|
driver.set_host_key_files c[:userauth_host_keys]
|
127
127
|
end
|
128
128
|
if c.knows_key?(:userauth_method_order) && c[:userauth_method_order]
|
129
|
-
driver.set_auth_method_order
|
129
|
+
driver.set_auth_method_order(*c[:userauth_method_order])
|
130
130
|
end
|
131
131
|
|
132
132
|
driver
|
data/lib/net/ssh/version.rb
CHANGED
data/test/proxy/tc_socks5.rb
CHANGED
@@ -181,7 +181,7 @@ class TC_Proxy_SOCKS5 < Test::Unit::TestCase
|
|
181
181
|
|
182
182
|
@server.wait
|
183
183
|
|
184
|
-
assert_equal [ "\5\2\0\2", "\
|
184
|
+
assert_equal [ "\5\2\0\2", "\1\3foo\3bar" ], @server.events
|
185
185
|
end
|
186
186
|
|
187
187
|
[
|
@@ -206,7 +206,7 @@ class TC_Proxy_SOCKS5 < Test::Unit::TestCase
|
|
206
206
|
|
207
207
|
@server.wait
|
208
208
|
|
209
|
-
assert_equal [ "\5\2\0\2", "\
|
209
|
+
assert_equal [ "\5\2\0\2", "\1\3foo\3bar",
|
210
210
|
"\5\1\0\3\11test.host\4\322" ], @server.events
|
211
211
|
end
|
212
212
|
end
|
@@ -126,7 +126,7 @@ class TC_Forward_Driver < Test::Unit::TestCase
|
|
126
126
|
assert_equal 0, @driver.open_direct_channel_count
|
127
127
|
assert @driver.active_locals.empty?
|
128
128
|
|
129
|
-
@driver.local
|
129
|
+
@driver.local(*args)
|
130
130
|
|
131
131
|
address = '127.0.0.1'
|
132
132
|
address = args.shift if args.first.is_a? String
|
data/test/userauth/tc_driver.rb
CHANGED
@@ -130,7 +130,7 @@ class TC_UserAuth_Driver < Test::Unit::TestCase
|
|
130
130
|
@driver.order << "four"
|
131
131
|
assert_equal [ "one", "two", "three" ], original
|
132
132
|
assert_equal [ "one", "two", "three", "four" ], @driver.order
|
133
|
-
@driver.set_auth_method_order
|
133
|
+
@driver.set_auth_method_order(*original)
|
134
134
|
assert_equal [ "one", "two", "three" ], @driver.order
|
135
135
|
end
|
136
136
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: net-ssh
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.1.2
|
7
|
+
date: 2007-06-18 00:00:00 -06:00
|
8
8
|
summary: Net::SSH is a pure-Ruby implementation of the SSH2 client protocol.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/net/ssh/connection/term.rb
|
100
100
|
- lib/net/ssh/errors.rb
|
101
101
|
- lib/net/ssh/host-key-verifier.rb
|
102
|
+
- lib/net/ssh/known-hosts.rb
|
102
103
|
- lib/net/ssh/lenient-host-key-verifier.rb
|
103
104
|
- lib/net/ssh/null-host-key-verifier.rb
|
104
105
|
- lib/net/ssh/proxy
|
@@ -268,6 +269,11 @@ files:
|
|
268
269
|
- test/userauth/tc_userkeys.rb
|
269
270
|
- test/util
|
270
271
|
- test/util/tc_buffer.rb
|
272
|
+
- README
|
273
|
+
- LICENSE
|
274
|
+
- NEWS
|
275
|
+
- THANKS
|
276
|
+
- ChangeLog
|
271
277
|
test_files:
|
272
278
|
- test/ALL-TESTS.rb
|
273
279
|
rdoc_options: []
|