17170: Fix crash when http transport uses default nil transport.
authorTom Clegg <tom@curii.com>
Tue, 19 Jan 2021 16:50:00 +0000 (11:50 -0500)
committerTom Clegg <tom@curii.com>
Tue, 19 Jan 2021 16:50:00 +0000 (11:50 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/controller/rpc/conn.go

index 26f41e128605934ca7363813539f6192db7bbbf1..c9c0ac308cded26082ad07cf782042ed85ed1c76 100644 (file)
@@ -298,7 +298,11 @@ func (conn *Conn) ContainerSSH(ctx context.Context, options arvados.ContainerSSH
                // hostname or ::1 or 1::1
                addr = net.JoinHostPort(addr, "https")
        }
-       netconn, err := tls.Dial("tcp", addr, &tls.Config{InsecureSkipVerify: conn.httpClient.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify})
+       insecure := false
+       if tlsconf := conn.httpClient.Transport.(*http.Transport).TLSClientConfig; tlsconf != nil && tlsconf.InsecureSkipVerify {
+               insecure = true
+       }
+       netconn, err := tls.Dial("tcp", addr, &tls.Config{InsecureSkipVerify: insecure})
        if err != nil {
                err = fmt.Errorf("tls.Dial: %w", err)
                return