Skip to content

Commit a878079

Browse files
committed
Apply less restrictive signature key algorithm check
Addresses same issue as golang/go#56342
1 parent 8e447d8 commit a878079

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ssh/client_auth.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,12 @@ func confirmKeyAck(key PublicKey, algo string, c packetConn) (bool, error) {
371371
if err := Unmarshal(packet, &msg); err != nil {
372372
return false, err
373373
}
374-
if msg.Algo != algo || !bytes.Equal(msg.PubKey, pubKey) {
374+
// if msg.Algo != algo || !bytes.Equal(msg.PubKey, pubKey) {
375+
// Some SSH servers do not respond with the approviate given algorithm that
376+
// was selected based on the server-sig-algs.
377+
// We therefore want to accept any algorithm that is acceptable to us.
378+
keyAlgos := algorithmsForKeyFormat(key.Type())
379+
if !contains(keyAlgos, msg.Algo) || !bytes.Equal(msg.PubKey, pubKey) {
375380
return false, nil
376381
}
377382
return true, nil

0 commit comments

Comments
 (0)