1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-29 09:18:26 +03:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Chen Fansong
51d977a26b
Merge 7114e41fc7 into d9363b5de1 2024-10-08 11:25:58 +11:00
Chen Fansong
7114e41fc7
Merge branch 'Eugeny:master' into master 2024-04-20 12:25:53 +08:00
cfs4819
53560854a2 Fix SSH X11 Repeated Handshake Issue 2024-03-26 10:56:06 +08:00
cfs4819
10c974f272 Fix SSH X11 Repeated Handshake Issue 2024-03-22 15:00:47 +08:00
cfs4819
31e35541ce Fix SSH X11 Repeated Handshake Issue 2024-03-22 14:57:28 +08:00
cfs4819
09ddd1f8b5 Fix SSH X11 Repeated Handshake Issue 2024-03-22 14:36:06 +08:00

View File

@ -205,10 +205,22 @@ export class SSHSession {
}
const hostVerifiedPromise: Promise<void> = new Promise((resolve, reject) => {
let hostkeyOld = ''
let isKeyVerified = false
ssh.on('handshake', async handshake => {
if (!await this.verifyHostKey(handshake)) {
this.ssh.end()
reject(new Error('Host key verification failed'))
if (isKeyVerified) {
resolve()
return
}
if (hostkeyOld !== handshake.serverHostKey) {
hostkeyOld = handshake.serverHostKey
if (!await this.verifyHostKey(handshake)) {
this.ssh.end()
reject(new Error('Host key verification failed'))
isKeyVerified = false
}else {
isKeyVerified = true
}
}
this.logger.info('Handshake complete:', handshake)
resolve()