Commit Graph

2989 Commits

Author SHA1 Message Date
Ivan Kozlovic
53a990f426 Fixed flapper
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-18 16:13:17 -06:00
Derek Collison
9bf85aca2b Merge pull request #1483 from nats-io/fs_bug
Run expiration only once at a time and double check cache, fixes #1482
2020-06-18 14:07:33 -07:00
Derek Collison
95462cde57 Fix for memory expiration and age timer
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-18 14:02:11 -07:00
Derek Collison
05fa11ba2f Merge pull request #1484 from nats-io/cnrace
Avoid data race on cluster name
2020-06-18 13:59:40 -07:00
Derek Collison
c7e4d8b194 Avoid data race on cluster name
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-18 13:17:50 -07:00
Ivan Kozlovic
dc88143b82 Merge pull request #1477 from pas2k/ws_cookie_auth
[ADDED] Cookie JWT auth for WebSocket
2020-06-18 14:01:14 -06:00
Ivan Kozlovic
c86bb0b3f2 Merge pull request #1481 from nats-io/filter_ping
Add filtering by name and cluster to PING events
2020-06-18 13:45:07 -06:00
Derek Collison
a13402cd01 Run expiration only once at a time and double check cache, fixes #1482
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-18 12:14:25 -07:00
Pavel Khlebovich
d5eb9ff6f2 Support Cookie JWT auth via WebSocket 2020-06-18 19:27:42 +03:00
Derek Collison
fa744fdcda Proper no response
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-17 15:47:55 -07:00
Derek Collison
6c69c6ae48 Off by one, and need to send in place
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-17 15:32:26 -07:00
Matthias Hanel
1309605563 Filter by host and json name change
Also added more unit tests

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-06-17 15:10:41 -04:00
Matthias Hanel
d086a39b64 Add filtering by name and cluster to PING events
On cluster name change, reset internalSendLoop so it picks up the
changed name.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-06-16 18:26:35 -04:00
Derek Collison
cef1fdae0b Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-16 14:50:43 -07:00
Derek Collison
58e5b3ac5a Merge pull request #1480 from nats-io/spoke_perms
Properly handle leafnode spoke permissions.
2020-06-16 14:50:03 -07:00
Derek Collison
3729552a37 Always check publish perms for leafnode delivery
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-16 13:34:53 -07:00
Derek Collison
98f84bdbc8 Make sure to merge with local deny clauses
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-16 11:56:24 -07:00
Derek Collison
3541e3f0f9 Updated older tests for new functionality
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-16 10:56:39 -07:00
Derek Collison
ca4f03c1a6 Properly handle leafnode spoke permissions.
When a leafnode would connect with credentials that had permissions the spoke did not have a way of knowing what those were.
This could lead to being disconnected when sending subscriptions or messages to the hub which were not allowed.

Signed-off-by: Derek Collison <derek@nats.io>
2020-06-16 08:33:09 -07:00
Derek Collison
c8b4b2efa3 Merge pull request #1478 from nats-io/no_responders
Allow support for no responders nil response message.
2020-06-15 10:39:07 -07:00
Derek Collison
e1c397342c Merge branch 'master' into no_responders 2020-06-15 10:23:01 -07:00
Derek Collison
ddb4219f7a Allow support for a empty response message when no responders are present.
This will also set a response status of 503 with the new header support.

Signed-off-by: Derek Collison <derek@nats.io>
2020-06-15 10:10:21 -07:00
Derek Collison
2b9e3e5b15 Merge pull request #1476 from nats-io/cluster_name
Cluster names are now required.
2020-06-15 10:07:30 -07:00
Derek Collison
1e52a1007b More updates based on feedback
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-13 08:00:57 -07:00
Derek Collison
146d8f5dcb Updates based on feedback, sped up some slow tests
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-12 17:26:43 -07:00
Ivan Kozlovic
498e625fba Merge pull request #1475 from nats-io/fix_leafnode_solicit_failure_race
[FIXED] LeafNode solicit failure race could leave conn registered
2020-06-12 17:04:16 -06:00
Ivan Kozlovic
b36672a6bc Fixed flapper
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-12 16:51:40 -06:00
Derek Collison
dd61535e5a Cluster names are now required.
Added cluster names as required for prep work for clustered JetStream. System can dynamically pick a cluster name and settle on one even in large clusters.

Signed-off-by: Derek Collison <derek@nats.io>
2020-06-12 15:48:38 -07:00
Ivan Kozlovic
61cccbce02 [FIXED] LeafNode solicit failure race could leave conn registered
This was found due to a recent test that was flapping. The test
was not checking the correct server for leafnode connection, but
that uncovered the following bug:

When a leafnode connection is solicited, the read/write loops are
started. Then, the connection lock is released and several
functions invoked to register the connection with an account and
add to the connection leafs map.
The problem is that the readloop (for instance) could get a read
error and close the connection *before* the above said code
executes, which would lead to a connection incorrectly registered.

This could be fixed either by delaying the start of read/write loops
after the registration is done, or like in this PR, check the
connection close status after registration, and if closed, manually
undoing the registration with account/leafs map.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-12 16:01:13 -06:00
Ivan Kozlovic
7545ff1cef Merge pull request #1473 from nats-io/fix_1451
[ADDED] Print the config file being used in startup banner
2020-06-12 13:51:38 -06:00
Ivan Kozlovic
d6de05f49a Fixed a test with data race
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-12 13:04:05 -06:00
Ivan Kozlovic
67d2638859 [ADDED] Print the config file being used in startup banner
Resolves #1451

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-12 12:21:50 -06:00
Ivan Kozlovic
02eb98c3c6 Merge pull request #1470 from nats-io/fix_websocket_auth_override_and_perf
[FIXED] LeafNode TLSMap and websocket auth override
2020-06-12 10:14:03 -06:00
Ivan Kozlovic
e9679523d8 Merge pull request #1471 from nats-io/fix_ping_test
Fixed TestPing test
2020-06-12 10:13:08 -06:00
Ivan Kozlovic
b60d5e6796 Fixed TestPing test
The test was not checking that PINGs were sent, however, without
disabling the first short ping and with a very low interval, there
was chance on Travis that the first short ping was sent before
the client had connected, which would break the NATS client protocol
that expects to receive a PONG to initial PING (after CONNECT).
The client library could arguably be updated to accept PING during
the CONNECT phase.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-12 10:03:47 -06:00
Derek Collison
240e72b91c Merge pull request #1469 from nats-io/fix-typo
Fix typo in maintainers.md
2020-06-11 16:33:01 -07:00
Waldemar Quevedo
c1a4372949 Fix maintainers typo 2020-06-11 16:31:09 -07:00
Ivan Kozlovic
d2a8282a0d [FIXED] LeafNode TLSMap and websocket auth override
We added authentication override block for websocket configuration
in PR #1463 and #1465 which somehow introduced a drop in perf as
reported by the bench tests.
This PR refactors a bit to restore the performance numbers.

This change also fixes the override behavior for websocket auth:
- If websocket's NoAuthUser is configured, the websocket's auth
  block MUST define Users, and the user be present.
- If there is any override (username/pwd,token,etc..) then the
  whole block config will be used when authenticating a websocket
  client, which means that if websocket NoAuthUser is empty we
  are not falling back to the regular client's NoAuthUser config.
- TLSMap always override the regular client's config. That is,
  whatever TLSMap value specified in the websocket's tls{} block
  will be used.

The TLSMap configuration was not used for LeafNodes. The behavior
now will be:
- If LeafNode's auth block contains users and TLSMap is true,
  the user is looked up based on the cert's info. If not found,
  authentication will fail. If found, it will be authenticated
  and bound to associated account.
- If no user is specified in LeafNode's auth block and TLSMap
  is true, then the cert's info will be used against the global
  users map.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-11 17:06:54 -06:00
R.I.Pienaar
967bb66061 Merge pull request #1430 from nats-io/header-spec
Header specification from the perspective of client libraries.
2020-06-11 22:06:27 +02:00
R.I.Pienaar
1546b3da82 Merge pull request #1405 from ripienaar/distributed_tracing_adr
distributed tracing adr
2020-06-11 22:06:08 +02:00
Alberto Ricart
3c3ee22e9f changed \r to and \n to 2020-06-11 12:11:43 -05:00
Ivan Kozlovic
ddfbc33c95 Merge pull request #1465 from nats-io/users_nkeys_map
Refactor some code to make it reuseable
2020-06-09 17:50:03 -06:00
Ivan Kozlovic
313cf898c1 Refactor some code to make it reuseable
Building server's nkeys and users map out of slices form options
has been made a function so it can be used for the server and
websocket (and in future for mqtt)

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-09 17:27:51 -06:00
Ivan Kozlovic
d18b013676 Merge pull request #1463 from nats-io/websocket_auth_block
Added dedicated auth block for websocket
2020-06-09 16:09:41 -06:00
Ivan Kozlovic
ec5caa692b Merge pull request #1464 from nats-io/fix_flapper
Fixed flappers
2020-06-09 16:08:50 -06:00
Ivan Kozlovic
b9bd5c2d35 Fixed flappers
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-09 15:34:52 -06:00
Ivan Kozlovic
01b14c2abe Added dedicated auth block for websocket
Websocket can now override
- Username/password
- Token
- Users
- NKeys
- no_auth_user
- auth_timeout

For TLS, support for verify and verify_and_map. We used to set
tls config's ClientAuth to NoClientCert. It will now depend
if the config requires client certificate verification, which
is needed if TLSMap is enabled.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-09 11:29:52 -06:00
Derek Collison
bfe52fdb77 Merge pull request #1458 from nats-io/mixed
Allow mixed TLS and non-TLS on same port.
2020-06-08 11:12:45 -07:00
Ivan Kozlovic
6413fcd9c0 Merge pull request #1460 from nats-io/fix_1459
[ADDED] lame_duck_grace_period option
2020-06-08 12:07:47 -06:00
Ivan Kozlovic
cd6d71deaa [ADDED] lame_duck_grace_period option
The grace period used to be hardcoded at 10 seconds.
This option allows the user to configure the amount of time the
server will wait before initiating the closing of client connections.

Note that the grace period needs to be strictly lower than the overall
lame_duck_duration. The server deducts the grace period from that
overall duration and spreads the closing of connections during
that time.
For instance, if there are 1000 connections and the lame duck
duration is set to 30 seconds and grace period to 10, then
the server will use 30-10 = 20 seconds to spread the closing
of those 1000 connections, so say roughly 50 clients per second.

Resolves #1459.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-06-08 11:43:25 -06:00