From a7687a6fc25f8cbec5fcdbf6f02a1acb4adec850 Mon Sep 17 00:00:00 2001 From: Jonathan Beverley Date: Wed, 26 Feb 2020 19:21:20 -0500 Subject: [PATCH 1/2] Include pagent.exe in installer, Remove check for pageant (fixed Eugeny#350) --- .gitignore | 2 ++ terminus-ssh/package.json | 6 ++++-- terminus-ssh/src/services/ssh.service.ts | 13 +------------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 0319ee50..4a74c238 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ docs/api .electron-symbols sentry.properties sentry-symbols.js + +terminus-ssh/util/pagent.exe diff --git a/terminus-ssh/package.json b/terminus-ssh/package.json index dc1e0d97..9ca98396 100644 --- a/terminus-ssh/package.json +++ b/terminus-ssh/package.json @@ -9,10 +9,12 @@ "typings": "typings/index.d.ts", "scripts": { "build": "webpack --progress --color", - "watch": "webpack --progress --color --watch" + "watch": "webpack --progress --color --watch", + "postinstall": "xcopy /i node_modules\\ssh2\\util\\pagent.exe util\\" }, "files": [ - "dist" + "dist", + "util/pagent.exe" ], "author": "Eugene Pankov", "license": "MIT", diff --git a/terminus-ssh/src/services/ssh.service.ts b/terminus-ssh/src/services/ssh.service.ts index 1e7446f3..a02543a8 100644 --- a/terminus-ssh/src/services/ssh.service.ts +++ b/terminus-ssh/src/services/ssh.service.ts @@ -16,10 +16,6 @@ import { PromptModalComponent } from '../components/promptModal.component' import { PasswordStorageService } from './passwordStorage.service' import { SSHTabComponent } from '../components/sshTab.component' -try { - var windowsProcessTreeNative = require('windows-process-tree/build/Release/windows_process_tree.node') // eslint-disable-line @typescript-eslint/no-var-requires, no-var -} catch { } - @Injectable({ providedIn: 'root' }) export class SSHService { private logger: Logger @@ -185,14 +181,7 @@ export class SSHService { let agent: string|null = null if (this.hostApp.platform === Platform.Windows) { - const pageantRunning = new Promise(resolve => { - windowsProcessTreeNative.getProcessList(list => { // eslint-disable-line block-scoped-var - resolve(list.some(x => x.name === 'pageant.exe')) - }, 0) - }) - if (await pageantRunning) { - agent = 'pageant' - } + agent = 'pageant' } else { agent = process.env.SSH_AUTH_SOCK as string } From 6d187e81178ef05cb2ca00217ecafa6b3db73e9f Mon Sep 17 00:00:00 2001 From: Jonathan Beverley Date: Wed, 26 Feb 2020 19:23:13 -0500 Subject: [PATCH 2/2] Add an option for Agent Forwarding I don't understand why this is on by default, let alone not configurable. Agent forwarding is a significant security concern, and buggy agent forwarding is the cause of a couple existing bugs. --- terminus-ssh/src/api.ts | 1 + .../src/components/editConnectionModal.component.pug | 5 +++++ terminus-ssh/src/services/ssh.service.ts | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/terminus-ssh/src/api.ts b/terminus-ssh/src/api.ts index d78d98ac..4bb9af20 100644 --- a/terminus-ssh/src/api.ts +++ b/terminus-ssh/src/api.ts @@ -36,6 +36,7 @@ export interface SSHConnection { skipBanner?: boolean disableDynamicTitle?: boolean jumpHost?: string + agentForward?: boolean algorithms?: {[t: string]: string[]} } diff --git a/terminus-ssh/src/components/editConnectionModal.component.pug b/terminus-ssh/src/components/editConnectionModal.component.pug index 6ba94a5a..d8f9b81c 100644 --- a/terminus-ssh/src/components/editConnectionModal.component.pug +++ b/terminus-ssh/src/components/editConnectionModal.component.pug @@ -82,6 +82,11 @@ .title X11 forwarding toggle([(ngModel)]='connection.x11') + .form-line + .header + .title Allow Agent Forwarding + toggle([(ngModel)]='connection.agentForward') + .form-line .header .title Tab color diff --git a/terminus-ssh/src/services/ssh.service.ts b/terminus-ssh/src/services/ssh.service.ts index a02543a8..f575087c 100644 --- a/terminus-ssh/src/services/ssh.service.ts +++ b/terminus-ssh/src/services/ssh.service.ts @@ -195,7 +195,7 @@ export class SSHService { privateKey: privateKey || undefined, tryKeyboard: true, agent: agent || undefined, - agentForward: !!agent, + agentForward: session.connection.agentForward && !!agent, keepaliveInterval: session.connection.keepaliveInterval, keepaliveCountMax: session.connection.keepaliveCountMax, readyTimeout: session.connection.readyTimeout,