diff options
| author | Nicola Murino <nicola.murino@gmail.com> | 2023-08-31 14:41:07 +0200 |
|---|---|---|
| committer | Filippo Valsorda <filippo@golang.org> | 2023-10-04 16:04:50 +0000 |
| commit | 833695f0a57b3037385dc9c0073bc88773cae6f3 (patch) | |
| tree | ca40d17e63b8b74af47c3708e4e92c0b88fac36c /ssh/handshake.go | |
| parent | ec07f4e35b9ef2fcfd790dd9437ef46bd64b3a4b (diff) | |
| download | go-x-crypto-833695f0a57b3037385dc9c0073bc88773cae6f3.tar.xz | |
ssh: add server side support for ping@openssh.com protocol extension
Fixes golang/go#62390
Change-Id: Ie4dc577fb55b45a0c26a9e2dc5903af2bd382e00
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/524775
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Nicola Murino <nicola.murino@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Diffstat (limited to 'ssh/handshake.go')
| -rw-r--r-- | ssh/handshake.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ssh/handshake.go b/ssh/handshake.go index b95b112..70a7369 100644 --- a/ssh/handshake.go +++ b/ssh/handshake.go @@ -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("ping@openssh.com")) + extInfo.Payload = append(extInfo.Payload, "ping@openssh.com"...) + extInfo.Payload = appendInt(extInfo.Payload, 1) + extInfo.Payload = append(extInfo.Payload, "0"...) if err := t.conn.writePacket(Marshal(extInfo)); err != nil { return err } |
