-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssh: add server side support for [email protected] protocol extension
Fixes golang/go#62390 Change-Id: Ie4dc577fb55b45a0c26a9e2dc5903af2bd382e00 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/524775 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Run-TryBot: Nicola Murino <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]>
- Loading branch information
1 parent
ec07f4e
commit 833695f
Showing
4 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -647,16 +647,20 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { | |
|
||
// On the server side, after the first SSH_MSG_NEWKEYS, send a SSH_MSG_EXT_INFO | ||
// message with the server-sig-algs extension if the client supports it. See | ||
// RFC 8308, Sections 2.4 and 3.1. | ||
// RFC 8308, Sections 2.4 and 3.1, and [PROTOCOL], Section 1.9. | ||
if !isClient && firstKeyExchange && contains(clientInit.KexAlgos, "ext-info-c") { | ||
extInfo := &extInfoMsg{ | ||
NumExtensions: 1, | ||
Payload: make([]byte, 0, 4+15+4+len(supportedPubKeyAuthAlgosList)), | ||
NumExtensions: 2, | ||
Payload: make([]byte, 0, 4+15+4+len(supportedPubKeyAuthAlgosList)+4+16+4+1), | ||
} | ||
extInfo.Payload = appendInt(extInfo.Payload, len("server-sig-algs")) | ||
extInfo.Payload = append(extInfo.Payload, "server-sig-algs"...) | ||
extInfo.Payload = appendInt(extInfo.Payload, len(supportedPubKeyAuthAlgosList)) | ||
extInfo.Payload = append(extInfo.Payload, supportedPubKeyAuthAlgosList...) | ||
extInfo.Payload = appendInt(extInfo.Payload, len("[email protected]")) | ||
extInfo.Payload = append(extInfo.Payload, "[email protected]"...) | ||
extInfo.Payload = appendInt(extInfo.Payload, 1) | ||
extInfo.Payload = append(extInfo.Payload, "0"...) | ||
if err := t.conn.writePacket(Marshal(extInfo)); err != nil { | ||
return err | ||
} | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,6 +231,12 @@ func (m *mux) onePacket() error { | |
return m.handleChannelOpen(packet) | ||
case msgGlobalRequest, msgRequestSuccess, msgRequestFailure: | ||
return m.handleGlobalPacket(packet) | ||
case msgPing: | ||
var msg pingMsg | ||
if err := Unmarshal(packet, &msg); err != nil { | ||
return fmt.Errorf("failed to unmarshal [email protected] message: %w", err) | ||
} | ||
return m.sendMessage(pongMsg(msg)) | ||
} | ||
|
||
// assume a channel packet. | ||
|