Skip to content

Commit ac5a527

Browse files
committed
Add an http2 required ciphersuite for raft server
Summary: The RAFT server on port 5766 needs either TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 in the list of cipher suites in the config. Not including one of those cipher suites would prevent the server from starting with an error like this: ``` 2024-07-22T00:45:02.219 INFO 78 1@runtime/asm_amd64.s:1594 the server is terminating due to a fatal error (see the KRONOS channel for details) 2024-07-22T00:45:02.219 FATAL 78 13@runtime/asm_amd64.s:1594 Failed to serve rafthttp (‹http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)›)goroutine 78 [running]: runtime/debug.Stack() GOROOT/src/runtime/debug/stack.go:24 +0x65 github.com/cockroachdb/cockroach/pkg/util/log.(*loggerT).outputLogEntry(0xc00006cc00, {{{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}}, 0x17e4625b63df8148, ...}) github.com/cockroachdb/cockroach/pkg/util/log/clog.go:261 +0xb8 github.com/cockroachdb/cockroach/pkg/util/log.logfDepthInternal({0x641aff8, 0xc000128000}, 0x4, 0x4, 0xd, 0x0?, {0x555afe6, 0x1d}, {0xc00077a490, 0x1, ...}) github.com/cockroachdb/cockroach/pkg/util/log/channels.go:106 +0x645 github.com/cockroachdb/cockroach/pkg/util/log.logfDepth(...) github.com/cockroachdb/cockroach/pkg/util/log/channels.go:39 github.com/cockroachdb/cockroach/pkg/util/log.loggerKronos.FatalfDepth(...) github.com/cockroachdb/cockroach/bazel-out/k8-fastbuild/bin/pkg/util/log/log_channels_generated.go:6386 github.com/rubrikinc/kronos/kronosutil/log.Fatalf(...) github.com/rubrikinc/kronos/kronosutil/log/external/com_github_rubrikinc_kronos/kronosutil/log/log.go:108 github.com/rubrikinc/kronos/oracle.(*raftNode).serveRaft(0xc001c4a2c0, {0x641aff8, 0xc000128000}, 0xc002721260, 0xc0009987b0) github.com/rubrikinc/kronos/oracle/external/com_github_rubrikinc_kronos/oracle/raft.go:1245 +0x6af created by github.com/rubrikinc/kronos/oracle.(*raftNode).startRaft github.com/rubrikinc/kronos/oracle/external/com_github_rubrikinc_kronos/oracle/raft.go:984 +0x152a ``` This diff adds one of those cipher suites (TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) to the default values. Test Plan: Manual test Reviewers: Sir.Alfred, grammar-police! JIRA Issues: CDM-437246 Differential Revision: https://phabricator.rubrik.com/D332815
1 parent eccc631 commit ac5a527

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

kronosutil/certs.go

+19
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const (
2929
var tls12CipherSuitesDefaultValue = []uint16{
3030
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
3131
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
32+
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, // required for http servers
3233
}
3334

3435
// SSLCreds returns credentials by reading keys and certificates from
@@ -134,6 +135,12 @@ func convertTLSVersionStrToInt(tlsVersionStr string) (uint16, error) {
134135

135136
func GetTLSVersions() (uint16, uint16) {
136137
minVersion := os.Getenv(defaultMinTLSVersionKey)
138+
if minVersion == "" {
139+
log.Infof(
140+
context.Background(),
141+
"TLS versions not provided. Using default values.")
142+
return defaultMinTLSVersionValue, defaultMaxTLSVersionValue
143+
}
137144
minVersionInt, err := convertTLSVersionStrToInt(minVersion)
138145
if err != nil {
139146
log.Errorf(
@@ -143,6 +150,12 @@ func GetTLSVersions() (uint16, uint16) {
143150
return defaultMinTLSVersionValue, defaultMaxTLSVersionValue
144151
}
145152
maxVersion := os.Getenv(defaultMaxTLSVersionKey)
153+
if maxVersion == "" {
154+
log.Infof(
155+
context.Background(),
156+
"TLS versions not provided. Using default values.")
157+
return defaultMinTLSVersionValue, defaultMaxTLSVersionValue
158+
}
146159
maxVersionInt, err := convertTLSVersionStrToInt(maxVersion)
147160
if err != nil {
148161
log.Errorf(
@@ -168,6 +181,12 @@ func GetTLSVersions() (uint16, uint16) {
168181

169182
func GetTls12CipherSuites() []uint16 {
170183
ianaTls12Ciphers := os.Getenv(defaultTLS12CipherSuitesKey)
184+
if ianaTls12Ciphers == "" {
185+
log.Infof(
186+
context.Background(),
187+
"TLS 1.2 cipher suites not provided. Using default values.")
188+
return tls12CipherSuitesDefaultValue
189+
}
171190
convertedCiphers, err := parseTLS12CipherSuites(ianaTls12Ciphers)
172191
if err != nil {
173192
log.Errorf(

0 commit comments

Comments
 (0)