Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change CLI default TLS host name verification behavior #1478

Merged
merged 2 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/cassandra/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func newCQLClientConfig(cli *cli.Context) (*CQLClientConfig, error) {
CertFile: cli.GlobalString(schema.CLIFlagTLSCertFile),
KeyFile: cli.GlobalString(schema.CLIFlagTLSKeyFile),
CaFile: cli.GlobalString(schema.CLIFlagTLSCaFile),
EnableHostVerification: cli.GlobalBool(schema.CLIFlagTLSEnableHostVerification),
EnableHostVerification: !cli.GlobalBool(schema.CLIFlagTLSDisableHostVerification),
}
}

Expand Down
6 changes: 3 additions & 3 deletions tools/cassandra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func buildCLIOptions() *cli.App {
EnvVar: "CASSANDRA_TLS_CA",
},
cli.BoolFlag{
Name: schema.CLIFlagTLSEnableHostVerification,
Usage: "TLS host verification",
EnvVar: "CASSANDRA_TLS_VERIFY_HOST",
Name: schema.CLIFlagTLSDisableHostVerification,
Usage: "Cassandra tls verify server hostname",
wxing1292 marked this conversation as resolved.
Show resolved Hide resolved
EnvVar: "CASSANDRA_TLS_DISABLE_HOST_VERIFICATION",
},
}

Expand Down
2 changes: 1 addition & 1 deletion tools/cli/adminCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func connectToCassandra(c *cli.Context) gocql.Session {
CertFile: c.String(FlagTLSCertPath),
KeyFile: c.String(FlagTLSKeyPath),
CaFile: c.String(FlagTLSCaPath),
EnableHostVerification: c.Bool(FlagTLSEnableHostVerification),
EnableHostVerification: !c.Bool(FlagTLSDisableHostVerification),
}
}

Expand Down
6 changes: 3 additions & 3 deletions tools/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ func NewCliApp() *cli.App {
EnvVar: "TEMPORAL_CLI_TLS_CA",
},
cli.BoolFlag{
Name: FlagTLSEnableHostVerification,
Usage: "validates hostname of temporal cluster against server certificate",
EnvVar: "TEMPORAL_CLI_TLS_ENABLE_HOST_VERIFICATION",
Name: FlagTLSDisableHostVerification,
Usage: "whether to validates hostname of temporal cluster against server certificate",
wxing1292 marked this conversation as resolved.
Show resolved Hide resolved
EnvVar: "TEMPORAL_CLI_TLS_DISABLE_HOST_VERIFICATION",
},
cli.StringFlag{
Name: FlagTLSServerName,
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (b *clientFactory) createTLSConfig(c *cli.Context) (*tls.Config, error) {
certPath := c.GlobalString(FlagTLSCertPath)
keyPath := c.GlobalString(FlagTLSKeyPath)
caPath := c.GlobalString(FlagTLSCaPath)
hostNameVerification := c.GlobalBool(FlagTLSEnableHostVerification)
hostNameVerification := !c.GlobalBool(FlagTLSDisableHostVerification)
serverName := c.GlobalString(FlagTLSServerName)

var host string
Expand Down
5 changes: 2 additions & 3 deletions tools/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,13 @@ const (
FlagTLSCertPath = "tls_cert_path"
FlagTLSKeyPath = "tls_key_path"
FlagTLSCaPath = "tls_ca_path"
FlagTLSEnableHostVerification = "tls_enable_host_verification"
FlagTLSDisableHostVerification = "tls_disable_host_verification"
FlagTLSServerName = "tls_server_name"
FlagDLQType = "dlq_type"
FlagDLQTypeWithAlias = FlagDLQType + ", dt"
FlagMaxMessageCount = "max_message_count"
FlagMaxMessageCountWithAlias = FlagMaxMessageCount + ", mmc"
FlagLastMessageID = "last_message_id"
FlagLastMessageIDWithAlias = FlagLastMessageID + ", lm"
FlagConcurrency = "concurrency"
FlagReportRate = "report_rate"
FlagLowerShardBound = "lower_shard_bound"
Expand Down Expand Up @@ -637,7 +636,7 @@ func getDBFlags() []cli.Flag {
Usage: "DB tls client ca path (tls must be enabled)",
},
cli.BoolFlag{
Name: FlagTLSEnableHostVerification,
Name: FlagTLSDisableHostVerification,
Usage: "DB tls verify hostname and server cert (tls must be enabled)",
},
}
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/persistenceUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func CreateDefaultDBConfig(c *cli.Context) (config.DataStore, error) {
CertFile: c.String(FlagTLSCertPath),
KeyFile: c.String(FlagTLSKeyPath),
CaFile: c.String(FlagTLSCaPath),
EnableHostVerification: c.Bool(FlagTLSEnableHostVerification),
EnableHostVerification: !c.Bool(FlagTLSDisableHostVerification),
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/common/schema/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ const (
CLIFlagTLSKeyFile = "tls-key-file"
// CLIFlagTLSCaFile is the optional tls CA file (tls must be enabled)
CLIFlagTLSCaFile = "tls-ca-file"
// CLIFlagTLSEnableHostVerification enables tls host verification (tls must be enabled)
CLIFlagTLSEnableHostVerification = "tls-enable-host-verification"
// CLIFlagTLSDisableHostVerification disable tls host verification (tls must be enabled)
CLIFlagTLSDisableHostVerification = "tls-disable-host-verification"
)

var rmspaceRegex = regexp.MustCompile(`\s+`)
Expand Down
2 changes: 1 addition & 1 deletion tools/sql/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func parseConnectConfig(cli *cli.Context) (*config.SQL, error) {
CertFile: cli.GlobalString(schema.CLIFlagTLSCertFile),
KeyFile: cli.GlobalString(schema.CLIFlagTLSKeyFile),
CaFile: cli.GlobalString(schema.CLIFlagTLSCaFile),
EnableHostVerification: cli.GlobalBool(schema.CLIFlagTLSEnableHostVerification),
EnableHostVerification: !cli.GlobalBool(schema.CLIFlagTLSDisableHostVerification),
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/sql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ func BuildCLIOptions() *cli.App {
EnvVar: "SQL_TLS_CA_FILE",
},
cli.BoolFlag{
Name: schema.CLIFlagTLSEnableHostVerification,
Name: schema.CLIFlagTLSDisableHostVerification,
Usage: "sql tls verify hostname and server cert (tls must be enabled)",
wxing1292 marked this conversation as resolved.
Show resolved Hide resolved
EnvVar: "SQL_TLS_ENABLE_HOST_VERIFICATION",
EnvVar: "SQL_TLS_DISABLE_HOST_VERIFICATION",
},
}

Expand Down