websocket-ssh-bridge
v1.0.1
Published
Bridge TCP Connections through a WebSocket Server
Readme
Bridge TCP connections through a WebSocket server
These tools help to bridge connections through a (WebSocket) server.
Concept (here SSH connections):
client.js server.js
SSHC => TCP-Server/WS-Client => WS-Server/TCP-Client => SSHD pipe.js server.js
SSHC => STDIO/WS-Client => WS-Server/TCP-Client => SSHD
via
Proxy-
CommandCommands
Map WebSocket server to TCP client
Command: server.js [localport] [remotehost] [remoteport]
| Name | Description |
|------|-------------|
| localport | Local portExample: 8022 |
| remotehost | Remote hostDefault: localhost |
| remoteport | Remote portDefault: 22 |
Configure Apache Server to forward WebSocket connections:
SSLProxyEngine On
ProxyRequests Off
<Location /ws/n89g8ssc5jlzs5vn>
ProxyPass ws://localhost:8022
</Location>Start daemon via screen and cron:
@reboot screen -d -m -S ws-tcp-bridge /path-to-websocket-tcp-bridge/server.jsMap stdio to WebSocket
Command: pipe.js [websocketpath]
| Name | Description |
|------|-------------|
| websocketpath | Path to the WebSocket server provided by the server.js command.Example: ws://myserver/Example: wss://myapacheserver/ws/n89g8ssc5jlzs5vn |
Configure SSH to use the pipe program:
Host ws-myhost
HostName myhost.example.com
ProxyCommand /path-to-websocket-tcp-bridge/pipe.js wss://%h/ws/n89g8ssc5jlzs5vnMap TCP server to WebSocket
client.js [localport] [websocketpath]
| Name | Description |
|------|-------------|
| localport | Local portExample: 8022 |
| websocketpath | Path to the WebSocket server provided by the server.js command.Example: ws://myserver/Example: wss://myapacheserver/ws/n89g8ssc5jlzs5vn |
License
This software is released under the MIT license.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
