Commit Graph

855 Commits

Author SHA1 Message Date
Waldemar Quevedo
255be72df8 Report warnings when using deprecated fields
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-09-11 17:50:02 -07:00
Waldemar Quevedo
df2364af26 Add -t pedantic config check to the server
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-09-11 16:06:53 -07:00
Ivan Kozlovic
846544ecfe Merge pull request #747 from nats-io/update_route_perms
[CHANGED] Cluster permissions moved out of cluster's authorization
2018-09-11 10:04:13 -06:00
Ivan Kozlovic
e1202dd30a [CHANGED] Cluster permissions moved out of cluster's authorization
It will be possible to set subjects permissions regardless of the
presence of an authorization block.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-10 17:03:50 -06:00
Derek Collison
129866bb76 Make warning style
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:32:26 -07:00
Derek Collison
e8611b1f47 Make sure mixed mode supported for config files.
Use test helpers for generating tmp configs.

Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:29:42 -07:00
Derek Collison
fff62d5bf7 Warn on plaintext passwords in config and redact from logs
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:29:42 -07:00
Derek Collison
3d2cb0e7d1 Basic nkey support and nonce handling
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:29:42 -07:00
Waldemar Quevedo
5e3950df0a Add Warnf to logger interface
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-09-10 14:50:48 -07:00
Ivan Kozlovic
deec3b821a Fixed flappers
During a config reload, it is possible for the server to send
an -ERR with auth violation and then close the connection.
Client library most of the time will process the -ERR but in
some cases, the socket read gets an error before that can happen.

Some tests were expectign the async error handler to fire, and would
fail the test otherwise. Changed those tests to still check that
if the async error is fire, we get the expected error, but not fail
the test if we don't. We still must get the disconnected callback
in those cases though.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-07 11:56:21 -06:00
Derek Collison
f85f002a28 Update tls and remove pre 1.9 files
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-06 19:00:44 -07:00
Derek Collison
fcf1cecda9 Merge pull request #737 from nats-io/route_perm2
Route permission propogation
2018-09-05 17:32:19 -07:00
Ivan Kozlovic
b15377b40c Merge pull request #736 from nats-io/fix_flappers
Fixed flapping tests
2018-09-05 18:10:50 -06:00
Derek Collison
f032dc4529 Simplify, don't need connect processing
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-05 17:03:45 -07:00
Ivan Kozlovic
8f480f3f42 Fixed flapping tests
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-05 17:22:15 -06:00
Derek Collison
2ee868ba18 Propogate route imports and exports to other connected servers
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-05 16:15:31 -07:00
Derek Collison
1b6b5b67a9 Merge pull request #735 from nats-io/routes_perm_reporting
Report route filtering on source server
2018-09-05 14:08:45 -07:00
Derek Collison
21f29cf897 Move tests
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-05 13:52:52 -07:00
Derek Collison
4b7cca2f5e Report route filtering on source server
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-05 11:55:15 -07:00
Ivan Kozlovic
c5203dc763 Update some tests
- Config reload tests have been modified to not rely on symlink.
- Close logger on shutdown (for Windows tests cleanup)

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-05 10:45:09 -06:00
Ivan Kozlovic
5e21ca9330 [FIXED] Ports file on Windows
Needed to use filepath, not path for Join/Base in order for that
to work. Tests were actually failing on Windows and now they pass.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-05 10:00:33 -06:00
Ivan Kozlovic
2ce3aba434 Bump version and fix megacheck report
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-05 09:33:01 -06:00
Derek Collison
803ca55e87 Merge pull request #729 from nats-io/sublist_race
Avoid a race between sublist and cache on store
2018-08-29 11:48:43 -06:00
Derek Collison
5b7cabd25e Avoid race between sublist and cache on store-s 2018-08-29 11:34:55 -06:00
Ivan Kozlovic
1cdf39d7f4 Merge pull request #727 from nats-io/fix_route_permissions
Fixed crash related to route permissions after allow/deny feature
2018-08-27 19:16:35 -06:00
Ivan Kozlovic
156224a85b Fix sublist cache flapping test
Use `checkFor` to ensure that cache size is ok. Repeated test
1000 times and no failure now.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-08-27 15:01:38 -06:00
Ivan Kozlovic
7e39d0935d Fixed crash related to route permissions after allow/deny feature
This is an issue in master only, not in any public release.
The issue is that permissions should be assigned as-is for the
route perms because Publish/Subscribe could be nil, so trying
to dereference Publish.Allow/Deny or Subscribe.Allow/Deny could
crash. The code checking for permissions correctly check if
Publish/Subscribe is nil or not.

This was introduced with PR #725

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-08-27 14:43:32 -06:00
Derek Collison
c926b56d1f Merge pull request #726 from nats-io/sublist_cache
Sublist Shared Cache Improvements
2018-08-27 12:03:49 -07:00
Derek Collison
2c4b7e7d54 Let cache sweeper run
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-27 12:56:28 -06:00
Derek Collison
ad3a1506d3 Move test into cache test, make sure it fails
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-27 12:49:29 -06:00
Derek Collison
ab9e4c7d8a Fix for wildcard cache addition
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-27 12:28:32 -06:00
Derek Collison
d21ac8de35 Use sync.Map for cache, fast version of literal test
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-25 17:42:36 -07:00
Derek Collison
543d403337 Optimize sublist cache, add tests for cache contention
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-25 14:33:15 -07:00
Derek Collison
34b556dd9f Additional nil checks for perms
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-25 09:49:29 -07:00
Derek Collison
7b9bab22c9 Reduce duplicate code, check subjects
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-23 16:47:20 -07:00
Derek Collison
3798df3044 Undo tmp changes not meant for PR
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-23 16:41:55 -07:00
Derek Collison
5955f22d65 Add in route permission support
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-23 14:42:43 -07:00
Derek Collison
a79806e79d Add enforcement of allow and deny permissions
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-23 11:00:35 -07:00
Derek Collison
65188f9768 Added parser for new style authorizations
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-22 20:41:48 -07:00
Ivan Kozlovic
3ad63c7cb6 Merge pull request #722 from nats-io/changes_for_service_and_syslog
Update service and syslog code to use variable instead of constant
2018-08-16 11:47:12 -06:00
Ivan Kozlovic
2153a45050 Update service and syslog code to use variable instead of constant
for the process name and service name. This allows the reuse of this
code in NATS Streaming Server by invoking the new setters to
change the service and process names.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-08-16 10:21:01 -06:00
Ivan Kozlovic
b1bb181f3d Ensure URLs are compared using reflect.DeepEqual
I don't think it is a good thing to compare the pointers and we
should use the DeepEqual instead.
When comparing a solicited route's URL to the URL that was created
during the parsing of the configuration, the pointers maybe the
same and so u1 == u2 would work. However, there are cases where
the URL is built on the fly based on the received route INFO protocol
so I think it is safer to use a function that does a reflect.DeepEqual
instead.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-08-16 09:48:32 -06:00
Ivan Kozlovic
d98d51c8cc [FIXED] Possible cluster Authorization Error during config reload
When changing something in the cluster, such as Timeout and doing
a config reload, the route could be closed with an `Authorization
Error` report. Moreover, the route would not try to reconnect,
even if specified as an explicit route.

There were 2 issues:
- When checking if a solicited route is still valid, we need to
  check the Routes' URL against the URL that we try to connect
  to but not compare the pointers, but either do a reflect
  deep equal, or compare their String representation (this is
  what I do in the PR).
- We should check route authorization only if this is an accepted
  route, not an explicit one. The reason is that we a server
  explicitly connect to another server, it does not get the remote
  server's username and password. So the check would always fail.

Note: It is possible that a config reload even without any change
in the cluster triggers the code checking if routes are properly
authorized, and that happens if there is TLS specified. When
the reload code checks if config has changed, the TLSConfig
between the old and new seem to indicate a change, eventhough there
is apparently none. Another reload does not detect a change. I
suspect some internal state in TLSConfig that causes the
reflect.DeepEqual() to report a difference.

Note2: This commit also contains fixes to regex that staticcheck
would otherwise complain about (they did not have any special
character), and I have removed printing the usage on startup when
getting an error. The usage is still correctly printed if passing
a parameter that is unknown.

Resolves #719

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-08-15 18:20:29 -06:00
Ivan Kozlovic
cd28d58a90 Prepare for release 1.2.0
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-07-05 10:12:06 -06:00
Ivan Kozlovic
508240ba8b Merge pull request #708 from nats-io/flaky
Fix for flaky tests
2018-07-03 11:31:23 -06:00
Ivan Kozlovic
895f05e5e9 Merge pull request #691 from nats-io/port-file
Added Internal option to write a ports file `--ports_file_dir`
2018-07-02 18:03:47 -06:00
Derek Collison
f7241aa435 Allow max and max/2 for edge conditions
Signed-off-by: Derek Collison <derek@nats.io>
2018-07-02 14:29:29 -07:00
Alberto Ricart
456c09855e fmt 2018-07-02 15:50:03 -05:00
Derek Collison
85c2edc314 Make sure to flush the sub
Signed-off-by: Derek Collison <derek@nats.io>
2018-07-02 12:10:17 -07:00
Derek Collison
90a3a1d8b4 Slow down sweeper to make sure we receive all messages
Signed-off-by: Derek Collison <derek@nats.io>
2018-07-02 12:02:59 -07:00