1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-23 02:22:02 +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
dist
*/dist
*.xcworkspacedata
*.xcuserstate

View File

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

View File

@ -11,6 +11,12 @@ import { PromptModalComponent } from '../components/promptModal.component'
import { PasswordStorageService } from './passwordStorage.service'
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()
export class SSHService {
private logger: Logger
@ -67,7 +73,7 @@ export class SSHService {
let ssh = new Client()
let connected = false
let savedPassword: string = null
await new Promise((resolve, reject) => {
await new Promise(async (resolve, reject) => {
ssh.on('ready', () => {
connected = true
if (savedPassword) {
@ -99,7 +105,14 @@ export class SSHService {
let agent: string = null
if (this.hostApp.platform === Platform.Windows) {
agent = 'pageant'
let pageantRunning = new Promise<boolean>(resolve => {
windowsProcessTree.getProcessList(list => {
resolve(list.some(x => x.name === 'pageant.exe'))
}, 0)
})
if (await pageantRunning) {
agent = 'pageant'
}
} else {
agent = process.env.SSH_AUTH_SOCK
}

View File

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

File diff suppressed because it is too large Load Diff