Skip to content

crypto/tls: error communicating with OpenSSL 1.0.2k client with high parallel connections #68302

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

Closed
hkishn opened this issue Jul 4, 2024 · 8 comments
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@hkishn
Copy link
Contributor

hkishn commented Jul 4, 2024

Go version

go version 1.21

Output of go env in your module/workspace:

GO111MODULE='off'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/test/.cache/go-build'
GOENV='/home/test/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS='-mod=vendor'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/test/go/pkg/mod'
GONOPROXY='gitlab.protectv.local'
GONOSUMDB='gitlab.protectv.local'
GOOS='linux'
GOPATH='/home/test/go'
GOPRIVATE='gitlab.protectv.local'
GOPROXY='
https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD=''
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4217941611=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I have a Golang server that is accepting TLS connections from an OpenSSL client. The OpenSSL client is on version OpenSSL 1.0.2k.
The client tries to connect with the server in TLS mode in parallel threads.

What did you see happen?

If I increase the thread count to 100 and try to connect with the server simultaneously. The TLS connection breaks with the error from the client side with the error "Fatal, Description: Unexpected Message"

This use case works work with Golang 1.18. Moreover, if I reduce the thread count to 50, then no error comes.

I think something has changed in the new releases of the Golang which is causing errors if the client tries to connect with the Golang server simultaneously in a large number of threads.

dump

What did you expect to see?

The Golang server should accept connections in parallel as it was working with Golang 1.18.

@seankhliao
Copy link
Member

I think you'll need to provide a reproducer for the issue, right now it doesn't look very actionable.

@seankhliao seankhliao changed the title Fatal error: Unexpected message in golang 1.21 crypto/tls: error communicating with OpenSSL 1.0.2k client with high parallel connections Jul 4, 2024
@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 4, 2024
@hkishn
Copy link
Contributor Author

hkishn commented Jul 4, 2024

@seankhliao I am trying to build the enviornment to reproduce the issue.
Is this issue similar to crypto/tls: Large session tickets in Go 1.21 can cause Windows Schannel clients to be unable to connect · Issue #63763 · golang/go · GitHub
?

In my setup when I downgrade to golang 1.20, then I won't see the error

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 4, 2024
@FiloSottile
Copy link
Contributor

Go servers are regularly used with more than 100 parallel connections, so we'll need more information to understand if there's an issue. Either a reproducer, or a PCAP with SSLKEYLOG, as well as the server code.

If you think it might be the same as #63763, you can try adding a WrapTicket that returns differently sized fake tickets and check if that fixes it, but that doesn't explain why it would break based on the number of parallel connections.

@hkishn
Copy link
Contributor Author

hkishn commented Jul 5, 2024

@FiloSottile
I try to create a setup where the issue is reproducing. I also have a tcpdump with SSLKEYLOG file. That I will share.

And I have tried the fix mentioned in #63763. I just called return []byte{0}, nil in the WrapTicket function. This fixed the issue.

Is there any timeline #63763 will be fixed ?

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 5, 2024
@hkishn
Copy link
Contributor Author

hkishn commented Jul 11, 2024

@seankhliao @FiloSottile

Go servers are regularly used with more than 100 parallel connections, so we'll need more information to understand if there's an issue. Either a reproducer, or a PCAP with SSLKEYLOG, as well as the server code.

If you think it might be the same as #63763, you can try adding a WrapTicket that returns differently sized fake tickets and check if that fixes it, but that doesn't explain why it would break based on the number of parallel connections.

When we configure TLS server with the following callback functions, then we can resolve the issue

 tlsConfig.WrapSession = (&tls.Config{}).EncryptTicket
   tlsConfig.UnwrapSession = (&tls.Config{}).DecryptTicket

Will these changes disable the new implementation of Wrapsession/Unwrapsession done in Golang 1.21?
Is there any other way by which we can resolve or disable this new functionality in golang1.21 ?

@seankhliao
Copy link
Member

Duplicate of #63763

@seankhliao seankhliao marked this as a duplicate of #63763 Jul 14, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants