Skip to content

Commit

Permalink
Fix SSH X11 Repeated Handshake Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cfs4819 committed Mar 26, 2024
1 parent 10c974f commit 5356085
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tabby-ssh/src/session/ssh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ export class SSHSession {
}

const hostVerifiedPromise: Promise<void> = new Promise((resolve, reject) => {
let hostkey_old = ''
let hostkeyOld = ''
let isKeyVerified = false
ssh.on('handshake', async handshake => {
if (isKeyVerified) {
resolve()
return
}
if (hostkey_old !== handshake.serverHostKey) {
hostkey_old = handshake.serverHostKey
if (hostkeyOld !== handshake.serverHostKey) {
hostkeyOld = handshake.serverHostKey
if (!await this.verifyHostKey(handshake)) {
this.ssh.end()
reject(new Error('Host key verification failed'))
Expand Down

0 comments on commit 5356085

Please sign in to comment.