Support hostname verification to allow verify-full
SSL/TLS connections
#1087
Labels
priority: p1
Important issue which blocks shipping the next release. Will be fixed prior to next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Feature Description
The Cloud SQL Python Connector currently only supports
verify-ca
as it's highest level of SSL/TLS client verification.
We are only getting
verify-ca
level of security due to hostname verificationbeing disabled currently .
cloud-sql-python-connector/google/cloud/sql/connector/connection_info.py
Lines 60 to 61 in 53e40c7
We should support
verify-full
as it is the highest level of security.To do so we must support hostname verification.
For Public IP and PSA Private IP connections, the server certificate's
subject CN field in the server certificate will contain the instance name
in the form
"{project}:{instance}"
. The python connector should validatethat this is correctly set during the TLS handshake. The connector should
reject the connection if this the server CN is not set correctly.
Unfortunately for PSC enabled and CAS-based instances hostname
verification is not possible. This is due to the server certificates including
the DNS name as a SAN which include a trailing dot ("."). Python's SSL does
not allow trailing dots during hostname verification, it requires stripping them.
This leads to
hostname mismatch
errors as the SAN is expecting a trailing dot.See also: GoogleCloudPlatform/cloud-sql-jdbc-socket-factory#1995
The text was updated successfully, but these errors were encountered: