Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用凭据登录keyboard-interactive认证模式的服务器时直接报错 #143

Open
Starainrt opened this issue Feb 10, 2025 · 0 comments

Comments

@Starainrt
Copy link

Starainrt commented Feb 10, 2025

问题描述

  1. 添加一个密码认证凭据
  2. 添加一个服务器,使用步骤1中添加的凭据进行登录认证
  3. 服务器sshd配置,取消password认证,只开启keyboard-interactive认证
PasswordAuthentication no
ChallengeResponseAuthentication yes
  1. web上连接服务器,报错:
连接终端失败: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined, 回车重新发起连接

可能的原因

server/app/socket/terminal.jsgetConnectionOptions函数中,如果使用凭据认证,authType 会被设置为凭据中的认证类型,如password

 if (authType === 'credential') {
      let credentialId = await AESDecryptAsync(hostInfo[authType])
      const sshRecord = await credentialsDB.findOneAsync({ _id: credentialId })
      authInfo.authType = sshRecord.authType
      authInfo[authInfo.authType] = await AESDecryptAsync(sshRecord[authInfo.authType])
    } 

而在keyboard的认证代码里,传入的authType的值是credential而不是password, 导致报错。

     let { authType, host, port, username, name, jumpHosts } = targetHostInfo
      .on('keyboard-interactive', function (name, instructions, instructionsLang, prompts, finish) {
          finish([targetConnectionOptions[authType]])
        })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant