fix: GetAllCertificatesAndCAs shouldn't fail internally (#810)

all libraries in pkg/* should never be called Fatal()
internally, the console is imported now and it is important
that the failure logging etc is all well controlled.

Bonus: update to latest minio/pkg v1.0.6 to get trial
customer license verification fixes.
This commit is contained in:
Harshavardhana
2021-06-14 10:41:34 -07:00
committed by GitHub
parent 31d18efa9a
commit f208ce5382
4 changed files with 13 additions and 9 deletions

View File

@@ -27,7 +27,6 @@ import (
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
@@ -313,18 +312,18 @@ func GetTLSConfig() (x509Certs []*x509.Certificate, manager *xcerts.Manager, err
return x509Certs, manager, nil
}
func GetAllCertificatesAndCAs() (*x509.CertPool, []*x509.Certificate, *xcerts.Manager) {
func GetAllCertificatesAndCAs() (*x509.CertPool, []*x509.Certificate, *xcerts.Manager, error) {
// load all CAs from ~/.console/certs/CAs
GlobalRootCAs, err := xcerts.GetRootCAs(GlobalCertsCADir.Get())
if err != nil {
log.Fatalln(err)
return nil, nil, nil, err
}
// load all certs from ~/.console/certs
globalPublicCerts, globalTLSCertsManager, err := GetTLSConfig()
if err != nil {
log.Fatalln(err)
return nil, nil, nil, err
}
return GlobalRootCAs, globalPublicCerts, globalTLSCertsManager
return GlobalRootCAs, globalPublicCerts, globalTLSCertsManager, nil
}
// TLSCertsManager custom TLS Manager for SNI support