Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

hessjcg
Copy link
Collaborator

@hessjcg hessjcg commented Mar 12, 2025

When the connector is configured with a DNS name, or if the Cloud SQL Instance reports that it has a DNS Name,
the connector will use standard TLS hostname validation when checking the server certificate. Now, the server's
TLS certificate must contain a SAN record with the instance's DNS name.

The ConnectSettings API added a field dns_names which contains all of the valid DNS names for
an instance.

See also: GoogleCloudPlatform/cloud-sql-go-connector#954

@hessjcg hessjcg force-pushed the cas-dns-names-field branch from 9f5aeb5 to 5153e7c Compare March 12, 2025 03:58
@hessjcg hessjcg marked this pull request as ready for review March 12, 2025 04:04
@hessjcg hessjcg requested a review from a team as a code owner March 12, 2025 04:04
Copy link
Collaborator

@jackwotherspoon jackwotherspoon left a comment

Choose a reason for hiding this comment

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

@hessjcg Is the plan to manually test all these PRs? We need to make sure we do not break PSC with these changes.

"expirationTime": str(self.cert_expiration),
},
"dnsName": "abcde.12345.us-central1.sql.goog",
"dnsNames": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

we probably should also test that no dnsNames (fallback options) also still works...

I am fine if you would rather create a new issue on the repo to track improving testing (rotate certs, dnsName fallback test, etc.) with some details.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated to test both paths. Also I added test in test_instance.py for legacy dns name.

@hessjcg hessjcg force-pushed the cas-dns-names-field branch from 5153e7c to 73246b8 Compare March 12, 2025 18:49
@hessjcg hessjcg force-pushed the cas-dns-names-field branch from 73246b8 to bbd29ad Compare March 12, 2025 19:08
@hessjcg hessjcg requested a review from jackwotherspoon March 12, 2025 19:09
Copy link
Collaborator

@jackwotherspoon jackwotherspoon left a comment

Choose a reason for hiding this comment

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

LGTM as long as you have manually tested changes on a real instance 👍

@hessjcg hessjcg changed the title refactor: Use new ConnectSettings.DnsNames field to validate the server TLS certificate. feat: Use standard TLS hostname validation for instances with DNS names Mar 19, 2025
@hessjcg hessjcg changed the title feat: Use standard TLS hostname validation for instances with DNS names refactor: Use new ConnectSettings.DnsNames field to validate the server TLS certificate. Mar 19, 2025
@hessjcg hessjcg merged commit 80ca379 into main Mar 20, 2025
15 checks passed
@hessjcg hessjcg deleted the cas-dns-names-field branch March 20, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants