mirror of
https://github.com/niusmallnan/steve.git
synced 2025-08-11 18:21:39 +00:00
Merge pull request #19 from StrongMonkey/cert
Don't append CA if url is behind public CA
This commit is contained in:
commit
97ff535abc
@ -26,12 +26,14 @@ func ListenAndServe(ctx context.Context, url string, caCert []byte, token string
|
|||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
}
|
}
|
||||||
} else if len(caCert) > 0 {
|
} else if len(caCert) > 0 {
|
||||||
|
if _, err := http.Get(url); err != nil {
|
||||||
pool := x509.NewCertPool()
|
pool := x509.NewCertPool()
|
||||||
pool.AppendCertsFromPEM(caCert)
|
pool.AppendCertsFromPEM(caCert)
|
||||||
dialer.TLSClientConfig = &tls.Config{
|
dialer.TLSClientConfig = &tls.Config{
|
||||||
RootCAs: pool,
|
RootCAs: pool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handler = auth.ToMiddleware(auth.AuthenticatorFunc(auth.Impersonation))(handler)
|
handler = auth.ToMiddleware(auth.AuthenticatorFunc(auth.Impersonation))(handler)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user