hrr_rb_ssh 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/demo/server.rb +23 -3
- data/hrr_rb_ssh.gemspec +2 -2
- data/lib/hrr_rb_ssh/authentication/method/method.rb +34 -0
- data/lib/hrr_rb_ssh/authentication/method/none.rb +5 -14
- data/lib/hrr_rb_ssh/authentication/method/password.rb +6 -12
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/algorithm.rb +41 -0
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/codable.rb +33 -0
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_dss.rb +105 -0
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_rsa.rb +85 -0
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm.rb +28 -0
- data/lib/hrr_rb_ssh/authentication/method/publickey.rb +9 -25
- data/lib/hrr_rb_ssh/authentication/method.rb +12 -9
- data/lib/hrr_rb_ssh/connection/channel/channel_type/channel_type.rb +30 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env/context.rb +46 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env.rb +34 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec/context.rb +44 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec.rb +34 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req/context.rb +54 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req.rb +34 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/request_type.rb +34 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell/context.rb +41 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb +34 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem/context.rb +44 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem.rb +34 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type.rb +33 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session.rb +30 -0
- data/lib/hrr_rb_ssh/connection/channel/channel_type.rb +25 -0
- data/lib/hrr_rb_ssh/connection/channel.rb +2 -12
- data/lib/hrr_rb_ssh/transport/compression_algorithm/compression_algorithm.rb +34 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm/functionable.rb +31 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm/none.rb +7 -19
- data/lib/hrr_rb_ssh/transport/compression_algorithm/unfunctionable.rb +20 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm/zlib.rb +7 -24
- data/lib/hrr_rb_ssh/transport/compression_algorithm.rb +11 -9
- data/lib/hrr_rb_ssh/transport/direction.rb +11 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_cbc.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_ctr.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_cbc.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_ctr.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_cbc.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_ctr.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/arcfour.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/blowfish_cbc.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/cast128_cbc.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/encryption_algorithm.rb +34 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/functionable.rb +61 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/none.rb +6 -33
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/three_des_cbc.rb +19 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/unfunctionable.rb +35 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm.rb +20 -9
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman.rb +3 -4
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group14_sha1.rb +4 -8
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group1_sha1.rb +4 -8
- data/lib/hrr_rb_ssh/transport/kex_algorithm/kex_algorithm.rb +34 -0
- data/lib/hrr_rb_ssh/transport/kex_algorithm.rb +10 -9
- data/lib/hrr_rb_ssh/transport/mac_algorithm/functionable.rb +32 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5.rb +21 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5_96.rb +21 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1.rb +5 -29
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1_96.rb +21 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm/mac_algorithm.rb +34 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm/none.rb +6 -22
- data/lib/hrr_rb_ssh/transport/mac_algorithm/unfunctionable.rb +24 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm.rb +14 -9
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/server_host_key_algorithm.rb +34 -0
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_dss.rb +106 -0
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_rsa.rb +4 -11
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm.rb +10 -8
- data/lib/hrr_rb_ssh/transport.rb +23 -15
- data/lib/hrr_rb_ssh/version.rb +1 -1
- metadata +51 -17
- data/lib/hrr_rb_ssh/authentication/method/publickey/ssh_rsa.rb +0 -116
- data/lib/hrr_rb_ssh/connection/channel/session/env/context.rb +0 -43
- data/lib/hrr_rb_ssh/connection/channel/session/env.rb +0 -31
- data/lib/hrr_rb_ssh/connection/channel/session/exec/context.rb +0 -41
- data/lib/hrr_rb_ssh/connection/channel/session/exec.rb +0 -31
- data/lib/hrr_rb_ssh/connection/channel/session/pty_req/context.rb +0 -50
- data/lib/hrr_rb_ssh/connection/channel/session/pty_req.rb +0 -31
- data/lib/hrr_rb_ssh/connection/channel/session/shell/context.rb +0 -37
- data/lib/hrr_rb_ssh/connection/channel/session/shell.rb +0 -31
- data/lib/hrr_rb_ssh/connection/channel/session/subsystem/context.rb +0 -40
- data/lib/hrr_rb_ssh/connection/channel/session/subsystem.rb +0 -31
- data/lib/hrr_rb_ssh/connection/channel/session.rb +0 -31
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes_128_cbc.rb +0 -73
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hrr_rb_ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hirura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.0.8
|
69
|
-
description: Pure Ruby
|
69
|
+
description: Pure Ruby SSH 2.0 server implementation
|
70
70
|
email:
|
71
71
|
- hirura@gmail.com
|
72
72
|
executables: []
|
@@ -88,32 +88,41 @@ files:
|
|
88
88
|
- lib/hrr_rb_ssh/authentication.rb
|
89
89
|
- lib/hrr_rb_ssh/authentication/authenticator.rb
|
90
90
|
- lib/hrr_rb_ssh/authentication/method.rb
|
91
|
+
- lib/hrr_rb_ssh/authentication/method/method.rb
|
91
92
|
- lib/hrr_rb_ssh/authentication/method/none.rb
|
92
93
|
- lib/hrr_rb_ssh/authentication/method/none/context.rb
|
93
94
|
- lib/hrr_rb_ssh/authentication/method/password.rb
|
94
95
|
- lib/hrr_rb_ssh/authentication/method/password/context.rb
|
95
96
|
- lib/hrr_rb_ssh/authentication/method/publickey.rb
|
97
|
+
- lib/hrr_rb_ssh/authentication/method/publickey/algorithm.rb
|
98
|
+
- lib/hrr_rb_ssh/authentication/method/publickey/algorithm/algorithm.rb
|
99
|
+
- lib/hrr_rb_ssh/authentication/method/publickey/algorithm/codable.rb
|
100
|
+
- lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_dss.rb
|
101
|
+
- lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_rsa.rb
|
96
102
|
- lib/hrr_rb_ssh/authentication/method/publickey/context.rb
|
97
|
-
- lib/hrr_rb_ssh/authentication/method/publickey/ssh_rsa.rb
|
98
103
|
- lib/hrr_rb_ssh/closed_authentication_error.rb
|
99
104
|
- lib/hrr_rb_ssh/closed_connection_error.rb
|
100
105
|
- lib/hrr_rb_ssh/closed_transport_error.rb
|
101
106
|
- lib/hrr_rb_ssh/compat.rb
|
102
107
|
- lib/hrr_rb_ssh/connection.rb
|
103
108
|
- lib/hrr_rb_ssh/connection/channel.rb
|
109
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type.rb
|
110
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/channel_type.rb
|
111
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session.rb
|
112
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type.rb
|
113
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env.rb
|
114
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env/context.rb
|
115
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec.rb
|
116
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec/context.rb
|
117
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req.rb
|
118
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req/context.rb
|
119
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/request_type.rb
|
120
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb
|
121
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell/context.rb
|
122
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem.rb
|
123
|
+
- lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem/context.rb
|
104
124
|
- lib/hrr_rb_ssh/connection/channel/proc_chain.rb
|
105
125
|
- lib/hrr_rb_ssh/connection/channel/proc_chain/chain_context.rb
|
106
|
-
- lib/hrr_rb_ssh/connection/channel/session.rb
|
107
|
-
- lib/hrr_rb_ssh/connection/channel/session/env.rb
|
108
|
-
- lib/hrr_rb_ssh/connection/channel/session/env/context.rb
|
109
|
-
- lib/hrr_rb_ssh/connection/channel/session/exec.rb
|
110
|
-
- lib/hrr_rb_ssh/connection/channel/session/exec/context.rb
|
111
|
-
- lib/hrr_rb_ssh/connection/channel/session/pty_req.rb
|
112
|
-
- lib/hrr_rb_ssh/connection/channel/session/pty_req/context.rb
|
113
|
-
- lib/hrr_rb_ssh/connection/channel/session/shell.rb
|
114
|
-
- lib/hrr_rb_ssh/connection/channel/session/shell/context.rb
|
115
|
-
- lib/hrr_rb_ssh/connection/channel/session/subsystem.rb
|
116
|
-
- lib/hrr_rb_ssh/connection/channel/session/subsystem/context.rb
|
117
126
|
- lib/hrr_rb_ssh/connection/request_handler.rb
|
118
127
|
- lib/hrr_rb_ssh/logger.rb
|
119
128
|
- lib/hrr_rb_ssh/message.rb
|
@@ -148,25 +157,50 @@ files:
|
|
148
157
|
- lib/hrr_rb_ssh/message/codable.rb
|
149
158
|
- lib/hrr_rb_ssh/transport.rb
|
150
159
|
- lib/hrr_rb_ssh/transport/compression_algorithm.rb
|
160
|
+
- lib/hrr_rb_ssh/transport/compression_algorithm/compression_algorithm.rb
|
161
|
+
- lib/hrr_rb_ssh/transport/compression_algorithm/functionable.rb
|
151
162
|
- lib/hrr_rb_ssh/transport/compression_algorithm/none.rb
|
163
|
+
- lib/hrr_rb_ssh/transport/compression_algorithm/unfunctionable.rb
|
152
164
|
- lib/hrr_rb_ssh/transport/compression_algorithm/zlib.rb
|
153
165
|
- lib/hrr_rb_ssh/transport/constant.rb
|
154
166
|
- lib/hrr_rb_ssh/transport/data_type.rb
|
167
|
+
- lib/hrr_rb_ssh/transport/direction.rb
|
155
168
|
- lib/hrr_rb_ssh/transport/encryption_algorithm.rb
|
156
|
-
- lib/hrr_rb_ssh/transport/encryption_algorithm/
|
169
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_cbc.rb
|
170
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_ctr.rb
|
171
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_cbc.rb
|
172
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_ctr.rb
|
173
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_cbc.rb
|
174
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_ctr.rb
|
175
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/arcfour.rb
|
176
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/blowfish_cbc.rb
|
177
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/cast128_cbc.rb
|
178
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/encryption_algorithm.rb
|
179
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/functionable.rb
|
157
180
|
- lib/hrr_rb_ssh/transport/encryption_algorithm/none.rb
|
181
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/three_des_cbc.rb
|
182
|
+
- lib/hrr_rb_ssh/transport/encryption_algorithm/unfunctionable.rb
|
158
183
|
- lib/hrr_rb_ssh/transport/kex_algorithm.rb
|
159
184
|
- lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman.rb
|
160
185
|
- lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group14_sha1.rb
|
161
186
|
- lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group1_sha1.rb
|
187
|
+
- lib/hrr_rb_ssh/transport/kex_algorithm/kex_algorithm.rb
|
162
188
|
- lib/hrr_rb_ssh/transport/mac_algorithm.rb
|
189
|
+
- lib/hrr_rb_ssh/transport/mac_algorithm/functionable.rb
|
190
|
+
- lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5.rb
|
191
|
+
- lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5_96.rb
|
163
192
|
- lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1.rb
|
193
|
+
- lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1_96.rb
|
194
|
+
- lib/hrr_rb_ssh/transport/mac_algorithm/mac_algorithm.rb
|
164
195
|
- lib/hrr_rb_ssh/transport/mac_algorithm/none.rb
|
196
|
+
- lib/hrr_rb_ssh/transport/mac_algorithm/unfunctionable.rb
|
165
197
|
- lib/hrr_rb_ssh/transport/mode.rb
|
166
198
|
- lib/hrr_rb_ssh/transport/receiver.rb
|
167
199
|
- lib/hrr_rb_ssh/transport/sender.rb
|
168
200
|
- lib/hrr_rb_ssh/transport/sequence_number.rb
|
169
201
|
- lib/hrr_rb_ssh/transport/server_host_key_algorithm.rb
|
202
|
+
- lib/hrr_rb_ssh/transport/server_host_key_algorithm/server_host_key_algorithm.rb
|
203
|
+
- lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_dss.rb
|
170
204
|
- lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_rsa.rb
|
171
205
|
- lib/hrr_rb_ssh/version.rb
|
172
206
|
homepage: https://github.com/hirura/hrr_rb_ssh
|
@@ -192,5 +226,5 @@ rubyforge_project:
|
|
192
226
|
rubygems_version: 2.7.6
|
193
227
|
signing_key:
|
194
228
|
specification_version: 4
|
195
|
-
summary: Pure Ruby
|
229
|
+
summary: Pure Ruby SSH 2.0 server implementation
|
196
230
|
test_files: []
|
@@ -1,116 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
require 'hrr_rb_ssh/transport/data_type'
|
6
|
-
|
7
|
-
module HrrRbSsh
|
8
|
-
class Authentication
|
9
|
-
module Method
|
10
|
-
class Publickey
|
11
|
-
name_list = [
|
12
|
-
'ssh-rsa'
|
13
|
-
]
|
14
|
-
|
15
|
-
class SshRsa
|
16
|
-
NAME = 'ssh-rsa'
|
17
|
-
DIGEST = 'sha1'
|
18
|
-
|
19
|
-
PUBLIC_KEY_BLOB_DEFINITION = [
|
20
|
-
['string', 'public key algorithm name'],
|
21
|
-
['mpint', 'e'],
|
22
|
-
['mpint', 'n'],
|
23
|
-
]
|
24
|
-
|
25
|
-
SIGNATURE_DEFINITION = [
|
26
|
-
['string', 'public key algorithm name'],
|
27
|
-
['string', 'signature blob'],
|
28
|
-
]
|
29
|
-
|
30
|
-
SIGNATURE_BLOB_DEFINITION = [
|
31
|
-
['string', 'session identifier'],
|
32
|
-
['byte', 'message number'],
|
33
|
-
['string', 'user name'],
|
34
|
-
['string', 'service name'],
|
35
|
-
['string', 'method name'],
|
36
|
-
['boolean', 'with signature'],
|
37
|
-
['string', 'public key algorithm name'],
|
38
|
-
['string', 'public key blob'],
|
39
|
-
]
|
40
|
-
|
41
|
-
def initialize
|
42
|
-
@logger = HrrRbSsh::Logger.new self.class.name
|
43
|
-
end
|
44
|
-
|
45
|
-
def encode definition, payload
|
46
|
-
definition.map{ |data_type, field_name|
|
47
|
-
field_value = if payload[field_name].instance_of? ::Proc then payload[field_name].call else payload[field_name] end
|
48
|
-
HrrRbSsh::Transport::DataType[data_type].encode(field_value)
|
49
|
-
}.join
|
50
|
-
end
|
51
|
-
|
52
|
-
def decode definition, payload
|
53
|
-
payload_io = StringIO.new payload, 'r'
|
54
|
-
definition.map{ |data_type, field_name|
|
55
|
-
[
|
56
|
-
field_name,
|
57
|
-
HrrRbSsh::Transport::DataType[data_type].decode(payload_io)
|
58
|
-
]
|
59
|
-
}.to_h
|
60
|
-
end
|
61
|
-
|
62
|
-
def verify_public_key public_key_algorithm_name, public_key, public_key_blob
|
63
|
-
public_key = case public_key
|
64
|
-
when String
|
65
|
-
OpenSSL::PKey::RSA.new(public_key)
|
66
|
-
when OpenSSL::PKey::RSA
|
67
|
-
public_key
|
68
|
-
else
|
69
|
-
return false
|
70
|
-
end
|
71
|
-
public_key_message = {
|
72
|
-
'public key algorithm name' => public_key_algorithm_name,
|
73
|
-
'e' => public_key.e.to_i,
|
74
|
-
'n' => public_key.n.to_i,
|
75
|
-
}
|
76
|
-
public_key_blob == encode(PUBLIC_KEY_BLOB_DEFINITION, public_key_message)
|
77
|
-
end
|
78
|
-
|
79
|
-
def verify_signature session_id, message
|
80
|
-
signature_message = decode SIGNATURE_DEFINITION, message['signature']
|
81
|
-
signature_algorithm = signature_message['public key algorithm name']
|
82
|
-
signature_blob = signature_message['signature blob']
|
83
|
-
|
84
|
-
public_key = decode PUBLIC_KEY_BLOB_DEFINITION, message['public key blob']
|
85
|
-
algorithm = OpenSSL::PKey::RSA.new
|
86
|
-
if algorithm.respond_to?(:set_key)
|
87
|
-
algorithm.set_key public_key['n'], public_key['e'], nil
|
88
|
-
else
|
89
|
-
algorithm.e = public_key['e']
|
90
|
-
algorithm.n = public_key['n']
|
91
|
-
end
|
92
|
-
|
93
|
-
data_message = {
|
94
|
-
'session identifier' => session_id,
|
95
|
-
'message number' => message['message number'],
|
96
|
-
'user name' => message['user name'],
|
97
|
-
'service name' => message['service name'],
|
98
|
-
'method name' => message['method name'],
|
99
|
-
'with signature' => message['with signature'],
|
100
|
-
'public key algorithm name' => message['public key algorithm name'],
|
101
|
-
'public key blob' => message['public key blob'],
|
102
|
-
}
|
103
|
-
data_blob = encode SIGNATURE_BLOB_DEFINITION, data_message
|
104
|
-
|
105
|
-
(signature_algorithm == message['public key algorithm name']) && algorithm.verify(DIGEST, signature_blob, data_blob)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
@@algorithm_list ||= Hash.new
|
110
|
-
name_list.each do |name|
|
111
|
-
@@algorithm_list[name] = SshRsa
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
|
6
|
-
module HrrRbSsh
|
7
|
-
class Connection
|
8
|
-
class Channel
|
9
|
-
module Session
|
10
|
-
class Env
|
11
|
-
class Context
|
12
|
-
attr_reader \
|
13
|
-
:logger,
|
14
|
-
:username,
|
15
|
-
:io,
|
16
|
-
:variables,
|
17
|
-
:vars,
|
18
|
-
:variable_name,
|
19
|
-
:variable_value
|
20
|
-
|
21
|
-
def initialize proc_chain, username, io, variables, message
|
22
|
-
@logger = HrrRbSsh::Logger.new self.class.name
|
23
|
-
|
24
|
-
@proc_chain = proc_chain
|
25
|
-
@username = username
|
26
|
-
@io = io
|
27
|
-
@variables = variables
|
28
|
-
@vars = variables
|
29
|
-
|
30
|
-
@variable_name = message['variable name']
|
31
|
-
@variable_value = message['variable value']
|
32
|
-
end
|
33
|
-
|
34
|
-
def chain_proc &block
|
35
|
-
@proc = block || @proc
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
require 'hrr_rb_ssh/connection/request_handler'
|
6
|
-
require 'hrr_rb_ssh/connection/channel/session/env/context'
|
7
|
-
|
8
|
-
module HrrRbSsh
|
9
|
-
class Connection
|
10
|
-
class Channel
|
11
|
-
module Session
|
12
|
-
request_type = 'env'
|
13
|
-
|
14
|
-
class Env
|
15
|
-
def self.run proc_chain, username, io, variables, message, options
|
16
|
-
logger = HrrRbSsh::Logger.new self.class.name
|
17
|
-
|
18
|
-
context = Context.new proc_chain, username, io, variables, message
|
19
|
-
handler = options.fetch('connection_channel_request_env', RequestHandler.new {})
|
20
|
-
handler.run context
|
21
|
-
|
22
|
-
proc_chain.connect context.chain_proc
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
@@request_type_list ||= Hash.new
|
27
|
-
@@request_type_list[request_type] = Env
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
|
6
|
-
module HrrRbSsh
|
7
|
-
class Connection
|
8
|
-
class Channel
|
9
|
-
module Session
|
10
|
-
class Exec
|
11
|
-
class Context
|
12
|
-
attr_reader \
|
13
|
-
:logger,
|
14
|
-
:username,
|
15
|
-
:io,
|
16
|
-
:variables,
|
17
|
-
:vars,
|
18
|
-
:command
|
19
|
-
|
20
|
-
def initialize proc_chain, username, io, variables, message
|
21
|
-
@logger = HrrRbSsh::Logger.new self.class.name
|
22
|
-
|
23
|
-
@proc_chain = proc_chain
|
24
|
-
@username = username
|
25
|
-
@io = io
|
26
|
-
@variables = variables
|
27
|
-
@vars = variables
|
28
|
-
|
29
|
-
@command = message['command']
|
30
|
-
end
|
31
|
-
|
32
|
-
def chain_proc &block
|
33
|
-
@proc = block || @proc
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
require 'hrr_rb_ssh/connection/request_handler'
|
6
|
-
require 'hrr_rb_ssh/connection/channel/session/exec/context'
|
7
|
-
|
8
|
-
module HrrRbSsh
|
9
|
-
class Connection
|
10
|
-
class Channel
|
11
|
-
module Session
|
12
|
-
request_type = 'exec'
|
13
|
-
|
14
|
-
class Exec
|
15
|
-
def self.run proc_chain, username, io, variables, message, options
|
16
|
-
logger = HrrRbSsh::Logger.new self.class.name
|
17
|
-
|
18
|
-
context = Context.new proc_chain, username, io, variables, message
|
19
|
-
handler = options.fetch('connection_channel_request_exec', RequestHandler.new {})
|
20
|
-
handler.run context
|
21
|
-
|
22
|
-
proc_chain.connect context.chain_proc
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
@@request_type_list ||= Hash.new
|
27
|
-
@@request_type_list[request_type] = Exec
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
|
6
|
-
module HrrRbSsh
|
7
|
-
class Connection
|
8
|
-
class Channel
|
9
|
-
module Session
|
10
|
-
class PtyReq
|
11
|
-
class Context
|
12
|
-
attr_reader \
|
13
|
-
:logger,
|
14
|
-
:username,
|
15
|
-
:io,
|
16
|
-
:variables,
|
17
|
-
:vars,
|
18
|
-
:term_environment_variable_value,
|
19
|
-
:terminal_width_characters,
|
20
|
-
:terminal_height_rows,
|
21
|
-
:terminal_width_pixels,
|
22
|
-
:terminal_height_pixels,
|
23
|
-
:encoded_terminal_modes
|
24
|
-
|
25
|
-
def initialize proc_chain, username, io, variables, message
|
26
|
-
@logger = HrrRbSsh::Logger.new self.class.name
|
27
|
-
|
28
|
-
@proc_chain = proc_chain
|
29
|
-
@username = username
|
30
|
-
@io = io
|
31
|
-
@variables = variables
|
32
|
-
@vars = variables
|
33
|
-
|
34
|
-
@term_environment_variable_value = message['TERM environment variable value']
|
35
|
-
@terminal_width_characters = message['terminal width, characters']
|
36
|
-
@terminal_height_rows = message['terminal height, rows']
|
37
|
-
@terminal_width_pixels = message['terminal width, pixels']
|
38
|
-
@terminal_height_pixels = message['terminal height, pixels']
|
39
|
-
@encoded_terminal_modes = message['encoded terminal modes']
|
40
|
-
end
|
41
|
-
|
42
|
-
def chain_proc &block
|
43
|
-
@proc = block || @proc
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
require 'hrr_rb_ssh/connection/request_handler'
|
6
|
-
require 'hrr_rb_ssh/connection/channel/session/pty_req/context'
|
7
|
-
|
8
|
-
module HrrRbSsh
|
9
|
-
class Connection
|
10
|
-
class Channel
|
11
|
-
module Session
|
12
|
-
request_type = 'pty-req'
|
13
|
-
|
14
|
-
class PtyReq
|
15
|
-
def self.run proc_chain, username, io, variables, message, options
|
16
|
-
logger = HrrRbSsh::Logger.new self.class.name
|
17
|
-
|
18
|
-
context = Context.new proc_chain, username, io, variables, message
|
19
|
-
handler = options.fetch('connection_channel_request_pty_req', RequestHandler.new {})
|
20
|
-
handler.run context
|
21
|
-
|
22
|
-
proc_chain.connect context.chain_proc
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
@@request_type_list ||= Hash.new
|
27
|
-
@@request_type_list[request_type] = PtyReq
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
|
6
|
-
module HrrRbSsh
|
7
|
-
class Connection
|
8
|
-
class Channel
|
9
|
-
module Session
|
10
|
-
class Shell
|
11
|
-
class Context
|
12
|
-
attr_reader \
|
13
|
-
:logger,
|
14
|
-
:username,
|
15
|
-
:io,
|
16
|
-
:variables,
|
17
|
-
:vars
|
18
|
-
|
19
|
-
def initialize proc_chain, username, io, variables, message
|
20
|
-
@logger = HrrRbSsh::Logger.new self.class.name
|
21
|
-
|
22
|
-
@proc_chain = proc_chain
|
23
|
-
@username = username
|
24
|
-
@io = io
|
25
|
-
@variables = variables
|
26
|
-
@vars = variables
|
27
|
-
end
|
28
|
-
|
29
|
-
def chain_proc &block
|
30
|
-
@proc = block || @proc
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
require 'hrr_rb_ssh/connection/request_handler'
|
6
|
-
require 'hrr_rb_ssh/connection/channel/session/shell/context'
|
7
|
-
|
8
|
-
module HrrRbSsh
|
9
|
-
class Connection
|
10
|
-
class Channel
|
11
|
-
module Session
|
12
|
-
request_type = 'shell'
|
13
|
-
|
14
|
-
class Shell
|
15
|
-
def self.run proc_chain, username, io, variables, message, options
|
16
|
-
logger = HrrRbSsh::Logger.new self.class.name
|
17
|
-
|
18
|
-
context = Context.new proc_chain, username, io, variables, message
|
19
|
-
handler = options.fetch('connection_channel_request_shell', RequestHandler.new {})
|
20
|
-
handler.run context
|
21
|
-
|
22
|
-
proc_chain.connect context.chain_proc
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
@@request_type_list ||= Hash.new
|
27
|
-
@@request_type_list[request_type] = Shell
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
|
6
|
-
module HrrRbSsh
|
7
|
-
class Connection
|
8
|
-
class Channel
|
9
|
-
module Session
|
10
|
-
class Subsystem
|
11
|
-
class Context
|
12
|
-
attr_reader \
|
13
|
-
:logger,
|
14
|
-
:username,
|
15
|
-
:io,
|
16
|
-
:variables,
|
17
|
-
:vars,
|
18
|
-
:subsystem_name
|
19
|
-
|
20
|
-
def initialize proc_chain, username, io, variables, message
|
21
|
-
@logger = HrrRbSsh::Logger.new self.class.name
|
22
|
-
|
23
|
-
@proc_chain = proc_chain
|
24
|
-
@username = username
|
25
|
-
@io = io
|
26
|
-
@variables = variables
|
27
|
-
@vars = variables
|
28
|
-
|
29
|
-
@subsystem_name = message['subsystem name']
|
30
|
-
end
|
31
|
-
|
32
|
-
def chain_proc &block
|
33
|
-
@proc = block || @proc
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/logger'
|
5
|
-
require 'hrr_rb_ssh/connection/request_handler'
|
6
|
-
require 'hrr_rb_ssh/connection/channel/session/subsystem/context'
|
7
|
-
|
8
|
-
module HrrRbSsh
|
9
|
-
class Connection
|
10
|
-
class Channel
|
11
|
-
module Session
|
12
|
-
request_type = 'subsystem'
|
13
|
-
|
14
|
-
class Subsystem
|
15
|
-
def self.run proc_chain, username, io, variables, message, options
|
16
|
-
logger = HrrRbSsh::Logger.new self.class.name
|
17
|
-
|
18
|
-
context = Context.new proc_chain, username, io, variables, message
|
19
|
-
handler = options.fetch('connection_channel_request_subsystem', RequestHandler.new {})
|
20
|
-
handler.run context
|
21
|
-
|
22
|
-
proc_chain.connect context.chain_proc
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
@@request_type_list ||= Hash.new
|
27
|
-
@@request_type_list[request_type] = Subsystem
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# vim: et ts=2 sw=2
|
3
|
-
|
4
|
-
require 'hrr_rb_ssh/connection/channel/session/pty_req'
|
5
|
-
require 'hrr_rb_ssh/connection/channel/session/env'
|
6
|
-
require 'hrr_rb_ssh/connection/channel/session/shell'
|
7
|
-
require 'hrr_rb_ssh/connection/channel/session/exec'
|
8
|
-
require 'hrr_rb_ssh/connection/channel/session/subsystem'
|
9
|
-
|
10
|
-
module HrrRbSsh
|
11
|
-
class Connection
|
12
|
-
class Channel
|
13
|
-
channel_type = 'session'
|
14
|
-
|
15
|
-
module Session
|
16
|
-
@@request_type_list ||= Hash.new
|
17
|
-
|
18
|
-
def self.[] key
|
19
|
-
@@request_type_list[key]
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.request_type_list
|
23
|
-
@@request_type_list.keys
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
@@type_list ||= Hash.new
|
28
|
-
@@type_list[channel_type] = Session
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|