bump russh for rsa hash autoselection

This commit is contained in:
Eugene 2025-01-25 12:56:54 +01:00
parent a3c5b41bb1
commit d1c1b48502
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
3 changed files with 9 additions and 12 deletions

View File

@ -30,7 +30,7 @@
"native-process-working-directory": "^1.0.2",
"npm": "6",
"rxjs": "^7.5.7",
"russh": "0.1.15",
"russh": "0.1.16",
"source-map-support": "^0.5.20",
"v8-compile-cache": "^2.3.0",
"yargs": "^17.7.2"

View File

@ -3628,10 +3628,10 @@ run-queue@^1.0.0, run-queue@^1.0.3:
dependencies:
aproba "^1.1.1"
russh@0.1.15:
version "0.1.15"
resolved "https://registry.yarnpkg.com/russh/-/russh-0.1.15.tgz#121c0be876c6b70c43910a56fadefffe78588a35"
integrity sha512-md/72roZn8nmgq+U8rVrfqHS82aPancQM5VqrYh7wEMcnK/ll8vNJJcKH/YJv5/8n8Ovxrl8SMwDE5DlfXSL6Q==
russh@0.1.16:
version "0.1.16"
resolved "https://registry.yarnpkg.com/russh/-/russh-0.1.16.tgz#f2192855e71ed4e17cb515d88c4739f05acdea86"
integrity sha512-L6X3liMiTReSv9dOZd3GYObTLlV7YULW0oBxh0lD0HCVDmsnTMRKJFyaA2hd+9vjlPHc7ICHPf5NcReJz+pnCA==
dependencies:
"@napi-rs/cli" "^2.18.3"

View File

@ -576,15 +576,12 @@ export class SSHSession {
if (method.type === 'publickey') {
try {
const key = await this.loadPrivateKey(method.name, method.contents)
const possibleHashAlgs = ['ssh-rsa', 'rsa-sha2-256', 'rsa-sha2-512'].includes(key.algorithm) ? ['sha256', 'sha512', 'sha1'] as const : [null] as const
this.emitServiceMessage(`Trying private key: ${method.name}`)
for (const alg of possibleHashAlgs) {
const result = await this.ssh.authenticateWithKeyPair(this.authUsername, key, alg)
if (result instanceof russh.AuthenticatedSSHClient) {
return result
}
maybeSetRemainingMethods(result)
const result = await this.ssh.authenticateWithKeyPair(this.authUsername, key, null)
if (result instanceof russh.AuthenticatedSSHClient) {
return result
}
maybeSetRemainingMethods(result)
} catch (e) {
this.emitServiceMessage(colors.bgYellow.yellow.black(' ! ') + ` Failed to load private key ${method.name}: ${e}`)
continue