diff --git a/README.md b/README.md index b9bda930..aac851f6 100644 --- a/README.md +++ b/README.md @@ -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}", @@ -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" ] + } } ``` @@ -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). diff --git a/package.json b/package.json index 38fb36f5..6f2b3f71 100644 --- a/package.json +++ b/package.json @@ -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." + } + } } } } diff --git a/src/backend/backend.ts b/src/backend/backend.ts index f532f0ed..d750acc7 100644 --- a/src/backend/backend.ts +++ b/src/backend/backend.ts @@ -47,6 +47,7 @@ export interface SSHArguments { x11host: string; bootstrap: string; sourceFileMap: { [index: string]: string }; + algorithms: any; } export interface IBackend { diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 007fd209..cf3fdccf 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -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 = {};