Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: trust server certificate (#15417)
h3n4l3e23a0041101
diff --git a/backend/plugin/db/mssql/mssql.go b/backend/plugin/db/mssql/mssql.goindex f89885ed98..bb7f4714a8 100644--- a/backend/plugin/db/mssql/mssql.go+++ b/backend/plugin/db/mssql/mssql.go@@ -65,16 +65,9 @@ func (driver *Driver) Open(_ context.Context, _ storepb.Engine, config db.Connec// See: https://github.com/microsoft/go-mssqldb/issues/33query.Add("tlsmin", "1.0")- trustServerCertificate := "true"-var err errorif config.TLSConfig.UseSSL && config.TLSConfig.SslCA != "" {- // We should not TrustServerCertificate in production environment, otherwise, TLS is susceptible- // to man-in-the middle attacks. TrustServerCertificate makes driver accepts any certificate presented by the server- // and any host name in that certificate.- // Due to Golang runtime limitation, x509 package will throw the error of 'certificate relies on legacy Common Name field, use SANs instead if- // TrustServerCertificate is false.- trustServerCertificate = "false"+ // Due to Golang runtime limitation, x509 package will throw the error of 'certificate relies on legacy Common Name field, use SANs instead.// Driver reads the certificate from file instead of regarding it as certificate content.// https://github.com/microsoft/go-mssqldb/blob/main/msdsn/conn_str.go#L159// TODO(zp): Driver supports .der format also.@@ -100,7 +93,7 @@ func (driver *Driver) Open(_ context.Context, _ storepb.Engine, config db.Connec}query.Add("certificate", fName)}- query.Add("TrustServerCertificate", trustServerCertificate)+ query.Add("TrustServerCertificate", "true")driverName := "sqlserver"password := config.Passworddiff --git a/backend/plugin/db/mysql/mysql.go b/backend/plugin/db/mysql/mysql.goindex e1c06e1552..acdf8adc62 100644--- a/backend/plugin/db/mysql/mysql.go+++ b/backend/plugin/db/mysql/mysql.go@@ -128,7 +128,6 @@ func (d *Driver) getMySQLConnection(connCfg db.ConnectionConfig) (string, error)protocol = "mysql+tcp"}- // TODO(zp): mysql and mysqlbinlog doesn't support SSL yet. We need to write certs to temp files and load them as CLI flags.tlsConfig, err := connCfg.TLSConfig.GetSslConfig()if err != nil {return "", errors.Wrap(err, "sql: tls config error")