Commit Graph

6080 Commits

Author SHA1 Message Date
Marco Primi
b42b0d5a77 Ignore dist and .vscode 2022-08-03 14:01:55 -07:00
Derek Collison
f7387f7762 Bump to 2.9.0-beta.19
Signed-off-by: Derek Collison <derek@nats.io>
2022-08-03 13:00:07 -07:00
Derek Collison
377ed4c365 Merge pull request #3327 from nats-io/direct-auto
Auto-set and upgrade AllowDirect when MaxMsgsPerSubject is set.
2022-08-03 12:59:31 -07:00
Derek Collison
748890adb1 Auto-set and upgrade AllowDirect when MaxMsgsPerSubject is set.
Also allow mirrors to inherit properly.

Signed-off-by: Derek Collison <derek@nats.io>
2022-08-03 12:36:52 -07:00
Derek Collison
d7847c97c1 Bump to 2.9.0-beta.18
Signed-off-by: Derek Collison <derek@nats.io>
2022-08-03 08:07:12 -07:00
Derek Collison
f45454b5a4 Merge pull request #3325 from nats-io/dg-perms
Allow direct get by subject to be all subject based.
2022-08-03 08:04:41 -07:00
Ivan Kozlovic
22b91238f3 Merge pull request #3323 from nats-io/js_raft_move_warn_to_debug
Downgrade a RAFT warning to debug
2022-08-03 08:52:52 -06:00
Matthias Hanel
ed2cb280cc Move to crypto/rand for nonce generation (#3324)
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-08-03 06:52:26 +02:00
Derek Collison
c82c49451c Allow direct get by subject to be all subject based.
This avoids marshalling or unmarshalling but also allows subject based permissioning.

Signed-off-by: Derek Collison <derek@nats.io>
2022-08-02 18:19:33 -07:00
Ivan Kozlovic
37c923c28e Downgrade a RAFT warning to debug
This is related to PR #3307.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-08-02 18:06:39 -06:00
Derek Collison
8ae0757e91 Merge pull request #3320 from nats-io/kv_improvements
[IMPROVED] Speed of storing new keys with a large number of pre-existing keys.
2022-08-02 09:15:06 -07:00
Derek Collison
6450301cfc Improved speed of storing new messages when lots of messages are present in KV mode.
Signed-off-by: Derek Collison <derek@nats.io>
2022-08-01 14:02:19 -07:00
Derek Collison
903a06a5b4 Bump to 2.9.0-beta.17
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-31 11:44:15 -07:00
Ivan Kozlovic
b6b746095b Merge pull request #3315 from nats-io/fix_3313
[FIXED] MQTT: Possible panic when clients misbehave
2022-07-31 12:43:28 -06:00
Derek Collison
588a8fcca9 Merge pull request #3314 from nats-io/enc_dsnap_bug
[FIXED] Instability with encrypted systems
2022-07-31 11:43:17 -07:00
Ivan Kozlovic
6460519cf5 [FIXED] MQTT: Possible panic when clients misbehave
If a client with a given client ID is connected and while connected
another client tries to reuse the same client ID, the spec says that
the old client be closed and the new one accepted.
However, the server protects from this flapping happening all the time
by rejecting new clients that try to connect at a very fast pace.

However, the server was closing a misbehaving client after a second
delay (to prevent immediate reconnect if the client library does that)
but was not blocking the read loop and the compounding issue was that
if that misbehaving client is REALLY misbehaving and not waiting for
the CONNACK to send more protocols (for instance SUB) the server would
panic because the client was not fully configured.

To prevent that, the server will now "block" this misbehaving client
in its readLoop before closing the connection, preventing processing
of possible protocols that follow the CONNECT.

Resolves #3313

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-31 12:20:38 -06:00
Derek Collison
717969510d Make sure to reset block encryption counter when clearing block but holding state for tracking sequences.
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-31 07:59:19 -07:00
Derek Collison
8dc1e4b6de When compact would reclaim head of block space, we needed to update block key for counter for new writes.
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-30 13:05:41 -07:00
Ivan Kozlovic
32ffc0257b Merge pull request #3311 from nats-io/fix_nightly_docker
Replace "go get" with "go install"
2022-07-29 17:25:18 -06:00
Ivan Kozlovic
f397e15896 Replace "go get" with "go install"
[ci skip]

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-29 17:23:58 -06:00
Ivan Kozlovic
05a7aaff45 Merge pull request #3310 from nats-io/update_nightly_go_version
Update nightly to Go 1.18
2022-07-29 17:17:50 -06:00
Derek Collison
e4ef3e4b09 Bump to 2.9.0-beta.16
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-29 16:16:14 -07:00
Derek Collison
5dfa7dcb40 Merge pull request #3309 from nats-io/remove_panic
General stability improvements
2022-07-29 16:15:52 -07:00
Ivan Kozlovic
ab1b86ef96 Update nightly to Go 1.18
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-29 17:15:12 -06:00
Derek Collison
5e98263de8 General stability improvements
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-29 16:02:31 -07:00
Ivan Kozlovic
465db58b44 Merge pull request #3302 from bruth/update-max-waiting
[FIXED] Reject update of pull consumer MaxWaiting since it is not supported
2022-07-29 13:14:44 -06:00
Byron Ruth
095cfef9eb Add check and test to prevent updating consumer MaxWaiting
Signed-off-by: Byron Ruth <b@devel.io>
2022-07-29 15:05:00 -04:00
Derek Collison
8aee7d5e51 Bump to 2.9.0-beta.15
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-29 09:30:07 -07:00
Derek Collison
43871300a3 Merge pull request #3308 from nats-io/encrypt_updates
Encrypt meta and raft states.
2022-07-29 09:25:55 -07:00
Derek Collison
259d1a1b9e Merge pull request #3307 from nats-io/raft_improvements
Improvements to raft layer with snapshots on catchup.
2022-07-29 09:12:24 -07:00
Derek Collison
27d87a68a4 Improvements to raft layer with snapshots on catchup.
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-29 09:01:03 -07:00
Derek Collison
50a25881e2 Encrypt meta and raft states.
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-29 08:10:57 -07:00
Ivan Kozlovic
7bf34d8623 Merge pull request #3304 from nats-io/tls_check_for_compliant_on_macOS
Fixed TLS test so it passes on macOS
2022-07-28 18:23:08 -06:00
Ivan Kozlovic
746b44a020 Fixed TLS test so it passes on macOS
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-28 17:58:25 -06:00
Ivan Kozlovic
58a3b2040a Merge pull request #3303 from nats-io/revert_jnm_changes_to_main
Revert direct changes to main
2022-07-28 17:36:27 -06:00
Ivan Kozlovic
f19908979f Revert direct changes to main
This reverts commit cf784c19f0.
This reverts commit c269a1ca09.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-28 17:25:37 -06:00
jnmoyne
cf784c19f0 - Adds new subject mapping functions:
{{SplitFromLeft(wildcard index, position)}}
{{SplitFromRight(wildcard index, position)}}
{{SliceFromLeft(wildcard index, slice size)}}
{{SliceFromRight(wildcard index, slice size)}}
{{Split(wildcard index, deliminator)}}

Examples:
	shouldMatch("*", "{{splitfromleft(1,3)}}", "12345", "123.45")
	shouldMatch("*", "{{SplitFromRight(1,3)}}", "12345", "12.345")
	shouldMatch("*", "{{SliceFromLeft(1,3)}}", "1234567890", "123.456.789.0")
	shouldMatch("*", "{{SliceFromRight(1,3)}}", "1234567890", "1.234.567.890")
	shouldMatch("*", "{{split(1,-)}}", "-abc-def--ghi-", "abc.def.ghi")
	shouldMatch("*.*", "{{split(2,-)}}.{{splitfromleft(1,2)}}", "foo.-abc-def--ghij-", "abc.def.ghij.fo.o")

- Subject mapping functions can now be all lower case or Pascal case (or a combination): e.g. splitfromleft, SplitFromLeft, splitFromleft, etc...
2022-07-28 12:53:14 -07:00
jnmoyne
c269a1ca09 New expendable implementation of subject mapping destinations to transform processing 2022-07-28 12:30:22 -07:00
Ivan Kozlovic
6631bf7bd7 Merge pull request #3300 from nats-io/pdp/certs-reissuance
Test-data certs reissuance (SHA1 -> SHA256)
2022-07-28 10:43:54 -06:00
Derek Collison
4b9e94d4a1 Merge pull request #3301 from nats-io/update_tests
Update tests to check last sequence state
2022-07-28 09:36:42 -07:00
Ivan Kozlovic
427e52dba2 Removed export GODEBUG="x509sha1=1" from runTestsOnTravis.sh
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-28 09:19:57 -06:00
Derek Collison
e120bb86a9 Update tests to check last seq
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-28 07:23:39 -07:00
Phil Pennock
e38419e09e testdata: regenerate X509 certs with new script 2022-07-28 02:52:56 -04:00
Phil Pennock
3f760760de test data: x509 cert reissuance script
We had some certs which used SHA1 still; this top-level script is a bit rough,
but works to recreate all the top-level certs, using a common CA.

RSA 2048 bits with SHA256.

I've put the IPv6 localhost IP into the certs too, wherever the IPv4 localhost
IP was present, as this might improve test-runner resilience in some
situations.  Seems like a good idea, can't think of a reason not to.
2022-07-28 02:52:36 -04:00
Ivan Kozlovic
725c1949e6 Bump version to 2.9.0-beta.14
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-27 19:06:12 -06:00
Ivan Kozlovic
258bd4240b Merge pull request #3297 from nats-io/js_fix_panic
Fixed a panic when consumer is closed
2022-07-27 18:50:53 -06:00
Ivan Kozlovic
5786d2d9d6 Changed "return" to "continue"
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-27 18:23:54 -06:00
Ivan Kozlovic
38727417df Moving super-cluster tests from cluster tests file to supercluster file
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-27 17:14:19 -06:00
Ivan Kozlovic
88203dd5d5 Fixed a panic when consumer is closed
Panic was:
```
=== RUN   TestJetStreamClusterDelete
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xcec8fb]
goroutine 1761 [running]:
github.com/nats-io/nats-server/v2/server.(*stream).config(0x0)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/stream.go:1192 +0x5b
github.com/nats-io/nats-server/v2/server.(*consumer).replica(0xc000101400)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/jetstream_cluster.go:3580 +0xea
github.com/nats-io/nats-server/v2/server.(*jetStream).monitorConsumer(0xc0001d2790, 0xc000101400, 0xc0004df0e0)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/jetstream_cluster.go:3733 +0xe06
github.com/nats-io/nats-server/v2/server.(*jetStream).processClusterCreateConsumer.func1()
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/jetstream_cluster.go:3445 +0x4d
created by github.com/nats-io/nats-server/v2/server.(*Server).startGoRoutine
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/server.go:3057 +0x85
FAIL	github.com/nats-io/nats-server/v2/server	9.911s
```

Seem to have been introduced in #3282

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-27 16:51:10 -06:00
Ivan Kozlovic
23c475e0d2 Merge pull request #3296 from nats-io/js_fix_subj_string_race
Fixed data race between UpdateConfif() and subjString
2022-07-27 16:19:56 -06:00