ssh_tunnel_proxy 1.2.6 → 1.2.7
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.
- package/README.md +29 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,9 +3,13 @@ Initiate a ssh reverse tunnel proxy with forwarding ports
|
|
|
3
3
|
|
|
4
4
|
ssh_tunnel_proxy can function as a stand-alone api, nodejs command line script or as part of an electron_js app. To setup a ssh tunnel, parameters are suppled for host, port, authentication and a list of proxy ports. If a ngrok api key is provided the host and port of the ngrok tunnel are obtained. A list of port forwards is provided and is validated to restrict connections to system ports on the remote host to a list of pre-defined ports such as http or https. After establishing a ssh connection on the remote server, local proxy port forwards are opened. If the connection is interrupted or connection errors occur, attempts are made re-establish the tunnel.
|
|
5
5
|
|
|
6
|
-
Example command line
|
|
6
|
+
Example command line to establish a list of local forwards:
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
```
|
|
9
|
+
node main.js -c
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
default config file, located at:
|
|
9
13
|
~/.config/ssh_tunnel_proxy/config.json
|
|
10
14
|
```json
|
|
11
15
|
[{
|
|
@@ -28,21 +32,40 @@ config file, located at:
|
|
|
28
32
|
"server_name": "test",
|
|
29
33
|
"ngrok_api": "<ngrok api key>"
|
|
30
34
|
}]
|
|
35
|
+
```
|
|
31
36
|
|
|
37
|
+
Command line to execute a series of commands on remote host:
|
|
38
|
+
```
|
|
39
|
+
node main.js -c -e='uptime' -e='ls -all'
|
|
32
40
|
```
|
|
33
|
-
start tunnel with default config, located at ~/.config/ssh_tunnel_proxy/config.json
|
|
34
41
|
|
|
42
|
+
Or execute commands defined in default config:
|
|
35
43
|
```
|
|
36
|
-
node main.js -c
|
|
44
|
+
node main.js -c
|
|
37
45
|
```
|
|
46
|
+
```json
|
|
47
|
+
[{
|
|
48
|
+
"enabled": true,
|
|
49
|
+
"username": "<username>",
|
|
50
|
+
"service_name": "ssh_proxy_client",
|
|
51
|
+
"server_name": "test",
|
|
52
|
+
"exec" : [
|
|
53
|
+
"uptime",
|
|
54
|
+
"ls -all"
|
|
55
|
+
],
|
|
56
|
+
"ngrok_api": "<ngrok api key>"
|
|
57
|
+
}]
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The following code is an example of use of the api with electronjs.
|
|
38
62
|
|
|
39
|
-
The following code is an example of use of the api with electronjs and is to be installed in main.js, preload.js and the render process.
|
|
40
63
|
main.js:
|
|
41
64
|
```js
|
|
42
65
|
|
|
43
66
|
async function init_sshTunnelProxy(win) {
|
|
44
67
|
|
|
45
|
-
const SSHTunnelProxy = require('ssh_tunnel_proxy');
|
|
68
|
+
const { SSHTunnelProxy } = require('ssh_tunnel_proxy');
|
|
46
69
|
const sshTunnelProxy = new SSHTunnelProxy();
|
|
47
70
|
|
|
48
71
|
ipcMain.on('connect_ssh_sync', async function(event,opts) {
|