-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Go version
go version go1.25.1 linux/amd64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/arno/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/arno/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4245395172=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/arno/go/pkg/mod'
GOOS='linux'
GOPATH='/home/arno/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='off'
GOTELEMETRYDIR='/home/arno/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.1'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
Since I've upgraded to Go 1.25 I have issues with a TLS connection which I use for MQTT. Testing the SSL connection works fine (openssl s_client -connect delta.swycs.services:8443 -servername delta.swycs.services -alpn mqtt -tls1_2 -brief </dev/null). But in Go I get tls: insufficient security level.
What did you see happen?
When I implement this minimal openssl example in Go, I get handshake failed: remote error: tls: insufficient security level.
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
)
func main() {
pool, _ := x509.SystemCertPool()
cfg := &tls.Config{
ServerName: "delta.swycs.services",
RootCAs: pool,
MinVersion: tls.VersionTLS12,
MaxVersion: tls.VersionTLS12,
NextProtos: []string{"mqtt"},
}
conn, err := tls.Dial("tcp", "delta.swycs.services:8443", cfg)
if err != nil {
log.Fatalf("handshake failed: %v", err)
}
defer conn.Close()
st := conn.ConnectionState()
fmt.Println("Version:", tls.VersionName(st.Version))
fmt.Println("Cipher :", tls.CipherSuiteName(st.CipherSuite))
fmt.Println("ALPN :", st.NegotiatedProtocol)
}I've also tried adding specific CurvePreferences and CipherSuites like the following, but to no avail.
cfg := &tls.Config{
...
CurvePreferences: []tls.CurveID{tls.X25519, tls.CurveP256},
CipherSuites: []uint16{
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
},
}Thanks to some helpful people in the Go Discord server, we have found commit e90acc8 to be the issue. Before this commit this program runs fine, after this commit not anymore. Which is curious as the commit message seems to indicate that it only affects TLS1.3, but this is TLS1.2.
What did you expect to see?
I expect the TLS connection to be setup correctly, as it did in Go 1.24.7.