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 Cluster Agent API to be served only with TLS 1.3 by default #11443

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/cluster-agent/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ func StartServer() error {

tlsConfig := tls.Config{
Certificates: []tls.Certificate{rootTLSCert},
MinVersion: tls.VersionTLS13,
}

if config.Datadog.GetBool("force_tls_12") {
tlsConfig.MinVersion = tls.VersionTLS12
if config.Datadog.GetBool("cluster_agent.allow_legacy_tls") {
tlsConfig.MinVersion = tls.VersionTLS10
}

srv := &http.Server{
Expand Down
3 changes: 1 addition & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ func InitConfig(config Config) {

// Datadog cluster agent
config.BindEnvAndSetDefault("cluster_agent.enabled", false)
config.BindEnvAndSetDefault("cluster_agent.allow_legacy_tls", false)
config.BindEnvAndSetDefault("cluster_agent.auth_token", "")
config.BindEnvAndSetDefault("cluster_agent.url", "")
config.BindEnvAndSetDefault("cluster_agent.kubernetes_service_name", "datadog-cluster-agent")
Expand Down Expand Up @@ -1370,7 +1371,6 @@ func getMainInfraEndpointWithConfig(config Config) string {

// GetMainEndpointWithConfig implements the logic to extract the DD URL from a config, based on `site` and ddURLKey
func GetMainEndpointWithConfig(config Config, prefix string, ddURLKey string) (resolvedDDURL string) {

if envVarAreSetAndNotEqual(config, "DD_DD_URL", "DD_URL") {
log.Warnf("'DD_URL' and 'DD_DD_URL' variables are both set in environment. URL key is set to 'DD_DD_URL' value")
}
Expand All @@ -1388,7 +1388,6 @@ func GetMainEndpointWithConfig(config Config, prefix string, ddURLKey string) (r

// envVarAreSetAndNotEqual returns true if two given variables are set in environment and are not equal.
func envVarAreSetAndNotEqual(config Config, lhsName string, rhsName string) bool {

lhsValue, lhsIsSet := os.LookupEnv(lhsName)
rhsValue, rhsIsSet := os.LookupEnv(rhsName)

Expand Down
3 changes: 3 additions & 0 deletions releasenotes-dca/notes/min-tls-13-4ea49e60e2378c37.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
security:
- |
Cluster Agent API (only used by Node Agents) is now only server with TLS >= 1.3 by default. Setting "cluster_agent.allow_legacy_tls" to true allows to fallback to TLS 1.0.