From 13c88463e0c340215ac8920308e719885671c25e Mon Sep 17 00:00:00 2001 From: Henrique Lindgren Date: Sun, 11 Jun 2023 20:49:16 +0100 Subject: [PATCH] Skip SSL verification when checking if the source file exists. Enables the use of an ovf_source with a self-signed certificate and ensures consistency with the use of ovftool's '--noSSLVerify' option. --- esxi/guest-create.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/esxi/guest-create.go b/esxi/guest-create.go index 86799cf..355591e 100644 --- a/esxi/guest-create.go +++ b/esxi/guest-create.go @@ -2,6 +2,7 @@ package esxi import ( "bytes" + "crypto/tls" "fmt" "io/ioutil" "log" @@ -205,7 +206,11 @@ func guestCREATE(c *Config, guest_name string, disk_store string, // Check if source file exist. if strings.HasPrefix(src_path, "http://") || strings.HasPrefix(src_path, "https://") { log.Printf("[guestCREATE] Source is URL.\n") - resp, err := http.Get(src_path) + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + client := &http.Client{Transport: tr} + resp, err := client.Get(src_path) if (err != nil) || (resp.StatusCode != 200) { log.Printf("[guestCREATE] URL not accessible: %s\n", src_path) log.Printf("[guestCREATE] URL StatusCode: %d\n", resp.StatusCode)