fix: use host's root CA set if ClientTLS ca is not defined
Co-authored-by: Tom Moulard <tom.moulard@traefik.io>
This commit is contained in:
parent
20dfb91948
commit
b39d226fb8
13 changed files with 31 additions and 13 deletions
|
@ -30,7 +30,9 @@ func (clientTLS *ClientTLS) CreateTLSConfig(ctx context.Context) (*tls.Config, e
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
caPool := x509.NewCertPool()
|
||||
// Not initialized, to rely on system bundle.
|
||||
var caPool *x509.CertPool
|
||||
|
||||
clientAuth := tls.NoClientCert
|
||||
if clientTLS.CA != "" {
|
||||
var ca []byte
|
||||
|
@ -44,6 +46,7 @@ func (clientTLS *ClientTLS) CreateTLSConfig(ctx context.Context) (*tls.Config, e
|
|||
ca = []byte(clientTLS.CA)
|
||||
}
|
||||
|
||||
caPool = x509.NewCertPool()
|
||||
if !caPool.AppendCertsFromPEM(ca) {
|
||||
return nil, errors.New("failed to parse CA")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue