Commit Graph

3084 Commits

Author SHA1 Message Date
Matthias Hanel
48c87c1447 Nats based resolver & avoiding nats account server in smaller deployments (#1550)
* Adding nats based resolver and bootstrap system account

These resolver operate on an exclusive  directory
Two types:
full: managing all jwt in the directory
    Will synchronize with other full resolver
    nats-account-server will also run such a resolver
cache: lru cache managing only a subset of all jwt in the directory
    Will lookup jwt from full resolver
    Can overwrite expiration with a ttl for the file

Both:
    track expiration of jwt and clean up
    Support reload
    Notify the server of changed jwt

Bootstrapping system account allows users signed with the system account
jwt to connect, without the server knowing the jwt.
This allows uploading jwt (including system account) using nats by
publishing to $SYS.ACCOUNT.<name>.CLAIMS.UPDATE
Sending a request, server will respond with the result of the operation.

Receive all jwt stored in one server by sending a
request to $SYS.ACCOUNT.CLAIMS.PACK
One server will respond with a message per stored jwt.
The end of the responses is indicated by an empty message.

The content of dirstore.go and dirstore_test.go was moved from
nats-account-server

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-18 13:58:41 -06:00
Derek Collison
fe549a1979 Merge pull request #1564 from nats-io/js_state_fix
Fix for https://github.com/nats-io/jetstream/issues/297
2020-08-18 11:24:07 -07:00
Ivan Kozlovic
74bdf38538 Merge pull request #1555 from nats-io/event_structs
Create dedicated options struct for system events that invoke monitoring
2020-08-17 12:06:16 -06:00
Matthias Hanel
2381d734bb Incorporating suggestions and fixes
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-17 13:44:22 -04:00
Derek Collison
3a61a0cef8 Fix for https://github.com/nats-io/jetstream/issues/297
Signed-off-by: Derek Collison <derek@nats.io>
2020-08-17 10:35:07 -07:00
Derek Collison
d30550166e Bumped version
Signed-off-by: Derek Collison <derek@nats.io>
2020-08-14 10:39:04 -07:00
Phil Pennock
3c680eceb9 Inhibit Go's default TCP keepalive settings for NATS (#1562)
Inhibit Go's default TCP keepalive settings for NATS

Go 1.13 changed the semantics of the tuning parameters for TCP keepalives, including the default value.  This affects all TCP listeners.  The NATS protocol has its own L7 keepalive system (PING/PONG) and the Go defaults are not a good fit for some valid deployment scenarios, while Go doesn't directly expose a working API for tuning these.

Rather than add a configuration knob and pull in another dependency (with portability issues) just disable TCP keepalives for all listeners used for speaking the NATS protocol.

Change the tests so we test the same logic.  Do not change HTTP monitoring, profiling, or the websocket API listeners.

Change KeepAlive on client connections too.
2020-08-14 13:37:59 -04:00
Matthias Hanel
913355250d Create dedicated options struct for system events that invoke monitoring
The dedicated struct contains filter options not used in monitoring
This also alters the json to filter by server name from "name" to
"server_name". Filtering is not released yet. Thus ok to change.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-12 18:16:41 -04:00
Derek Collison
400b044ea0 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2020-08-05 10:54:56 -07:00
Ivan Kozlovic
4d0e50209c Merge pull request #1549 from nats-io/reload_auth_service_imp_deadlock
[FIXED] Deadlock on config reload with routes and account service import
2020-08-03 15:54:36 -06:00
Ivan Kozlovic
f11931314f [FIXED] Deadlock on config reload with routes and account service import
Related to #1544

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-08-03 15:45:21 -06:00
Ivan Kozlovic
a1484931b8 Merge pull request #1548 from nats-io/syssubscribe_races
Fix sysSubscribe races
2020-08-03 15:36:07 -06:00
Ivan Kozlovic
22833c8d1a Fix sysSubscribe races
Made changes to processSub() to accept subscription properties,
including the icb callback so that it is set prior to add the
subscription to the account's sublist, which prevent races.
Fixed some other racy conditions, notably in addServiceImportSub()

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-08-03 14:59:00 -06:00
Ivan Kozlovic
94fee0eb01 Merge pull request #1547 from nats-io/rework_close_connection
Rework closeConnection()
2020-08-03 11:01:15 -06:00
Ivan Kozlovic
c620175353 Rework closeConnection()
This change allows the removal of the connection and update of
the server state to be done "in place" but still delay the flushing
of and close of tcp connection to the writeLoop. With ref counting
we ensure that the reconnect happens after the flushing but not
before the state has been updated.

Had to fix some places where we may have called closeConnection()
from under the server lock since it now would deadlock for sure.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-31 15:30:17 -06:00
Ivan Kozlovic
9bad202d5d Merge pull request #1546 from nats-io/systemQ
Deliver to all non remote queue subscriber instead of kind == CLIENT
2020-07-31 14:45:03 -06:00
Matthias Hanel
b759282407 Removing gateway as this condition won't be happening
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-31 16:26:33 -04:00
Matthias Hanel
e089fae7fb Deliver to all non remote queue subscriber instead of kind == CLIENT
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-31 15:18:26 -04:00
Ivan Kozlovic
33d41c7447 Merge pull request #1545 from nats-io/fix_1543
[FIXED] Possible deadlock with solicited leafnodes when cluster conflict
2020-07-31 09:11:31 -06:00
Ivan Kozlovic
96ccf91566 [FIXED] Possible deadlock with solicited leafnodes when cluster conflict
We cannot call c.closeConnection() under the server lock because
closeConnection() can invoke server lock in some cases.

Created a test that should run without `-race` to reproduce the deadlock
(which it does) but sometimes would fail because cluster would not be
formed. This unconvered an issue with conflict resolution which
test TestRouteClusterNameConflictBetweenStaticAndDynamic() can reproduce
easily. The issue was that we were not updating a dynamic name with
the remote if the remote was non dynamic.

Resolves #1543

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-30 18:45:36 -06:00
Ivan Kozlovic
60f9256d40 Merge pull request #1542 from nats-io/websocket_no_tls
Websocket: add option to disable TLS
2020-07-29 18:11:10 -06:00
Ivan Kozlovic
20a67a5be8 Websocket: add option to disable TLS
The new option Websocket.NoTLS would have to be set to true
to disable the server check that enforces TLS configuration.

Resolves #1529

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-29 17:33:02 -06:00
Derek Collison
6e1a892740 Merge pull request #1531 from ripienaar/max_consumers
allow max consumers to be set
2020-07-29 09:09:11 -07:00
Ivan Kozlovic
e2333641f9 Merge pull request #1539 from nats-io/silent_sub_loss_in_cluster
Remove unnecessary account fetch from remote remove functions
2020-07-28 09:31:18 -06:00
Matthias Hanel
3da66ad80d Remove unnecessary account fetch from remote remove functions
Changed: removeReplySub, removeRemoteSubs and processRemoteUnsub

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-28 11:00:17 -04:00
Ivan Kozlovic
fbab1daf06 Merge pull request #1538 from nats-io/silent_sub_loss_in_cluster
[Fixed] Skip fetch when a non config based account resolver is used
2020-07-27 17:29:09 -06:00
Matthias Hanel
946e8415a0 Incorporating review comments 2020-07-27 19:19:43 -04:00
Matthias Hanel
00faefec06 Reduce usage of tmpAccounts to only location where it is needed imports
On import handle it with priority as in non recursive situations, it
won't be present.
2020-07-27 17:38:39 -04:00
Matthias Hanel
37692d2cf9 [Fixed] Skip fetch when a non config based account resolver is used
Resolves #1532

Instead of the fetched account we create a dummy account that is
expired. Any client connecting will trigger a fetch of the actual
account jwt.

This also avoids one fetch, thus the unit test was changed to reflect
this.
Unlike other resolver the memory resolver does not depend on external
systems. It is purely based on server configuration. Therefore, fetch
can be done and not finding an account means there is a configuration issue.
2020-07-27 17:36:55 -04:00
Ivan Kozlovic
b71ba6e223 Merge pull request #1536 from nats-io/untrusted_account_memory
Ensuring that an untrusted account is not held in memory
2020-07-27 13:50:44 -06:00
R.I.Pienaar
b80e40340e allow account limits to be applied to unlimited streams
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-07-27 19:02:37 +02:00
Matthias Hanel
99921725a9 Ensuring that an untrusted account is not held in memory
The check that an account has to be signed by a configured operator is
done after fetch as well. As a consequence an account claim will never
become an Account in memory.
The original check during client or leaf authentication is left in
place.

Adding unit tests.
Modifying existing tests to not rely on an account but it's name instead.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-27 11:59:49 -04:00
Ivan Kozlovic
00eb20b293 Merge pull request #1533 from nats-io/silent_sub_loss_in_cluster
Adding unit test demonstrating silent subscription loss
2020-07-24 14:37:35 -06:00
Derek Collison
ad8d768d34 bumped beta version
Signed-off-by: Derek Collison <derek@nats.io>
2020-07-24 11:25:59 -07:00
Derek Collison
ec34552a88 Merge pull request #1534 from nats-io/ratelimit
Add in push based consumer rate limits
2020-07-24 13:25:10 -05:00
Matthias Hanel
59af53c452 Adding unit test demonstrating silent subscription loss
This test uses is skipped for now

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-24 13:21:27 -04:00
Derek Collison
154d4303a9 Add in consumer rate limits
Signed-off-by: Derek Collison <derek@nats.io>
2020-07-24 10:11:32 -07:00
R.I.Pienaar
ca0dc72841 allow max consumers to be set
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-07-24 17:30:41 +02:00
Ivan Kozlovic
aa67270ea5 Merge pull request #1530 from nats-io/fix_1527
[FIXED] Queue subscriptions not able to receive system events.
2020-07-23 12:40:38 -06:00
Ivan Kozlovic
dbf962f958 [FIXED] Queue subscriptions not able to receive system events.
The issue was caused by the kind of connections being checked.

Resolves #1527

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-23 11:38:43 -06:00
Derek Collison
9514576b72 Merge pull request #1526 from nats-io/no-header-support-option
added 'no_header_support' config option mapping to NoHeaderSupport
2020-07-22 12:13:30 -05:00
Alberto Ricart
2047c791ea added option so clients can test if a server disables header support 2020-07-22 10:11:44 -05:00
Derek Collison
70769b1d2d Merge pull request #1524 from nats-io/jsfix
Fix for stream delete with many consumers
2020-07-22 09:55:45 -05:00
Derek Collison
48b2335cbf Fix for stream delete with many consumers - https://github.com/nats-io/jetstream/issues/260
Signed-off-by: Derek Collison <derek@nats.io>
2020-07-22 07:35:38 -07:00
Ivan Kozlovic
449f7f15cb Merge pull request #1523 from nats-io/add_cmd_line_cluster_name
Added -cluster_name command line option
2020-07-21 16:45:21 -06:00
Ivan Kozlovic
0ce84a83c5 Added -cluster_name command line option
This is handy for client libraries that start the server as
external executable and pass command line arguments. Without
specifying the cluster name, routes can take time to establish
and cause some tests to fail.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-21 15:50:24 -06:00
Derek Collison
1d394fbd28 Merge pull request #1522 from nats-io/adr-ldm
adr describing new `ldm` field in the `INFO` protocol.
2020-07-20 17:45:53 -05:00
Alberto Ricart
d2c50be093 adr describing new ldm field in the INFO protocol. 2020-07-20 10:41:06 -05:00
Derek Collison
862dfcde0e Merge pull request #1521 from ripienaar/unlimited_accounts
ensure unlimited account limits are calculated correctly
2020-07-20 07:50:17 -05:00
R.I.Pienaar
5037f00b30 ensure unlimited account limits are calculated correctly
Previously unlimited accounts - ones who inherit server values - would
be unable to publish any messags at all

Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-07-20 10:46:34 +02:00