Commit 4aea99dd authored by SparkSnail's avatar SparkSnail Committed by QuanluZhang
Browse files

Support keyboard-interactive mode in ssh client (#1650)

parent 483232c8
...@@ -209,7 +209,8 @@ export class SSHClientManager { ...@@ -209,7 +209,8 @@ export class SSHClientManager {
const connectConfig: ConnectConfig = { const connectConfig: ConnectConfig = {
host: this.rmMeta.ip, host: this.rmMeta.ip,
port: this.rmMeta.port, port: this.rmMeta.port,
username: this.rmMeta.username }; username: this.rmMeta.username,
tryKeyboard: true };
if (this.rmMeta.passwd !== undefined) { if (this.rmMeta.passwd !== undefined) {
connectConfig.password = this.rmMeta.passwd; connectConfig.password = this.rmMeta.passwd;
} else if (this.rmMeta.sshKeyPath !== undefined) { } else if (this.rmMeta.sshKeyPath !== undefined) {
...@@ -231,6 +232,8 @@ export class SSHClientManager { ...@@ -231,6 +232,8 @@ export class SSHClientManager {
.on('error', (err: Error) => { .on('error', (err: Error) => {
// SSH connection error, reject with error message // SSH connection error, reject with error message
deferred.reject(new Error(err.message)); deferred.reject(new Error(err.message));
}).on("keyboard-interactive", (name, instructions, lang, prompts, finish) => {
finish([this.rmMeta.passwd]);
}) })
.connect(connectConfig); .connect(connectConfig);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment