em-wssh 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd71c6b444c01d0a53369ee3a19b4e249117fa87
4
- data.tar.gz: a0e23c5ad1d09084ae419ff505358ca87094aad1
3
+ metadata.gz: 565319173ca1f911be46fe7cc4493be5d6b06e22
4
+ data.tar.gz: 50601f66b068bfa8d31d1e9db41377c2bec3286f
5
5
  SHA512:
6
- metadata.gz: 3e807d7f77ffaed65ce0e065f2266735fe3290e2e01bef37e83ebcdaaa81c99bfb3ce599ab12f7751d11f726c3693b4023210b7ec78621e4f825e90b4013b6f5
7
- data.tar.gz: a4576f6827cd4722b4a7fb64f54558386a4c4bab8ece93db875239ce4150ea086e9c23b3287b3b6171a078c57d58c5b57218773d561de51f5617b94a9a964085
6
+ metadata.gz: 4f340eb263ae672fcf55aa8067a3308e1c7af99622bb5d5442ae2da6607bd9a1e7d100472b39d039565d4ecc25a3594a3757ff5b3b70f2f0b3ac8c647e4aab8f
7
+ data.tar.gz: b7ef678358ed0f5452ac97886f276e6142db5f9d4df4898dbe1556af6f4cb6e28b5466a14495c853594073465817dd13d21e5137e08f34b6cbc39fb53fdfc48f
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module Wssh
3
- VERSION = "0.7.0"
3
+ VERSION = "0.7.1"
4
4
  end
5
5
  end
@@ -1 +1 @@
1
- Dir.glob(File.expand_path '../*.rb', __FILE__){|f|require f}
1
+ Dir.glob(File.expand_path '../*.rb', __FILE__){|f|require f}
@@ -1,12 +1,12 @@
1
- require_relative '../wssh'
2
-
3
- module EventMachine::Wssh
4
- module Version
5
-
6
- Title = 'Show WSSH version'
7
-
8
- def self.go!
9
- puts VERSION
10
- end
11
- end
12
- end
1
+ require_relative '../wssh'
2
+
3
+ module EventMachine::Wssh
4
+ module Version
5
+
6
+ Title = 'Show WSSH version'
7
+
8
+ def self.go!
9
+ puts VERSION
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-wssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Ukolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-websocket
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faye-websocket
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: openssl-win-root
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Proxy SSH connection through Websocket (nginx)
@@ -88,15 +88,7 @@ executables:
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .gitignore
92
- - FarMenu.ini
93
- - Gemfile
94
- - LICENSE.txt
95
- - README.md
96
- - Rakefile
97
91
  - bin/wssh
98
- - em-wssh.gemspec
99
- - hosts.yml
100
92
  - lib/em/wssh.rb
101
93
  - lib/em/wssh/all.rb
102
94
  - lib/em/wssh/client.rb
@@ -109,7 +101,6 @@ files:
109
101
  - lib/em/wssh/tls.rb
110
102
  - lib/em/wssh/uri.rb
111
103
  - lib/em/wssh/version.rb
112
- - nginx/ssh
113
104
  homepage: https://github.com/ukoloff/em-wssh
114
105
  licenses:
115
106
  - MIT
@@ -120,17 +111,17 @@ require_paths:
120
111
  - lib
121
112
  required_ruby_version: !ruby/object:Gem::Requirement
122
113
  requirements:
123
- - - '>='
114
+ - - ">="
124
115
  - !ruby/object:Gem::Version
125
116
  version: '0'
126
117
  required_rubygems_version: !ruby/object:Gem::Requirement
127
118
  requirements:
128
- - - '>='
119
+ - - ">="
129
120
  - !ruby/object:Gem::Version
130
121
  version: '0'
131
122
  requirements: []
132
123
  rubyforge_project:
133
- rubygems_version: 2.4.6
124
+ rubygems_version: 2.4.5.1
134
125
  signing_key:
135
126
  specification_version: 4
136
127
  summary: ''
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- log
@@ -1,17 +0,0 @@
1
- I: Install dependencies
2
- bundle install
3
- --:
4
- B: Build gem
5
- bundle exec rake build
6
- L: Install gem locally
7
- bundle exec rake install
8
- U: Uninstall gem
9
- gem uninstall -ax em-wssh
10
- --:
11
- S: Start server
12
- bundle exec ruby bin/wssh server -new_console:cb
13
- C: Start CONNECT proxy
14
- bundle exec ruby bin/wssh connect ws://localhost:4567/test -new_console:cb
15
- 2: Start both servers
16
- bundle exec ruby bin/wssh server -new_console:cb
17
- bundle exec ruby bin/wssh connect ws://localhost:4567/test -new_console:cb
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in em-wssh.gemspec
4
- gemspec
@@ -1,22 +0,0 @@
1
- Copyright (c) 2015 Stas Ukolov
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,256 +0,0 @@
1
- # em-wssh
2
-
3
- [![Gem Version](https://badge.fury.io/rb/em-wssh.svg)](http://badge.fury.io/rb/em-wssh)
4
-
5
- Ruby version of ssh thru websocket proxying.
6
-
7
- [Original version](https://github.com/ukoloff/wssh) uses Node.js
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'em-wssh'
15
- ```
16
-
17
- And then execute:
18
-
19
- ```sh
20
- $ bundle
21
- ```
22
-
23
- Or install it yourself as:
24
-
25
- ```sh
26
- $ gem install em-wssh
27
- ```
28
-
29
- ## Usage
30
-
31
- Single command `wssh` is exported. Sometimes it should be `bundle exec wssh`.
32
-
33
- ### WSSH Server
34
-
35
- To run WSSH server say `wssh server`.
36
-
37
- You can set some options for server, ie:
38
-
39
- Most useful option is `--base=path` (or `-b`). It set path, where server files stored.
40
- By default this path is where gem installed. To use current directory say `wssh server -b.`
41
-
42
- This `base` path is used to locate `hosts.yml` file, which maps host requested by user to real servers.
43
- See [sample](hosts.yml). One can define direct map or regexp-style mapping (denoted by // with optional //i).
44
- If multiple regexps match user host, the last one wins.
45
- To disable connecting to host (or all hosts for regexp) map it to null or false.
46
-
47
- The `base` also is root for log file and pid file, created by server.
48
-
49
- Parameters `--listen=port` (`-l`) and `--all` (`-a`) define on what address server will listen.
50
- By default it is `localhost:4567`.
51
-
52
- Parameter `--daemon` will force server to go in background.
53
-
54
- ### nginx
55
-
56
- Directly exposing WSSH server to Internet is not a good idea.
57
- One should better install nginx (with TLS) and [force it to redirect](nginx/ssh)
58
- WSSH connections to WSSH server.
59
-
60
- ### WSSH Client
61
-
62
- Client is started with `wssh client URI`, eg `wssh client ws://localhost:4567`.
63
-
64
- Running client from terminal is not very useful. It should be called by ssh client:
65
-
66
- ```sh
67
- ssh -o ProxyCommand='wssh client wss://server.host.com/ssh/%h' sshd.local
68
- ```
69
-
70
- By default nginx has 60 seconds timeout. To prevent idle connection to drop,
71
- one can use `ServerAliveInterval` parameter:
72
-
73
- ```sh
74
- ssh -o ProxyCommand='wssh client wss://server.host.com/ssh/%h' -o ServerAliveInterval=50 sshd.local
75
- ```
76
-
77
- ### WSSH Proxy
78
-
79
- WSSH client is in fact unusable on Windows.
80
- It can be impractical when we create a lot of SSH connections (eg with Capistrano mass deploy).
81
-
82
- In these cases run `wssh connect URI`, it will listen to TCP port (3122 by default) and will work
83
- as normal HTTP proxy, so proxy-capable clients (PuTTY/Plink and Net::SSH) can use it to connect to SSH servers.
84
-
85
- ```ruby
86
- #!/usr/bin/env ruby
87
-
88
- require 'net/ssh'
89
- require 'net/ssh/proxy/http'
90
-
91
- x=Net::SSH.start 'sshd.local', 'root',
92
- proxy: Net::SSH::Proxy::HTTP.new('localhost', 3122)
93
-
94
- puts x.exec! 'hostname'
95
- ```
96
-
97
- Proxy allows the same command line parameters as server.
98
- For proxy parameter `--ping` may be useful,
99
- it forces proxy to periodically send Websocket ping packets to server
100
- for nginx to not drop connection on timeout.
101
-
102
- ## API
103
-
104
- WSSH server, client or proxy can be start programmaticaly:
105
-
106
- ```ruby
107
- require 'em/wssh/server'
108
-
109
- s=EventMachine::Wssh::Server
110
- s.options.merge! base: '.'
111
- s.loop!
112
- ```
113
-
114
- ```ruby
115
- require 'em/wssh/client'
116
-
117
- c=EventMachine::Wssh::Client
118
- c.options[:uri]='wss://server.host.com/ssh/sshd.local'
119
- c.loop!
120
- ```
121
-
122
- ```ruby
123
- require 'em/wssh/connect'
124
-
125
- p=EventMachine::Wssh::Connect
126
- p.options.merge! base: '.', all: true, uri: 'wss://server.host.com/ssh/sshd.local'
127
- p.loop!
128
- ```
129
-
130
- Use `go!` method instead `loop!` to mimic cli behavour (command line parsing).
131
-
132
- Some options are not accesible to `wssh` command and can be used only programmaticaly.
133
-
134
- ### Ephemeral module
135
-
136
- Eg, EventMachine::Wssh::Connect has option `onlisten` that allows listening to ephemeral port:
137
-
138
- ```ruby
139
- #!/usr/bin/env ruby
140
-
141
- require 'net/ssh'
142
- require 'net/ssh/proxy/http'
143
- require 'em/wssh/connect'
144
-
145
- q=Queue.new
146
- c=EventMachine::Wssh::Connect
147
- c.options.merge!(
148
- port: 0,
149
- uri: 'wss://server.host.com/ssh',
150
- onlisten: Proc.new{|port| q.push port},
151
- )
152
-
153
- Thread.new{c.loop!}
154
-
155
- puts "Port=#{port=q.pop}"
156
-
157
- x=Net::SSH.start 'sshd.local', 'root',
158
- proxy: Net::SSH::Proxy::HTTP.new('localhost', port)
159
-
160
- puts x.exec! 'hostname'
161
- ```
162
-
163
- Unfortunately, EventMachine fails to run in thread inside Capistrano.
164
- But Connect proxy still can run in separate process.
165
- To do this, module Ephemeral was forged:
166
-
167
- ```ruby
168
- task :wssh do
169
- require 'net/ssh/proxy/http'
170
- require 'em/wssh/ephemeral'
171
-
172
- port = EventMachine::Wssh::Ephemeral.allocate 'ws://localhost:4567/test'
173
-
174
- proxy = Net::SSH::Proxy::HTTP.new 'localhost', port
175
-
176
- roles(:all).each{|h| h.wssh_proxy proxy }
177
- end
178
-
179
- class SSHKit::Host
180
- def wssh_proxy proxy
181
- @ssh_options[:proxy]=proxy
182
- end
183
- end
184
- ```
185
- Use this task `cap stage wssh task(s)...` to tunnel all Capistrano ssh traffic through
186
- WSSH server.
187
-
188
- In addition, if WSSH URL is secure (wss: or https:) and Ephemeral module is running on Windows,
189
- it automagically starts small Node.js process that wraps traffic into TLS.
190
- This behavour can be disabled by setting Ephemeral.options[:tlswrap]=false
191
-
192
- ## Data flow
193
-
194
- Normal SSH session is very simple:
195
-
196
- * SSH Client
197
- * TCP Connection
198
- * SSH Server, listening on TCP port 22
199
-
200
- WSSH session is:
201
-
202
- * SSH Client with -o ProxyCommand='wssh client WSSH-URI'
203
- * WSSH client listening to its stdin
204
- * Websocket (HTTP/HTTPS) connection to nginx
205
- * nginx [configured](nginx/ssh) to redirect connection to WSSH server
206
- * Another Websocket connection from nginx to WSSH server
207
- * WSSH server, listening to dedicated TCP port (4567 by default)
208
- * Normal TCP connection
209
- * Normal SSH Server, listening on TCP port 22
210
-
211
- And nginx stage can be omited in development/testing scenarios.
212
-
213
- In some scenarios this path can be even longer:
214
-
215
- * SSH Client, capable to connect via HTTP proxy (eg PuTTY/PLink or Net::SSH)
216
- * TCP connection to local proxy
217
- * `wssh connect` listening to dedicated port (3122 by default)
218
- * Websocket (HTTP/HTTPS) connection to nginx
219
- * nginx [configured](nginx/ssh) to redirect connection to WSSH server
220
- * Another Websocket connection from nginx to WSSH server
221
- * WSSH server, listening to dedicated TCP port (4567 by default)
222
- * Normal TCP connection
223
- * Normal SSH Server, listening on TCP port 22
224
-
225
- ## Windows bugs
226
-
227
- Windows installation of EventMachine has a few bugs:
228
-
229
- 1. Using STDIN [blocks](https://groups.google.com/forum/#!topic/eventmachine/5rDIOA2uOoA) all other connections
230
- 2. By default SSL/TLS is not available
231
- 3. No root certificates available ([Fixed](https://github.com/ukoloff/openssl-win-root))
232
-
233
- So, this package is in fact almost unusable on MS Windows.
234
-
235
- The only exception: if you connect to Non-TLS WSSH server
236
- (ws: or http:, not wss: or https:), you **can** start `wssh connect`
237
- and then use SSH client, capable to connect via HTTP proxy.
238
-
239
- To connect to TLS WSSH server, you should use Node.js version.
240
-
241
- ## See also
242
-
243
- * [Node.js version](https://github.com/ukoloff/wssh)
244
- * [Python version](https://github.com/progrium/wssh)
245
-
246
- ## Credits
247
-
248
- * [nginx](http://nginx.org/)
249
- * [Ruby](https://www.ruby-lang.org/)
250
- * [EventMachine](https://github.com/eventmachine/eventmachine)
251
- * [EM-WebSocket](https://github.com/igrigorik/em-websocket)
252
- * [faye-websocket](https://github.com/faye/faye-websocket-ruby)
253
- * [Node.js](http://nodejs.org/)
254
- * [OpenSSH](http://www.openssh.com/)
255
- * [Net::SSH](https://github.com/net-ssh/net-ssh)
256
- * [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/)
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,27 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'em/wssh'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "em-wssh"
8
- spec.version = EventMachine::Wssh::VERSION
9
- spec.authors = ["Stas Ukolov"]
10
- spec.email = ["ukoloff@gmail.com"]
11
- spec.description = 'Proxy SSH connection through Websocket (nginx)'
12
- spec.summary = ''
13
- spec.homepage = "https://github.com/ukoloff/em-wssh"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency "em-websocket" # server side
22
- spec.add_dependency "faye-websocket" # client side
23
- spec.add_dependency "openssl-win-root" if Gem.win_platform?
24
-
25
- spec.add_development_dependency "bundler", "~> 1.3"
26
- spec.add_development_dependency "rake"
27
- end
data/hosts.yml DELETED
@@ -1,20 +0,0 @@
1
- # Catch all regexp
2
- //: localhost
3
-
4
- # Simple rule
5
- self: localhost
6
-
7
- # Disabled
8
- none: false
9
-
10
- # Allowed
11
- github.com: true
12
- gitlab.com: true
13
- bitbucket.org: true
14
-
15
- # Sample regexp
16
- /lab$/i: gitlab.com
17
-
18
- # Allow intranet IPs
19
- /10(?:\.\d+){3}/: true
20
- /192\.168(?:\.\d+){2}/: true
data/nginx/ssh DELETED
@@ -1,8 +0,0 @@
1
- location /ssh {
2
- proxy_pass http://localhost:4567;
3
- proxy_http_version 1.1;
4
- proxy_set_header Upgrade $http_upgrade;
5
- proxy_set_header Connection "upgrade";
6
- proxy_set_header X-Real-IP $remote_addr;
7
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
8
- }