Adds TLS support to Cassandra State Store (#3230)

Adds TLS support to Cassandra State Store
This commit is contained in:
Bernd Verst 2023-11-20 07:53:57 -08:00 committed by GitHub
parent 1f12557241
commit ba5831b1ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 9 deletions

View File

@ -62,15 +62,16 @@ type Cassandra struct {
}
type cassandraMetadata struct {
Hosts []string
Port int
ProtoVersion int
ReplicationFactor int
Username string
Password string
Consistency string
Table string
Keyspace string
Hosts []string
Port int
ProtoVersion int
ReplicationFactor int
Username string
Password string
Consistency string
Table string
Keyspace string
EnableHostVerification bool
}
// NewCassandraStateStore returns a new cassandra state store.
@ -136,6 +137,11 @@ func (c *Cassandra) createClusterConfig(metadata *cassandraMetadata) (*gocql.Clu
if metadata.Username != "" && metadata.Password != "" {
clusterConfig.Authenticator = gocql.PasswordAuthenticator{Username: metadata.Username, Password: metadata.Password}
}
if metadata.EnableHostVerification {
clusterConfig.SslOpts = &gocql.SslOptions{
EnableHostVerification: true,
}
}
clusterConfig.Port = metadata.Port
clusterConfig.ProtoVersion = metadata.ProtoVersion
cons, err := c.getConsistency(metadata.Consistency)

View File

@ -38,6 +38,11 @@ metadata:
description: "Port for communication."
default: "9042"
example: "8080"
- name: enableHostVerification
type: bool
description: "Enables host verification. Secures the traffic between client server with TLS."
default: "false"
example: "true"
- name: table
type: string
description: "The name of the table to use."