Skip to content

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

Closed
@sding3

Description

@sding3

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions