Changelog
This release fixes security issues in how the client decides to use TLS and which servers it takes from the cluster. Some of these fixes change how the client connects: read BREAKING CHANGES below before upgrading.
BREAKING CHANGES
- Core NATS:
-
TLS settings now require TLS.
Options.TLSConfig,RootCAsCBorTLSCertCBset directly now act likeSecure(). Against a server without TLS, the connection fails. Against a server where TLS is optional (allow_non_tls,InProcessServer()), the client now uses TLS, so the certificate must verify. To connect without TLS, drop the TLS settings (#2245) -
ErrSecureConnWantedis wrapped. Compare witherrors.Is(err, nats.ErrSecureConnWanted).==no longer matches (#2245) -
With TLS after INFO, discovered servers come only from the INFO received inside TLS. The plaintext INFO before the handshake no longer adds servers, and neither does a failed attempt. A TLS client configured with a single server URL therefore:
- has nothing to fail over to against nats-server before 2.12, until the server sends a later INFO.
- fails
Connect()when that server fails it after its INFO, for example atmax_connections(reported as a TLS handshake error, not the server's reason), or with a certificate that doesn't match a server configured by IP.
Configure more than one server URL to keep fail-over. For a server configured by IP, set
TLSConfig.ServerNameto a name in its certificate (#2245) -
SetServerPool()with atls://URL turns TLS on for the connection, as it does atConnect(). Plaintext servers in that pool can no longer be reached. Over WebSocket, servers listed on awss://connection are dialed withwss://(#2245)
-
FIXED
- Core NATS:
- User info in a
connect_urlsentry (x@host:port) used as the credentials for that server. Discovered servers now always get the credentials the client used for the server that reported them (#2245) - Report TLS verification failures during reconnect. Thanks @cr7258 for the contribution (#2229)
- Draining subscriptions resubscribed on reconnect (#2232)
- Keep TLS server name for IPs discovered via an IP entry. Thanks @igor-kupczynski for the contribution (#2217)
- Require a separator before inline header status. Thanks @ViktorBystrov72 for the contribution (#2237)
- WebSocket frame handling (#2225)
- Treat malformed WS close frames as protocol errors (#2226)
- User info in a
- JetStream:
- Legacy JetStream:
IMPROVED
- Core NATS:
- JetStream:
- Remove duplicated word in
MemoryMaxStreamBytescomment. Thanks @ninglinLiu for the contribution (#2242)
- Remove duplicated word in
- Remove stale
go.modversion notes from docs. Thanks @nik-6174 for the contribution (#2233) - Bump ntf-client to v0.0.5 to fix nightly tester failures (#2243)