Skip to content

Commit

Permalink
Add support for ssh algorithms, compaitibale with old embeded devices
Browse files Browse the repository at this point in the history
  • Loading branch information
FANG.Ge committed Feb 24, 2024
1 parent 26d7d9f commit f7baa9f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Debugging using ssh automatically converts all paths between client & server and
redirects X11 output from the server to the client.
Simply add a `ssh` object in your `launch` request.

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

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


SSH algorithms used by some old embedded devices may be out of date, there is a compatible method using `algorithms`. `kex`, `cipher`,`compress`, `hmac`, `serverHostKey` are known to be supported in algorithms. The data format of these keys is array. Supported values can be found in [`msc/ssh`](https://github.com/mscdex/ssh2/blob/master/README.md#client-methods) (Client methods->connect->algorithms).

Because some builds requires one or more environment files to be sourced before running any
command, you can use the `ssh.bootstrap` option to add some extra commands which will be prepended
to the debugger call (using `&&` to join both).
Expand Down
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,32 @@
"bootstrap": {
"type": "string",
"description": "Content will be executed on the SSH host before the debugger call."
},
"algorithms": {
"type": "object",
"description": "This option allows you to explicitly override the default transport layer algorithms used for the connection.",
"properties": {
"cipher": {
"type": "array",
"description": "Ciphers."
},
"compress": {
"type": "array",
"description": "Compression algorithms."
},
"hmac": {
"type": "array",
"description": "(H)MAC algorithms."
},
"kex": {
"type": "array",
"description": "Key exchange algorithms."
},
"serverHostKey": {
"type": "array",
"description": "Server host key formats."
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/backend/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface SSHArguments {
x11host: string;
bootstrap: string;
sourceFileMap: { [index: string]: string };
algorithms: any;
}

export interface IBackend {
Expand Down
4 changes: 4 additions & 0 deletions src/backend/mi2/mi2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export class MI2 extends EventEmitter implements IBackend {
connectionArgs.password = args.password;
}

if (args.algorithms) {
connectionArgs.algorithms = args.algorithms;
}

this.sshConn.on("ready", () => {
this.log("stdout", "Running " + this.application + " over ssh...");
const execArgs: any = {};
Expand Down

0 comments on commit f7baa9f

Please sign in to comment.