1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-23 10:32:29 +03:00

only enable agent forwarding on windows when pageant is running (fixes #496)

This commit is contained in:
Eugene Pankov 2018-12-15 15:19:47 +01:00
parent 76633db25e
commit 384744ec44
5 changed files with 29 additions and 370 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ node_modules
build/files.wxs build/files.wxs
dist dist
*/dist
*.xcworkspacedata *.xcworkspacedata
*.xcuserstate *.xcuserstate

View File

@ -36,7 +36,8 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"wincredmgr": "^2.0.0", "wincredmgr": "^2.0.0",
"xkeychain": "^0.0.6" "xkeychain": "^0.0.6",
"windows-process-tree": "^0.2.3"
}, },
"dependencies": { "dependencies": {
"ssh2": "^0.5.5" "ssh2": "^0.5.5"

View File

@ -11,6 +11,12 @@ import { PromptModalComponent } from '../components/promptModal.component'
import { PasswordStorageService } from './passwordStorage.service' import { PasswordStorageService } from './passwordStorage.service'
const { SSH2Stream } = require('ssh2-streams') const { SSH2Stream } = require('ssh2-streams')
let windowsProcessTree
try {
windowsProcessTree = require('windows-process-tree/build/Release/windows_process_tree.node')
} catch (e) {
} // tslint:disable-line
@Injectable() @Injectable()
export class SSHService { export class SSHService {
private logger: Logger private logger: Logger
@ -67,7 +73,7 @@ export class SSHService {
let ssh = new Client() let ssh = new Client()
let connected = false let connected = false
let savedPassword: string = null let savedPassword: string = null
await new Promise((resolve, reject) => { await new Promise(async (resolve, reject) => {
ssh.on('ready', () => { ssh.on('ready', () => {
connected = true connected = true
if (savedPassword) { if (savedPassword) {
@ -99,7 +105,14 @@ export class SSHService {
let agent: string = null let agent: string = null
if (this.hostApp.platform === Platform.Windows) { if (this.hostApp.platform === Platform.Windows) {
let pageantRunning = new Promise<boolean>(resolve => {
windowsProcessTree.getProcessList(list => {
resolve(list.some(x => x.name === 'pageant.exe'))
}, 0)
})
if (await pageantRunning) {
agent = 'pageant' agent = 'pageant'
}
} else { } else {
agent = process.env.SSH_AUTH_SOCK agent = process.env.SSH_AUTH_SOCK
} }

View File

@ -48,6 +48,7 @@ module.exports = {
'wincredmgr', 'wincredmgr',
'path', 'path',
'ngx-toastr', 'ngx-toastr',
'windows-process-tree/build/Release/windows_process_tree.node',
/^rxjs/, /^rxjs/,
/^@angular/, /^@angular/,
/^@ng-bootstrap/, /^@ng-bootstrap/,

File diff suppressed because it is too large Load Diff