how can i input the password use keyboard-interactive
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript, node.js, typescript
- 領域
- backend, networking
調査の方向性
提供された node-ssh の接続オプションで失敗を再現し、その後 node-ssh の認証処理と、バンドルされている ssh2 クライアントのフローを確認します。onKeyboardInteractive と tryKeyboard のドキュメントに記載された動作を authHandler の例と比較します。keyboard-interactive コールバックに到達し、クライアント認証エラーなしでパスワードの再試行が完了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
env
i want to connet to the different host, some of them no config the no password login,so i need to try to connect the host no password firstly, if faild ,i'll use prompts ask the user to input the password to retry.
ssh2
when i use ssh2 to achieve it, the code like this:
conn.on('ready', () => {
// some code
}).connect({
host,
port: 22,
username,
tryKeyboard: true,
authHandler: (methodsLeft, partialSuccess, callback) => {
prompts([{
type: 'password',
name: 'newPassword',
message: `input the password of ${hostItem}:`,
}]).then(({newPassword}) => {
callback({type: 'password', username, password: newPassword})
})
},
})
the code workd very well
node-ssh
the ssh2 hard to exec the multiple command on one connect. but the node-ssh is easy to do that.
when i try to connect , the problem was happen,
Error: All configured authentication methods failed
at doNextAuth (E:\workSpace\my-project-name\node_modules\node-ssh\node_modules\ssh2\lib\client.js:413:17)
at tryNextAuth (E:\workSpace\my-project-name\node_modules\node-ssh\node_modules\ssh2\lib\client.js:484:5)
at SSH2Stream.onUSERAUTH_FAILURE (E:\workSpace\my-project-name\node_modules\node-ssh\node_modules\ssh2\lib\client.js:597:5)
at SSH2Stream.emit (events.js:310:20)
at parsePacket (E:\workSpace\my-project-name\node_modules\ssh2-streams\lib\ssh.js:3682:10)
at SSH2Stream._transform (E:\workSpace\my-project-name\node_modules\ssh2-streams\lib\ssh.js:701:13)
at SSH2Stream.Transform._read (_stream_transform.js:191:10)
at SSH2Stream._read (E:\workSpace\my-project-name\node_modules\ssh2-streams\lib\ssh.js:253:15)
at SSH2Stream.Transform._write (_stream_transform.js:179:12)
at doWrite (_stream_writable.js:442:12) {
level: 'client-authentication'
}
from other issus i knew the authHandler not support so i tyied the onKeyboardInteractive, but obviously,it not be called ,because i can't see the console mark.
my code are following:
ssh.connect({
host,
username,
port: 22,
tryKeyboard: true,
debug: console.log(),
onKeyboardInteractive(name, instructions, instructionsLang, prompts, finish) {
console.log('🔊🚀🚀🚀🔊 ~ RollbackCommand ~', prompts)
if (prompts.length > 0 && prompts[0].prompt.toLowerCase().includes('password')) {
prompts([{
type: 'password',
name: 'newPassword',
message: `input the password of ${hostItem}:`,
}]).then(({newPassword}) => {
finish([newPassword])
})
}
},
})
i'm a newcoming ,so i'm not sure it's my code error or i use this API in wrong way.
i need some help, thx
- 主要言語
- TypeScript
- スター
- 1k
- フォーク
- 94
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
steelbrain/node-ssh のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
steelbrain/node-ssh#487 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
steelbrain/node-ssh#482 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
steelbrain/node-ssh#474 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
steelbrain/node-ssh#473 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
steelbrain/node-ssh#472 ·
steelbrain/node-ssh の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundariesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
lingdojo/kana-dojo#34127 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
osmlab/name-suggestion-index#13104 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100