Skip to content

Insecure Rancher Version Request Fails When Certificate Is Self-Signed #389

Description

@omkarkhatavkar

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}, 
	},
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions