Skip to content

Commit a8ed925

Browse files
authored
feat: Support server certificates from a private CA
The connector will now validate the Subject Alternative Name field for instances using a Private CA. These instances will be designated by having ServerCAMode set to CUSTOMER_MANAGED_CAS_CA
1 parent 9339d75 commit a8ed925

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

dialer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func (d *Dialer) Dial(ctx context.Context, icn string, opts ...DialOption) (conn
394394
}()
395395

396396
iConn := newInstrumentedConn(tlsConn, func() {
397-
n := atomic.AddUint64(c.openConnsCount, ^uint64(0))
397+
n := atomic.AddUint64(c.openConnsCount, ^uint64(0)) // c.openConnsCount = c.openConnsCount - 1
398398
trace.RecordOpenConnections(context.Background(), int64(n), d.dialerID, cn.String())
399399
}, d.dialerID, cn.String())
400400

internal/cloudsql/instance.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ func (c ConnectionInfo) TLSConfig() *tls.Config {
241241
for _, caCert := range c.ServerCACert {
242242
pool.AddCert(caCert)
243243
}
244-
if c.ServerCAMode == "GOOGLE_MANAGED_CAS_CA" {
244+
if c.ServerCAMode == "GOOGLE_MANAGED_CAS_CA" ||
245+
c.ServerCAMode == "CUSTOMER_MANAGED_CAS_CA" {
245246
// For CAS instances, we can rely on the DNS name to verify the server identity.
246247
return &tls.Config{
247248
ServerName: c.DNSName,

0 commit comments

Comments
 (0)