crussh 0.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +371 -0
- data/ext/poly1305/Cargo.toml +13 -0
- data/ext/poly1305/extconf.rb +6 -0
- data/ext/poly1305/src/lib.rs +75 -0
- data/lib/crussh/auth.rb +46 -0
- data/lib/crussh/channel/key_parser.rb +125 -0
- data/lib/crussh/channel.rb +381 -0
- data/lib/crussh/cipher/algorithm.rb +31 -0
- data/lib/crussh/cipher/chacha20poly1305.rb +98 -0
- data/lib/crussh/cipher.rb +25 -0
- data/lib/crussh/compression.rb +42 -0
- data/lib/crussh/gatekeeper.rb +50 -0
- data/lib/crussh/handler/line_buffer.rb +131 -0
- data/lib/crussh/handler.rb +128 -0
- data/lib/crussh/heartbeat.rb +68 -0
- data/lib/crussh/kex/algorithm.rb +86 -0
- data/lib/crussh/kex/curve25519.rb +30 -0
- data/lib/crussh/kex/exchange.rb +234 -0
- data/lib/crussh/kex.rb +42 -0
- data/lib/crussh/keys/key_pair.rb +61 -0
- data/lib/crussh/keys/public_key.rb +35 -0
- data/lib/crussh/keys.rb +70 -0
- data/lib/crussh/limits.rb +45 -0
- data/lib/crussh/logger.rb +95 -0
- data/lib/crussh/mac/algorithm.rb +23 -0
- data/lib/crussh/mac/crypto.rb +60 -0
- data/lib/crussh/mac/none.rb +9 -0
- data/lib/crussh/mac.rb +28 -0
- data/lib/crussh/negotiator.rb +41 -0
- data/lib/crussh/preferred.rb +16 -0
- data/lib/crussh/protocol/channel_close.rb +11 -0
- data/lib/crussh/protocol/channel_data.rb +12 -0
- data/lib/crussh/protocol/channel_eof.rb +11 -0
- data/lib/crussh/protocol/channel_extended_data.rb +13 -0
- data/lib/crussh/protocol/channel_failure.rb +11 -0
- data/lib/crussh/protocol/channel_open.rb +69 -0
- data/lib/crussh/protocol/channel_open_confirmation.rb +15 -0
- data/lib/crussh/protocol/channel_open_failure.rb +14 -0
- data/lib/crussh/protocol/channel_request.rb +146 -0
- data/lib/crussh/protocol/channel_success.rb +11 -0
- data/lib/crussh/protocol/channel_window_adjust.rb +12 -0
- data/lib/crussh/protocol/debug.rb +15 -0
- data/lib/crussh/protocol/disconnect.rb +39 -0
- data/lib/crussh/protocol/ext_info.rb +48 -0
- data/lib/crussh/protocol/global_request.rb +46 -0
- data/lib/crussh/protocol/ignore.rb +11 -0
- data/lib/crussh/protocol/kex_ecdh_init.rb +11 -0
- data/lib/crussh/protocol/kex_ecdh_reply.rb +13 -0
- data/lib/crussh/protocol/kex_init.rb +38 -0
- data/lib/crussh/protocol/new_keys.rb +9 -0
- data/lib/crussh/protocol/ping.rb +11 -0
- data/lib/crussh/protocol/pong.rb +11 -0
- data/lib/crussh/protocol/request_failure.rb +9 -0
- data/lib/crussh/protocol/request_success.rb +11 -0
- data/lib/crussh/protocol/service_accept.rb +11 -0
- data/lib/crussh/protocol/service_request.rb +11 -0
- data/lib/crussh/protocol/unimplemented.rb +11 -0
- data/lib/crussh/protocol/userauth_banner.rb +12 -0
- data/lib/crussh/protocol/userauth_failure.rb +12 -0
- data/lib/crussh/protocol/userauth_pk_ok.rb +12 -0
- data/lib/crussh/protocol/userauth_request.rb +52 -0
- data/lib/crussh/protocol/userauth_success.rb +9 -0
- data/lib/crussh/protocol.rb +135 -0
- data/lib/crussh/server/auth_handler.rb +18 -0
- data/lib/crussh/server/config.rb +157 -0
- data/lib/crussh/server/layers/connection.rb +363 -0
- data/lib/crussh/server/layers/transport.rb +49 -0
- data/lib/crussh/server/layers/userauth.rb +232 -0
- data/lib/crussh/server/request_rule.rb +76 -0
- data/lib/crussh/server/session.rb +192 -0
- data/lib/crussh/server.rb +214 -0
- data/lib/crussh/ssh_id.rb +44 -0
- data/lib/crussh/transport/packet_stream.rb +245 -0
- data/lib/crussh/transport/reader.rb +98 -0
- data/lib/crussh/transport/version_exchange.rb +26 -0
- data/lib/crussh/transport/writer.rb +72 -0
- data/lib/crussh/version.rb +5 -0
- data/lib/crussh.rb +61 -0
- data/sig/crussh.rbs +4 -0
- metadata +249 -0
data/lib/crussh.rb
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "zeitwerk"
|
|
4
|
+
require "securerandom"
|
|
5
|
+
require "async"
|
|
6
|
+
require "io/endpoint"
|
|
7
|
+
require "io/endpoint/host_endpoint"
|
|
8
|
+
|
|
9
|
+
loader = Zeitwerk::Loader.for_gem
|
|
10
|
+
loader.inflector.inflect("chacha20poly1305" => "ChaCha20Poly1305")
|
|
11
|
+
loader.ignore("#{__dir__}/crussh/crypto")
|
|
12
|
+
loader.setup
|
|
13
|
+
|
|
14
|
+
begin
|
|
15
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
|
16
|
+
require "crussh/crypto/#{Regexp.last_match(1)}/poly1305"
|
|
17
|
+
rescue LoadError
|
|
18
|
+
require "crussh/crypto/poly1305"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
module Crussh
|
|
22
|
+
Algorithms = Data.define(
|
|
23
|
+
:kex,
|
|
24
|
+
:host_key,
|
|
25
|
+
:cipher_client_to_server,
|
|
26
|
+
:cipher_server_to_client,
|
|
27
|
+
:mac_client_to_server,
|
|
28
|
+
:mac_server_to_client,
|
|
29
|
+
:compression_client_to_server,
|
|
30
|
+
:compression_server_to_client,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
class Error < StandardError; end
|
|
34
|
+
|
|
35
|
+
class ConfigError < Error; end
|
|
36
|
+
class ProtocolError < Error; end
|
|
37
|
+
|
|
38
|
+
class PacketError < Error; end
|
|
39
|
+
class PacketTooLarge < PacketError; end
|
|
40
|
+
class PacketTooSmall < PacketError; end
|
|
41
|
+
class InvalidPadding < PacketError; end
|
|
42
|
+
class IncompletePacket < PacketError; end
|
|
43
|
+
|
|
44
|
+
class NegotiationError < ProtocolError; end
|
|
45
|
+
|
|
46
|
+
class KexError < ProtocolError; end
|
|
47
|
+
|
|
48
|
+
class ConnectionError < Error; end
|
|
49
|
+
class TimeoutError < ConnectionError; end
|
|
50
|
+
class ConnectionClosed < ConnectionError; end
|
|
51
|
+
|
|
52
|
+
class CryptoError < Error; end
|
|
53
|
+
class UnknownAlgorithm < CryptoError; end
|
|
54
|
+
class DecryptionError < CryptoError; end
|
|
55
|
+
class SignatureError < CryptoError; end
|
|
56
|
+
class KeyError < CryptoError; end
|
|
57
|
+
|
|
58
|
+
class ChannelError < Error; end
|
|
59
|
+
class ChannelClosed < ChannelError; end
|
|
60
|
+
class ChannelWindowExhausted < ChannelError; end
|
|
61
|
+
end
|
data/sig/crussh.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: crussh
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- MSILycanthropy
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: activesupport
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '8.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '8.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: async
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: ed25519
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '1.0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '1.0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: io-endpoint
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0.1'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0.1'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: io-stream
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0.1'
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0.1'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: rb_sys
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0.9'
|
|
89
|
+
type: :runtime
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0.9'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: ssh_data
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 2.0.0
|
|
103
|
+
type: :runtime
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 2.0.0
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: x25519
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: 1.0.10
|
|
117
|
+
type: :runtime
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: 1.0.10
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: zeitwerk
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '2'
|
|
131
|
+
type: :runtime
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '2'
|
|
138
|
+
email:
|
|
139
|
+
- ethanmichaelk@gmail.com
|
|
140
|
+
executables: []
|
|
141
|
+
extensions:
|
|
142
|
+
- ext/poly1305/extconf.rb
|
|
143
|
+
extra_rdoc_files: []
|
|
144
|
+
files:
|
|
145
|
+
- CHANGELOG.md
|
|
146
|
+
- LICENSE.txt
|
|
147
|
+
- README.md
|
|
148
|
+
- ext/poly1305/Cargo.toml
|
|
149
|
+
- ext/poly1305/extconf.rb
|
|
150
|
+
- ext/poly1305/src/lib.rs
|
|
151
|
+
- lib/crussh.rb
|
|
152
|
+
- lib/crussh/auth.rb
|
|
153
|
+
- lib/crussh/channel.rb
|
|
154
|
+
- lib/crussh/channel/key_parser.rb
|
|
155
|
+
- lib/crussh/cipher.rb
|
|
156
|
+
- lib/crussh/cipher/algorithm.rb
|
|
157
|
+
- lib/crussh/cipher/chacha20poly1305.rb
|
|
158
|
+
- lib/crussh/compression.rb
|
|
159
|
+
- lib/crussh/gatekeeper.rb
|
|
160
|
+
- lib/crussh/handler.rb
|
|
161
|
+
- lib/crussh/handler/line_buffer.rb
|
|
162
|
+
- lib/crussh/heartbeat.rb
|
|
163
|
+
- lib/crussh/kex.rb
|
|
164
|
+
- lib/crussh/kex/algorithm.rb
|
|
165
|
+
- lib/crussh/kex/curve25519.rb
|
|
166
|
+
- lib/crussh/kex/exchange.rb
|
|
167
|
+
- lib/crussh/keys.rb
|
|
168
|
+
- lib/crussh/keys/key_pair.rb
|
|
169
|
+
- lib/crussh/keys/public_key.rb
|
|
170
|
+
- lib/crussh/limits.rb
|
|
171
|
+
- lib/crussh/logger.rb
|
|
172
|
+
- lib/crussh/mac.rb
|
|
173
|
+
- lib/crussh/mac/algorithm.rb
|
|
174
|
+
- lib/crussh/mac/crypto.rb
|
|
175
|
+
- lib/crussh/mac/none.rb
|
|
176
|
+
- lib/crussh/negotiator.rb
|
|
177
|
+
- lib/crussh/preferred.rb
|
|
178
|
+
- lib/crussh/protocol.rb
|
|
179
|
+
- lib/crussh/protocol/channel_close.rb
|
|
180
|
+
- lib/crussh/protocol/channel_data.rb
|
|
181
|
+
- lib/crussh/protocol/channel_eof.rb
|
|
182
|
+
- lib/crussh/protocol/channel_extended_data.rb
|
|
183
|
+
- lib/crussh/protocol/channel_failure.rb
|
|
184
|
+
- lib/crussh/protocol/channel_open.rb
|
|
185
|
+
- lib/crussh/protocol/channel_open_confirmation.rb
|
|
186
|
+
- lib/crussh/protocol/channel_open_failure.rb
|
|
187
|
+
- lib/crussh/protocol/channel_request.rb
|
|
188
|
+
- lib/crussh/protocol/channel_success.rb
|
|
189
|
+
- lib/crussh/protocol/channel_window_adjust.rb
|
|
190
|
+
- lib/crussh/protocol/debug.rb
|
|
191
|
+
- lib/crussh/protocol/disconnect.rb
|
|
192
|
+
- lib/crussh/protocol/ext_info.rb
|
|
193
|
+
- lib/crussh/protocol/global_request.rb
|
|
194
|
+
- lib/crussh/protocol/ignore.rb
|
|
195
|
+
- lib/crussh/protocol/kex_ecdh_init.rb
|
|
196
|
+
- lib/crussh/protocol/kex_ecdh_reply.rb
|
|
197
|
+
- lib/crussh/protocol/kex_init.rb
|
|
198
|
+
- lib/crussh/protocol/new_keys.rb
|
|
199
|
+
- lib/crussh/protocol/ping.rb
|
|
200
|
+
- lib/crussh/protocol/pong.rb
|
|
201
|
+
- lib/crussh/protocol/request_failure.rb
|
|
202
|
+
- lib/crussh/protocol/request_success.rb
|
|
203
|
+
- lib/crussh/protocol/service_accept.rb
|
|
204
|
+
- lib/crussh/protocol/service_request.rb
|
|
205
|
+
- lib/crussh/protocol/unimplemented.rb
|
|
206
|
+
- lib/crussh/protocol/userauth_banner.rb
|
|
207
|
+
- lib/crussh/protocol/userauth_failure.rb
|
|
208
|
+
- lib/crussh/protocol/userauth_pk_ok.rb
|
|
209
|
+
- lib/crussh/protocol/userauth_request.rb
|
|
210
|
+
- lib/crussh/protocol/userauth_success.rb
|
|
211
|
+
- lib/crussh/server.rb
|
|
212
|
+
- lib/crussh/server/auth_handler.rb
|
|
213
|
+
- lib/crussh/server/config.rb
|
|
214
|
+
- lib/crussh/server/layers/connection.rb
|
|
215
|
+
- lib/crussh/server/layers/transport.rb
|
|
216
|
+
- lib/crussh/server/layers/userauth.rb
|
|
217
|
+
- lib/crussh/server/request_rule.rb
|
|
218
|
+
- lib/crussh/server/session.rb
|
|
219
|
+
- lib/crussh/ssh_id.rb
|
|
220
|
+
- lib/crussh/transport/packet_stream.rb
|
|
221
|
+
- lib/crussh/transport/reader.rb
|
|
222
|
+
- lib/crussh/transport/version_exchange.rb
|
|
223
|
+
- lib/crussh/transport/writer.rb
|
|
224
|
+
- lib/crussh/version.rb
|
|
225
|
+
- sig/crussh.rbs
|
|
226
|
+
homepage: https://github.com/MSILycanthropy/crussh
|
|
227
|
+
licenses:
|
|
228
|
+
- MIT
|
|
229
|
+
metadata:
|
|
230
|
+
homepage_uri: https://github.com/MSILycanthropy/crussh
|
|
231
|
+
source_code_uri: https://github.com/MSILycanthropy/crussh
|
|
232
|
+
rdoc_options: []
|
|
233
|
+
require_paths:
|
|
234
|
+
- lib
|
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
|
+
requirements:
|
|
237
|
+
- - ">="
|
|
238
|
+
- !ruby/object:Gem::Version
|
|
239
|
+
version: 3.3.0
|
|
240
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
|
+
requirements:
|
|
242
|
+
- - ">="
|
|
243
|
+
- !ruby/object:Gem::Version
|
|
244
|
+
version: '0'
|
|
245
|
+
requirements: []
|
|
246
|
+
rubygems_version: 3.6.9
|
|
247
|
+
specification_version: 4
|
|
248
|
+
summary: A lowish-level SSH server library for Ruby
|
|
249
|
+
test_files: []
|