x/crypto/ssh/knownhosts: can't verify host key if host certificate is sent #33366
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Write the following single line to a file called
known_hosts
:Run the following Go code (in the same directory so that it finds the file or change the path accordingly):
What did you expect to see?
The host key can be verified successfully.
Due to the minimal example which omits any authentication, there will also be an error in the successful case, but a different one:
Note that the connection works fine if the
HostKeyAlgorithms
from the code is uncommitted, which disables requesting host certificates. I found this behavior quite surprising and it took me some time to figure this out. Also this is inconsistent with OpenSSH which, if it receives a host certificate, seems to extract the host public key from it and also check this against the known hosts file.What did you see instead?
The host key can't be verified and the program exits with this error message:
The text was updated successfully, but these errors were encountered: