Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto/tls: client gets nondescriptive EOF error if server stops connection after client hello #44663

Closed
sding3 opened this issue Feb 27, 2021 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@sding3
Copy link
Contributor

sding3 commented Feb 27, 2021

What version of Go are you using (go version)?

$ go version
go version go1.15.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/shang/.cache/go-build"
GOENV="/home/shang/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/shang/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/shang/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/shang/go/src/go/src/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build665899226=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Made HTTPS request against a bad server that was terminating connections upon seeing TLS client hello.

Click to expand sample bad server
package main

import (
	"net"
)

func main() {
	l, err := net.Listen("tcp", "localhost:1234")
	panicOnErr(err)
	defer l.Close()

	for {
		conn, err := l.Accept()
		panicOnErr(err)
		conn.Close()
	}
}

func panicOnErr(e error) {
	if e != nil {
		panic(e)
	}
}

What did you expect to see?

Expected to see some contextual information on the error indicating issue with tls or better yet tls handshake. For comparision, curl, in this case, emitts curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL

Most errors from the crypto/tls package prefix their errors with additional context in the form of tls: {extra info} ... in a helpful way, but this EOF error here appears to be an exception.

What did you see instead?

Got a nondescriptive EOF error.


edit: reformat markdown codeblock

@seankhliao seankhliao changed the title crypto/tls client gets nondescriptive EOF error if server stops connection after client hello crypto/tls: client gets nondescriptive EOF error if server stops connection after client hello Feb 27, 2021
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 27, 2021
@networkimprov
Copy link

cc @FiloSottile

@gopherbot
Copy link

Change https://golang.org/cl/299449 mentions this issue: crypto/tls: add error context to handshake error

@sding3
Copy link
Contributor Author

sding3 commented Mar 12, 2021

This appears to be a duplicate of #19874, and #13523.

I'm closing this one out.

@sding3 sding3 closed this as completed Mar 12, 2021
@golang golang locked and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants