/
githubmirror
/
terraform
Обзор
Документация
Войти
/
githubmirror
/
terraform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
internal/communicator/ssh/password.go
31 строка
865 B
Radek Simko
make copyrightfix
17 фев 2026, 16:56
17 фев 2026, 16:56
0fe906f
Код
Авторство
О чём код?
// Copyright IBM Corp. 2014, 2026 // SPDX-License-Identifier: BUSL-1.1 package ssh import ( "log" "golang.org/x/crypto/ssh" ) // An implementation of ssh.KeyboardInteractiveChallenge that simply sends // back the password for all questions. The questions are logged. func PasswordKeyboardInteractive(password string) ssh.KeyboardInteractiveChallenge { return func(user, instruction string, questions []string, echos []bool) ([]string, error) { log.Printf("Keyboard interactive challenge: ") log.Printf("-- User: %s", user) log.Printf("-- Instructions: %s", instruction) for i, question := range questions { log.Printf("-- Question %d: %s", i+1, question) } // Just send the password back for all questions answers := make([]string, len(questions)) for i := range answers { answers[i] = string(password) } return answers, nil } }