Commit Graph

1892 Commits

Author SHA1 Message Date
R.I.Pienaar
cd376aa753 Do not ack to AckNxt
This causes nil messages mid content stream and is confusing,
the test for this is amended to test the content received for
validity - where previously the test assumed any content is
good content but in fact it only received half the content.

Removing this behaviour until we can design this properly

Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-09-21 17:28:53 +02:00
Matthias Hanel
f76d6e38bd Adding new subscription for account conns (#1599)
This fits better with similar events
New subject is $SYS.ACCOUNT.%s.SERVER.CONNS
Old subject remains for backwards compatibiliby

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-09-18 15:52:23 -06:00
Ivan Kozlovic
04f96813a7 Validate options for user embedded NATS Server in their app
We were doing option validation from options parsing, but added
it also for Users/NKeyUsers options.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-09-18 13:09:52 -06:00
Ivan Kozlovic
e84f1cf52c Added test with unknown JWT allowed connection type
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-09-17 18:17:19 -06:00
Ivan Kozlovic
648346f857 Add some tests for config parsing
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-09-16 19:17:12 -06:00
Ivan Kozlovic
7ccbaca782 Added an allowed connection type filter for users
Users and NKey users will now have the option to specify a list
of allowed connection types.

This will allow for instance a certain user to be allowed to
connect as a standard NATS client, but not as Websocket, or
vice-versa.

This also fixes the websocket auth override. Indeed, with
the original behavior, the websocket users would have been bound
to $G, which would not work when there are accounts defined, since
when that is the case, no app can connect/bind to $G account.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-09-16 18:22:44 -06:00
Ivan Kozlovic
04ec50865d Merge pull request #1598 from nats-io/sys-evt-cleanup
Tie account in system event subject to data and clean up subject names
2020-09-16 15:29:40 -06:00
Matthias Hanel
3c149ea99b Incorporating comments and renaming claims pack as well
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-09-16 16:04:33 -04:00
Matthias Hanel
a4c069884f Tie account in system event subject to data and clean up subject names
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-09-16 13:26:06 -04:00
David Simner
a4b13c0f8b Change nats.io resources from HTTP to HTTPS 2020-09-15 15:23:04 +02:00
Ivan Kozlovic
bd920c42bc Fix dirstore code and speed up some tests
When using Unix() time, since it is number of seconds, it is better
to round up the time before adding a ttl. Trying to shorten some
of the tests showed that in some cases a file was removed too early.
This was because the computed expiration with ttl fell in the same
second, so the file was removed prematurely.

So anywhere where we used to do: time.Now().Addd(ttl).Unix(), I
changed to time.Now().Round(time.Second).Add(ttl).Unix().

I was able to reduce the time of TestTTL from 21 seconds down to
less than 5. TestExpiration was also shorten.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-09-10 17:47:33 -06:00
Ivan Kozlovic
540160116e Merge pull request #1587 from nats-io/js-jwt
Updating jetstream account settings from jwt
2020-09-10 12:52:25 -06:00
Waldemar Quevedo
de98a04aa2 Update config check tests
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-09-09 04:46:52 -07:00
Waldemar Quevedo
26f4971827 Fix all certs for Go 1.15 SAN and CN changes
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-09-09 04:43:23 -07:00
Ivan Kozlovic
2ad2bed170 [ADDED] Support for route hostname resolution
We previously simply called DialTimeout() on a route's url when
soliciting. If it resolved to the IP of the host, it would create
a route to self, which server detects, but then would not try again
with other IPs that would have allowed to form a cluster with
other servers running on the other IPs.

This PR keeps track of local IPs + cluster port and exclude them
from the list of IPs returned by LookupHost API. This even prevent
solicitation of routes to self. Only non-local IPs will be tried.

Resolves #1586

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-09-08 13:40:17 -06:00
Matthias Hanel
d6ab6799b4 Fixing unit test
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-09-04 17:14:51 -04:00
Matthias Hanel
a3c5fd4575 Updating jetstream account settings from jwt
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-09-04 16:07:38 -04:00
Waldemar Quevedo
3161cb1693 Add more config checks for leafnode remotes
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-09-04 00:34:40 -07:00
Matthias Hanel
3954030abf [FIXED] Error when importing an account results in an error, retry later (#1578)
* [FIXED] Error when importing an account results in an error

When the account that could not be imported is updated, update the
original account as well.

Fixes #1582

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-09-03 13:57:06 -06:00
Derek Collison
959b35a775 Merge pull request #1581 from nats-io/js_interest_only
JetStream fixes for InterestPolicy retention
2020-09-03 12:19:40 -07:00
Derek Collison
bcbf28fb3a Make sure to clear messages from stream when consumer deleted
Signed-off-by: Derek Collison <derek@nats.io>
2020-09-03 11:41:14 -07:00
Waldemar Quevedo
57f2c74d62 Better support for distinguishedNameMatch in TLS Auth
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-09-03 00:52:50 -07:00
Derek Collison
3faa2e7637 Fix for #1580
Signed-off-by: Derek Collison <derek@nats.io>
2020-09-02 17:18:28 -07:00
Derek Collison
cdbea93a87 Interest based retention should not store if no consumers present.
Fix for https://github.com/nats-io/jetstream/issues/314

Signed-off-by: Derek Collison <derek@nats.io>
2020-09-02 16:04:38 -07:00
Matthias Hanel
40e4659f25 Convert current time into time for locale before usage
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-31 18:46:26 -04:00
Matthias Hanel
b02b6215b6 Support locale for times in user jwt
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-28 16:01:00 -04:00
Matthias Hanel
cc14e54179 Discard client provided jwt when not in operator mode
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-28 12:31:02 -04:00
Matthias Hanel
431560b004 Update JWT and incorporate change of cidr ranges from string to array
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-27 23:11:54 -04:00
Matthias Hanel
846b2b5ce0 Fix flapping test and limit channel recv when there is an error
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-25 00:36:14 -04:00
Matthias Hanel
9d1526cbb8 Adding user jwt payload and subscriber limits
Addresses part of #1552

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-24 18:16:25 -04:00
Ivan Kozlovic
8c60b10d5f Merge pull request #1553 from bfoxstudio/feature/monitoring_proxy
fix absolute url in monitoring menu
2020-08-24 13:31:27 -06:00
Matthias Hanel
6bfa25376d Removing blank line from imports 2020-08-24 11:49:50 -04:00
Matthias Hanel
32615b4c71 Update jwtv2 and fix test that embedded jwtv2 operators
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-24 11:49:50 -04:00
Matthias Hanel
e1350a05f3 Emit latency traces when sampling is set to headers
Latency reports will include the header(s) responsible for the trace
Updated ADR to have it reflect implementation

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-21 20:01:11 -04:00
Matthias Hanel
9bad6725aa Speed up test and make it more robust (#1569)
* Speed up test and make it more robust

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-21 17:41:44 -06:00
Matthias Hanel
6c61464915 [ADDED] Checks for CIDR blocks and connect time ranges specified in jwt (#1567)
because times stored are hh:mm:ss it is possible to end up with start > end where end is actually the next day.
jwt.go line 189

Also, ranges are based on the servers location, not the clients.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-20 13:28:16 -06:00
Ivan Kozlovic
7cc0113076 Merge pull request #1565 from nats-io/fix_panic_on_conn_close_early
[FIXED] Possible panic for TLS connections that are aborted early
2020-08-18 16:50:45 -06:00
Ivan Kozlovic
92970316ee [FIXED] Possible panic for TLS connections that are aborted early
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-08-18 16:38:35 -06:00
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
bfoxstudio
ae2411c013 fix absolute url in monitoring menu 2020-08-10 19:40:36 +03:00
Derek Collison
400b044ea0 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2020-08-05 10:54:56 -07: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
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