Commit Graph

57297 Commits

Author SHA1 Message Date
David Ansari 3e7f5a00e2 Fix AMQP 1.0 SASL CR Demo
```
switch_callback(State1, {frame_header, sasl}, 8);
```
was missing.

Tidy up various other small things.
2024-08-16 13:24:49 +02:00
Michael Klishin 74121d7bdb
Merge pull request #12024 from rabbitmq/gazelle-main
bazel run gazelle
2024-08-16 00:39:36 -04:00
GitHub 3e9cb1ed1b bazel run gazelle 2024-08-16 04:02:25 +00:00
Michael Klishin 178f9a962e
Merge pull request #11964 from rabbitmq/qq-checkpointing-tweaks
QQ: checkpointing frequency improvements
2024-08-15 20:49:24 -04:00
Michael Klishin 1fb70c7e95 Correct a couple of doc guide links 2024-08-15 16:04:46 -04:00
Michael Davis 9ca77f8efe
Remove max_in_memory_length/bytes from QQ config type
Also remove a resolved TODO about conversion for the `last_checkpoint`
field.
2024-08-15 15:44:28 -04:00
Michael Davis 140abd871a
Merge pull request #11980 from rabbitmq/md/khepri-minority-errors/queue-declaration 2024-08-15 14:26:08 -05:00
Michael Klishin 2058f449a1
Merge pull request #11999 from rabbitmq/sasl-anon
Add SASL mechanism ANONYMOUS
2024-08-15 13:12:41 -04:00
Michael Klishin e21a3bd7e5 Re-arrange 4.0 release notes 2024-08-15 13:12:31 -04:00
Michael Klishin 4ff80ecfb5
Merge pull request #12014 from rabbitmq/rabbitmq-server-12013
rabbitmq-upgrade revive: handle more errors
2024-08-15 11:18:39 -04:00
David Ansari 8c60cf7523 Add breaking changes to the release notes 2024-08-15 16:51:28 +02:00
Michael Klishin 2f165e02f2 rabbitmq-upgrade revive: handle more errors
returned by Ra, e.g. when a replica cannot be
restarted because of a concurrent delete
or because a QQ was inserted into a schema data
store but not yet registered as a process on
the node.

References #12013.
2024-08-15 10:02:02 -04:00
David Ansari b09f2d4da3 Save a Cuttlefish translation 2024-08-15 15:00:09 +02:00
David Ansari ba14b158af Remove mqtt.default_user and mqtt.default_pass
This commit is a breaking change in RabbitMQ 4.0.

 ## What?
Remove mqtt.default_user and mqtt.default_pass
Instead, rabbit.anonymous_login_user and rabbit.anonymous_login_pass
should be used.

 ## Why?
RabbitMQ 4.0 simplifies anonymous logins.
There should be a single configuration place
```
rabbit.anonymous_login_user
rabbit.anonymous_login_pass
```
that is used for anonymous logins for any protocol.

Anonymous login is orthogonal to the protocol the client uses.
Hence, there should be a single configuration place which can then be
used for MQTT, AMQP 1.0, AMQP 0.9.1, and RabbitMQ Stream protocol.

This will also simplify switching to SASL for MQTT 5.0 in the future.
2024-08-15 10:58:48 +00:00
David Ansari d46f07c0a4 Add SASL mechanism ANONYMOUS
## 1. Introduce new SASL mechanism ANONYMOUS

 ### What?
Introduce a new `rabbit_auth_mechanism` implementation for SASL
mechanism ANONYMOUS called `rabbit_auth_mechanism_anonymous`.

 ### Why?
As described in AMQP section 5.3.3.1, ANONYMOUS should be used when the
client doesn't need to authenticate.

Introducing a new `rabbit_auth_mechanism` consolidates and simplifies how anonymous
logins work across all RabbitMQ protocols that support SASL. This commit
therefore allows AMQP 0.9.1, AMQP 1.0, stream clients to connect out of
the box to RabbitMQ without providing any username or password.

Today's AMQP 0.9.1 and stream protocol client libs hard code RabbitMQ default credentials
`guest:guest` for example done in:
* 0215e85643/src/main/java/com/rabbitmq/client/ConnectionFactory.java (L58-L61)
* ddb7a2f068/uri.go (L31-L32)

Hard coding RabbitMQ specific default credentials in dozens of different
client libraries is an anti-pattern in my opinion.
Furthermore, there are various AMQP 1.0 and MQTT client libraries which
we do not control or maintain and which still should work out of the box
when a user is getting started with RabbitMQ (that is without
providing `guest:guest` credentials).

 ### How?
The old RabbitMQ 3.13 AMQP 1.0 plugin `default_user`
[configuration](146b4862d8/deps/rabbitmq_amqp1_0/Makefile (L6))
is replaced with the following two new `rabbit` configurations:
```
{anonymous_login_user, <<"guest">>},
{anonymous_login_pass, <<"guest">>},
```
We call it `anonymous_login_user` because this user will be used for
anonymous logins. The subsequent commit uses the same setting for
anonymous logins in MQTT. Hence, this user is orthogonal to the protocol
used when the client connects.

Setting `anonymous_login_pass` could have been left out.
This commit decides to include it because our documentation has so far
recommended:
> It is highly recommended to pre-configure a new user with a generated username and password or delete the guest user
> or at least change its password to reasonably secure generated value that won't be known to the public.

By having the new module `rabbit_auth_mechanism_anonymous` internally
authenticate with `anonymous_login_pass` instead of blindly allowing
access without any password, we protect operators that relied on the
sentence:
> or at least change its password to reasonably secure generated value that won't be known to the public

To ease the getting started experience, since RabbitMQ already deploys a
guest user with full access to the default virtual host `/`, this commit
also allows SASL mechanism ANONYMOUS in `rabbit` setting `auth_mechanisms`.

In production, operators should disable SASL mechanism ANONYMOUS by
setting `anonymous_login_user` to `none` (or by removing ANONYMOUS from
the `auth_mechanisms` setting. This will be documented separately.
Even if operators forget or don't read the docs, this new ANONYMOUS
mechanism won't do any harm because it relies on the default user name
`guest` and password `guest`, which is recommended against in
production, and who by default can only connect from the local host.

 ## 2. Require SASL security layer in AMQP 1.0

 ### What?
An AMQP 1.0 client must use the SASL security layer.

 ### Why?
This is in line with the mandatory usage of SASL in AMQP 0.9.1 and
RabbitMQ stream protocol.
Since (presumably) any AMQP 1.0 client knows how to authenticate with a
username and password using SASL mechanism PLAIN, any AMQP 1.0 client
also (presumably) implements the trivial SASL mechanism ANONYMOUS.

Skipping SASL is not recommended in production anyway.
By requiring SASL, configuration for operators becomes easier.
Following the principle of least surprise, when an an operator
configures `auth_mechanisms` to exclude `ANONYMOUS`, anonymous logins
will be prohibited in SASL and also by disallowing skipping the SASL
layer.

 ### How?
This commit implements AMQP 1.0 figure 2.13.

A follow-up commit needs to be pushed to `v3.13.x` which will use SASL
mechanism `anon` instead of `none` in the Erlang AMQP 1.0 client
such that AMQP 1.0 shovels running on 3.13 can connect to 4.0 RabbitMQ nodes.
2024-08-15 10:58:48 +00:00
Karl Nilsson 0f1f27c1dd Qq: adjust checkpointing algo to something more like
it was in 3.13.x.

Also add a force_checkpoint aux command that the purge operation
emits - this can also be used to try to force a checkpoint
2024-08-15 11:54:18 +01:00
Michael Davis 8eef209791
Handle database timeouts in `rabbit_amqqueue:store_queue/1` 2024-08-14 15:11:28 -04:00
Michael Klishin cabe873348
Merge pull request #12011 from rabbitmq/dependabot/maven/deps/rabbitmq_stream/test/rabbit_stream_SUITE_data/main/junit.jupiter.version-5.11.0
Bump junit.jupiter.version from 5.10.3 to 5.11.0 in /deps/rabbitmq_stream/test/rabbit_stream_SUITE_data
2024-08-14 15:05:11 -04:00
Michael Klishin 9987817fc2
Merge pull request #12010 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.junit.jupiter-junit-jupiter-5.11.0
Bump org.junit.jupiter:junit-jupiter from 5.10.3 to 5.11.0 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-08-14 15:05:03 -04:00
Michael Klishin 6dca81fad5
Merge pull request #12009 from rabbitmq/dependabot/maven/deps/rabbitmq_stream_management/test/http_SUITE_data/main/junit.jupiter.version-5.11.0
Bump junit.jupiter.version from 5.10.3 to 5.11.0 in /deps/rabbitmq_stream_management/test/http_SUITE_data
2024-08-14 15:04:55 -04:00
Michael Klishin 860b0f0a45
Merge pull request #12008 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot/main/org.junit.jupiter-junit-jupiter-params-5.11.0
Bump org.junit.jupiter:junit-jupiter-params from 5.10.3 to 5.11.0 in /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot
2024-08-14 15:04:48 -04:00
dependabot[bot] 843068c27a
Bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.10.3 to 5.11.0.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:54:16 +00:00
dependabot[bot] 93c6a28d06
Bump org.junit.jupiter:junit-jupiter
Bumps [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5) from 5.10.3 to 5.11.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:36:10 +00:00
dependabot[bot] dc9a28cc2c
Bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.10.3 to 5.11.0.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:28:57 +00:00
dependabot[bot] d841b82b9e
Bump org.junit.jupiter:junit-jupiter-params
Bumps [org.junit.jupiter:junit-jupiter-params](https://github.com/junit-team/junit5) from 5.10.3 to 5.11.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:28:18 +00:00
Michael Klishin 9f47ca5ddf
Merge pull request #12005 from rabbitmq/mk-initial-man-page-updates-for-4.0
Initial man page updates for 4.0
2024-08-14 12:54:46 -04:00
Michael Klishin 8fa7f3add0 Document man page sync with the new website 2024-08-14 12:53:51 -04:00
Michael Klishin 242b2243bb First man page updates for 4.0 2024-08-14 12:35:12 -04:00
Michael Klishin 1cbe373697
Merge pull request #12002 from rabbitmq/mk-ldap-password-tagging
LDAP: optional sensitive value tagging
2024-08-14 12:34:05 -04:00
David Ansari 60ae4d4eca
Support SASL mechanism EXTERNAL in Erlang AMQP 1.0 client (#11984)
* Support SASL mechanism EXTERNAL in Erlang AMQP 1.0 client

* Move test to plugin rabbitmq_auth_mechanism_ssl

In theory, there can be other plugin that offer SASL mechanism EXTERNAL.
Therefore, instead of adding a test dependency from app rabbit to app
rabbitmq_auth_mechanism_ssl, it's better to test this plugin specific
functionality directly in the plugin itself.
2024-08-14 18:18:00 +02:00
Michael Klishin 4ff90b4564 LDAP: update config_schema_SUITE expectations 2024-08-14 12:15:17 -04:00
Michael Klishin e51d3b8c52 Revert "Update deps/rabbitmq_management/selenium/test/authnz-msg-protocols/enabled_plugins"
This reverts commit 23ad641d9a.

It's not really necessary for the Selenium suites.
2024-08-14 12:05:02 -04:00
Michael Klishin 15fe108cc3 LDAP: allow tagged values to be used for sensitive settings
Plus a drive-by Dialyzer improvement.
2024-08-14 11:57:37 -04:00
Michael Klishin 23ad641d9a Update deps/rabbitmq_management/selenium/test/authnz-msg-protocols/enabled_plugins
Used by Selenium suites.
2024-08-14 11:56:35 -04:00
Michael Klishin e396c16c32
Merge pull request #12000 from rabbitmq/ra-2.13.6
Ra v2.13.6
2024-08-14 10:42:30 -04:00
Karl Nilsson c6006fd5ce Ra v2.13.6
This release contains a few fixes and improvements:

* Add ra:key_metrics/2
* ra_server: Add a new last_applied state query
* Stop checkpoint validation when encountering a valid checkpoint
* Kill snapshot process before deleting everything
2024-08-14 14:30:30 +01:00
Michael Klishin 8ef8d18f5f
Merge pull request #11986 from rabbitmq/amqplain
Restrict username and password in AMQPLAIN
2024-08-13 21:33:46 -04:00
Michael Klishin dad09e6123
Merge pull request #11989 from rabbitmq/mk-encrypted-values-in-rabbitmq-conf
Make it possible to specify encrypted values in rabbitmq conf
2024-08-13 18:48:31 -04:00
Michael Klishin 8b90d4a27c Allow for tagged values for a few more rabbitmq.conf settings 2024-08-13 16:27:00 -04:00
Michael Davis 267d7b8f24
Merge pull request #11979 from rabbitmq/md/khepri/transient-queue-deletion-minority 2024-08-13 13:51:28 -05:00
Michael Klishin bd1e953b95 Configuration value encryption CLI commands: unconditionally print stack traces 2024-08-13 14:31:55 -04:00
Michael Klishin 9dc899441f Validation tests for the new command 2024-08-13 14:29:14 -04:00
Michael Klishin e1490c6d9c More CLI commands for tagged values 2024-08-13 14:26:02 -04:00
Michael Klishin c2fdd73c4b Secret encoding: refine CLI tools
'ctl encode' is unfortunately name and targets
advanced.config commands.

This introduce a command that targets 'rabbitmq.conf'
values and has a more specific name.

Eventually 'ctl encode' will be aliased and deprecated,
although we still do not have an aliasing mechanism
and it won't be in scope for 4.0.
2024-08-13 12:29:28 -04:00
Michael Davis 3f734ef560
Handle timeouts in transient queue deletion
Transient queue deletion previously caused a crash if Khepri was enabled
and a node with a transient queue went down while its cluster was in a
minority. We need to handle the `{error,timeout}` return possible from
`rabbit_db_queue:delete_transient/1`. In the
`rabbit_amqqueue:on_node_down/1` callback we log a warning when we see
this return.

We then try this deletion again during that node's
`rabbit_khepri:init/0` which is called from a boot step after
`rabbit_khepri:setup/0`. At that point we can return an error and halt
the node's boot if the command times out. The cluster is very likely to
be in a majority at that point since `rabbit_khepri:setup/0` waits for
a leader to be elected (requiring a majority).

This fixes a crash report found in the `cluster_minority_SUITE`'s
`end_per_group`.
2024-08-13 11:40:18 -04:00
Michael Davis 0dd26f0c52
rabbit_db_queue: Transactionally delete transient queues from Khepri
The prior code skirted transactions because the filter function might
cause Khepri to call itself. We want to use the same idea as the old
code - get all queues, filter them, then delete them - but we want to
perform the deletion in a transaction and fail the transaction if any
queues changed since we read them.

This fixes a bug - that the call to `delete_in_khepri/2` could return
an error tuple that would be improperly recognized as `Deletions` -
but should also make deleting transient queues atomic and fast.
Each call to `delete_in_khepri/2` needed to wait on Ra to replicate
because the deletion is an individual command sent from one process.
Performing all deletions at once means we only need to wait for one
command to be replicated across the cluster.

We also bubble up any errors to delete now rather than storing them as
deletions. This fixes a crash that occurs on node down when Khepri is
in a minority.
2024-08-13 11:40:18 -04:00
Michael Klishin 1c7e590495 Initial encrypted value support for rabbitmq.conf
This makes possible to specify an encrypted
value in rabbitmq.conf using a prefix.

For example, to specify a default user password
as an encrypted value:

``` ini
default_user = bunnies-444
default_pass = encrypted:F/bjQkteQENB4rMUXFKdgsJEpYMXYLzBY/AmcYG83Tg8AOUwYP7Oa0Q33ooNEpK9
```

``` erl
[
  {rabbit, [
      {config_entry_decoder, [
             {passphrase, <<"bunnies">>}
       ]}
    ]}
].
```
2024-08-13 10:34:52 -04:00
David Ansari 29437d0344 Restrict username and password in AMQPLAIN
Restrict both username and password in SASL mechanism AMQPLAIN to be a
binary.
2024-08-13 14:11:58 +02:00
David Ansari dbf498a65e Update 4.0.0 release notes 2024-08-13 11:29:25 +02:00
Michael Klishin 5c61d73567
Merge pull request #11981 from rabbitmq/mk-update-4.x-release-notes
4.0.0-beta.4 release notes
2024-08-12 23:38:35 -04:00