diff --git a/exporter/tls.go b/exporter/tls.go index f5e3c853..0dc84642 100644 --- a/exporter/tls.go +++ b/exporter/tls.go @@ -29,6 +29,14 @@ func (e *Exporter) CreateClientTLSConfig() (*tls.Config, error) { return nil, err } tlsConfig.RootCAs = certificates + } else { + // Load the system certificate pool + rootCAs, err := x509.SystemCertPool() + if err != nil { + return nil, err + } + + tlsConfig.RootCAs = rootCAs } return &tlsConfig, nil diff --git a/exporter/tls_test.go b/exporter/tls_test.go index 5461dc0a..0789a217 100644 --- a/exporter/tls_test.go +++ b/exporter/tls_test.go @@ -19,6 +19,7 @@ func TestCreateClientTLSConfig(t *testing.T) { ClientKeyFile: "../contrib/tls/redis.key"}, true}, {"load_ca_cert", Options{ CaCertFile: "../contrib/tls/ca.crt"}, true}, + {"load_system_certs", Options{}, true}, // negative tests {"nonexisting_client_files", Options{