Commit Graph

129 Commits

Author SHA1 Message Date
Ivan Kozlovic
ce96de2ed5 [ADDED] TLS: Handshake First for client connections
A new option instructs the server to perform the TLS handshake first,
that is prior to sending the INFO protocol to the client.

Only clients that implement equivalent option would be able to
connect if the server runs with this option enabled.

The configuration would look something like this:
```
...
tls {
    cert_file: ...
    key_file: ...

    handshake_first: true
}
```

The same option can be set to "auto" or a Go time duration to fallback
to the old behavior. This is intended for deployments where it is known
that not all clients have been upgraded to a client library providing
the TLS handshake first option.

After the delay has elapsed without receiving the TLS handshake from
the client, the server reverts to sending the INFO protocol so that
older clients can connect. Clients that do connect with the "TLS first"
option will be marked as such in the monitoring's Connz page/result.
It will allow the administrator to keep track of applications still
needing to upgrade.

The configuration would be similar to:
```
...
tls {
    cert_file: ...
    key_file: ...

    handshake_first: auto
}
```
With the above value, the fallback delay used by the server is 50ms.

The duration can be explcitly set, say 300 milliseconds:
```
...
tls {
    cert_file: ...
    key_file: ...

    handshake_first: "300ms"
}
```

It is understood that any configuration other that "true" will result
in the server sending the INFO protocol after the elapsed amount of
time without the client initiating the TLS handshake. Therefore, for
administrators that do not want any data transmitted in plain text,
the value must be set to "true" only. It will require applications
to be updated to a library that provides the option, which may or
may not be readily available.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2023-10-10 09:46:01 -06:00
Derek Collison
b3f5bac31a Update for Go client
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-27 09:55:38 -07:00
Derek Collison
da70ef27b5 Update of dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-18 11:20:39 -07:00
Neil Twigg
7b85fd1045 Update nats.go to v1.29.0
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-13 16:24:30 +01:00
Neil Twigg
3becc840d9 Allow more time in TestFileStoreNumPendingLargeNumBlks, improve logging on failure
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-12 11:02:43 +01:00
Neil
7781407618 v2.10: Use Go 1.21 in nightlies, update rand usage (#4490)
- Use Go 1.21 in nightlies
- Both rand.Seed and rand.Read are both deprecated, remove its use to
fix staticcheck errors

```go
server/client.go:95:2: SA1019: rand.Seed has been deprecated since Go 1.20 and an alternative 
  has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. 
  Programs that call Seed with a known value to get a specific sequence of results should use 
  New(NewSource(seed)) to obtain a local random generator. (staticcheck)

server/jetstream_test.go:20399:2: SA1019: rand.Read has been deprecated since Go 1.20 
  because it shouldn't be used: For almost all use cases, crypto/rand.Read is more appropriate. (staticcheck)
```
2023-09-06 10:22:25 +01:00
Derek Collison
c3648d27bd Update to dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-01 09:54:16 -07:00
Neil Twigg
d08eeee94d Use Go 1.21 for nightlies, Dockerfile, code coverage, bump go.mod version to Go 1.20
Signed-off-by: Neil Twigg <neil@nats.io>
2023-08-31 09:02:20 +01:00
Derek Collison
2e48b54d14 Update dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-23 11:43:51 -07:00
Tomasz Pietrek
13bf12ce64 Bump client version to v1.27.0
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
2023-06-12 22:06:08 +02:00
Derek Collison
0980384c97 Update dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-11 12:25:44 -07:00
Derek Collison
4ac45ff6f3 When consumers were R1 and the same name was reused, server restarts could try to cleanup old ones and effect the new ones.
These changes allow consumer name reuse more effectively during server restarts.

Signed-off-by: Derek Collison <derek@nats.io>
2023-06-05 12:48:18 -07:00
Derek Collison
acc8e69f23 Update to the compress lib
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 14:18:54 -07:00
Derek Collison
a6029a090c Update pkg dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-16 14:25:33 -07:00
Derek Collison
5980cbf861 Update to latest dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-03-01 05:23:37 -08:00
Derek Collison
12a49859e9 Update pkg dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-01-31 09:33:01 -08:00
Friedrich Wilken
735ce64a7f Upgrade the dependency golang.org/x/crypto to v0.5.0. 2023-01-05 14:53:18 +01:00
Derek Collison
a746b578e7 Update Go client to release 1.19.0
Signed-off-by: Derek Collison <derek@nats.io>
2022-10-27 13:03:54 -07:00
Derek Collison
1a193fe8a6 Updated Go client
Signed-off-by: Derek Collison <derek@nats.io>
2022-10-27 08:55:43 -07:00
Ivan Kozlovic
1039df088c [UPDATED] Dependencies
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-09-29 15:00:44 -06:00
Ivan Kozlovic
f88f2265d2 [UPDATED] Dependencies
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-09-22 14:13:40 -06:00
Derek Collison
f190b6b6f4 Upgrade packages
Signed-off-by: Derek Collison <derek@nats.io>
2022-09-06 13:33:39 -07:00
Ivan Kozlovic
68e74e1d1c Update nats.go mod to be able to run tests
Will then update nats.go to remove temp code and then have
another server PR to point to nats.go latest.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-08-10 13:26:06 -06:00
Derek Collison
e52c7cd3da Update client for direct get in KV
Signed-off-by: Derek Collison <derek@nats.io>
2022-08-03 20:20:56 -07:00
Derek Collison
6e0d3eaa9d Update compress dependency
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-25 11:31:12 -07:00
Ivan Kozlovic
dac8b0959b [UPDATED] Compression library
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-14 10:33:38 -06:00
Matthias Hanel
6e52608936 [added] support for jwt account option DisallowBearer (#3127)
* [added] support for jwt account option DisallowBearer

change 3 out of 3. Fixes #3084
corresponds to:
https://github.com/nats-io/jwt/pull/177
https://github.com/nats-io/nsc/pull/495

update jwt library to 2.3.0

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-06-29 18:19:14 +02:00
Parham Alvani
253ff6b517 chore: go mod tidy 2022-06-28 07:39:10 +04:30
Parham Alvani
baf0506b78 feat: add automaxprocs 2022-06-25 19:59:04 +04:30
Ivan Kozlovic
725ea8a5ed Update go.mod dependencies
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-26 17:16:37 -06:00
Ivan Kozlovic
f423f07134 Release v2.8.3
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-23 14:48:19 -06:00
Ivan Kozlovic
3cdbba16cb Revert "[added] support for jwt operator option DisallowBearerToken" 2022-05-04 11:11:25 -06:00
Matthias Hanel
bd2883122e [added] support for jwt operator option DisallowBearerToken
I modified an existing data structure that held a similar attribute already.
Instead this data structure references the claim.

change 3 out of 3. Fixes #3084
corresponds to:
https://github.com/nats-io/jwt/pull/177
https://github.com/nats-io/nsc/pull/495

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-04-29 14:18:11 -04:00
pgvishnuram
5cc4d0ca4a fix for CVE-2022-27191
* our CVE scanner has detected crypto go module vulnerability in nats exporter this PR fixes that issue by updating the module version
2022-04-21 10:19:35 +05:30
Derek Collison
efb91c4ade Upgrade to latest released client
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-10 08:03:11 -07:00
Matthias Hanel
92f4dc986a added max_ack_pending setting to js account limits (#2982)
* added max_ack_penind setting to js account limits

because of the addition, defaults now have to be set later (depend on
these new limits now)

also re-organized the code to closer track how stream create looks

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-03-31 14:17:16 -04:00
Matthias Hanel
1445153130 Adding max stream bytes check (#2970)
* Adding max stream bytes check

Also start checking on  stream update

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-03-30 15:50:28 -04:00
Matthias Hanel
0c5f3688a7 [ADDED] Tiered limits and fix limit issues on updates (#2945)
* Adding tiered limits and fix limit issues on updates

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-03-28 20:47:54 -04:00
Derek Collison
7fd5f4dc24 Update Go client
Signed-off-by: Derek Collison <derek@nats.io>
2022-03-24 17:45:15 -06:00
Matthias Hanel
9a2da9ed8c Adding denies $KV.>/$OBJ.> along leaf connections on differing domain (#2916)
* Adding denies $KV.>/$OBJ.> along leaf connections on differing domain

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-03-09 13:17:59 -05:00
Ivan Kozlovic
26a8dc8add Update compress and highwayhash dependencies
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-02-22 17:09:05 -07:00
Derek Collison
56870e4ddb Update Go client
Signed-off-by: Derek Collison <derek@nats.io>
2022-01-24 10:24:49 -08:00
Ivan Kozlovic
2ba6d97dc1 Update deps
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-01-13 16:17:46 -07:00
Derek Collison
7dc99c3840 Merge from main
Signed-off-by: Derek Collison <derek@nats.io>
2022-01-13 10:01:33 -08:00
Matthias Hanel
78bbcd791f [Adding] support for JS MaxBytesRequired
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-01-12 22:57:34 -05:00
Derek Collison
42818f06c1 Update client
Signed-off-by: Derek Collison <derek@nats.io>
2022-01-10 16:58:52 -08:00
Ivan Kozlovic
cbfa93e4a8 [UPDATED] golang.org/x/crypto dependency
They just released some fix that is not affecting the NATS Server
but could cause some security vulnerability reports.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-12-02 13:48:21 -07:00
Ivan Kozlovic
9f30bf00e0 [FIXED] Corrupted headers receiving from consumer with meta-only
When a consumer is configured with "meta-only" option, and the
stream was backed by a memory store, a memory corruption could
happen causing the application to receive corrupted headers.

Also replaced most of usage of `append(a[:0:0], a...)` to make
copies. This was based on this wiki:
https://github.com/go101/go101/wiki/How-to-efficiently-clone-a-slice%3F

But since Go 1.15, it is actually faster to call make+copy instead.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-12-01 10:50:15 -07:00
Ivan Kozlovic
ede8124fb2 [FIXED/CHANGED] Add leafnode websocket connection type
This was missing since WEBSOCKET allowed connection type is really
used for client connections.
If one wants to limit a configured user to leafnode connections,
including if the connection is over websocket, but does not
want an application to connect over websocket using this user,
this would have been impossible to configure.

The JWT library has been updated to add LEAFNODE_WS and MQTT_WS for
future work.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-22 10:32:58 -07:00
Derek Collison
ab91da8f9b Upgrade Go client
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-25 17:13:05 -07:00