Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ssh algorithms, compaitibale with old embedded devices #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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