Skip to content

Commit

Permalink
util: Disable 3DES ciphers for TLS connections (pingcap#27690) (pingc…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Sep 22, 2021
1 parent cd8fb24 commit 5bd54df
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions util/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,28 @@ func LoadTLSCertificates(ca, key, cert string, autoTLS bool) (tlsConfig *tls.Con
}
}
}

// This excludes ciphers listed in tls.InsecureCipherSuites() and can be used to filter out more
var cipherSuites []uint16
var cipherNames []string
for _, sc := range tls.CipherSuites() {
switch sc.ID {
case tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA:
logutil.BgLogger().Info("Disabling weak cipherSuite", zap.String("cipherSuite", sc.Name))
default:
cipherNames = append(cipherNames, sc.Name)
cipherSuites = append(cipherSuites, sc.ID)
}

}
logutil.BgLogger().Info("Enabled ciphersuites", zap.Strings("cipherNames", cipherNames))

/* #nosec G402 */
tlsConfig = &tls.Config{
Certificates: []tls.Certificate{tlsCert},
ClientCAs: certPool,
ClientAuth: clientAuthPolicy,
CipherSuites: cipherSuites,
}
return
}
Expand Down

0 comments on commit 5bd54df

Please sign in to comment.