-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
What version of Go are you using (go version
)?
go version go1.13.7 windows/amd64
Does this issue reproduce with the latest release?
Not tested on 1.14.x
What operating system and processor architecture are you using (go env
)?
Windows 10 (amd64) and Docker/CentOS7 (amd64)
go env
Output
set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\thyams\AppData\Local\go-build set GOENV=C:\Users\thyams\AppData\Roaming\go\env set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\Users\thyams\go set GOPRIVATE= set GOPROXY=direct set GOROOT=c:\go set GOSUMDB=off set GOTMPDIR= set GOTOOLDIR=c:\go\pkg\tool\windows_amd64 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=C:\******\go.mod set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\thyams\AppData\Local\Temp\go-build099847662=/tmp/go-build -gno-record-gcc-switches
What did you do?
HTTPClient that have default values for the HTTPTransport TLSClientConfig don't appear to be negotiating handshake downwards (using a lower supported protocol version) if receiving client/system/web.api doesn't support the max version we have configured.
Default Example:
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: false,
MinVersion: tls.VersionTLS10,
MaxVersion: tls.VersionTLS13,
}
Communicating with a client whose max protocol level is tls.VersionTLS12 (771) will trigger a remote error: tls: handshake failure
response.
Workaround
If I manipulate the transport.TLSClientConfig
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: false,
MinVersion: tls.VersionTLS10,
MaxVersion: tls.VersionTLS12, // Lowered
}
Communication resumes. I, of course, apologize if I am mistaken in my understanding of the functionality in the HTTPTransport.TLSClientConfig.
What did you expect to see?
I expected to see proper HTTP Status of 200
for a call succesful through curl
or postman
.
// BuildHTTPTransport creates a basic HTTP transport with default timeouts and can skip TLS verification check.
func BuildHTTPTransport(tlsInsecure bool, proxy func(*http.Request) (*url.URL, error)) *http.Transport {
transport := &http.Transport{
Proxy: proxy, // Can Be Nil
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 100, // Default was 2
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: time.Second,
}
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: tlsInsecure,
MinVersion: tls.VersionTLS10,
MaxVersion: tls.VersionTLS12, // Default is TLS13
}
return transport
}
What did you see instead?
remote error: tls: handshake failure