Repository navigation
Conversation
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.
ssh-keyscan -H(and OpenSSH withHashKnownHosts yes) writes one hashed line per key type, each with its own salt:KnownHostsKeys#keys_forreturned the key from the first hashed line that matched the host, and ignored the others. If the server then negotiated a different key type (e.g.ssh-ed25519while the first line isssh-rsa), verification failed withNet::SSH::HostKeyMismatch, even though the key is inknown_hosts. Unhashed lines don't have this problem, because their keys are collected per host.This change collects the keys from every matching hashed line instead. The added test uses a hashed fixture with GitHub's three published host keys. Before the change, only the
ssh-rsakey was returned.Reported downstream in basecamp/kamal#1814.
Not changed here: a file mixing unhashed and hashed lines for the same host still returns only the unhashed keys, and hashed lines for the name and the IP aren't combined. Both differ from
Net::SSH::KnownHosts, as does the unhashed case in #585. They could be handled separately if wanted.The functional suite's
test_ssh_option_mergefailure on CI with net-ssh ≥ 8.1 is unrelated, and is fixed in #586.