-
Notifications
You must be signed in to change notification settings - Fork 810
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
SSH git clone fails after update to v5.13.0. Specifically, the issue comes from ssh.FixedHostKey(hostKey)
where we try to set the host key callback. The following works fine with v5.12.0
, but fails with v5.13.0
; the error is ssh: handshake failed: ssh: host key mismatch
. So I dont think it is actually a host key mismatch, but something that changed in this module (or a dependency).
hostKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(serverHostKey))
if err != nil {
return "", fmt.Errorf("unable to parse host key: %w", err)
}
pk, err := ssh2.NewPublicKeys(gitUser, []byte(repoPrivateKey), "")
if err != nil {
return "", fmt.Errorf("unable to create git public key: %w", err)
}
pk.HostKeyCallback = ssh.FixedHostKey(hostKey)
deployBranch := gitplum.NewBranchReferenceName(gitBranch)
r, err := git.PlainClone(destDirPath, false, &git.CloneOptions{
URL: repoURL,
Auth: pk,
})
if err != nil {
return "", fmt.Errorf("unable to clone git repo [%s] (branch [%s]): %w", repoURL, deployBranch, err)
}
I can use insecure and it works, but obviously I would like to verify the host key:
pk.HostKeyCallback = ssh.InsecureIgnoreHostKey()
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working