File/Function:
RequestRancherVersion in package rancherversion
|
func RequestRancherVersion(rancherURL string) (*Config, error) { |
Description
The current implementation of the RequestRancherVersion function uses HTTPS by default:
var httpURL = "https://" + rancherURL + "/rancherversion"
This fails when Rancher is running via Docker, because Rancher uses a self-signed certificate by default. The Go HTTP client does not accept self-signed certs unless explicitly configured to do so.
Error
When running Rancher in Docker and calling the function, it fails with:
x509: certificate signed by unknown authority
Suggested Fixes
Provide an option to skip TLS verification for local/testing scenarios.
Allow http:// scheme as well for environments where TLS is not used.
// Configure HTTP client to skip TLS verification for self-signed certs
httpClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
File/Function:
RequestRancherVersionin packagerancherversionshepherd/extensions/rancherversion/rancherversion.go
Line 12 in 2d4a7f2
Description
The current implementation of the RequestRancherVersion function uses HTTPS by default:
var httpURL = "https://" + rancherURL + "/rancherversion"This fails when Rancher is running via Docker, because Rancher uses a self-signed certificate by default. The Go HTTP client does not accept self-signed certs unless explicitly configured to do so.
Error
When running Rancher in Docker and calling the function, it fails with:
x509: certificate signed by unknown authoritySuggested Fixes
Provide an option to skip TLS verification for local/testing scenarios.
Allow http:// scheme as well for environments where TLS is not used.