Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions internal/cloudsql/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,17 @@ func (c ConnectionInfo) TLSConfig() *tls.Config {
for _, caCert := range c.ServerCACert {
pool.AddCert(caCert)
}
if c.ServerCAMode == "GOOGLE_MANAGED_CAS_CA" ||
c.ServerCAMode == "CUSTOMER_MANAGED_CAS_CA" {
// For CAS instances, we can rely on the DNS name to verify the server identity.
if c.ServerCAMode != "" && c.ServerCAMode != "GOOGLE_MANAGED_INTERNAL_CA" {
// By default, use Standard TLS hostname verification name to
// verify the server identity.
return &tls.Config{
ServerName: c.DNSName,
Certificates: []tls.Certificate{c.ClientCertificate},
RootCAs: pool,
MinVersion: tls.VersionTLS13,
}
}
// For legacy instances use the custom TLS validation
return &tls.Config{
ServerName: c.ConnectionName.String(),
Certificates: []tls.Certificate{c.ClientCertificate},
Expand Down
Loading