Commit Graph

3375 Commits

Author SHA1 Message Date
R.I.Pienaar
51ea92d7c7 support always presenting a nonce to clients
The nonce feature is useful to custom authentication plugins
but at present there is no way to enable a nonce to be presented
other than by setting nkey accounts etc.

This enables the nonce to always be presented in those situations.
Since its primarily useful to embedded scenarios there is no corresponding
configuration file behavior for this flag.

Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-11-17 15:19:00 +01:00
Waldemar Quevedo
70cd512cef Merge pull request #2692 from nats-io/ocsp-desig
Add support for designated OCSP responders
2021-11-16 14:48:57 -08:00
Jaime Piña
9c42636856 Add support for designated OCSP responders
Currently, OCSP responses that aren't signed by the root CA will fail
with a verification error. This change allows intermediates, or
designated responders, to sign responses on behalf of the CA.
2021-11-16 13:33:44 -08:00
Ivan Kozlovic
f805f23d6e Travis updates
- Add Go 1.17
- Fix go fmt from Go 1.17 (build directives)
- Download version of misspell and staticcheck instead of doing
"go get" since current staticcheck would be broken without go.mod

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-15 17:23:08 -07:00
Derek Collison
1552e6fd5b Fix for staticcheck shadow issue
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-12 17:47:35 -08:00
Derek Collison
c13d14cfb5 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-12 17:40:53 -08:00
Derek Collison
65d098f526 Fix for latency tracking bug.
The bug occures when latency tracking is on, a requestor and responder are not connected to the same server, and the responder sends two responses for a single request.

Signed-off-by: Derek Collison <derek@nats.io>
2021-11-12 17:37:15 -08:00
Ivan Kozlovic
27d1a50b35 [FIXED] A slow consumer could cause the publisher to block
The server reads data from a client from a go routine. When receiving
messages, it checks for matching subscriptions, and if found, would
send those messages from the producer's readLoop.
A notion of "budget" was used to make sure the server does not spend
too much time sending to clients from the producer's readLoop, however,
regardless of how small the budget was, if one of the subscription's
connection TCP buffer was full, a TCP write would block for as long
as the defined write_deadline (which is now 10 seconds).

We are removing this behavior and therefore clients (like it was the
case for other type of connections) will now always notify the
subscriber's writeLoop that data is ready to be sent, but the send
will not occur in the producer's writeLoop.

Resolves #2679

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-09 17:22:15 -07:00
Matthias Hanel
2221dbe685 fixed unit test where after a server shutdown no quorum existed
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-11-08 20:27:35 -05:00
Derek Collison
a27de5a681 Merge pull request #2678 from nats-io/race-fix-undo
Undo race fix which could cause deadlock
2021-11-04 15:37:41 -07:00
Derek Collison
cd54b4028d Undo race fix which could cause deadlock
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 15:36:03 -07:00
Ivan Kozlovic
197b384da5 Release v2.6.4
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-04 16:12:31 -06:00
Derek Collison
7ef0cc5651 Fix for race on js.cluster status
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 15:09:40 -07:00
Derek Collison
804696dda4 Merge pull request #2675 from nats-io/max-tokens
Add in max_sub_tokens support
2021-11-04 14:43:17 -07:00
Derek Collison
b96df068cb Add in max_sub_tokens support
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 14:26:01 -07:00
Derek Collison
ee3009e121 Merge pull request #2674 from nats-io/fix-2670
[ADDED] Allow certain consumer attributes to be updated #2670, #2603
2021-11-04 13:58:56 -07:00
Derek Collison
5ead954fee [ADDED] Allow certain consumer attributes to be updated #2670, #2603
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 13:43:11 -07:00
Matthias Hanel
fe3abafaeb Merge pull request #2672 from nats-io/jwt-localhost-unit
Altered jwt tests to not use localhost and prefixed tests with TestJWT
2021-11-03 16:28:24 -04:00
Derek Collison
6f7deaaed5 Only pass through to system account for account info api
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-03 12:41:36 -07:00
Matthias Hanel
501ebc0747 Altered jwt unit tests to not use localhost and prefixed tests with TestJWT
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-11-03 15:22:33 -04:00
Derek Collison
bb0b591dab Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-03 05:53:54 -07:00
Derek Collison
6df5f350c7 Allow system account to respond with jetstream not enabled.
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-03 05:34:29 -07:00
Derek Collison
c2cb19ce09 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-02 15:40:13 -07:00
Derek Collison
ae999aabe9 Merge pull request #2669 from nats-io/fix-2658
[FIXED] Duplicate stream create returned wrong response type #2658
2021-11-02 15:39:30 -07:00
Derek Collison
c78d700e90 Fix for #2658
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-02 15:23:15 -07:00
Derek Collison
1af3ab1b4e Fix for #2666
When encountering errors for sequence mismatches that were benign we were returning an error and not processing the rest of the entries.
This would lead to more severe sequence mismatches later on that would cause stream resets.

Also added code to deal with server restarts and the clfs fixup states which should have been reset properly.

Signed-off-by: Derek Collison <derek@nats.io>
2021-11-02 14:38:22 -07:00
Derek Collison
14469ccfc8 Fix for #2662.
Upon server restart a server would set the check expiration to the configured amount vs delta of next to expire.

Signed-off-by: Derek Collison <derek@nats.io>
2021-11-01 18:04:37 -07:00
Ivan Kozlovic
dbfff14d3b [IMPROVED] Websocket: Add client IP in websocket upgrade failures
The error message would now look like this:
```
[8672] 2021/11/01 10:56:50.251985 [ERR] [::1]:59279 - websocket handshake error: invalid value for header 'Upgrade'
```

(without this change the part `[::1]:59279 - ` would not be present)

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-01 10:54:22 -06:00
Ivan Kozlovic
a06e11a5a3 Release v2.6.3
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-28 13:41:54 -06:00
Derek Collison
31cb06d018 Merge pull request #2655 from nats-io/st-race
Race around accessing storage type
2021-10-28 12:41:25 -07:00
Derek Collison
cf5322088d Race around accessing storage type
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-28 12:36:01 -07:00
Ivan Kozlovic
c6b1d7f119 Merge pull request #2653 from nats-io/gw_gossip_urls
[FIXED] Gateway URLs gossip and `/varz` report issues
2021-10-28 12:51:50 -06:00
Ivan Kozlovic
5fc9e0e1cc [FIXED] Gateway URLs gossip and /varz report issues
- When detecting duplicate route, it was possible that a server
would lose track of the peer's gateway URL, which would prevent
it from gossiping that URL to inbound gateway connections
- When a server has gateways enabled and has as a remote its
own gateway, the monitoring endpoint `/varz` would include it
but without the "urls" array.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-28 12:05:30 -06:00
Derek Collison
003b6996f1 If AckWait less then restart check interval use AckWait
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-28 11:00:06 -07:00
Derek Collison
3a14a984fc Fix for a bug that did not properly decode redelivered state for consumers from a filestore.
This also caused state abnormalities in a user's setup so added code to clean up bad state as needed.

Signed-off-by: Derek Collison <derek@nats.io>
2021-10-28 08:33:48 -07:00
Derek Collison
0f7cdb00e8 Fix for #2633
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-27 15:07:59 -07:00
Phil Pennock
635c98a04b tests: hard-reject bad ports for JS clusters 2021-10-27 14:21:08 -04:00
Phil Pennock
7aacba4bda tests: don't allocate fixed ports from random range
When a socket is bound for IP stack protocols with port == 0, the kernel picks
a free port in a specific range and binds it; on Linux, the range can be seen
(and modified) with `sysctl net.ipv4.ip_local_port_range` or looking in
`/proc/sys/net/ipv4/ip_local_port_range`.  This defaults to 32768:60999.

When binding explicit ports (for tests), don't use a port number from that
range, or there will be flaky tests as periodically that port will already be
in use from another test.

This renumbers all the JS clustering tests I found binding in that range to be
beneath that range; I checked the code to ensure the new port wasn't already in
use.
2021-10-27 13:46:43 -04:00
Phil Pennock
fc6df0fbbc Redact URLs before logging or returning in error (#2643)
* Redact URLs before logging or returning in error

This does not affect strings which failed to parse, and in such a scenario
there's a mix of "which evil" to accept; we can't sanely find what should be
redacted in those cases, so we leave them alone for debugging.

The JWT library returns some errors for Operator URLs, but it rejects URLs
which contain userinfo, so there can't be passwords in those and they're safe.

Fixes #2597

* Test the URL redaction auxiliary functions

* End-to-end tests for secrets in debug/trace

Create internal/testhelper and move DummyLogger there, so it can be used from
the test/ sub-dir too.

Let DummyLogger optionally accumulate all log messages, not just retain the
last-seen message.

Confirm no passwords logged by TestLeafNodeBasicAuthFailover.

Change TestNoPasswordsFromConnectTrace to check all trace messages, not just the
most recent.

Validate existing trace redaction in TestRouteToSelf.

* Test for password in solicited route reconnect debug
2021-10-27 12:44:59 -04:00
Derek Collison
7dc5014941 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-27 09:20:31 -07:00
Derek Collison
d4b0b38a8f Fix for #2642
There was a bug that would erase the sync subject for upper level catchup for streams.
Raft layer repair was ok but if that was compacted it gets kicked up to the upper layers which would fail.
Users would see "Catchup stalled" messages repeatedly and consumers that had their leaders attached to that replica would also stop working.

Changes were put in to repair the corrupt state after the fact as well, regardless of presence of fix.

Signed-off-by: Derek Collison <derek@nats.io>
2021-10-26 20:09:00 -07:00
Ivan Kozlovic
694e9016b6 Fixed flapper
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-26 13:36:58 -06:00
Ivan Kozlovic
0bd38bd424 [FIXED] Monitoring: /varz gateway URLs not always updated
When servers leave a cluster and their gateway URLs was not in
the remote cluster's configuration, it is possible that their
gateway URL do not disappear from the list of URLs in the `/varz`
monitoring endpoint.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-26 13:11:06 -06:00
Derek Collison
cc4f802e09 Optimize compaction under heavy KV use
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-26 08:39:22 -07:00
Derek Collison
678469b40b Fix for #2644
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-25 13:12:37 -07:00
Matthias Hanel
81ccce9422 Merge pull request #2638 from nats-io/tmr-leak
Fixed memory leak caused by retained client and conn of timer
2021-10-20 12:12:23 -04:00
Matthias Hanel
1c508220d8 Review comment
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-10-19 18:03:59 -04:00
Matthias Hanel
c4a3a4c95e fix timer not being stopped prior to reset
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-10-19 16:56:20 -04:00
Matthias Hanel
8f64b99912 Fixed memory leak caused by retained client and conn of timer
by closing the timer.
This is a follow up to #2630

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-10-19 15:58:22 -04:00
David Simner
31814aa169 Update test 2021-10-19 12:39:08 +02:00