-
Notifications
You must be signed in to change notification settings - Fork 84
refactor: Use new ConnectSettings.DnsNames field to validate the server TLS certificate. #1242
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
Conversation
9f5aeb5
to
5153e7c
Compare
There was a problem hiding this 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.
tests/unit/mocks.py
Outdated
"expirationTime": str(self.cert_expiration), | ||
}, | ||
"dnsName": "abcde.12345.us-central1.sql.goog", | ||
"dnsNames": [ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
5153e7c
to
73246b8
Compare
…er TLS certificate.
73246b8
to
bbd29ad
Compare
There was a problem hiding this 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 👍
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