Skip to content

Commit 85aed76

Browse files
authored
Merge pull request #1770 from shiftstack/fix-certs-parse
🐛 Verify success of parsing OpenStack cloud cacert
2 parents 8a49b9f + 02dde93 commit 85aed76

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/scope/provider.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ func NewProviderClient(cloud clientconfig.Cloud, caCert []byte, logger logr.Logg
224224
}
225225
if caCert != nil {
226226
config.RootCAs = x509.NewCertPool()
227-
config.RootCAs.AppendCertsFromPEM(caCert)
227+
ok := config.RootCAs.AppendCertsFromPEM(caCert)
228+
if !ok {
229+
// If no certificates were successfully parsed, set RootCAs to nil to use the host's root CA
230+
config.RootCAs = nil
231+
}
228232
}
229233

230234
provider.HTTPClient.Transport = &http.Transport{Proxy: http.ProxyFromEnvironment, TLSClientConfig: config}

0 commit comments

Comments
 (0)