99 "math/big"
1010 "math/rand"
1111 "path/filepath"
12+ "slices"
1213 "strings"
1314 "sync"
1415 "time"
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
6577type 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