Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore(ssl): add intermediates cert (#4195)

rebeliced28a111f9cd1
diff --git a/plugin/db/ssl.go b/plugin/db/ssl.go
index dbc3cf88cf..eda6b8c3c8 100644
--- a/plugin/db/ssl.go
+++ b/plugin/db/ssl.go
@@ -50,7 +50,21 @@ func (tc TLSConfig) GetSslConfig() (*tls.Config, error) {
if err != nil {
return err
}
- opts := x509.VerifyOptions{Roots: rootCertPool}
+
+ // Add the intermediates.
+ intermediatePool := x509.NewCertPool()
+ for _, intermediate := range rawCerts[1:] {
+ cert, err := x509.ParseCertificate(intermediate)
+ if err != nil {
+ return err
+ }
+ intermediatePool.AddCert(cert)
+ }
+
+ opts := x509.VerifyOptions{
+ Roots: rootCertPool,
+ Intermediates: intermediatePool,
+ }
if _, err = cert.Verify(opts); err != nil {
return errors.Wrap(err, "SSL cert failed to verify")
}