mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-01 18:14:02 +03:00
Compare commits
6 Commits
617a6dd472
...
51d977a26b
Author | SHA1 | Date | |
---|---|---|---|
|
51d977a26b | ||
|
7114e41fc7 | ||
|
53560854a2 | ||
|
10c974f272 | ||
|
31e35541ce | ||
|
09ddd1f8b5 |
@ -205,10 +205,22 @@ export class SSHSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const hostVerifiedPromise: Promise<void> = new Promise((resolve, reject) => {
|
const hostVerifiedPromise: Promise<void> = new Promise((resolve, reject) => {
|
||||||
|
let hostkeyOld = ''
|
||||||
|
let isKeyVerified = false
|
||||||
ssh.on('handshake', async handshake => {
|
ssh.on('handshake', async handshake => {
|
||||||
|
if (isKeyVerified) {
|
||||||
|
resolve()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (hostkeyOld !== handshake.serverHostKey) {
|
||||||
|
hostkeyOld = handshake.serverHostKey
|
||||||
if (!await this.verifyHostKey(handshake)) {
|
if (!await this.verifyHostKey(handshake)) {
|
||||||
this.ssh.end()
|
this.ssh.end()
|
||||||
reject(new Error('Host key verification failed'))
|
reject(new Error('Host key verification failed'))
|
||||||
|
isKeyVerified = false
|
||||||
|
}else {
|
||||||
|
isKeyVerified = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.logger.info('Handshake complete:', handshake)
|
this.logger.info('Handshake complete:', handshake)
|
||||||
resolve()
|
resolve()
|
||||||
|
Loading…
Reference in New Issue
Block a user