Repository navigation
repository: negotiate the host key algorithms of known_hosts - #249
Open
KakatkarAkshay wants to merge 1 commit into
Open
KakatkarAkshay wants to merge 1 commit into
KakatkarAkshay wants to merge 1 commit into
Conversation
go-git v5.18.0 no longer derives HostKeyAlgorithms from a custom HostKeyCallback, so the server could present a host key type that known_hosts doesn't pin and the fetch failed with "knownhosts: key mismatch". The callback and the algorithms now both come from the known_hosts database. Fixes nlewo#248.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #248.
go-git v5.18.0 (#241) no longer derives
HostKeyAlgorithmsfrom a caller-providedHostKeyCallback. comin set only the callback, sox/crypto/sshnegotiated its default host key order. A server like GitHub then presented a key typeknown_hostsdoesn't pin, and every fetch failed withknownhosts: key mismatch.comin now loads
known_hostswithssh.NewKnownHostsDband sets bothHostKeyCallbackandHostKeyAlgorithmsfrom it, for the remote's host and port. It's the same thing go-git does for its own default callback. The deploy key setup moved intosshAuthso it can be tested on its own.The new test pins only an ed25519 host key, for a scp-like remote on the default port and an
ssh://remote on port 2222, and checks that the client config only offersssh-ed25519. Without the fix,HostKeyAlgorithmsisnilin both cases.I've been running into this on two nix-darwin hosts and one NixOS host that pin only GitHub's ed25519 key.