Skip to content

tlsutil: fix ServerName used for health checks that use TLS#10490

Merged
dnephin merged 3 commits into
masterfrom
dnephin/fix-tls-for-health-check
Jun 24, 2021
Merged

tlsutil: fix ServerName used for health checks that use TLS#10490
dnephin merged 3 commits into
masterfrom
dnephin/fix-tls-for-health-check

Conversation

@dnephin
Copy link
Copy Markdown
Contributor

@dnephin dnephin commented Jun 24, 2021

Fixes #10481
Related to #9475 (comment)

When EnableAgentTLSForChecks is disabled we should not default to the agent server or node name.

The specific fix and test case can be seen in the second commit.

In preparation for adding more test cases.
@dnephin dnephin added theme/health-checks Health Check functionality theme/tls Using TLS (Transport Layer Security) or mTLS (mutual TLS) to secure communication backport/1.10 labels Jun 24, 2021
@dnephin dnephin requested a review from a team June 24, 2021 17:45
@github-actions github-actions Bot added theme/certificates Related to creating, distributing, and rotating certificates in Consul and removed theme/health-checks Health Check functionality labels Jun 24, 2021
dnephin added 2 commits June 24, 2021 13:49
Don't use the agent node name or agent server name when EnableAgentTLSForChecks=false.
@dnephin dnephin force-pushed the dnephin/fix-tls-for-health-check branch from c945075 to d09027c Compare June 24, 2021 17:50
@vercel vercel Bot temporarily deployed to Preview – consul-ui-staging June 24, 2021 17:50 Inactive
@vercel vercel Bot temporarily deployed to Preview – consul June 24, 2021 17:50 Inactive
Copy link
Copy Markdown
Contributor

@freddygv freddygv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Comment thread tlsutil/config_test.go
}

cmpTLSConfig := cmp.Options{
cmpopts.IgnoreFields(tls.Config{}, "GetCertificate", "GetClientCertificate"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh cool, TIL about cmp being able to ignore 👍🏽

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ya! This is one of the big reasons I prefer go-cmp over reflect.DeepEqual. Being able to customize the comparison like this makes it much easier to write strict test cases that compare the full return value (instead of picking out parts of the return value and likely missing important fields as they are added).

@dnephin dnephin merged commit bbf52dd into master Jun 24, 2021
@dnephin dnephin deleted the dnephin/fix-tls-for-health-check branch June 24, 2021 18:27
@hc-github-team-consul-core
Copy link
Copy Markdown
Collaborator

🍒 If backport labels were added before merging, cherry-picking will start automatically.

To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/396953.

@hc-github-team-consul-core
Copy link
Copy Markdown
Collaborator

🍒❌ Cherry pick of commit bbf52dd onto release/1.10.x failed! Build Log

dnephin added a commit that referenced this pull request Jun 24, 2021
…heck

tlsutil: fix ServerName used for health checks that use TLS
chrisboulton pushed a commit to bigcommerce/consul that referenced this pull request Jun 28, 2021
…-health-check

tlsutil: fix ServerName used for health checks that use TLS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/certificates Related to creating, distributing, and rotating certificates in Consul theme/tls Using TLS (Transport Layer Security) or mTLS (mutual TLS) to secure communication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Health checks broken since consul 1.10 client update if not using tls_server_name

3 participants