Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.18 darwin/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="/Users/agandhi/Library/Caches/go-build" GOENV="/Users/agandhi/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/agandhi/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/agandhi/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/agandhi/.gimme/versions/go1.18.darwin.amd64" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/agandhi/.gimme/versions/go1.18.darwin.amd64/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.18" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8b/jm61yqyn0g126b4p23hrfz7c0000gp/T/go-build4159564691=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
- Run a Go TLS server with
ClientAuthType
configuration higher thanRequestClientCert
. This could be an HTTPS server, gRPC, etc. - Connect to it using
curl
,openssl s_client
, etc and provide an invalid client certificate.
What did you expect to see?
I'd like to see one of the more meaningful TLS alerts that RFC 5246 (TLSv1.2) or RFC 8446 (TLSv1.3) define. Namely:
certificate_required
when the server is configured withtls.RequireAnyClientCert
ortls.RequireAndVerifyClientCert
, and the client doesn't provide any client certcertificate_expired
when the client provides a client cert but it's expired (or not yet valid)unknown_ca
when the client provides a client cert but it's not signed by an authority that the Go TLS server is configured to require.
What did you see instead?
TLS alert bad_certificate
is always returned, which is often confusing to end users because it doesn't surface enough information to quickly find out if/how they can fix their client certificate.