Skip to content

Commit 0196e38

Browse files
committed
remove the Extension setting
always add ext-info-s to KEX and send the SSH_MSG_EXT_INFO message if we received ext-info-c from the client Signed-off-by: Nicola Murino <[email protected]>
1 parent 7fe3443 commit 0196e38

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

ssh/common.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,9 @@ const (
2828
const (
2929
extInfoServer = "ext-info-s"
3030
extInfoClient = "ext-info-c"
31-
ExtServerSigAlgs = "server-sig-algs"
31+
extServerSigAlgs = "server-sig-algs"
3232
)
3333

34-
// defaultExtensions lists extensions enabled by default.
35-
var defaultExtensions = []string{
36-
ExtServerSigAlgs,
37-
}
38-
3934
// supportedCiphers lists ciphers we support but might not recommend.
4035
var supportedCiphers = []string{
4136
"aes128-ctr", "aes192-ctr", "aes256-ctr",
@@ -282,10 +277,6 @@ type Config struct {
282277
// The allowed MAC algorithms. If unspecified then a sensible default
283278
// is used.
284279
MACs []string
285-
286-
// A list of enabled extensions. If unspecified then a sensible
287-
// default is used
288-
Extensions []string
289280
}
290281

291282
// SetDefaults sets sensible values for unset fields in config. This is
@@ -315,10 +306,6 @@ func (c *Config) SetDefaults() {
315306
c.MACs = supportedMACs
316307
}
317308

318-
if c.Extensions == nil {
319-
c.Extensions = defaultExtensions
320-
}
321-
322309
if c.RekeyThreshold == 0 {
323310
// cipher specific default
324311
} else if c.RekeyThreshold < minRekeyThreshold {

ssh/handshake.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,7 @@ func (t *handshakeTransport) sendKexInit() error {
479479
msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, keyFormat)
480480
}
481481
}
482-
if contains(t.config.Extensions, ExtServerSigAlgs) {
483-
msg.KexAlgos = append(msg.KexAlgos, extInfoServer)
484-
}
482+
msg.KexAlgos = append(msg.KexAlgos, extInfoServer)
485483
} else {
486484
msg.ServerHostKeyAlgos = t.hostKeyAlgorithms
487485

@@ -642,13 +640,13 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error {
642640

643641
if !isClient {
644642
// We're on the server side, see if the client sent the extension signal
645-
if !t.extInfoSent && contains(clientInit.KexAlgos, extInfoClient) && contains(t.config.Extensions, ExtServerSigAlgs) {
643+
if !t.extInfoSent && contains(clientInit.KexAlgos, extInfoClient) {
646644
// The other side supports ext info, an ext info message hasn't been sent this session,
647645
// and we have at least one extension enabled, so send an SSH_MSG_EXT_INFO message.
648646
extensions := map[string][]byte{}
649647
// We're the server, the client supports SSH_MSG_EXT_INFO and server-sig-algs
650648
// is enabled. Prepare the server-sig-algos extension message to send.
651-
extensions[ExtServerSigAlgs] = []byte(strings.Join(supportedServerSigAlgs, ","))
649+
extensions[extServerSigAlgs] = []byte(strings.Join(supportedServerSigAlgs, ","))
652650
var payload []byte
653651
for k, v := range extensions {
654652
payload = appendInt(payload, len(k))

0 commit comments

Comments
 (0)