Forum Discussion
acorreia
Nov 03, 2021Nimbostratus
Golang SSH script for F5?
I am testing a small program written in go to SSH into an F5 do some work but still getting a failure to connect . Has anyone else ran into a similar issue? Code is below: package main impo...
boyeolowoyeye
Apr 27, 2023Nimbostratus
Hi,
Using inspiration from the golang tmsh library GitHub - yukirii/go-tmsh: Golang wrapper library & CLI tool for BIG-IP Traffic Management Shell (TMSH). You just need to handle the keyboard interactions.
By creating challenge response struct and function.
type keyboardInteractive map[string]string
func (ki keyboardInteractive) Challenge(user, instruction string, questions []string, echos []bool) ([]string, error) {
var answers []string
for _, q := range questions {
answers = append(answers, ki[q])
}
return answers, nil
}
answers := keyboardInteractive(map[string]string{
"Password: ": "*****",
})
Then your config will look like so now
config := &ssh.ClientConfig{
User: "******",
Auth: []ssh.AuthMethod{
ssh.Password("*******"),
ssh.KeyboardInteractive(
answers.Challenge,
),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects