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

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

Merged
merged 3 commits into from
Jun 24, 2021

Conversation

dnephin
Copy link
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
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
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!

}

cmpTLSConfig := cmp.Options{
cmpopts.IgnoreFields(tls.Config{}, "GetCertificate", "GetClientCertificate"),
Copy link
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
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
Contributor

🍒 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
Contributor

🍒❌ 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