Skip to content

Commit 2b4606e

Browse files
authored
fix tls certPool client regression (#263)
1 parent 30f5943 commit 2b4606e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

restapi/tls.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,24 @@ import (
2727
)
2828

2929
func getCertPool() *x509.CertPool {
30+
rootCAs, _ := x509.SystemCertPool()
31+
if rootCAs == nil {
32+
// In some systems (like Windows) system cert pool is
33+
// not supported or no certificates are present on the
34+
// system - so we create a new cert pool.
35+
rootCAs = x509.NewCertPool()
36+
}
3037
caCertFileNames := getMinioServerTLSRootCAs()
31-
// If CAs certificates are configured we save them to the http.Client RootCAs store
32-
certs := x509.NewCertPool()
3338
for _, caCert := range caCertFileNames {
3439
pemData, err := ioutil.ReadFile(caCert)
3540
if err != nil {
3641
// logging this error
3742
log.Println(err)
3843
continue
3944
}
40-
certs.AppendCertsFromPEM(pemData)
45+
rootCAs.AppendCertsFromPEM(pemData)
4146
}
42-
return certs
47+
return rootCAs
4348
}
4449

4550
var certPool = getCertPool()

0 commit comments

Comments
 (0)