mcp-ssh-manager 3.1.5 → 3.2.1
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/CLAUDE.md +2 -0
- package/README.md +72 -8
- package/package.json +4 -1
- package/src/config-loader.js +4 -0
- package/src/index.js +90 -21
- package/src/ssh-manager.js +19 -1
- package/context-test.txt +0 -1
package/CLAUDE.md
CHANGED
|
@@ -155,6 +155,7 @@ SSH_SERVER_[NAME]_PORT=22 # Optional
|
|
|
155
155
|
SSH_SERVER_[NAME]_DEFAULT_DIR=/path # Optional default working directory
|
|
156
156
|
SSH_SERVER_[NAME]_SUDO_PASSWORD=pass # Optional for automated sudo
|
|
157
157
|
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
|
|
158
|
+
SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
### TOML Format
|
|
@@ -169,6 +170,7 @@ port = 22 # Optional
|
|
|
169
170
|
default_dir = "/path" # Optional default working directory
|
|
170
171
|
sudo_password = "pass" # Optional for automated sudo
|
|
171
172
|
platform = "windows" # Optional: "linux" (default) or "windows"
|
|
173
|
+
proxy_jump = "bastion" # Optional: name of another server to use as jump host
|
|
172
174
|
```
|
|
173
175
|
|
|
174
176
|
## Key Implementation Details
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A powerful Model Context Protocol (MCP) server that enables **Claude Code** and
|
|
|
12
12
|
[](https://www.npmjs.com/package/mcp-ssh-manager)
|
|
13
13
|
[](https://github.com/bvisible/mcp-ssh-manager)
|
|
14
14
|
[](https://modelcontextprotocol.io)
|
|
15
|
-
[](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v3.2.0)
|
|
16
16
|
[](https://claude.ai/code)
|
|
17
17
|
[](https://openai.com/codex)
|
|
18
18
|
[](https://modelcontextprotocol.io)
|
|
@@ -32,20 +32,28 @@ A powerful Model Context Protocol (MCP) server that enables **Claude Code** and
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
## 🎉 What's New in v3.
|
|
35
|
+
## 🎉 What's New in v3.2.0
|
|
36
36
|
|
|
37
|
-
**SSH
|
|
37
|
+
**SSH ProxyJump / Bastion Host Support & npx Fix** (Released: March 18, 2026)
|
|
38
38
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
- **🔀 ProxyJump support**: Connect to servers behind bastion/jump hosts with a simple `PROXYJUMP` config field ([#15](https://github.com/bvisible/mcp-ssh-manager/issues/15))
|
|
40
|
+
- Chain multiple jumps (A → B → C) via recursive connections
|
|
41
|
+
- Circular dependency detection prevents infinite loops
|
|
42
|
+
- All tools work transparently through jump hosts (execute, upload, download, sync...)
|
|
43
|
+
- Jump connections are pooled and reused like direct connections
|
|
44
|
+
- **📦 npx support fixed**: Added `bin` field to `package.json` — `npx mcp-ssh-manager` now works correctly ([#14](https://github.com/bvisible/mcp-ssh-manager/issues/14))
|
|
44
45
|
|
|
45
46
|
---
|
|
46
47
|
|
|
47
48
|
## Previous Releases
|
|
48
49
|
|
|
50
|
+
### v3.1.5 - SSH Agent & Passphrase Support (March 5, 2026)
|
|
51
|
+
|
|
52
|
+
- **🔑 SSH Agent support**: Automatically uses `ssh-agent` when `SSH_AUTH_SOCK` is available — passphrase-protected keys work transparently
|
|
53
|
+
- **🔐 Passphrase configuration**: New `passphrase` field for both `.env` and TOML formats
|
|
54
|
+
|
|
55
|
+
Thanks to [@snjax](https://github.com/snjax) for the original contribution ([#12](https://github.com/bvisible/mcp-ssh-manager/pull/12)).
|
|
56
|
+
|
|
49
57
|
### v3.1.4 - Windows SSH Host Support (February 22, 2026)
|
|
50
58
|
|
|
51
59
|
- **🪟 Windows SSH host fix**: Commands no longer fail on Windows hosts running OpenSSH ([#10](https://github.com/bvisible/mcp-ssh-manager/issues/10))
|
|
@@ -114,6 +122,7 @@ This release adds **12 new MCP tools** transforming SSH Manager into a comprehen
|
|
|
114
122
|
### Core Features
|
|
115
123
|
- **🔗 Multiple SSH Connections** - Manage unlimited SSH servers from a single interface
|
|
116
124
|
- **🔐 Secure Authentication** - Support for password, SSH key, and ssh-agent authentication (including passphrase-protected keys)
|
|
125
|
+
- **🔀 ProxyJump / Bastion Host** - Connect to servers behind jump hosts with chained multi-hop support
|
|
117
126
|
- **📁 File Operations** - Upload and download files between local and remote systems
|
|
118
127
|
- **⚡ Command Execution** - Run commands on remote servers with working directory support
|
|
119
128
|
- **📂 Default Directories** - Set default working directories per server for convenience
|
|
@@ -366,6 +375,18 @@ key_path = "~/.ssh/winhost_key"
|
|
|
366
375
|
port = 2222
|
|
367
376
|
platform = "windows"
|
|
368
377
|
description = "Windows host via OpenSSH"
|
|
378
|
+
|
|
379
|
+
[ssh_servers.bastion]
|
|
380
|
+
host = "bastion.example.com"
|
|
381
|
+
user = "jumpuser"
|
|
382
|
+
key_path = "~/.ssh/bastion_key"
|
|
383
|
+
|
|
384
|
+
[ssh_servers.internal]
|
|
385
|
+
host = "10.0.0.5"
|
|
386
|
+
user = "admin"
|
|
387
|
+
key_path = "~/.ssh/internal_key"
|
|
388
|
+
proxy_jump = "bastion"
|
|
389
|
+
description = "Private server behind bastion"
|
|
369
390
|
```
|
|
370
391
|
|
|
371
392
|
💡 **See [examples/codex-ssh-config.example.toml](examples/codex-ssh-config.example.toml) for more complete examples!**
|
|
@@ -568,6 +589,7 @@ SSH_SERVER_[NAME]_PORT=22 # Optional, defaults to 22
|
|
|
568
589
|
SSH_SERVER_[NAME]_DEFAULT_DIR=/path/to/dir # Optional, default working directory
|
|
569
590
|
SSH_SERVER_[NAME]_DESCRIPTION=Description # Optional
|
|
570
591
|
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
|
|
592
|
+
SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
|
|
571
593
|
|
|
572
594
|
# Example: Linux server
|
|
573
595
|
SSH_SERVER_PRODUCTION_HOST=prod.example.com
|
|
@@ -585,6 +607,17 @@ SSH_SERVER_WINHOST_KEYPATH=~/.ssh/winhost_key
|
|
|
585
607
|
SSH_SERVER_WINHOST_PORT=2222
|
|
586
608
|
SSH_SERVER_WINHOST_PLATFORM=windows
|
|
587
609
|
SSH_SERVER_WINHOST_DESCRIPTION=Windows host via OpenSSH
|
|
610
|
+
|
|
611
|
+
# Example: Server behind a bastion/jump host
|
|
612
|
+
SSH_SERVER_BASTION_HOST=bastion.example.com
|
|
613
|
+
SSH_SERVER_BASTION_USER=jumpuser
|
|
614
|
+
SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
|
|
615
|
+
|
|
616
|
+
SSH_SERVER_INTERNAL_HOST=10.0.0.5
|
|
617
|
+
SSH_SERVER_INTERNAL_USER=admin
|
|
618
|
+
SSH_SERVER_INTERNAL_KEYPATH=~/.ssh/internal_key
|
|
619
|
+
SSH_SERVER_INTERNAL_PROXYJUMP=bastion
|
|
620
|
+
SSH_SERVER_INTERNAL_DESCRIPTION=Private server behind bastion
|
|
588
621
|
```
|
|
589
622
|
|
|
590
623
|
### Server Management Tool
|
|
@@ -684,6 +717,37 @@ passphrase = "your_passphrase"
|
|
|
684
717
|
|
|
685
718
|
## 📚 Advanced Usage
|
|
686
719
|
|
|
720
|
+
### ProxyJump / Bastion Host
|
|
721
|
+
|
|
722
|
+
Connect to servers behind a bastion or jump host. The connection is tunneled through the jump server transparently — all tools (execute, upload, download, sync) work as usual.
|
|
723
|
+
|
|
724
|
+
```env
|
|
725
|
+
# Define the bastion server
|
|
726
|
+
SSH_SERVER_BASTION_HOST=bastion.example.com
|
|
727
|
+
SSH_SERVER_BASTION_USER=jumpuser
|
|
728
|
+
SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
|
|
729
|
+
|
|
730
|
+
# Point the target server to the bastion
|
|
731
|
+
SSH_SERVER_PRIVATE_HOST=10.0.0.5
|
|
732
|
+
SSH_SERVER_PRIVATE_USER=admin
|
|
733
|
+
SSH_SERVER_PRIVATE_PROXYJUMP=bastion
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
Or in TOML:
|
|
737
|
+
```toml
|
|
738
|
+
[ssh_servers.bastion]
|
|
739
|
+
host = "bastion.example.com"
|
|
740
|
+
user = "jumpuser"
|
|
741
|
+
key_path = "~/.ssh/bastion_key"
|
|
742
|
+
|
|
743
|
+
[ssh_servers.private]
|
|
744
|
+
host = "10.0.0.5"
|
|
745
|
+
user = "admin"
|
|
746
|
+
proxy_jump = "bastion"
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
**Chained jumps** are supported: if `bastion` itself has a `proxy_jump`, the chain is followed recursively. Circular references are detected and rejected.
|
|
750
|
+
|
|
687
751
|
### Documentation
|
|
688
752
|
- [DEPLOYMENT_GUIDE.md](docs/DEPLOYMENT_GUIDE.md) - Deployment strategies and permission handling
|
|
689
753
|
- [ALIASES_AND_HOOKS.md](docs/ALIASES_AND_HOOKS.md) - Command aliases and automation hooks
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ssh-manager",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "MCP SSH Manager: Model Context Protocol server for SSH remote server management. Control SSH connections from Claude Code and OpenAI Codex - execute commands, transfer files, database operations, backups, health monitoring, and DevOps automation. NEW: Tool activation system reduces context usage by 92%",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mcp-ssh-manager": "src/index.js"
|
|
8
|
+
},
|
|
6
9
|
"type": "module",
|
|
7
10
|
"scripts": {
|
|
8
11
|
"start": "node src/index.js",
|
package/src/config-loader.js
CHANGED
|
@@ -93,6 +93,7 @@ export class ConfigLoader {
|
|
|
93
93
|
sudoPassword: serverConfig.sudo_password,
|
|
94
94
|
description: serverConfig.description,
|
|
95
95
|
platform: serverConfig.platform ? serverConfig.platform.toLowerCase() : undefined,
|
|
96
|
+
proxyJump: serverConfig.proxy_jump,
|
|
96
97
|
source: 'toml'
|
|
97
98
|
});
|
|
98
99
|
}
|
|
@@ -141,6 +142,7 @@ export class ConfigLoader {
|
|
|
141
142
|
sudoPassword: env[`SSH_SERVER_${match[1]}_SUDO_PASSWORD`],
|
|
142
143
|
description: env[`SSH_SERVER_${match[1]}_DESCRIPTION`],
|
|
143
144
|
platform: (env[`SSH_SERVER_${match[1]}_PLATFORM`] || '').toLowerCase() || undefined,
|
|
145
|
+
proxyJump: env[`SSH_SERVER_${match[1]}_PROXYJUMP`],
|
|
144
146
|
source: 'env'
|
|
145
147
|
};
|
|
146
148
|
|
|
@@ -193,6 +195,7 @@ export class ConfigLoader {
|
|
|
193
195
|
if (server.sudoPassword) serverConfig.sudo_password = server.sudoPassword;
|
|
194
196
|
if (server.description) serverConfig.description = server.description;
|
|
195
197
|
if (server.platform) serverConfig.platform = server.platform;
|
|
198
|
+
if (server.proxyJump) serverConfig.proxy_jump = server.proxyJump;
|
|
196
199
|
|
|
197
200
|
config.ssh_servers[name] = serverConfig;
|
|
198
201
|
}
|
|
@@ -221,6 +224,7 @@ export class ConfigLoader {
|
|
|
221
224
|
if (server.sudoPassword) lines.push(`SSH_SERVER_${upperName}_SUDO_PASSWORD="${server.sudoPassword}"`);
|
|
222
225
|
if (server.description) lines.push(`SSH_SERVER_${upperName}_DESCRIPTION="${server.description}"`);
|
|
223
226
|
if (server.platform) lines.push(`SSH_SERVER_${upperName}_PLATFORM=${server.platform}`);
|
|
227
|
+
if (server.proxyJump) lines.push(`SSH_SERVER_${upperName}_PROXYJUMP=${server.proxyJump}`);
|
|
224
228
|
lines.push('');
|
|
225
229
|
}
|
|
226
230
|
|
package/src/index.js
CHANGED
|
@@ -164,51 +164,75 @@ import { loadToolConfig, isToolEnabled } from './tool-config-manager.js';
|
|
|
164
164
|
const __filename = fileURLToPath(import.meta.url);
|
|
165
165
|
const __dirname = path.dirname(__filename);
|
|
166
166
|
|
|
167
|
-
//
|
|
168
|
-
|
|
167
|
+
// Resolve .env file path with fallback chain:
|
|
168
|
+
// 1. SSH_ENV_PATH env var (explicit override)
|
|
169
|
+
// 2. process.cwd()/.env (standard working directory)
|
|
170
|
+
// 3. ~/.env (home directory, where ssh-manager server add writes)
|
|
171
|
+
// 4. __dirname/../.env (backward compat for local installs)
|
|
172
|
+
function resolveEnvFilePath() {
|
|
173
|
+
if (process.env.SSH_ENV_PATH) {
|
|
174
|
+
return process.env.SSH_ENV_PATH;
|
|
175
|
+
}
|
|
176
|
+
const candidates = [
|
|
177
|
+
path.join(process.cwd(), '.env'),
|
|
178
|
+
path.join(os.homedir(), '.env'),
|
|
179
|
+
path.join(__dirname, '..', '.env'),
|
|
180
|
+
];
|
|
181
|
+
for (const candidate of candidates) {
|
|
182
|
+
if (fs.existsSync(candidate)) {
|
|
183
|
+
return candidate;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Default to cwd (consistent with config-loader.js)
|
|
187
|
+
return path.join(process.cwd(), '.env');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const envFilePath = resolveEnvFilePath();
|
|
169
191
|
dotenv.config({ path: envFilePath });
|
|
170
192
|
|
|
171
193
|
// Initialize logger
|
|
172
194
|
logger.info('MCP SSH Manager starting', {
|
|
173
195
|
logLevel: process.env.SSH_LOG_LEVEL || 'INFO',
|
|
174
|
-
verbose: process.env.SSH_VERBOSE === 'true'
|
|
196
|
+
verbose: process.env.SSH_VERBOSE === 'true',
|
|
197
|
+
envFilePath
|
|
175
198
|
});
|
|
176
199
|
|
|
177
200
|
// Load SSH server configuration
|
|
178
201
|
let servers = {};
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
servers = {};
|
|
202
|
+
try {
|
|
203
|
+
const loadedServers = await configLoader.load({
|
|
204
|
+
envPath: envFilePath,
|
|
205
|
+
tomlPath: process.env.SSH_CONFIG_PATH,
|
|
206
|
+
preferToml: process.env.PREFER_TOML_CONFIG === 'true'
|
|
207
|
+
});
|
|
186
208
|
for (const [name, config] of loadedServers) {
|
|
187
209
|
servers[name] = config;
|
|
188
210
|
}
|
|
189
211
|
logger.info(`Loaded ${loadedServers.size} SSH server configurations from ${configLoader.configSource}`);
|
|
190
|
-
}
|
|
212
|
+
} catch (error) {
|
|
191
213
|
logger.error('Failed to load server configuration', { error: error.message });
|
|
192
|
-
}
|
|
214
|
+
}
|
|
193
215
|
|
|
194
216
|
// Initialize hooks system
|
|
195
|
-
|
|
217
|
+
try {
|
|
218
|
+
await initializeHooks();
|
|
219
|
+
} catch (error) {
|
|
196
220
|
logger.error('Failed to initialize hooks', { error: error.message });
|
|
197
|
-
}
|
|
221
|
+
}
|
|
198
222
|
|
|
199
223
|
// Load tool configuration
|
|
200
224
|
let toolConfig = null;
|
|
201
|
-
|
|
202
|
-
toolConfig =
|
|
203
|
-
const summary =
|
|
225
|
+
try {
|
|
226
|
+
toolConfig = await loadToolConfig();
|
|
227
|
+
const summary = toolConfig.getSummary();
|
|
204
228
|
logger.info(`Tool configuration loaded: ${summary.mode} mode, ${summary.enabledCount}/${summary.totalTools} tools enabled`);
|
|
205
229
|
if (summary.mode === 'all') {
|
|
206
230
|
logger.info('💡 Tip: Run "ssh-manager tools configure" to reduce context usage in Claude Code');
|
|
207
231
|
}
|
|
208
|
-
}
|
|
232
|
+
} catch (error) {
|
|
209
233
|
logger.error('Failed to load tool configuration', { error: error.message });
|
|
210
234
|
logger.info('Using default configuration (all tools enabled)');
|
|
211
|
-
}
|
|
235
|
+
}
|
|
212
236
|
|
|
213
237
|
// Map to store active connections
|
|
214
238
|
const connections = new Map();
|
|
@@ -225,6 +249,9 @@ const KEEPALIVE_INTERVAL = 5 * 60 * 1000;
|
|
|
225
249
|
// Map to store keepalive intervals
|
|
226
250
|
const keepaliveIntervals = new Map();
|
|
227
251
|
|
|
252
|
+
// Map to track proxy jump dependencies (target -> jump server)
|
|
253
|
+
const jumpDependencies = new Map();
|
|
254
|
+
|
|
228
255
|
// Load server configuration (backward compatibility wrapper)
|
|
229
256
|
function loadServerConfig() {
|
|
230
257
|
// This function is kept for backward compatibility
|
|
@@ -339,6 +366,9 @@ function closeConnection(serverName) {
|
|
|
339
366
|
// Remove timestamp
|
|
340
367
|
connectionTimestamps.delete(normalizedName);
|
|
341
368
|
|
|
369
|
+
// Clean up jump dependency tracking
|
|
370
|
+
jumpDependencies.delete(normalizedName);
|
|
371
|
+
|
|
342
372
|
logger.logConnection(serverName, 'closed');
|
|
343
373
|
}
|
|
344
374
|
|
|
@@ -398,7 +428,45 @@ async function getConnection(serverName) {
|
|
|
398
428
|
const ssh = new SSHManager(serverConfig);
|
|
399
429
|
|
|
400
430
|
try {
|
|
401
|
-
|
|
431
|
+
if (serverConfig.proxyJump) {
|
|
432
|
+
const jumpServerName = serverConfig.proxyJump.toLowerCase();
|
|
433
|
+
|
|
434
|
+
// Validate jump server exists
|
|
435
|
+
if (!servers[jumpServerName]) {
|
|
436
|
+
throw new Error(
|
|
437
|
+
`Proxy jump server "${serverConfig.proxyJump}" not found. ` +
|
|
438
|
+
`Available servers: ${Object.keys(servers).join(', ')}`
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Detect circular proxy jumps
|
|
443
|
+
const visited = new Set([normalizedName]);
|
|
444
|
+
let current = jumpServerName;
|
|
445
|
+
while (current) {
|
|
446
|
+
if (visited.has(current)) {
|
|
447
|
+
throw new Error(`Circular proxy jump detected: ${[...visited, current].join(' -> ')}`);
|
|
448
|
+
}
|
|
449
|
+
visited.add(current);
|
|
450
|
+
current = servers[current]?.proxyJump?.toLowerCase() || null;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Connect to jump server (recursive — handles chained jumps)
|
|
454
|
+
const jumpSSH = await getConnection(serverConfig.proxyJump);
|
|
455
|
+
|
|
456
|
+
// Create forwarded stream through the jump server
|
|
457
|
+
const stream = await jumpSSH.forwardOut(
|
|
458
|
+
'127.0.0.1', 0,
|
|
459
|
+
serverConfig.host, serverConfig.port || 22
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
// Connect target through the forwarded stream
|
|
463
|
+
await ssh.connect({ sock: stream });
|
|
464
|
+
jumpDependencies.set(normalizedName, jumpServerName);
|
|
465
|
+
ssh.jumpConnection = jumpSSH;
|
|
466
|
+
} else {
|
|
467
|
+
await ssh.connect();
|
|
468
|
+
}
|
|
469
|
+
|
|
402
470
|
connections.set(normalizedName, ssh);
|
|
403
471
|
connectionTimestamps.set(normalizedName, Date.now());
|
|
404
472
|
|
|
@@ -408,7 +476,8 @@ async function getConnection(serverName) {
|
|
|
408
476
|
logger.logConnection(serverName, 'established', {
|
|
409
477
|
host: serverConfig.host,
|
|
410
478
|
port: serverConfig.port,
|
|
411
|
-
method: serverConfig.password ? 'password' : 'key'
|
|
479
|
+
method: serverConfig.password ? 'password' : 'key',
|
|
480
|
+
proxyJump: serverConfig.proxyJump || null
|
|
412
481
|
});
|
|
413
482
|
|
|
414
483
|
// Execute post-connect hook
|
package/src/ssh-manager.js
CHANGED
|
@@ -16,9 +16,10 @@ class SSHManager {
|
|
|
16
16
|
this.cachedHomeDir = null;
|
|
17
17
|
this.autoAcceptHostKey = config.autoAcceptHostKey || false;
|
|
18
18
|
this.hostKeyVerification = config.hostKeyVerification !== false; // Default true
|
|
19
|
+
this.jumpConnection = null;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
async connect() {
|
|
22
|
+
async connect(options = {}) {
|
|
22
23
|
return new Promise((resolve, reject) => {
|
|
23
24
|
this.client.on('ready', () => {
|
|
24
25
|
this.connected = true;
|
|
@@ -115,6 +116,11 @@ class SSHManager {
|
|
|
115
116
|
connConfig.password = this.config.password;
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
// Use provided stream for proxy jump connections
|
|
120
|
+
if (options.sock) {
|
|
121
|
+
connConfig.sock = options.sock;
|
|
122
|
+
}
|
|
123
|
+
|
|
118
124
|
this.client.connect(connConfig);
|
|
119
125
|
});
|
|
120
126
|
}
|
|
@@ -452,6 +458,18 @@ class SSHManager {
|
|
|
452
458
|
}
|
|
453
459
|
}
|
|
454
460
|
|
|
461
|
+
async forwardOut(srcAddr, srcPort, dstAddr, dstPort) {
|
|
462
|
+
if (!this.connected) {
|
|
463
|
+
throw new Error('Not connected to SSH server');
|
|
464
|
+
}
|
|
465
|
+
return new Promise((resolve, reject) => {
|
|
466
|
+
this.client.forwardOut(srcAddr, srcPort, dstAddr, dstPort, (err, stream) => {
|
|
467
|
+
if (err) reject(err);
|
|
468
|
+
else resolve(stream);
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
|
|
455
473
|
async ping() {
|
|
456
474
|
try {
|
|
457
475
|
const result = await this.execCommand('echo "ping"', { timeout: 5000 });
|
package/context-test.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Server: production, Error: test-error
|