|
|
@ -25,7 +25,7 @@ import ( |
|
|
|
"encoding/pem" |
|
|
|
"encoding/pem" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path/filepath" |
|
|
|
"path" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/minio/minio/pkg/env" |
|
|
|
"github.com/minio/minio/pkg/env" |
|
|
|
) |
|
|
|
) |
|
|
@ -82,22 +82,21 @@ func GetRootCAs(certsCAsDir string) (*x509.CertPool, error) { |
|
|
|
|
|
|
|
|
|
|
|
fis, err := ioutil.ReadDir(certsCAsDir) |
|
|
|
fis, err := ioutil.ReadDir(certsCAsDir) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if os.IsNotExist(err) { |
|
|
|
if os.IsNotExist(err) || os.IsPermission(err) { |
|
|
|
err = nil // Return success if CA's directory is missing.
|
|
|
|
// Return success if CA's directory is missing or permission denied.
|
|
|
|
|
|
|
|
err = nil |
|
|
|
} |
|
|
|
} |
|
|
|
return rootCAs, err |
|
|
|
return rootCAs, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Load all custom CA files.
|
|
|
|
// Load all custom CA files.
|
|
|
|
for _, fi := range fis { |
|
|
|
for _, fi := range fis { |
|
|
|
// Only load regular files as public cert.
|
|
|
|
caCert, err := ioutil.ReadFile(path.Join(certsCAsDir, fi.Name())) |
|
|
|
if fi.Mode().IsRegular() { |
|
|
|
if err != nil { |
|
|
|
caCert, err := ioutil.ReadFile(filepath.Join(certsCAsDir, fi.Name())) |
|
|
|
// ignore files which are not readable.
|
|
|
|
if err != nil { |
|
|
|
continue |
|
|
|
return rootCAs, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
rootCAs.AppendCertsFromPEM(caCert) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
rootCAs.AppendCertsFromPEM(caCert) |
|
|
|
} |
|
|
|
} |
|
|
|
return rootCAs, nil |
|
|
|
return rootCAs, nil |
|
|
|
} |
|
|
|
} |
|
|
|