Commit Graph

549 Commits

Author SHA1 Message Date
Matthias Hanel
b3e355c263 [fixed] sub ref count issue across leaf node connections
This was caused by not sending subs across leaf node connections in some
cases but sending unsub in all cases. This imbalance caused
subscriptions to go away too soon. (ref count was off)

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-15 20:13:57 -04:00
Derek Collison
35bf0e8ce5 Merge pull request #2122 from nats-io/cleanup_tests
Cleanup some tests + GetTLSConnectionState() race fix
2021-04-15 13:57:51 -07:00
Ivan Kozlovic
6e1205b660 Cleanup some tests + GetTLSConnectionState() race fix
Missing defers

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-15 11:37:43 -06:00
Ivan Kozlovic
56d0d9ec87 Do not propagate service import interest across GW and ROUTES
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-15 11:34:36 -06:00
Derek Collison
6788c757d1 Merge pull request #2108 from nats-io/lnjs
Improve JS when a leafnode cluster extends and shares a system account.
2021-04-12 17:24:13 -07:00
Matthias Hanel
9486722e96 [fixing] subscription issue when subscribing to a super set of deny_import
If the subscription was foo. > but the server also had an import deny of foo.bar
It was legal to send the subscription. But the other server was unaware
of the restriction and sent the message anyway. The check of the
incoming message did not happen.

Fixing by ignoring messages the server is not supposed to receive.
And exchange deny_import so that the non soliciting leaf node knows to not
send these messages in the first place.

NB. merging of deny_ export/import with perms from INFO happens in processLeafnodeInfo

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-12 20:09:55 -04:00
Derek Collison
755ef74855 When a cluser of leafnodes connects to a cluster or supercluster hub and they share the system account make the leafnode servers observers.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-12 17:00:55 -07:00
Matthias Hanel
f7a772f097 Ensure that leafNodeFinishConnectProcess is only executed once.
incorporate review comments

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-09 16:53:06 -04:00
Matthias Hanel
5d1f36dd17 [Fixed] leaf node subscription permission negotiation.
On connect all subscription where sent by the soliciting leaf node.
If creds contains sub deny permissions, the leaf node would be
disconnected.
This waits for the permissions to be exchanged and checks permissions
before sending subscriptions.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-09 16:53:06 -04:00
R.I.Pienaar
f2d1a173db expose the connection kind to CustomClientAuthentication
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-04-08 18:33:55 +02:00
Ivan Kozlovic
c7f8296a85 Merge pull request #2065 from alexpantyukhin/extract_server_update
extract_server_update
2021-04-08 09:01:51 -06:00
alexpantyukhin
e16bebb8df extract update remote subscription. 2021-04-08 16:37:12 +04:00
alexpantyukhin
84884a93b5 put typestring to map and add tests 2021-04-05 22:03:14 +04:00
Matthias Hanel
b154c3d957 [Fixed] remote subscription leak for leafnodes caused by auto unsubscribe
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-02 17:38:57 -04:00
Ivan Kozlovic
b17f38e356 [FIXED] Websocket: do not generate empty frames + LN corruption
- It was possible that when the server was sending frames to a
webbrowser, it would send empty frames. While technically not wrong,
prevent that from happening.
- Not copying enqueued buffers could cause corruption with LN+WS.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-03-26 16:17:46 -06:00
R.I.Pienaar
d6e63cb683 improve log line when account registration fails
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-03-18 12:19:23 +01:00
Ivan Kozlovic
ccec4a6ab1 Fixed consumer idle hearbeats and JS route/GWs unsubscribes
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-03-09 12:08:47 -07:00
Derek Collison
e70e46ea4a Updates based on PR feedback
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-04 16:16:28 -08:00
Derek Collison
bfb8e3432e Move RAFT comms off internal sendq.
Move route and gateway msgs our of fast path for inbound stream msgs.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-04 14:45:34 -08:00
Ivan Kozlovic
e7e756034a Switch Gateway JS accounts to interest-only mode + some other fixes
- Fixed the close of a TLS connection which starting Go 1.16
set the deadline to 5 seconds.

- Fixed an issue with setHeader that was causing these error messages
```
=== RUN   TestServiceImportReplyMatchCycleMultiHops
nats: message could not decode headers on connection [4] for subscription on "foo"
--- PASS: TestServiceImportReplyMatchCycleMultiHops (0.04s)
```

- Fixed names of tests in norace_test.go since they must start with
TestNoRace in order to make sure that we execute them in Travis:
```
go test -v -run=TestNoRace --failfast -p=1 ./...
```

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-03-03 19:15:28 -07:00
Matthias Hanel
25ef6b0f0d Merge pull request #1952 from nats-io/goland-lint
Fixed linter issues
2021-03-02 21:43:04 -05:00
Matthias Hanel
c50ee2a1c6 [Changed] all times exposed will be computed in UTC (#1943)
This also applies to times that end up in that json.
Where applicable moved time.Now() to where it is used.
Moved calls to .UTC() to where time is created it that time is converted
later anyway.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-03-02 21:37:42 -05:00
Matthias Hanel
4f2db7d187 Fixed linter issues
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-03-02 20:21:44 -05:00
Derek Collison
49cd38c064 Enable cross account behaviors for mirrors and sources.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-02 06:36:57 -08:00
Derek Collison
44b08c538a Pass deliver, don't remap
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-25 17:42:03 -08:00
Derek Collison
57403b1903 When pulling consumer messages if the consumer and the client were on the same server we needed to process local deliver subject.
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 19:28:46 -08:00
Derek Collison
3def02a459 check for '\n' at beginning og key
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 17:46:30 -08:00
Derek Collison
75fbcffedb Make sure it's the exact key
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 14:56:44 -08:00
Derek Collison
36a2cbeff7 Cross account pull consumers would not work correctly due to reply subject rewrite.
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 13:33:24 -08:00
Derek Collison
a9394d7692 Handle JetStream subjects across GWs
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-23 10:56:24 -08:00
Ivan Kozlovic
2bd7a4d32e Merge pull request #1926 from nats-io/mqtt_clustering
MQTT clustering
2021-02-19 11:45:19 -07:00
Ivan Kozlovic
7526c76703 Changes to setHeader
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-19 10:46:14 -07:00
Ivan Kozlovic
61bd1b8d86 MQTT clustering
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-19 08:50:00 -07:00
Ivan Kozlovic
eafc6b7a25 [fixed] LeafNode sending message using stream's import subject.
A publish on "a" becomes an LMSG on ">" which
is the stream import's subject. The subscriber on "a" on the other
side did not receive the message.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-19 00:11:41 -05:00
Matthias Hanel
b410026319 [fixed] out of range issue in processMsgResults during subject rewrite
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-02-18 16:16:41 -05:00
Derek Collison
4759560e29 Fixed raft bug on catchup logic with external snapshots
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-12 19:58:02 -08:00
Derek Collison
7facbc995b More robust key detection per feedback
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-12 18:23:16 -08:00
Derek Collison
d803189eca Changes needed to properly support multi-layer service imports for system services like JS.
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-12 17:01:32 -08:00
Derek Collison
fa8a95a06a Improved snapshots and compactions.
Various bug fixes and stability improvements.

Signed-off-by: Derek Collison <derek@nats.io>
2021-02-11 11:16:00 -08:00
Ivan Kozlovic
8af8cf4e67 Remap subject only for service imports
Also optimized a test that was taking too long to run.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-08 14:41:33 -07:00
Jaime Piña
71b842520b Prevent non-exported messages from leaking into importer account (#1891)
* Add account isolation tests config & jwt

* Set the shadow subscription static subject
2021-02-08 14:07:18 -05:00
Ivan Kozlovic
d732c8fe82 Fixed bug that would prevent queue subs to ack messages
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-07 11:26:54 -07:00
Derek Collison
a1e0f7dc1a First pass at supercluster enablement.
This allows metacontrollers to span superclusters. Also includes placement directives for streams. By default they select the request origin cluster.

Signed-off-by: Derek Collison <derek@nats.io>
2021-02-03 17:28:13 -08:00
Ivan Kozlovic
2b8c6e0124 Support for Websocket Leafnode connections
Added two options in the remote leaf node configuration

- compress, for websocket only at the moment
- ws_masking, to force remote leafnode connections to mask websocket
frames (default is no masking since it is communication between
server to server)

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-01-28 13:13:11 -07:00
Ivan Kozlovic
131be1cb33 Make TLS client/server handshake helpers function
This reduces code duplication

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-01-28 13:13:11 -07:00
Ivan Kozlovic
33694762b1 Merge pull request #1850 from nats-io/max_control_line
[CHANGED] Enforce max_control_line for client connections only
2021-01-26 16:25:28 -07:00
Matthias Hanel
dea9effa8d [added] support for StrictSigningKeyUsage and updated jwt library (#1845)
This will cause the server to not trust accounts/user signed by an
identity key

The boot strapping system account will assume the account is issued by
the operator.
If this is not desirable, the system account can be provided right away
as resolver_preload.

[fixes] crash when the system account uses signing keys and an update changes that key set.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-01-26 17:49:58 -05:00
Ivan Kozlovic
dce814009b [CHANGED] Enforce max_control_line for client connections only
Only check limit for CLIENT connection types, however, the check
is done for CLIENT in all conditions, not only in the case of a
split buffer as it was the case so far.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-01-26 15:33:39 -07:00
Matthias Hanel
d35cd2996d [added] jwt/issuerkey/nametag/tags to monitoring and event endpoints (#1830)
Also added a trace on jwt authentication

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-01-21 21:16:34 -05:00
Derek Collison
8dc1c42fe3 Bump version, remove spurious debug prints
Signed-off-by: Derek Collison <derek@nats.io>
2021-01-20 11:58:31 -08:00