merge system cert pool with own certs (#2226)

This commit is contained in:
mmetc 2023-05-25 10:10:58 +02:00 committed by GitHub
parent e5fe74ce77
commit 025f14f879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View file

@ -133,7 +133,13 @@ func (l *LocalApiClientCfg) Load() error {
return errors.Wrapf(err, "failed to load cacert")
}
caCertPool := x509.NewCertPool()
caCertPool, err := x509.SystemCertPool()
if err != nil {
log.Warningf("Error loading system CA certificates: %s", err)
}
if caCertPool == nil {
caCertPool = x509.NewCertPool()
}
caCertPool.AppendCertsFromPEM(caCert)
apiclient.CaCertPool = caCertPool
}