Skip to content

Commit 3a23580

Browse files
authored
Merge pull request #3214 from smerkviladze/remove-weak-tls-ciphers
Remove weak TLS cipher suites
2 parents 5739f4b + 802d314 commit 3a23580

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ca/config.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"math/big"
1010
"math/rand"
1111
"path/filepath"
12+
"slices"
1213
"strings"
1314
"sync"
1415
"time"
@@ -60,6 +61,17 @@ var (
6061
errInvalidJoinToken = errors.New("invalid join token")
6162
)
6263

64+
// strongTLSCiphers defines a secure, modern set of TLS cipher suites
65+
// with known weak algorithms removed.
66+
var strongTLSCiphers = []uint16{
67+
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
68+
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
69+
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
70+
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
71+
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,
72+
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
73+
}
74+
6375
// SecurityConfig is used to represent a node's security configuration. It includes information about
6476
// the RootCA and ServerTLSCreds/ClientTLSCreds transport authenticators to be used for MTLS
6577
type SecurityConfig struct {
@@ -649,6 +661,7 @@ func NewServerTLSConfig(certs []tls.Certificate, rootCAPool *x509.CertPool) (*tl
649661
RootCAs: rootCAPool,
650662
ClientCAs: rootCAPool,
651663
PreferServerCipherSuites: true,
664+
CipherSuites: slices.Clone(strongTLSCiphers),
652665
MinVersion: tls.VersionTLS12,
653666
NextProtos: alpnProtoStr,
654667
}, nil
@@ -665,6 +678,7 @@ func NewClientTLSConfig(certs []tls.Certificate, rootCAPool *x509.CertPool, serv
665678
ServerName: serverName,
666679
Certificates: certs,
667680
RootCAs: rootCAPool,
681+
CipherSuites: slices.Clone(strongTLSCiphers),
668682
MinVersion: tls.VersionTLS12,
669683
}, nil
670684
}

0 commit comments

Comments
 (0)