mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 07:41:17 +00:00
trust system pool of CAs if cacert is empty
This commit is contained in:
@@ -81,12 +81,16 @@ func (self *RestClientEdgeIdentity) IsReadOnly() bool {
|
||||
func (self *RestClientEdgeIdentity) NewTlsClientConfig() (*tls.Config, error) {
|
||||
rootCaPool := x509.NewCertPool()
|
||||
|
||||
rootPemData, err := os.ReadFile(self.CaCert)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("could not read session certificates [%s]: %v", self.CaCert, err)
|
||||
}
|
||||
if self.CaCert != "" {
|
||||
rootPemData, err := os.ReadFile(self.CaCert)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("could not read session certificates [%s]: %v", self.CaCert, err)
|
||||
}
|
||||
|
||||
rootCaPool.AppendCertsFromPEM(rootPemData)
|
||||
rootCaPool.AppendCertsFromPEM(rootPemData)
|
||||
} else {
|
||||
rootCaPool, _ = x509.SystemCertPool()
|
||||
}
|
||||
|
||||
return &tls.Config{
|
||||
RootCAs: rootCaPool,
|
||||
|
||||
Reference in New Issue
Block a user