Skip to content

Commit 00a5990

Browse files
author
FANG.Ge
committed
Add support for ssh algorithms, compaitibale with old embeded devices
1 parent 26d7d9f commit 00a5990

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Debugging using ssh automatically converts all paths between client & server and
122122
redirects X11 output from the server to the client.
123123
Simply add a `ssh` object in your `launch` request.
124124

125-
```
125+
```JSON
126126
"request": "launch",
127127
"target": "./executable",
128128
"cwd": "${workspaceRoot}",
@@ -137,7 +137,11 @@ Simply add a `ssh` object in your `launch` request.
137137
// x11port may also be specified as string containing only numbers (useful to use configuration variables)
138138
"x11port": 6000,
139139
// Optional, content will be executed on the SSH host before the debugger call.
140-
"bootstrap": "source /home/remoteUser/some-env"
140+
"bootstrap": "source /home/remoteUser/some-env",
141+
// Optional, override the default transport layer algorithms used for the connection
142+
"algorithms": {
143+
"kex" : [ "diffie-hellman-group-exchange-sha1" ]
144+
}
141145
}
142146
```
143147

@@ -151,6 +155,8 @@ For X11 forwarding to work you first need to enable it in your Display Manager a
151155
connections. To allow connections you can either add an entry for applications or run `xhost +`
152156
in the console while you are debugging and turn it off again when you are done using `xhost -`.
153157

158+
SSH algorithms that some old embeded devices use may be outdate, there is a compiable method via using `algorithms`. `kex`, `cipher`,`compress`, `hmac`, `serverHostKey` are known to be supported in `algorithms`, data format of these keys is array. Specific content can be referred to [msc/ssh](https://github.com/mscdex/ssh2) (`Client methods`->`connect`->`algorithms`) .
159+
154160
Because some builds requires one or more environment files to be sourced before running any
155161
command, you can use the `ssh.bootstrap` option to add some extra commands which will be prepended
156162
to the debugger call (using `&&` to join both).

package.json

+26
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,32 @@
288288
"bootstrap": {
289289
"type": "string",
290290
"description": "Content will be executed on the SSH host before the debugger call."
291+
},
292+
"algorithms": {
293+
"type": "object",
294+
"description": "This option allows you to explicitly override the default transport layer algorithms used for the connection.",
295+
"properties": {
296+
"cipher": {
297+
"type": "array",
298+
"description": "Ciphers."
299+
},
300+
"compress": {
301+
"type": "array",
302+
"description": "Compression algorithms."
303+
},
304+
"hmac": {
305+
"type": "array",
306+
"description": "(H)MAC algorithms."
307+
},
308+
"kex": {
309+
"type": "array",
310+
"description": "Key exchange algorithms."
311+
},
312+
"serverHostKey": {
313+
"type": "array",
314+
"description": "Server host key formats."
315+
}
316+
}
291317
}
292318
}
293319
}

src/backend/backend.ts

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface SSHArguments {
4747
x11host: string;
4848
bootstrap: string;
4949
sourceFileMap: { [index: string]: string };
50+
algorithms: any;
5051
}
5152

5253
export interface IBackend {

src/backend/mi2/mi2.ts

+4
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ export class MI2 extends EventEmitter implements IBackend {
135135
connectionArgs.password = args.password;
136136
}
137137

138+
if (args.algorithms) {
139+
connectionArgs.algorithms = args.algorithms;
140+
}
141+
138142
this.sshConn.on("ready", () => {
139143
this.log("stdout", "Running " + this.application + " over ssh...");
140144
const execArgs: any = {};

0 commit comments

Comments
 (0)