go/net/ssh: allow multiple AuthMethods
Change-Id: Icdd8c12bc959f87271db4abba3219edd0ea1b7ca
Reviewed-on: https://review.monogon.dev/c/monogon/+/3434
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/go/net/ssh/ssh_client.go b/go/net/ssh/ssh_client.go
index 1c52484..d0a0518 100644
--- a/go/net/ssh/ssh_client.go
+++ b/go/net/ssh/ssh_client.go
@@ -36,8 +36,8 @@
// DirectClient implements Client (and Connection) using
// golang.org/x/crypto/ssh.
type DirectClient struct {
- AuthMethod ssh.AuthMethod
- Username string
+ AuthMethods []ssh.AuthMethod
+ Username string
}
type directConn struct {
@@ -54,9 +54,7 @@
}
conf := &ssh.ClientConfig{
User: p.Username,
- Auth: []ssh.AuthMethod{
- p.AuthMethod,
- },
+ Auth: p.AuthMethods,
// Ignore the host key, since it's likely the first time anything logs into
// this device, and also because there's no way of knowing its fingerprint.
HostKeyCallback: ssh.InsecureIgnoreHostKey(),