postgres: tls: only use non-empty certificates (#82182)

This commit is contained in:
Gábor Farkas
2024-02-19 11:58:42 +01:00
committed by GitHub
parent dcc977005c
commit 7f77be8f85
2 changed files with 52 additions and 0 deletions
@@ -200,6 +200,19 @@ func (m *tlsManager) writeCertFiles(dsInfo sqleng.DataSourceInfo, tlsconfig *tls
return err
}
// we do not want to point to cert-files that do not exist
if tlsRootCert == "" {
tlsconfig.RootCertFile = ""
}
if tlsClientCert == "" {
tlsconfig.CertFile = ""
}
if tlsClientKey == "" {
tlsconfig.CertKeyFile = ""
}
// Update datasource cache
m.dsCacheInstance.cache.Store(cacheKey, dsInfo.Updated)
return nil