Commit Graph

4657 Commits

Author SHA1 Message Date
Diana Parra Corbacho dc3b6fb5bc Allow management users to query feature flags and deprecated features
The new banner to warn about not-enabled feature flags requires access
to this endpoint, and it must be visible for all users.
2024-01-29 15:51:21 +01:00
Michael Klishin 0c0e2ca932 An alternative to #10415, closes #10330
Per discussion in #10415, this introduces a new module,
rabbit_mgmt_nodes, which provides a couple of helpers
that can be used to implement Cowboy REST's
resource_exists/2 in the modules that return
information about cluster members.
2024-01-25 18:41:56 -05:00
Michael Klishin 7b151a7651 More missed (c) header updates 2024-01-22 23:44:47 -05:00
Michael Klishin 838cb93142
Merge pull request #10337 from rabbitmq/loic-revert-cqv2-default
Revert "Default to classic queues v2"
2024-01-15 08:03:05 -05:00
Loïc Hoguin a0c8dab057
Update expected CQ version in tests 2024-01-15 12:08:08 +01:00
Diana Parra Corbacho 5a3584beea Remove FF warning as soon as all features are enabled
The warning in the header needs a full refresh, just updating
the page content will not clear the warning.
2024-01-15 08:41:36 +01:00
Michael Klishin 01092ff31f
(c) year bumps 2024-01-01 22:02:20 -05:00
Ariel Otilibili 0b24d3c0bb Defined "tags" as list
Typo spotted in #4050
2023-12-27 22:47:52 +01:00
Marcial Rosales b9f3771f2d Use correct user to authenticate
depending on the backend we want to
exercise
2023-12-27 14:03:26 +00:00
Michael Klishin 5af5f0cf3d
Selenium: update run-suites.sh argument to match #10200 2023-12-23 20:33:21 -05:00
Michael Klishin a374f40303
Merge pull request #10200 from rabbitmq/propagate_credentials_to_http_backend
Propagate all credentials to http backend
2023-12-23 19:09:48 -05:00
Michael Klishin 920c664fa3
Add a test originally introduced in #10062 2023-12-23 19:09:35 -05:00
Ariel Otilibili e1d09fbba6 Replaced true | false by boolean() 2023-12-22 17:28:31 +01:00
Marcial Rosales f3c4355cfb Clean up 2023-12-22 14:29:53 +00:00
Marcial Rosales 2fc8d2b3ae Propagate all credentials to http backend 2023-12-22 13:54:34 +00:00
Michael Klishin 7ebaae7ef0
Revert "HTTP API: DELETE /api/queues/{vhost}/{name} use internal API call"
This reverts commit 78f901a224.
2023-12-20 04:13:11 -05:00
Péter Gömöri 0a144e7698 Prevent formatter crash in mgmt_util
`rabbit_mgmt_util:direct_request/6` is always called with an
`ErrorMsg` which expects one format argument as a string. Convert the
arbitrary reason term into a string to avoid a crash like the below:

```
warning: FORMATTER CRASH: {"Delete exchange error: ~ts",[{'EXIT',{{badmatch,{error,...
```
2023-12-20 00:11:26 +01:00
Péter Gömöri f4a9edfd2f Tolerate race condition when starting management db cache process
This prevents the below harmless crash when multiple parallel API
requests arrive soon after starting the node.

```
exception error: no match of right hand side value
                 {error,{already_started,<0.1593.0>}}
  in function  rabbit_mgmt_db_cache:fetch/4 (rabbit_mgmt_db_cache.erl, line 68)
  in call from rabbit_mgmt_db:submit_cached/4 (rabbit_mgmt_db.erl, line 756)
  in call from rabbit_mgmt_util:augment/2 (rabbit_mgmt_util.erl, line 412)
  in call from rabbit_mgmt_util:run_augmentation/2 (rabbit_mgmt_util.erl, line 389)
  in call from rabbit_mgmt_util:augment_resources0/6 (rabbit_mgmt_util.erl, line 378)
  in call from rabbit_mgmt_util:with_valid_pagination/3 (rabbit_mgmt_util.erl, line 302)
  in call from rabbit_mgmt_wm_queues:to_json/2 (rabbit_mgmt_wm_queues.erl, line 44)
  in call from cowboy_rest:call/3 (src/cowboy_rest.erl, line 1583)
```
2023-12-19 18:07:22 +01:00
David Ansari f44c851293 Fix crash when closing connection
Avoid the following crash
```
** Reason for termination ==
** {mqtt_unexpected_cast,{shutdown,"Closed via management plugin"}}

  crasher:
    initial call: rabbit_mqtt_reader:init/1
    pid: <0.1096.0>
    registered_name: []
    exception exit: {mqtt_unexpected_cast,
                        {shutdown,"Closed via management plugin"}}
      in function  gen_server:handle_common_reply/8 (gen_server.erl, line 1208)
```
when closing MQTT or Stream connections via HTTP API endpoint
```
/connections/username/:username
```
2023-12-14 12:35:51 +01:00
Diana Parra Corbacho 5aa35e0570 Management: introduce deprecated features API endpoints, UI page and warnings 2023-12-13 07:39:37 +01:00
Diana Parra Corbacho ee84038ef5 Add experimental/disabled warning in State column 2023-12-12 18:07:36 +01:00
Diana Parra Corbacho ada8083d0d Add a warning banner if any stable feature flags is not enabled
Add an experimental tag on the description to experimental features
2023-12-12 18:07:36 +01:00
Michael Klishin 26aa534e40 Definition import: more logging improvements 2023-12-09 20:20:56 -05:00
Michael Klishin 62fffb6634 Another take at #10068
Scan queues, exchanges and bindings before attempting
to import anything on boot. If they miss the virtual
host field, fail early and log a sensible message.
2023-12-08 01:39:47 -05:00
Johan Rhodin 8ea1f8fc49
Merge branch 'rabbitmq:main' into FixInfoItems 2023-11-27 15:59:34 -06:00
Michael Klishin cc3084dfbf Fixes #9983 2023-11-25 18:59:51 -05:00
Michael Klishin 1b642353ca
Update (c) according to [1]
1. https://investors.broadcom.com/news-releases/news-release-details/broadcom-and-vmware-intend-close-transaction-november-22-2023
2023-11-21 23:18:22 -05:00
Michael Klishin 28ad76467e Management UI: link to GitHub Discussions and not the Google group 2023-11-19 19:35:49 -05:00
Johan Rhodin 851fddcad2 Fix wrong link 2023-11-17 16:48:39 -06:00
Johan Rhodin 226e7d138d fix info item, and behavior->behaviour 2023-11-17 11:01:47 -06:00
Ayanda Dube 324debe6cf add a test case for mgmt API deletion of crashed queues 2023-11-15 17:43:47 +00:00
Ayanda Dube 1ce75c7aae handle different queue states on deletion from the mgmt API 2023-11-15 17:43:47 +00:00
Karl Nilsson baff660ab4 use right dummy type 2023-11-07 11:53:57 +00:00
Karl Nilsson ff12d3b6b4 HTTP API /queues optimise resource_exists
There is no need to list all queues to check if the vhost
exists.
2023-11-07 11:27:11 +00:00
Karl Nilsson c2cd60b18d Optimise mgmt HTTP API /queues endpoint
Listing queues with the HTTP API when there are many (1000s) of
quorum queues could be excessively slow compared to the same scenario
with classic queues.

This optimises various aspects of HTTP API queue listings.
For QQs it removes the expensive cluster wide rpcs used to get the
"online" status of each quorum queue. This was previously done _before_
paging and thus would perform a cluster-wide query for _each_ quorum queue in
the vhost/system. This accounted for most of the slowness compared to
classic queues.

Secondly the query to separate the running from the down queues
consisted of two separate queries that later were combined when a single
query would have sufficed.

This commit also includes a variety of other improvements and minor
fixes discovered during testing and optimisation.

MINOR BREAKING CHANGE: quorum queues would previously only display one
of two states: running or down. Now there is a new state called minority
which is emitted when the queue has at least one member running but
cannot commit entries due to lack of quorum.

Also the quorum queue may transiently enter the down state when a node
goes down and before its elected a new leader.
2023-11-06 15:34:26 +00:00
Emerson Almeida 9c87e1902d remove test to idp-initiated 2023-11-01 10:23:02 -03:00
Emerson Almeida 64ded4632d make the baseUrl equal when run with prefix 2023-11-01 09:52:27 -03:00
Duke ca5e7e34d7
Merge branch 'main' into improve-login-exp 2023-10-31 13:35:20 -03:00
Marcial Rosales 7c58649942 Reduce by 5 seconds every oauth2 test
clickToLogin sbould only check that the
login button exists and not that the
warning messages is not visible
2023-10-31 16:31:37 +01:00
Marcial Rosales b409d97927 Bump up chromedriver version 2023-10-31 14:07:38 +01:00
Marcial Rosales c169f6ef50 Fix issue in run-scripts 2023-10-31 12:55:31 +01:00
Duke cd680bc568
move store pref to startWithOAuthLogin 2023-10-30 12:02:29 -03:00
Duke 9060941fc2
Remove overview var from redirection-after-login.js 2023-10-30 11:51:59 -03:00
Duke 0e757f394a
remove unused overview var 2023-10-30 11:50:23 -03:00
Emerson Almeida 7bf452c522 fix pref default 2023-10-29 18:34:42 -03:00
Emerson Almeida 7525ccc236 add tests 2023-10-29 18:34:42 -03:00
Duke 3e0ca9ede7 add oauth-return-to 2023-10-29 18:34:42 -03:00
Diana Parra Corbacho 07196e297b Reduce the number of metrics served by GET /api/queues
Introduce GET /api/queues/detailed endpoint

Just removed garbage_collection, idle_since and any 'null' value

/api/queues with 10k classic queues returns 7.4MB of data
/api/queues/detailed with 10k classic queues returns 11MB of data

This sits behind a new feature flag, required to collect data from
all nodes: detailed_queues_endpoint
2023-10-23 19:49:37 -04:00
Karl Nilsson 1ba62a90f2 Actually nack when using 'Nack message requeue true'
Option in mgmt UI.
2023-10-17 14:12:09 +01:00
Michael Klishin 6009a4973f
Merge pull request #9708 from rabbitmq/mk-limit-max-http-api-payload-size
Introduce a configurable limit to HTTP API request body size
2023-10-16 21:49:50 -04:00
Michael Klishin 087794dded
HTTP API: adapt publishing tests
to take the newly introduced 10 MiB default body size limit
into account.
2023-10-16 19:14:16 -04:00
Rin Kuryloski 558b8d03f4 Remove mnesia from rabbitmq_management_agent deps in bazel
it's not required and is not listed in the LOCAL_DEPS in the Makefile
2023-10-16 17:37:54 +02:00
Michael Klishin c6d0382be4
Reduce default HTTP API request body size limit to 10 MiB
per discussion with the team.

It should be enough to accomodate a definition file with about
100K queues.
2023-10-16 06:48:23 -04:00
Michael Klishin b7b3514bb1
Introduce HTTP request body limit for definition uploads
The default is 20 MiB, which is enough to upload
a definition file with 200K queues, a few virtual host
and a few users. In other words, it should accomodate
a lot of environments.
2023-10-14 06:11:01 -04:00
Michael Klishin 8e7e8f9127
Merge branch 'main' into issue-9437-queue-storage-version 2023-10-10 15:03:50 -04:00
Michael Klishin aa0c52093f Add length limit overflow behavior to supported features in the UI 2023-10-05 21:17:56 -04:00
Alex Valiushko 2d569f1701 New quorum queue members join as temporary non-voters
Because both `add_member` and `grow` default to Membership status `promotable`,
new members will have to catch up before they are considered cluster members.
This can be overridden with either `voter` or (permanent `non_voter` statuses.
The latter one is useless without additional tooling so kept undocumented.

- non-voters do not affect quorum size for election purposes
- `observer_cli` reports their status with lowercase 'f'
- `rabbitmq-queues check_if_node_is_quorum_critical` takes voter status into
account
2023-10-05 20:30:30 -04:00
Diana Parra Corbacho c1a6e5b3e5 Return storage_version as top-level key in queue objects
A previous PR removed backing_queue_status as it is mostly unused,
but classic queue version is still useful. This PR returns version
as a top-level key in queue objects.
2023-10-04 09:29:01 +02:00
Diana Parra Corbacho 5f0981c5a3
Allow to use Khepri database to store metadata instead of Mnesia
[Why]

Mnesia is a very powerful and convenient tool for Erlang applications:
it is a persistent disc-based database, it handles replication accross
multiple Erlang nodes and it is available out-of-the-box from the
Erlang/OTP distribution. RabbitMQ relies on Mnesia to manage all its
metadata:

* virtual hosts' properties
* intenal users
* queue, exchange and binding declarations (not queues data)
* runtime parameters and policies
* ...

Unfortunately Mnesia makes it difficult to handle network partition and,
as a consequence, the merge conflicts between Erlang nodes once the
network partition is resolved. RabbitMQ provides several partition
handling strategies but they are not bullet-proof. Users still hit
situations where it is a pain to repair a cluster following a network
partition.

[How]

@kjnilsson created Ra [1], a Raft consensus library that RabbitMQ
already uses successfully to implement quorum queues and streams for
instance. Those queues do not suffer from network partitions.

We created Khepri [2], a new persistent and replicated database engine
based on Ra and we want to use it in place of Mnesia in RabbitMQ to
solve the problems with network partitions.

This patch integrates Khepri as an experimental feature. When enabled,
RabbitMQ will store all its metadata in Khepri instead of Mnesia.

This change comes with behavior changes. While Khepri remains disabled,
you should see no changes to the behavior of RabbitMQ. If there are
changes, it is a bug. After Khepri is enabled, there are significant
changes of behavior that you should be aware of.

Because it is based on the Raft consensus algorithm, when there is a
network partition, only the cluster members that are in the partition
with at least `(Number of nodes in the cluster ÷ 2) + 1` number of nodes
can "make progress". In other words, only those nodes may write to the
Khepri database and read from the database and expect a consistent
result.

For instance in a cluster of 5 RabbitMQ nodes:
* If there are two partitions, one with 3 nodes, one with 2 nodes, only
  the group of 3 nodes will be able to write to the database.
* If there are three partitions, two with 2 nodes, one with 1 node, none
  of the group can write to the database.

Because the Khepri database will be used for all kind of metadata, it
means that RabbitMQ nodes that can't write to the database will be
unable to perform some operations. A list of operations and what to
expect is documented in the associated pull request and the RabbitMQ
website.

This requirement from Raft also affects the startup of RabbitMQ nodes in
a cluster. Indeed, at least a quorum number of nodes must be started at
once to allow nodes to become ready.

To enable Khepri, you need to enable the `khepri_db` feature flag:

    rabbitmqctl enable_feature_flag khepri_db

When the `khepri_db` feature flag is enabled, the migration code
performs the following two tasks:
1. It synchronizes the Khepri cluster membership from the Mnesia
   cluster. It uses `mnesia_to_khepri:sync_cluster_membership/1` from
   the `khepri_mnesia_migration` application [3].
2. It copies data from relevant Mnesia tables to Khepri, doing some
   conversion if necessary on the way. Again, it uses
   `mnesia_to_khepri:copy_tables/4` from `khepri_mnesia_migration` to do
   it.

This can be performed on a running standalone RabbitMQ node or cluster.
Data will be migrated from Mnesia to Khepri without any service
interruption. Note that during the migration, the performance may
decrease and the memory footprint may go up.

Because this feature flag is considered experimental, it is not enabled
by default even on a brand new RabbitMQ deployment.

More about the implementation details below:

In the past months, all accesses to Mnesia were isolated in a collection
of `rabbit_db*` modules. This is where the integration of Khepri mostly
takes place: we use a function called `rabbit_khepri:handle_fallback/1`
which selects the database and perform the query or the transaction.
Here is an example from `rabbit_db_vhost`:

* Up until RabbitMQ 3.12.x:

        get(VHostName) when is_binary(VHostName) ->
            get_in_mnesia(VHostName).

* Starting with RabbitMQ 3.13.0:

        get(VHostName) when is_binary(VHostName) ->
            rabbit_khepri:handle_fallback(
              #{mnesia => fun() -> get_in_mnesia(VHostName) end,
                khepri => fun() -> get_in_khepri(VHostName) end}).

This `rabbit_khepri:handle_fallback/1` function relies on two things:
1. the fact that the `khepri_db` feature flag is enabled, in which case
   it always executes the Khepri-based variant.
4. the ability or not to read and write to Mnesia tables otherwise.

Before the feature flag is enabled, or during the migration, the
function will try to execute the Mnesia-based variant. If it succeeds,
then it returns the result. If it fails because one or more Mnesia
tables can't be used, it restarts from scratch: it means the feature
flag is being enabled and depending on the outcome, either the
Mnesia-based variant will succeed (the feature flag couldn't be enabled)
or the feature flag will be marked as enabled and it will call the
Khepri-based variant. The meat of this function really lives in the
`khepri_mnesia_migration` application [3] and
`rabbit_khepri:handle_fallback/1` is a wrapper on top of it that knows
about the feature flag.

However, some calls to the database do not depend on the existence of
Mnesia tables, such as functions where we need to learn about the
members of a cluster. For those, we can't rely on exceptions from
Mnesia. Therefore, we just look at the state of the feature flag to
determine which database to use. There are two situations though:

* Sometimes, we need the feature flag state query to block because the
  function interested in it can't return a valid answer during the
  migration. Here is an example:

        case rabbit_khepri:is_enabled(RemoteNode) of
            true  -> can_join_using_khepri(RemoteNode);
            false -> can_join_using_mnesia(RemoteNode)
        end

* Sometimes, we need the feature flag state query to NOT block (for
  instance because it would cause a deadlock). Here is an example:

        case rabbit_khepri:get_feature_state() of
            enabled -> members_using_khepri();
            _       -> members_using_mnesia()
        end

Direct accesses to Mnesia still exists. They are limited to code that is
specific to Mnesia such as classic queue mirroring or network partitions
handling strategies.

Now, to discover the Mnesia tables to migrate and how to migrate them,
we use an Erlang module attribute called
`rabbit_mnesia_tables_to_khepri_db` which indicates a list of Mnesia
tables and an associated converter module. Here is an example in the
`rabbitmq_recent_history_exchange` plugin:

    -rabbit_mnesia_tables_to_khepri_db(
       [{?RH_TABLE, rabbit_db_rh_exchange_m2k_converter}]).

The converter module  — `rabbit_db_rh_exchange_m2k_converter` in this
example  — is is fact a "sub" converter module called but
`rabbit_db_m2k_converter`. See the documentation of a `mnesia_to_khepri`
converter module to learn more about these modules.

[1] https://github.com/rabbitmq/ra
[2] https://github.com/rabbitmq/khepri
[3] https://github.com/rabbitmq/khepri_mnesia_migration

See #7206.

Co-authored-by: Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com>
Co-authored-by: Diana Parra Corbacho <dparracorbac@vmware.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-09-29 16:00:11 +02:00
Michael Klishin 8ca0200503 HTTP API docs: be more specific 2023-09-28 05:57:50 -04:00
Diana Parra Corbacho 9d8a537073 HTTP API: document disable_stats and enable_queue_totals
Using GET /api/queues?disable_stats=true&enable_queue_totals=true is far more efficient than the standard GET /api/queues and in many cases will suffice for monitoring and operating purposes.
2023-09-28 09:16:08 +02:00
Michael Klishin 13702b7f04
Merge pull request #9550 from rabbitmq/issue-8758
HTTP API: DELETE /api/queues/{vhost}/{name} use internal API call
2023-09-27 02:55:47 -04:00
Diana Parra Corbacho 78f901a224 HTTP API: DELETE /api/queues/{vhost}/{name} use internal API call
A direct client operation fails if the queue is exclusive. This
API should behave like the rabbitmqctl that can delete the queue
even in that case
2023-09-27 08:18:59 +02:00
Jean-Sébastien Dominique 8c6ba6daca Add Classic Queue version to operator policies 2023-09-26 20:13:52 -04:00
Diana Parra Corbacho cbf479f1a9 mgmt UI admin page: list all operator policies per queue type 2023-09-22 09:01:27 +02:00
Marcial Rosales 54ff3273ab Run full manaegement ui suite by default 2023-09-05 19:50:47 +02:00
Marcial Rosales 7fb55881a4 Refactor suites to shorten pipeline execution
- Separate pure management ui suites from authnz
- Run full management ui suite on every commit to main or
 release brances
 - Fun full management ui suite on every change done to
 rabbitmq_management plugin on any PR
2023-09-05 19:50:46 +02:00
Karl Nilsson 119f034406
Message Containers (#5077)
This PR implements an approach for a "protocol (data format) agnostic core" where the format of the message isn't converted at point of reception.

Currently all non AMQP 0.9.1 originating messages are converted into a AMQP 0.9.1 flavoured basic_message record before sent to a queue. If the messages are then consumed by the originating protocol they are converted back from AMQP 0.9.1. For some protocols such as MQTT 3.1 this isn't too expensive as MQTT is mostly a fairly easily mapped subset of AMQP 0.9.1 but for others such as AMQP 1.0 the conversions are awkward and in some cases lossy even if consuming from the originating protocol.

This PR instead wraps all incoming messages in their originating form into a generic, extensible message container type (mc). The container module exposes an API to get common message details such as size and various properties (ttl, priority etc) directly from the source data type. Each protocol needs to implement the mc behaviour such that when a message originating form one protocol is consumed by another protocol we convert it to the target protocol at that point.

The message container also contains annotations, dead letter records and other meta data we need to record during the lifetime of a message. The original protocol message is never modified unless it is consumed.

This includes conversion modules to and from amqp, amqpl (AMQP 0.9.1) and mqtt.


COMMIT HISTORY:

* Refactor away from using the delivery{} record

In many places including exchange types. This should make it
easier to move towards using a message container type instead of
basic_message.

Add mc module and move direct replies outside of exchange

Lots of changes incl classic queues

Implement stream support incl amqp conversions

simplify mc state record

move mc.erl

mc dlx stuff

recent history exchange

Make tracking work

But doesn't take a protocol agnostic approach as we just convert
everything into AMQP legacy and back. Might be good enough for now.

Tracing as a whole may want a bit of a re-vamp at some point.

tidy

make quorum queue peek work by legacy conversion

dead lettering fixes

dead lettering fixes

CMQ fixes

rabbit_trace type fixes

fixes

fix

Fix classic queue props

test assertion fix

feature flag and backwards compat

Enable message_container feature flag in some SUITEs

Dialyzer fixes

fixes

fix

test fixes

Various

Manually update a gazelle generated file

until a gazelle enhancement can be made
https://github.com/rabbitmq/rules_erlang/issues/185

Add message_containers_SUITE to bazel

and regen bazel files with gazelle from rules_erlang@main

Simplify essential proprty access

Such as durable, ttl and priority by extracting them into annotations
at message container init time.

Move type

to remove dependenc on amqp10 stuff in mc.erl

mostly because I don't know how to make bazel do the right thing

add more stuff

Refine routing header stuff

wip

Cosmetics

Do not use "maybe" as type name as "maybe" is a keyword since OTP 25
which makes Erlang LS complain.

* Dedup death queue names

* Fix function clause crashes

Fix failing tests in the MQTT shared_SUITE:
A classic queue message ID can be undefined as set in
fbe79ff47b/deps/rabbit/src/rabbit_classic_queue_index_v2.erl (L1048)

Fix failing tests in the MQTT shared_SUITE-mixed:
When feature flag message_containers is disabled, the
message is not an #mc{} record, but a #basic_message{} record.

* Fix is_utf8_no_null crash

Prior to this commit, the function crashed if invalid UTF-8 was
provided, e.g.:
```
1> rabbit_misc:is_valid_shortstr(<<"😇"/utf16>>).
** exception error: no function clause matching rabbit_misc:is_utf8_no_null(<<216,61,222,7>>) (rabbit_misc.erl, line 1481)
```

* Implement mqtt mc behaviour

For now via amqp translation.

This is still work in progress, but the following SUITEs pass:
```
make -C deps/rabbitmq_mqtt ct-shared t=[mqtt,v5,cluster_size_1] FULL=1
make -C deps/rabbitmq_mqtt ct-v5 t=[mqtt,cluster_size_1] FULL=1
```

* Shorten mc file names

Module name length matters because for each persistent message the #mc{}
record is persisted to disk.

```
1> iolist_size(term_to_iovec({mc, rabbit_mc_amqp_legacy})).
30
2> iolist_size(term_to_iovec({mc, mc_amqpl})).
17
```

This commit renames the mc modules:
```
ag -l rabbit_mc_amqp_legacy | xargs sed -i 's/rabbit_mc_amqp_legacy/mc_amqpl/g'
ag -l rabbit_mc_amqp | xargs sed -i 's/rabbit_mc_amqp/mc_amqp/g'
ag -l rabbit_mqtt_mc | xargs sed -i 's/rabbit_mqtt_mc/mc_mqtt/g'
```

* mc: make deaths an annotation + fixes

* Fix mc_mqtt protocol_state callback

* Fix test will_delay_node_restart

```
make -C deps/rabbitmq_mqtt ct-v5 t=[mqtt,cluster_size_3]:will_delay_node_restart FULL=1
```

* Bazel run gazelle

* mix format rabbitmqctl.ex

* Ensure ttl annotation is refelected in amqp legacy protocol state

* Fix id access in message store

* Fix rabbit_message_interceptor_SUITE

* dializer fixes

* Fix rabbit:rabbit_message_interceptor_SUITE-mixed

set_annotation/3 should not result in duplicate keys

* Fix MQTT shared_SUITE-mixed

Up to 3.12 non-MQTT publishes were always QoS 1 regardless of delivery_mode.
75a953ce28/deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl (L2075-L2076)
From now on, non-MQTT publishes are QoS 1 if durable.
This makes more sense.

The MQTT plugin must send a #basic_message{} to an old node that does
not understand message containers.

* Field content of 'v1_0.data' can be binary

Fix
```
bazel test //deps/rabbitmq_mqtt:shared_SUITE-mixed \
    --test_env FOCUS="-group [mqtt,v4,cluster_size_1] -case trace" \
    -t- --test_sharding_strategy=disabled
```

* Remove route/2 and implement route/3 for all exchange types.

This removes the route/2 callback from rabbit_exchange_type and
makes route/3 mandatory instead. This is a breaking change and
will require all implementations of exchange types to update their
code, however this is necessary anyway for them to correctly handle
the mc type.

stream filtering fixes

* Translate directly from MQTT to AMQP 0.9.1

* handle undecoded properties in mc_compat

amqpl: put clause in right order

recover death deatails from amqp data

* Replace callback init_amqp with convert_from

* Fix return value of lists:keyfind/3

* Translate directly from AMQP 0.9.1 to MQTT

* Fix MQTT payload size

MQTT payload can be a list when converted from AMQP 0.9.1 for example

First conversions tests

Plus some other conversion related fixes.

bazel

bazel

translate amqp 1.0 null to undefined

mc: property/2 and correlation_id/message_id return type tagged values.

To ensure we can support a variety of types better.

The type type tags are AMQP 1.0 flavoured.

fix death recovery

mc_mqtt: impl new api

Add callbacks to allow protocols to compact data before storage

And make readable if needing to query things repeatedly.

bazel fix

* more decoding

* tracking mixed versions compat

* mc: flip default of `durable` annotation to save some data.

Assuming most messages are durable and that in memory messages suffer less
from persistence overhead it makes sense for a non existent `durable`
annotation to mean durable=true.

* mc conversion tests and tidy up

* mc make x_header unstrict again

* amqpl: death record fixes

* bazel

* amqp -> amqpl conversion test

* Fix crash in mc_amqp:size/1

Body can be a single amqp-value section (instead of
being a list) as shown by test
```
make -C deps/rabbitmq_amqp1_0/ ct-system t=java
```
on branch native-amqp.

* Fix crash in lists:flatten/1

Data can be a single amqp-value section (instead of
being a list) as shown by test
```
make -C deps/rabbitmq_amqp1_0 ct-system t=dotnet:roundtrip_to_amqp_091
```
on branch native-amqp.

* Fix crash in rabbit_writer

Running test
```
make -C deps/rabbitmq_amqp1_0 ct-system t=dotnet:roundtrip_to_amqp_091
```
on branch native-amqp resulted in the following crash:
```
crasher:
  initial call: rabbit_writer:enter_mainloop/2
  pid: <0.711.0>
  registered_name: []
  exception error: bad argument
    in function  size/1
       called as size([<<0>>,<<"Sw">>,[<<160,2>>,<<"hi">>]])
       *** argument 1: not tuple or binary
    in call from rabbit_binary_generator:build_content_frames/7 (rabbit_binary_generator.erl, line 89)
    in call from rabbit_binary_generator:build_simple_content_frames/4 (rabbit_binary_generator.erl, line 61)
    in call from rabbit_writer:assemble_frames/5 (rabbit_writer.erl, line 334)
    in call from rabbit_writer:internal_send_command_async/3 (rabbit_writer.erl, line 365)
    in call from rabbit_writer:handle_message/2 (rabbit_writer.erl, line 265)
    in call from rabbit_writer:handle_message/3 (rabbit_writer.erl, line 232)
    in call from rabbit_writer:mainloop1/2 (rabbit_writer.erl, line 223)
```
because #content.payload_fragments_rev is currently supposed to
be a flat list of binaries instead of being an iolist.

This commit fixes this crash inefficiently by calling
iolist_to_binary/1. A better solution would be to allow AMQP legacy's #content.payload_fragments_rev
to be an iolist.

* Add accidentally deleted line back

* mc: optimise mc_amqp internal format

By removint the outer records for message and delivery annotations
as well as application properties and footers.

* mc: optimis mc_amqp map_add by using upsert

* mc: refactoring and bug fixes

* mc_SUITE routingheader assertions

* mc remove serialize/1 callback as only used by amqp

* mc_amqp: avoid returning a nested list from protocol_state

* test and bug fix

* move infer_type to mc_util

* mc fixes and additiona assertions

* Support headers exchange routing for MQTT messages

When a headers exchange is bound to the MQTT topic exchange, routing
will be performend based on both MQTT topic (by the topic exchange) and
MQTT User Property (by the headers exchange).

This combines the best worlds of both MQTT 5.0 and AMQP 0.9.1 and
enables powerful routing topologies.

When the User Property contains the same name multiple times, only the
last name (and value) will be considered by the headers exchange.

* Fix crash when sending from stream to amqpl

When publishing a message via the stream protocol and consuming it via
AMQP 0.9.1, the following crash occurred prior to this commit:
```
crasher:
  initial call: rabbit_channel:init/1
  pid: <0.818.0>
  registered_name: []
  exception exit: {{badmatch,undefined},
                   [{rabbit_channel,handle_deliver0,4,
                                    [{file,"rabbit_channel.erl"},
                                     {line,2728}]},
                    {lists,foldl,3,[{file,"lists.erl"},{line,1594}]},
                    {rabbit_channel,handle_cast,2,
                                    [{file,"rabbit_channel.erl"},
                                     {line,728}]},
                    {gen_server2,handle_msg,2,
                                 [{file,"gen_server2.erl"},{line,1056}]},
                    {proc_lib,wake_up,3,
                              [{file,"proc_lib.erl"},{line,251}]}]}
```

This commit first gives `mc:init/3` the chance to set exchange and
routing_keys annotations.
If not set, `rabbit_stream_queue` will set these annotations assuming
the message was originally published via the stream protocol.

* Support consistent hash exchange routing for MQTT 5.0

When a consistent hash exchange is bound to the MQTT topic exchange,
MQTT 5.0 messages can be routed to queues consistently based on the
Correlation-Data in the PUBLISH packet.

* Convert MQTT 5.0 User Property

* to AMQP 0.9.1 headers
* from AMQP 0.9.1 headers
* to AMQP 1.0 application properties and message annotations
* from AMQP 1.0 application properties and message annotations

* Make use of Annotations in mc_mqtt:protocol_state/2

mc_mqtt:protocol_state/2 includes Annotations as parameter.
It's cleaner to make use of these Annotations when computing the
protocol state instead of relying on the caller (rabbitmq_mqtt_processor)
to compute the protocol state.

* Enforce AMQP 0.9.1 field name length limit

The AMQP 0.9.1 spec prohibits field names longer than 128 characters.
Therefore, when converting AMQP 1.0 message annotations, application
properties or MQTT 5.0 User Property to AMQP 0.9.1 headers, drop any
names longer than 128 characters.

* Fix type specs

Apply feedback from Michael Davis

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Add mc_mqtt unit test suite

Implement mc_mqtt:x_header/2

* Translate indicator that payload is UTF-8 encoded

when converting between MQTT 5.0 and AMQP 1.0

* Translate single amqp-value section from AMQP 1.0 to MQTT

Convert to a text representation, if possible, and indicate to MQTT
client that the payload is UTF-8 encoded. This way, the MQTT client will
be able to parse the payload.

If conversion to text representation is not possible, encode the payload
using the AMQP 1.0 type system and indiate the encoding via Content-Type
message/vnd.rabbitmq.amqp.

This Content-Type is not registered.
Type "message" makes sense since it's a message.
Vendor tree "vnd.rabbitmq.amqp" makes sense since merely subtype "amqp" is not
registered.

* Fix payload conversion

* Translate Response Topic between MQTT and AMQP

Translate MQTT 5.0 Response Topic to AMQP 1.0 reply-to address and vice
versa.

The Response Topic must be a UTF-8 encoded string.

This commit re-uses the already defined RabbitMQ target addresses:
```
"/topic/"     RK        Publish to amq.topic with routing key RK
"/exchange/"  X "/" RK  Publish to exchange X with routing key RK
```

By default, the MQTT topic exchange is configure dto be amq.topic using
the 1st target address.

When an operator modifies the mqtt.exchange, the 2nd target address is
used.

* Apply PR feedback

and fix formatting

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* tidy up

* Add MQTT message_containers test

* consistent hash exchange: avoid amqp legacy conversion

When hashing on a header value.

* Avoid converting to amqp legacy when using exchange federation

* Fix test flake

* test and dialyzer fixes

* dialyzer fix

* Add MQTT protocol interoperability tests

Test receiving from and sending to MQTT 5.0 and
* AMQP 0.9.1
* AMQP 1.0
* STOMP
* Streams

* Regenerate portions of deps/rabbit/app.bzl with gazelle

I'm not exactly sure how this happened, but gazell seems to have been
run with an older version of the rules_erlang gazelle extension at
some point. This caused generation of a structure that is no longer
used. This commit updates the structure to the current pattern.

* mc: refactoring

* mc_amqpl: handle delivery annotations

Just in case they are included.

Also use iolist_to_iovec to create flat list of binaries when
converting from amqp with amqp encoded payload.

---------

Co-authored-by: David Ansari <david.ansari@gmx.de>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
2023-08-31 11:27:13 +01:00
Simon Unge 2d74d24b80 Disable add/delete/shrink/grow QQ operations via HTTP api 2023-08-23 01:03:28 +00:00
Marcial Rosales 1e74490412 Fix wrong config 2023-08-14 12:15:51 +01:00
Marcial Rosales dbffccba9d Fix #9043 2023-08-14 11:51:46 +01:00
Michael Klishin 52d78e018a
Merge pull request #8218 from SimonUnge/eval_membership_stand_alone_process
Reconcile (repair or expand) quorum queue membership periodically
2023-07-13 20:28:34 +04:00
Arnaud Cogoluègnes d0a6efc1c9
Document stream management plugin endpoints
Fixes #8751
2023-07-13 15:41:23 +02:00
Simon Unge 559a83d45f See #7209. Evaluate quorum queue membership periodically. 2023-07-11 13:14:04 -07:00
Karl Nilsson 86479670cf
Make filter size configurable
as a queue arg and policy
2023-07-10 15:21:53 +02:00
Jean-Sébastien Pédron f3be0118c6
Mark management metrics collection as deprecated
[Why]
Management metrics collection will be removed in RabbitMQ 4.0. The
prometheus plugin provides a better and more scalable alternative.

[How]
The management metrics collection is marked as deprecated in the code
using the Deprecated features subsystem (based on feature flags). See
pull request #7390 for a description of that subsystem.

To test RabbitMQ behavior as if the feature was removed, the following
configuration setting can be used:
deprecated_features.permit.management_metrics_collection = false

Management metrics collection can be turned off anytime, there are no
conditions to do that.

Once management metrics collection is turned off, the management API
will not report any metrics and the UI will show empty graphs.

Note that given the marketing calendar, the deprecated feature will go
directly from "permitted by default" to "removed" in RabbitMQ 4.0. It
won't go through the gradual deprecation process.
2023-07-06 11:02:45 +02:00
antsthebul 4ebc3244f0 Set max height value for popup, as to not conlfict with smaller length popups 2023-06-30 13:40:34 -04:00
antsthebul b8f65083d1 Adjust CSS on Popup box 2023-06-29 14:47:56 -04:00
Simon Unge 1037d8014d gazelle deps fix! 2023-06-23 14:52:56 -07:00
Simon Unge 8b3ca4c972 See #8605. Add authentcation support to prometheus. 2023-06-23 13:54:45 -07:00
Michael Klishin 55442aa914 Replace @rabbitmq.com addresses with rabbitmq-core@groups.vmware.com
Don't ask why we have to do it. Because reasons!
2023-06-20 15:40:13 +04:00
Michael Klishin 0a00526dba More wording, link to the maintenance mode doc section 2023-06-15 22:48:41 +04:00
Michael Klishin f428af75b7 One more UI wording change 2023-06-15 22:39:03 +04:00
Michael Klishin 46561fc9fe Naming changes #8578 2023-06-15 22:37:36 +04:00
Simon Unge 782830f4bd Show nodes in maintenance mode in UI 2023-06-15 22:37:36 +04:00
Marcial Rosales 77ee572467 Fixes #8547 2023-06-14 09:39:03 +02:00
Michael Klishin 99968792fa Basic tests for the endpoints introduced in #8532 2023-06-14 03:14:36 +04:00
Michael Klishin e5759e2b60 Implement {POST, DELETE} /api/queues/quorum/replicas/on/:node/{grow,shrink}
Part of #8532.
2023-06-14 02:01:31 +04:00
Michael Klishin fc895b7212 Return 202 for QQ replica removal 2023-06-14 00:07:06 +04:00
Michael Klishin de75f3bf79 HTTP API: introduce two endpoints for QQ replica management
to match what is offered by the CLI (`rabbitmq-queues`).

Part of #8532.
2023-06-13 01:36:54 +04:00
Michael Klishin ddb9fbd12c
Merge pull request #8520 from rabbitmq/mk-rename-management-ui-tabs
Rename a couple of management UI tabs
2023-06-11 00:14:43 +04:00
Michael Klishin f54b2906bd More Selenium suite updates 2023-06-10 23:21:32 +04:00
Michael Klishin f4aed7a55e Make sure that nav element ids follow a reasonable convention
Instead of using the label, use a snake-case value
without any spaces.

While at it, update Selenium/WebDriver test suites.
2023-06-10 19:38:36 +04:00
Michael Klishin c68d13d071 Don't fail with a 500 when virtual host or user do not exist
when clearing their limits.
2023-06-10 19:28:09 +04:00
Michael Klishin f720338658 Rename a couple of management UI tabs
* Queueus => Queues and Streams
 * Stream => Stream Connections

to better reflect what they display in modern versions.

Per discussion with the team.
2023-06-10 18:57:16 +04:00
Simon Unge cfdc4c7991 Fix /api/connections/username bug where wrong datatype was provided to internal function causing internal error 2023-06-05 15:35:23 -07:00
Marcial Rosales da43ccf6c7 Fix member variable for datamodel in Display 2023-05-23 17:03:45 +02:00
Marcial Rosales 02fda919a5 Fix #8276 2023-05-23 16:47:11 +02:00
Iliia Khaprov 00b3a895f1 UI bits for consumer timeout 2023-05-22 11:59:30 +02:00
Marcial Rosales 9736fb6c46 Fix mgt-only exchanges test 2023-05-19 21:08:44 +02:00
Marcial Rosales e155da86e8 Fix test cases 2023-05-19 20:32:44 +02:00
Marcial Rosales 79c206d339 Test only admin users can edit limits 2023-05-19 17:53:01 +02:00
Marcial Rosales 6ca5d026eb Only load users for limits for admin user 2023-05-19 17:24:38 +02:00
Marcial Rosales 93907b38a1 Look up for elements rather than clicking on them
This is because when we clicked on a menu option
there are html content refreshed which confuses
the webdriver
2023-05-19 17:01:15 +02:00
Marcial Rosales 67e04259a0 Test various user tags without vhost permissions 2023-05-19 17:01:15 +02:00
Marcial Rosales 1022f7d197 Do not mount route to pages
which require vhost access but the
use has no access to any vhost
2023-05-19 17:01:15 +02:00
Marcial Rosales 24fb9afe16 WIP Fix issue 2023-05-19 17:01:15 +02:00
Michael Klishin 29f9e1ceaf
Merge pull request #8236 from rabbitmq/no-more-lazy
Remove "lazy" from Management and lazy-specific tests
2023-05-19 11:51:22 +04:00
Michael Klishin e60a5409ff
Merge pull request #8241 from cloudamqp/queue_storage_version
Show classic queue storage version on Mgmt UI queue page
2023-05-19 11:09:19 +04:00
Péter Gömöri e0f485b1cc Show classic queue storage version on Mgmt UI queue page 2023-05-19 00:07:22 +02:00
Simon Unge 472496b4a3 Add ha-* operator policies to UI shortcuts 2023-05-18 11:24:04 -07:00
Michal Kuratczyk f8a3643d5d
Remove "lazy" from Management and lazy-specific tests 2023-05-18 13:59:50 +02:00
Rin Kuryloski eb94a58bc9 Add a workflow to compare the bazel/erlang.mk output
To catch any drift between the builds
2023-05-15 13:54:14 +02:00
Michael Klishin 65e59f670b Only validate regular expression when the regex box is checked 2023-04-27 13:43:44 +04:00
Michael Klishin a4386db25d Wording 2023-04-27 12:32:39 +04:00
Michael Klishin fe1fbb8264 Add a warning for invalid regular expressions
Warn the user when filter expression does not compile to a regular
expression.

Part of #8008.
2023-04-27 12:27:19 +04:00
Michael Klishin a93ad3b7f1 First attempt at addressing #8008
When filter exression is not a valid regexp, send
it as a regular text filer.
2023-04-27 12:06:13 +04:00
Rin Kuryloski a944439fba Replace globs in bazel with explicit lists of files
As this is preferred in rules_erlang 3.9.14
2023-04-25 17:29:12 +02:00
Rin Kuryloski 854d01d9a5 Restore the original -include_lib statements from before #6466
since this broke erlang_ls

requires rules_erlang 3.9.13
2023-04-20 12:40:45 +02:00
Michael Klishin c0ed80c625
Merge pull request #6466 from rabbitmq/gazelle
Use gazelle for some maintenance of bazel BUILD files
2023-04-19 09:33:44 +04:00
Michael Klishin 6e6c1581d4
rabbit_mgmt_wm_auth: rearrange exports 2023-04-18 03:28:58 +04:00
Rin Kuryloski 8de8f59d47 Use gazelle generated bazel files
Bazel build files are now maintained primarily with `bazel run
gazelle`. This will analyze and merge changes into the build files as
necessitated by certain code changes (e.g. the introduction of new
modules).

In some cases there hints to gazelle in the build files, such as `#
gazelle:erlang...` or `# keep` comments. xref checks on plugins that
depend on the cli are a good example.
2023-04-17 18:13:18 +02:00
Michael Klishin 0f8a5899de
Merge branch 'main' into otp26-compatibility 2023-04-17 14:23:21 +04:00
Michael Klishin 858b74ff19
Merge branch 'main' into rin/ignore-warnings-plts 2023-04-17 14:01:41 +04:00
Marcial Rosales 67638fa535 Use rabbit_json library to produce json representations 2023-04-17 11:12:36 +02:00
Rin Kuryloski 8a7eee6a86 Ignore warnings when building plt files for dependencies
As we don't generally care if a dependency has warnings, only the
target
2023-04-17 10:09:24 +02:00
Michael Klishin fe3d65002d
Revert "Remove an old version of rabbit_mgmt_wm_auth"
This reverts commit 753fa5a191.

Both rabbit_mgmt_oauth_bootstrap and rabbit_mgmt_wm_auth should
be kept for backwards compatibility with certain clients.
2023-04-17 11:48:23 +04:00
Michael Klishin 753fa5a191
Remove an old version of rabbit_mgmt_wm_auth
rabbit_mgmt_oauth_bootstrap is not hooked up to the dispatcher,
and appears to be an older version of what is now rabbit_mgmt_wm_auth

(cherry picked from commit 1209b86671)
2023-04-14 19:23:16 +04:00
Michal Kuratczyk 3c2917b871
Don't rely on implict list ordering
While at it, refactor `rabbit_misc:plmerge/2` to use the same precedence
as maps:merge and lists:merge (the second argument supersedes the first
one)
2023-04-13 14:37:18 +02:00
Marcial Rosales 1c1e4515f7 Deprecate uaa settings from management plugin 2023-04-13 11:22:05 +02:00
Michael Klishin f1af3bb922
Merge pull request #7365 from rabbitmq/oauth2-login-with-authorization-header
Read JWT token from Authorization header to login to management ui
2023-04-04 18:48:05 +04:00
Loïc Hoguin 1595727a1a
Fix parsing of cookie header in test suite 2023-04-04 10:11:31 +02:00
Marcial Rosales 829d9d9428 Read JWT token from Authorization Header 2023-04-04 12:00:08 +04:00
Michael Klishin 1a3126d72a Management UI footer link updates 2023-04-03 22:23:06 +04:00
Michael Klishin d478fadaa1 Type specs around virtual host addition 2023-04-02 01:04:16 +04:00
Michael Klishin f1a922a17c Virtual host limit: error type naming
vhost_precondition_failed => vhost_limit_exceeded

vhost_limit_exceeded is the error type used by
definition import when a per-vhost is exceeded.
It feels appropriate for this case, too.
2023-04-01 23:11:48 +04:00
Simon Unge 574ca55a3f See #7777. Use vhost_max to stop vhost creation in rabbitmq 2023-03-31 12:18:16 -07:00
Michael Klishin bfcbef64b4 HTTP API: rename default queue type key
from defaultqueuetype to default_queue_type.
defaultqueuetype is still used as a fallback for backwards
compatibility.

Closes #7734.
2023-03-25 01:33:22 +04:00
Michael Klishin 7fb32b6ae0
Merge pull request #7675 from cloudamqp/login_handler
Fix return value of mgmt login handler on bad method
2023-03-21 19:48:55 +04:00
Marcial Rosales 67b952c28c Refactor selenium tests 2023-03-21 12:39:28 +01:00
Péter Gömöri 4d21184a12 Fix return value of mgmt login handler on bad method
To match what cowboy_handler expects.
2023-03-20 11:13:12 +01:00
Michal Kuratczyk 0a3136a916
Allow applying policies to specific queue types
Rather than relying on queue name conventions, allow applying policies
based on the queue type. For example, this allows multiple policies that
apply to all queue names (".*") that specify different parameters for
different queue types.
2023-03-13 12:36:48 +01:00
Marcial Rosales 42b821f0e9 Add missing pem file 2023-02-28 14:10:00 +01:00
Marcial Rosales efb1b5bd10 Fix 2549
Allow list of preferred_username_claims in cuttlefish
config style.
Use new config style on two selenium test suites
Test oauth2 backend's config schema and oauth2 management
config schema
2023-02-28 10:38:28 +01:00
Luke Bakken f420487e5e
Add documentation for hashing passwords
Fixes #7432

Adds HTTP API documentation as well as `rabbitmqctl hash_password` docs.

Add `rabbitmqctl` docs
2023-02-26 15:16:38 -08:00
Jean-Sébastien Pédron 42bcd94dce
rabbit_db_cluster: New module on top of databases clustering
This new module sits on top of `rabbit_mnesia` and provide an API with
all cluster-related functions.

`rabbit_mnesia` should be called directly inside Mnesia-specific code
only, `rabbit_mnesia_rename` or classic mirrored queues for instance.
Otherwise, `rabbit_db_cluster` must be used.

Several modules, in particular in `rabbitmq_cli`, continue to call
`rabbit_mnesia` as a fallback option if the `rabbit_db_cluster` module
unavailable. This will be the case when the CLI will interact with an
older RabbitMQ version.

This will help with the introduction of a new database backend.
2023-02-22 15:28:04 +01:00
Marcial Rosales 20269bf222 Fix issue #7369
Depending on `disable_stats` value
search for detailed exchange details or
basic details
2023-02-21 13:11:45 +01:00
Marcial Rosales 89ee77e5ec Improve how to look for elements and wait for them 2023-02-21 13:07:37 +01:00
Marcial Rosales 9ab7dca650 Fix issue 7301 2023-02-15 14:29:55 +01:00
Michael Klishin d0dc951343
Merge pull request #7058 from rabbitmq/add-node-lists-functions-to-clarify-intent
rabbit_nodes: Add list functions to clarify which nodes we are interested in
2023-02-13 23:06:50 -03:00
David Ansari 575f4e78bc Remove compatibility for feature flag stream_queue
Remove compatibility code for feature flag `stream_queue`
because this feature flag is required in 3.12.

See #7219
2023-02-13 15:31:40 +00:00
Jean-Sébastien Pédron d65637190a
rabbit_nodes: Add list functions to clarify which nodes we are interested in
So far, we had the following functions to list nodes in a RabbitMQ
cluster:
* `rabbit_mnesia:cluster_nodes/1` to get members of the Mnesia cluster;
  the argument was used to select members (all members or only those
  running Mnesia and participating in the cluster)
* `rabbit_nodes:all/0` to get all members of the Mnesia cluster
* `rabbit_nodes:all_running/0` to get all members who currently run
  Mnesia

Basically:
* `rabbit_nodes:all/0` calls `rabbit_mnesia:cluster_nodes(all)`
* `rabbit_nodes:all_running/0` calls `rabbit_mnesia:cluster_nodes(running)`

We also have:
* `rabbit_node_monitor:alive_nodes/1` which filters the given list of
  nodes to only select those currently running Mnesia
* `rabbit_node_monitor:alive_rabbit_nodes/1` which filters the given
  list of nodes to only select those currently running RabbitMQ

Most of the code uses `rabbit_mnesia:cluster_nodes/1` or the
`rabbit_nodes:all*/0` functions. `rabbit_mnesia:cluster_nodes(running)`
or `rabbit_nodes:all_running/0` is often used as a close approximation
of "all cluster members running RabbitMQ". This list might be incorrect
in times where a node is joining the clustered or is being worked on
(i.e. Mnesia is running but not RabbitMQ).

With Khepri, there won't be the same possible approximation because we
will try to keep Khepri/Ra running even if RabbitMQ is stopped to
expand/shrink the cluster.

So in order to clarify what we want when we query a list of nodes, this
patch introduces the following functions:
* `rabbit_nodes:list_members/0` to get all cluster members, regardless
  of their state
* `rabbit_nodes:list_reachable/0` to get all cluster members we can
  reach using Erlang distribution, regardless of the state of RabbitMQ
* `rabbit_nodes:list_running/0` to get all cluster members who run
  RabbitMQ, regardless of the maintenance state
* `rabbit_nodes:list_serving/0` to get all cluster members who run
  RabbitMQ and are accepting clients

In addition to the list functions, there are the corresponding
`rabbit_nodes:is_*(Node)` checks and `rabbit_nodes:filter_*(Nodes)`
filtering functions.

The code is modified to use these new functions. One possible
significant change is that the new list functions will perform RPC calls
to query the nodes' state, unlike `rabbit_mnesia:cluster_nodes(running)`.
2023-02-13 12:58:40 +01:00
David Ansari 79c12b60bc Use maybe expression instead of messy patterns
This commit is pure refactoring making the code base more maintainable.

Replace rabbit_misc:pipeline/3 with the new OTP 25 experimental maybe
expression because
"Frequent ways in which people work with sequences of failable
operations include folds over lists of functions, and abusing list
comprehensions. Both patterns have heavy weaknesses that makes them less
than ideal."
https://www.erlang.org/eeps/eep-0049#obsoleting-messy-patterns

Additionally, this commit is more restrictive in the type spec of
rabbit_mqtt_processor state fields.
Specifically, many fields were defined to be `undefined | T` where
`undefined` was only temporarily until the first CONNECT packet was
processed by the processor.
It's better to initialise the MQTT processor upon first CONNECT packet
because there is no point in having a processor without having received
any packet.
This allows many type specs in the processor to change from `undefined |
T` to just `T`.
Additionally, memory is saved by removing the `received_connect_packet`
field from the `rabbit_mqtt_reader` and `rabbit_web_mqtt_handler`.
2023-02-07 16:36:08 +01:00
Michael Klishin ee5fddc37f
Correct find-and-replace artifact 2023-02-06 22:39:54 -05:00
Michael Klishin 6c6f9c49ae
Naming, references #7165 2023-02-06 22:25:09 -05:00
Alex Valiushko db99c252a0 Add setting to disable op policy edit via API 2023-02-06 14:36:10 -08:00
Alexey Lebedeff c7da0da8b8 Cleanup dialyzer calls
- Use the same base .plt everywhere, so there is no need to list
standard apps everywhere
- Fix typespecs: some typos and the use of not-exported types
2023-02-06 17:05:30 +01:00
Marcial Rosales 166faa3629 Test when there are zero limits 2023-02-01 18:13:57 +01:00
Marcial Rosales 5ad72497a3 Test display limits when there are none 2023-02-01 17:42:38 +01:00
Marcial Rosales 3fca42ed7a Fix issue #7142
The issue is that users retrieved with
the intention to list in the limits view
are not paged hence they are not wrapped
around a paging struct where users would be
under items attribute.

Pending selenium tests
2023-02-01 16:42:33 +01:00
Iliia Khaprov e4f1486d7a Fix Users filtering in Management UI.
close #4908
2023-01-26 16:28:47 +01:00
David Ansari 8a2a82e19b Remove feature flag no_queue_name_in_classic_queue_client
as it was unnecessary to introduce it in the first place.

Remove the queue name from all queue type clients and pass the queue
name to the queue type callbacks that need it.

We have to leave feature flag classic_queue_type_delivery_support
required because we removed the monitor registry
1fd4a6d353/deps/rabbit/src/rabbit_queue_type.erl (L322-L325)

Implements review from Karl:
"rather than changing the message format we could amend the queue type
callbacks involved with the stateful operation to also take the queue
name record as an argument. This way we don't need to maintain the extra
queue name (which uses memory for known but obscurely technical reasons
with how maps work) in the queue type state (as it is used in the queue
type state map as the key)"
2023-01-24 17:32:59 +00:00
David Ansari 56e97a9142 Fix MQTT in management plugin
1. Allow to inspect an (web) MQTT connection.
2. Show MQTT client ID on connection page as part of client_properties.
3. Handle force_event_refresh (when management_plugin gets enabled
   after (web) MQTT connections got created).
4. Reduce code duplication between protocol readers.
5. Display '?' instead of 'NaN' in UI for absent queue metrics.
6. Allow an (web) MQTT connection to be closed via management_plugin.

For 6. this commit takes the same approach as already done for the stream
plugin:
The stream plugin registers neither with {type, network} nor {type,
direct}.
We cannot use gen_server:call/3 anymore to close the connection
because the web MQTT connection cannot handle gen_server calls (only
casts).
Strictly speaking, this commit requires a feature flag to allow to force
closing stream connections from the management plugin during a rolling
update. However, given that this is rather an edge case, and there is a
workaround (connect to the node directly hosting the stream connection),
this commit will not introduce a new feature flag.
2023-01-24 17:30:10 +00:00
Michael Klishin 9801773cc7
Merge pull request #7004 from SimonUnge/http-hash-password
See #5957. HTTP api to generate hashed password from cleartext password
2023-01-23 21:04:54 -06:00
Alexey Lebedeff 6517c7fe6c Bump node versions for selenium tests
Search for `Error: Cannot find module 'node:events'` in internet
suggests using at least node 16.6.
2023-01-23 22:47:50 +01:00
Simon Unge 7fecfcd26c See #5957. HTTP api to generate hashed password from cleartext password 2023-01-23 13:00:49 -08:00
Rin Kuryloski b84e746ee9 Rework plt/dialyze for rabbitmqctl and plugins that depend on it
This allows us to stop ignorning undefined callback warnings

When mix compiles rabbitmqctl, it produces a 'consolidated' directory
alongside the 'ebin' dir. Some of the modules in consolidated are
intended to be used instead of those provided by elixir. We now handle
the conflicts properly in the bazel build.
2023-01-19 17:29:23 +01:00
Michael Klishin c87bffc1d0
Merge pull request #6938 from rabbitmq/dialyzer-warnings-rabbitmq_management
Fix all dialyzer warnings in rabbitmq_management
2023-01-19 07:53:04 -06:00
Alexey Lebedeff 1865284ab3 Fix all dialyzer warnings in rabbitmq_management 2023-01-19 12:47:34 +01:00
Rin Kuryloski 5ef8923462 Avoid the need to pass package name to rabbitmq_integration_suite 2023-01-18 15:25:27 +01:00
Rin Kuryloski a317b30807 Use improved assert_suites2 macro from rules_erlang 3.9.0 2023-01-18 15:07:06 +01:00
Marcial Rosales 6a08cd014f
Resolve conflict 2023-01-03 07:09:05 -05:00
Marcial Rosales 07fc6d1313
Validate imported user from file 2023-01-03 07:09:05 -05:00
Marcial Rosales 6e84444059
Test token refresh
And enable hard session timeout which was
disabled by mistake when moved credentials
from cookies to local storage
2023-01-03 07:09:04 -05:00
Marcial Rosales e8fc9af13a
Refactor code following recommendations
from @essen
2023-01-03 07:09:04 -05:00
Marcial Rosales f6fad5c32e
Rename section otherwise
clicking on any area triggered
the download of the definitions
2023-01-03 07:09:04 -05:00
Marcial Rosales 4b1e30640d
Fix import/export test cases
When running test remotely, the import
definition file must be transfered from
the test container onto the selenium container
wehre the browser runs
2023-01-03 07:09:04 -05:00
Marcial Rosales 58be01f1d1
Use only token in authorization header to
import and export definitions
2023-01-03 07:09:04 -05:00
Marcial Rosales 36728042ec
Test with selenium export/import definitions 2023-01-03 07:09:03 -05:00
Marcial Rosales bf172af236
Do not use cookies to store basic auth
Use window.localStorage. If it is disabled
Management UI should stop working rather than
falling back to cookies
2023-01-03 07:09:03 -05:00
Marcial Rosales c76e589130
Do not use cookies to store basic auth
Instead use localStorage
2023-01-03 07:09:03 -05:00
Marcial Rosales 8f1ddb2786
Test basic-auth behind proxy 2023-01-03 07:09:03 -05:00
Marcial Rosales 54acf88210
Support path_prefix in /login url
For OAuth2 idp initiated logon
2023-01-03 07:09:02 -05:00
Marcial Rosales 9354397cbf
Support Idp initiated logon in mgt ui with Oauth
Configure preferred username from a token
Make client_secret optional
2023-01-03 07:09:00 -05:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Patrik Ragnarsson 29d3a0e0d4 Escape the user controlled error parameter 2022-12-30 12:48:55 +01:00
Michael Klishin aa71d9ecc3
Merge pull request #6674 from rabbitmq/lukebakken/definitions-download
Use more modern method to download definitions
2022-12-14 20:19:04 +04:00
Luke Bakken a193f4516b
Use more modern method to download definitions
Does not require sending auth as a query parameter

Ref: https://vmware.slack.com/archives/C0RDGG81Z/p1669827808015729
2022-12-13 17:11:25 -08:00
Jean-Sébastien Pédron 88dac7ec07
rabbit_mgmt_wm_parameter: Verify variables before calling `rabbit_runtime_parameters`
So far, `rabbit_runtime_parameters` could be called with invalid terms.
There are probably still places in the code which lack this kind of
verification.
2022-12-13 14:55:46 +01:00
Michael Klishin f216ecca9f
Merge pull request #6638 from rabbitmq/unused-buggy-apply_defs_5
Remove unused rabbit_definitions:apply_defs/5
2022-12-12 22:06:03 +04:00
Michael Klishin 4ddcab2b76
Use ?assertEqual here
References #6599
2022-12-12 19:52:51 +04:00
Michael Klishin 7c9e328a5c
Merge pull request #6599 from rabbitmq/default-queue-type-single-vhost-import
Fix default queue type handling for single vhost imports
2022-12-12 19:46:13 +04:00
Alexey Lebedeff aa0104c49f Remove unused rabbit_definitions:apply_defs/5
`rabbit_definitions:apply_defs/5` contains a bug
where it was trying to import bindings too
early (aec3dcbf37/deps/rabbit/src/rabbit_definitions.erl (L480)).
`apply_defs/4` imports exchanges at exactly the same place.

Turns out `apply_defs/5` is almost an verbatim copy of
`apply_defs/4`, just with custom error handling - and it isn't being
used anywhere in the source code.

Also removes related unused exports.
2022-12-12 15:37:23 +01:00
Alexey Lebedeff 4bfe352168 Fix default queue type handling for single vhost imports
Default queue type logic didn't apply when import was done for a
single vhost. Exported definitions for a single vhost don't contain
`vhost` key, and anyway it's better to use the actual vhost name that
will be used for queue declaration.

And just in case, `vhost` is now stripped from all exported items for
a single vhost (it was still present in `parameters` and `policies`) -
on import it was ignored, but it could have been a source of the bug
similar to the one with the default queue type.
2022-12-12 14:20:22 +01:00
Michael Klishin a2533a6de2
Merge pull request #6628 from SimonUnge/6016-fetch_app_environment_api
See #6016. Add HTTP to fetch app environment config
2022-12-12 15:26:31 +04:00
Simon Unge 32097035dc See #6016. Add HTTP to fetch app environment config 2022-12-11 20:38:53 -08:00
Alexey Lebedeff 6693af78af Consistently expose default queue functionality in management UI
1. Allow to create queues without `x-queue-type` argument, which give
default queue type logic a chance to run. What's more, those queues
definitions will be exported without `x-queue-type`, so they can be
loaded into another vhost and default queue logic will be applied
again.

2. Show default queue type on the vhost page and the vhosts list pages
2022-12-08 17:39:44 +01:00
Michal Kuratczyk d8ff99180b
Consider streams when quorum critical check (#6448)
Extended the quorum critical check to also consider streams and their
potential unavailability if the nodes is stopped.
2022-11-23 15:24:26 +01:00
Marcial Rosales 913c931184 Start UAA first then RabbitMQ
To avoid flaky timing issues where
UAA is not ready yet when the tests need
it
2022-11-18 11:53:51 +01:00
Michael Klishin 6fe28e724a
Squash a couple of warnings 2022-11-03 16:40:52 +04:00
Alex Valiushko 0a81a063b5 Add noopener to hrefs in rabbitmq_management 2022-10-20 12:15:32 -07:00
Luke Bakken 7fe159edef
Yolo-replace format strings
Replaces `~s` and `~p` with their unicode-friendly counterparts.

```
git ls-files *.erl | xargs sed -i.ORIG -e s/~s>/~ts/g -e s/~p>/~tp/g
```
2022-10-10 10:32:03 +04:00
Michael Klishin a955f736fe
Merge pull request #5934 from rabbitmq/gh_5931
Introduce new feature flag to avoid сhannel exceptions when delivering to CQs post #5105
2022-10-07 14:10:42 +04:00
Karl Nilsson 2ad9f1320a Introduce new feature flag to avoid crashing channel.
When a delivery or credit_reply is sent from a node running 3.11.0 or 3.10.8
to an older node.
2022-10-07 09:21:35 +01:00
Marcial Rosales edabd8816b Support multiple path segments in management path
Updated selenium tests to tests against 2 path
segments rather than just one
2022-10-04 16:43:18 +02:00
Marcial Rosales 4f3e5398f6 Improve wording of how to run selenium tests 2022-10-04 10:01:59 +02:00
Marcial Rosales d46566099f Support management path prefix when using OAuth2 2022-10-04 09:13:57 +02:00
Marcial Rosales bb9d7a134e Refactor how selenium suites are run 2022-10-03 13:15:57 +02:00
Luke Bakken 755ac7176b
Follow-up to #5486
Discovered by @dumbbell

Ensure externally read strings are saved as utf-8 encoded binaries. This
is necessary since `cmd.exe` on Windows uses ISO-8859-1 encoding and
directories can have latin1 characters, like `RabbitMQ Sérvér`.

The `é` is represented by decimal `233` in the ISO-8859-1 encoding. The
unicode code point is the same decimal value, `233`, so you will see
this in the charlist data. However, when encoded using utf-8, this
becomes the two-byte sequence `C3 A9` (hexidecimal).

When reading strings from env variables and configuration, they will be
unicode charlists, with each list item representing a unicode code
point. All of Erlang string functions can handle strings in this form.
Once these strings are written to ETS or Mnesia, they will be converted
to utf-8 encoded binaries. Prior to these changes just
`list_to_binary/1` was used.

Fix xref error

re:replace requires an iodata, which is not a list of unicode code points

Correctly parse unicode vhost tags

Fix many format strings to account for utf8 input. Try again to fix unicode vhost tags

More format string fixes, try to get the CONFIG_FILE var correct

Be sure to use the `unicode` option for re:replace when necessary

More unicode format strings, add unicode option to re:split

More format strings updated

Change ~s to ~ts for vhost format strings

Change ~s to ~ts for more vhost format strings

Change ~s to ~ts for more vhost format strings

Add unicode format chars to disk monitor

Quote the directory on unix

Finally figure out the correct way to pass unicode to the port
2022-09-24 11:19:59 -07:00
Marcial Rosales 9c25457261 Simplify make targets 2022-09-02 09:34:51 +01:00
Marcial Rosales bbc3c75d05 Add missing renamed oauth.enable -> oauth.enabled 2022-09-02 09:33:11 +01:00
Michael Klishin c0a38c6da5 Management plugin: oauth_enable => oauth_enabled in more places 2022-09-02 01:17:58 +04:00
Michael Klishin dca7132dc3 management.oauth_enable => management.oauth_enabled 2022-09-02 00:16:13 +04:00
Marcial Rosales 0cbe370ec0 Fix bug in start-uaa.sh script
And capture screenshots on all test cases
on teardown if the test failed
Use headless chrome 104
2022-09-01 16:26:12 +01:00
Marcial Rosales e3d2af924e Fix location of script waitTillUAAReady
and use 105 of headless chrome
2022-09-01 14:41:03 +01:00
Marcial Rosales da77481663 Wait till token TTL before checking again 2022-09-01 13:54:29 +01:00
Marcial Rosales 54464c0498 Logging improvements
Rather than logging directly via console.log
we do it via the Logger library provided by
oidc-client which allows to use logging levels
2022-09-01 13:53:42 +01:00
Marcial Rosales dbf5797107 Enable only 2 plugins not all 2022-09-01 13:50:11 +01:00
Michael Klishin 31a5e1ab14 OAuth 2 Selenium suite: bump selenium-webdriver and chromedriver 2022-09-01 15:24:17 +04:00
Marcial Rosales 48e90b9f74 Improve wording 2022-09-01 11:46:45 +01:00
Marcial Rosales d544442647 Fix wrong folder name 2022-09-01 11:43:59 +01:00
Marcial Rosales 81f612f8ff Test hard session timeout
When the management ui session times out
the user should be logged out also from
the idp
2022-08-30 17:53:44 +01:00
Marcial Rosales 0ce972da2e Refactor how selenium tests are run 2022-08-30 17:13:22 +01:00
Marcial Rosales e57b88f2b7 Fix logout workflow
The issue was primarily that UAA was
not properly configured. We had to whitelist
the uri used for logout otherwise UAA redirects
to its login page

WIP verify that logout.js works when running in
headless mode. For that we need a docker image
and at the moment, make docker-image is not
working because it is still using old otp 24.0.2
2022-08-30 17:11:21 +01:00
Marcial Rosales 7f14fa77f7 Skip logout selenium test 2022-08-30 17:11:21 +01:00
Marcial Rosales 9c7a36f626 Explain how to launch rabbitq from source 2022-08-30 17:11:21 +01:00
Marcial Rosales 9d599449e7 Run selenium tests with Actions 2022-08-30 17:11:20 +01:00
Marcial Rosales 99930e1fef Improve docs and fix some mistakes on the selenium tests 2022-08-30 17:11:20 +01:00
Marcial Rosales c8f6d9ee86 Enable oauth2 plugin
However this change will not take any effect
unless we add the aouth2 plugin as a dependency
in the Makefile
2022-08-30 17:11:20 +01:00
Marcial Rosales 1fa83260ba Ensure first oauth2 plugin is configured 2022-08-30 17:11:19 +01:00
Marcial Rosales fe34d27413 Fix test case oauth_test 2022-08-30 17:11:19 +01:00
Marcial Rosales 78d1be295a Fix auth_test
It was skipping the www-authenticate response header
regardless of the auth method when it should really skip it
when using oauth2
2022-08-30 17:11:19 +01:00
Marcial Rosales 1be9db3221 WIP prepare to run all tests
Waiting for the docker image to be pushed to repo
2022-08-30 17:11:19 +01:00
Marcial Rosales 33f14060c6 Comment why test last 20sec 2022-08-30 17:11:19 +01:00
Marcial Rosales 4f3c7caa3c Document testing 2022-08-30 17:11:19 +01:00
Marcial Rosales 745ff0b4b2 Fix issue related to refreshing access tokens 2022-08-30 17:11:19 +01:00
Marcial Rosales 5c4e92ba25 Issue found on token refresh 2022-08-30 17:11:19 +01:00
Marcial Rosales c5d137121e Verify login,logout when uaa is up 2022-08-30 17:11:18 +01:00
Marcial Rosales 93cee6dede Verify happy-login scenario
With auto-approved scopes
2022-08-30 17:11:18 +01:00
Marcial Rosales f402f4a3bc WIP fixing test case happy-login.js using ObjectPages 2022-08-30 17:11:18 +01:00
Marcial Rosales 7e0adbbb1f Tested landing page
WIP: happy login scenario
2022-08-30 17:11:18 +01:00
Marcial Rosales 84e9f653e8 WIP Using PageObject pattern to write tests 2022-08-30 17:11:18 +01:00
Marcial Rosales 5fc370c88f WIP only landing.js working 2022-08-30 17:11:18 +01:00
Marcial Rosales cc25fdee87 WIP running selenium tests from docker
There is still an issue running the tests in docker
2022-08-30 17:11:18 +01:00
Marcial Rosales 316b520b17 Remove dummy state 2022-08-30 17:11:17 +01:00
Marcial Rosales 7fb967f572 Run tests 2022-08-30 17:11:17 +01:00
Marcial Rosales 4d098fcfbf Complete login and logout flows 2022-08-30 17:11:17 +01:00
Marcial Rosales 05d13f99b0 Auto approve scopes
This is to avoid the authorization page in
UAA. It is not clear how to remove approvals therefore
once they are approved the user has the scopes approved
until they expire. If the user has some approved scopes,
they will not be prompted to approve them until they
expire hence the ui flow differs when the user has to
approve scopes and when not.
2022-08-30 17:11:17 +01:00
Marcial Rosales bcb26a20fc Testing happy login for oauth 2022-08-30 17:11:17 +01:00
Marcial Rosales b555ef6d66 Explain what it is needed to run tests 2022-08-30 17:11:17 +01:00
Marcial Rosales dd7ee46e07 Explain how automated testing works 2022-08-30 17:11:17 +01:00
Marcial Rosales 14b5c67b53 Test home page with oauth2 and without token 2022-08-30 17:11:17 +01:00
Marcial Rosales 896e07d4e6 Add audience request parameter to /authorize
Oauth0 requires this parameter in order to
return a proper JWT token and not an opaque JWT
token.
2022-08-30 17:11:16 +01:00
Marcial Rosales 15637ba944 Fix two issues
One in the management ui when the user has
not enough priviledges
And a second one with the api/auth endpoint
which was using a worng json attribute
2022-08-30 17:11:16 +01:00
Marcial Rosales c73f95d3ac Handle not authorized oauth user
When the oauth user has a token without enough
credentials to access the management ui, the
rest request `/api/whoami` returns a 401 with
www-authentication response header which instructs
the browser to show a popup dialog box for basic
auth. With this change, we had to remove the response
header so that we could use the same mechanism we
use to show other oauth errors, i.e. use the login-status
panel instead.
2022-08-30 17:11:16 +01:00
Marcial Rosales 6426d116c0 Handle rabbitmq session timeout 2022-08-30 17:11:16 +01:00
Marcial Rosales 448d8ecb34 Handle scopes
It is important that RabbitMQ specifies which
scopes it has to request. We control that via the
management.oauth_scopes field. If we have enable_uaa = true,
the scopes are automatically configured for us as follows:
"openid profile " + authSettings.oauth_resource_id + ".*"

Else we have to configure oauth_scopes field.
2022-08-30 17:11:16 +01:00
Marcial Rosales 10ccf33d4f WIP login/logout/token-refresh against keycloak 2022-08-30 17:11:16 +01:00
Marcial Rosales 827d0cc4a0 Refresh token 2022-08-30 17:11:16 +01:00
Marcial Rosales 91ba01e7c5 Set cookies expiry from token expiry claim 2022-08-30 17:11:15 +01:00
Marcial Rosales 6218618fbf Replace singular with oidc-client-ts library
Right now only login and logout flows are supported
To be added refresh token
And test all possible failure scenarios
2022-08-30 17:11:15 +01:00
Michael Klishin 25e5182801 Release series support: announce in more places
* Log file on boot
 * Startup banner
 * HTTP API response @ GET /api/overview
2022-08-28 02:13:42 +04:00
Marcial Rosales d69781a7ef
Support rich authorization request spec 2022-08-22 16:16:11 +04:00
Rin Kuryloski 575c5f9975 Remove all of the .travis.yml files
since we no longer use them
2022-08-16 09:46:31 +02:00
Nuwan Sameera 6eb2630f55
Add delete connection by username feature
Format code

Fix whitespace, fix warning

Update API docs

Remove blank lines

Add get all connections by username

Fix method name issue

Enable GET method to get connections by username

Update API documentation

Modify list all connections of username method

Remove list_by_username method and modify get all connections of user API

Code formatting, break up lines for readability

Refactor code to use pattern matching more effectively

Typo
2022-08-05 13:34:54 -07:00
Jean-Sébastien Pédron 6e9ee4d0da
Remove test code which depended on the `quorum_queue` feature flags
These checks are now irrelevant as the feature flag is required.
2022-08-01 12:41:30 +02:00
Jean-Sébastien Pédron 776b4323bd
Remove test code which depended on the `virtual_host_metadata` feature flags
These checks are now irrelevant as the feature flag is required.
2022-08-01 11:56:53 +02:00
Michael Klishin 3fe97685d6
Merge branch 'master' into mk-swap-json-library 2022-07-30 15:35:25 +04:00
Michael Klishin cba60c04c8
rabbitmqadmin_SUITE: encode value as bytes on Python 3 2022-07-30 02:43:04 +04:00
Michael Klishin ba18abd6e2
rabbitmqadmin_SUITE: only use Python 3, Python 2 is really truly EOL 2022-07-29 21:47:59 +04:00
Jean-Sébastien Pédron 32049cd256
Remove test code which depended on the `user_limits` feature flags
These checks are now irrelevant as the feature flag is required.
2022-07-29 11:04:48 +02:00
Michael Klishin d216d4293e
Remove a few tests that are no longer relevant
Back in 2016, JSON encoding and
much of the Erlang ecosystem used
proplists, which can lead to duplicate
keys in JSON documents.

In 2022 some JSON libraries only
decode JSON to maps, and maps
have unique keys, so these tests
are not worth adjusting or reproducing
with maps.

Per discussion with the team.
2022-07-29 10:34:52 +04:00
Michael Klishin 4cacec6bfd
Merge pull request #5305 from rabbitmq/default-queue-type-per-vhost
Configure default queue type by vhost
2022-07-26 01:37:56 +04:00
Karl Nilsson 3c5614f4e2 Add default queue type to Add new virtual host form 2022-07-25 12:34:51 +01:00
Michael Klishin 9063212f1c
HTTP API: allow for setting a few extra security-related response headers
All configurable via `rabbitmq.conf`:

``` ini
management.headers.content_type_options = nosniff
management.headers.xss_protection = 1; mode=block
management.headers.frame_options = DENY
```

Closes #5320
2022-07-25 13:54:54 +04:00
Michael Klishin 6feae50b0c
Schema: support for X-Frame-Options
as `management.headers.frame_options`
2022-07-25 13:54:54 +04:00
Michael Klishin 970d8acc3a
Correct header values used in tests 2022-07-25 13:54:54 +04:00
Michael Klishin fd22f105a8
Schema: support X-Xss-Protection
as management.headers.xss_protection
2022-07-25 13:54:54 +04:00
Michael Klishin 02e1f65d97
Schema: support for X-Content-Type-Options
as `management.headers.content_type_options`
2022-07-25 13:54:53 +04:00
Philip Kuryloski 15a79466b1 Use the new xref2 macro from rules_erlang
That adopts the modern erlang.mk xref behaviour
2022-06-09 23:18:28 +02:00
Philip Kuryloski 327f075d57 Make rabbitmq-server work with rules_erlang 3
Also rework elixir dependency handling, so we no longer rely on mix to
fetch the rabbitmq_cli deps

Also:

- Specify ra version with a commit rather than a branch
- Fixup compilation options for erlang 23
- Add missing ra reference in MODULE.bazel
- Add missing flag in oci.yaml
- Reduce bazel rbe jobs to try to save memory
- Use bazel built erlang for erlang git master tests
- Use the same cache for all the workflows but windows
- Avoid using `mix local.hex --force` in elixir rules
  - Fetching seems blocked in CI, and this should reduce hex api usage in
    all builds, which is always nice
- Remove xref and dialyze tags since rules_erlang 3 includes them in
  the defaults
2022-06-08 14:04:53 +02:00
Loïc Hoguin dc70cbf281
Update Erlang.mk and switch to new xref code 2022-05-31 13:51:12 +02:00
Arnaud Cogoluègnes 827fe6f008
Add active and activity_status in stream consumer UI list
The UI handles the case where the 2 fields are not present.
This can happen in a mixed-version cluster, where a node
of a previous version returns records without the fields.
The UI uses default values (active = true, activity status = up),
which is valid as the consumers of the node are "standalone"
consumers (not part of a group).

References #3753
2022-05-09 10:52:34 +02:00
Arnaud Cogoluègnes febefbd591
Skip test in mixed-version cluster mode
Otherwise needs to enable stream feature flag.

References #4622
2022-05-04 15:58:18 +02:00
Arnaud Cogoluègnes f3dfb507b7
Add consumer count to stream queue metrics
This commit adds the "consumers" metrics to stream queues (consumer count).
It is computed by counting the element of the consumer_created ETS table
for the given stream queue and for each member of the Osiris cluster.

Fixes #4622
2022-05-04 14:43:42 +02:00
Michael Klishin 7c47d0925a
Revert "Correct a double quote introduced in #4603"
This reverts commit 6a44e0e2ef.

That wiped a lot of files unintentionally
2022-04-20 16:05:56 +04:00
Michael Klishin 6a44e0e2ef
Correct a double quote introduced in #4603 2022-04-20 16:01:29 +04:00
Luke Bakken dba25f6462
Replace files with symlinks
This prevents duplicated and out-of-date instructions.
2022-04-15 06:04:29 -07:00
Michael Klishin 37a3448672
Merge pull request #4442 from rabbitmq/quorum-queue-leader-locator
Add quorum queue-leader-locator
2022-04-15 09:31:45 +04:00
zavarkog 135260eb00 SI binary prefix fix (ki => Ki) 2022-04-12 16:21:49 +02:00
zavarkog 60f085e671 fmt_si_prefix improvement 2022-04-12 13:13:05 +02:00
Zavarkó Gábor 630a2129a7
Fix for #4523
(cherry picked from commit 8e18cb7e95)
2022-04-11 18:43:17 -07:00
David Ansari f32e80c01c Convert random and least-leaders to balanced
Deprecate queue-leader-locator values 'random' and 'least-leaders'.
Both become value 'balanced'.

From now on only queue-leader-locator values 'client-local', and
'balanced' should be set.

'balanced' will place the leader on the node with the least leaders if
there are few queues and will select a random leader if there are many
queues.
This avoid expensive least leaders calculation if there are many queues.

This change also allows us to change the implementation of 'balanced' in
the future. For example 'balanced' could place a leader on a node
depending on resource usage or available node resources.

There is no need to expose implementation details like 'random' or
'least-leaders' as configuration to users.
2022-04-11 10:39:28 +02:00
Michael Klishin 6ac4d303bc
Correct a management UI metric description
Closes #4493
2022-04-10 07:30:45 +04:00
Philip Kuryloski 2dd9bde891 Bring over PROJECT_APP_EXTRA_KEYS values from make to bazel 2022-04-07 17:39:33 +02:00
Philip Kuryloski a22234f6eb Updates for rules_erlang 2.5.0
rabbitmq_cli uses some private rules_erlang apis that have changed in
the upcoming release

Additionally:
- Avoid including both standard and test versions of amqp_client in
integration test suites
- Eliminate most of the compilation order hints (explicit first_srcs)
in the bazel build
- Fix an include statement - in bazel, an app is not available to
itself as a library at compilation time
2022-04-07 14:54:37 +02:00
Michael Klishin 758098d7ae
Merge pull request #4431 from rabbitmq/loic-disable-expensive-v1-qi-stats
CQv1: Disable expensive stats killing v1 performance
2022-04-05 23:47:27 +04:00
David Ansari 542f21506c Support quorum queue leader locator
Prior to this commit:
1. When a new quorum queue was created, the local node + random nodes
   were selected as replicas.
2. Always local node became leader.

For example, when an AMQP client connects to a single RabbitMQ node and
creates N quorum queues, all N leaders will be on that node and replicas
are not evenly distributed across the RabbitMQ cluster.
If N is small and the RabbitMQ cluster has many nodes, some nodes might
not host any quorum queue replicas at all.

After this commit:
1. When a new quorum queue is created, the local node + RabbitMQ nodes
   with least quorum queue replicas are selected.
   This will nicely distribute the quorum queue replicas across the
   RabbitMQ cluster.
2. Support (x-)queue-leader-locator argument / policy with
    * client-local (stays the default)
    * random
    * least-leaders
    The same settings are already available for streams.
2022-04-05 16:01:51 +02:00
David Ansari 1be49d7974 Remove max-in-memory-* in Management UI
Remove quorum queue arguments and quorum queue policies
(x-)max-in-memory-length and (x-)max-in-memory-bytes
from the Management UI since they are deprecated since RabbitMQ 3.10.

They have no effect anymore since message bodies will not be stored in
memory.
2022-04-05 15:44:17 +02:00
Loïc Hoguin 499e0b9197
Remove the CQv1 disabled stats from management/Prometheus 2022-04-05 12:37:54 +02:00
Florian Wolfsjäger 648812ee11
Fixed reading SSL settings from rabbitmqadmin config file
Fixed reading boolean values from rabbitmqadmin config file
2022-04-01 17:48:04 +02:00
Michael Klishin c38a3d697d
Bump (c) year 2022-03-21 01:21:56 +04:00
David Ansari c7cd530633 Add memory details of dlx workers
to see memory usage across all dlx workers at a glance.
2022-02-28 16:28:04 +01:00
David Ansari 1c17773c91 Add at-least once dead-lettering for quorum queues
and message TTL
2022-02-28 16:27:56 +01:00
Philip Kuryloski 226e00fcd2 Tighten up dialyzer usage
now that rules_erlang no longer cascades up dialyzer warnings from deps
2022-02-24 11:18:41 +01:00
Philip Kuryloski d8201726ae Ignore dialyzer warnings for most apps 2022-02-21 09:19:56 +01:00
Marco Cameriero fb81ae057a Add option to choose payload encoding when manually publishing a message from the Management UI.
The HTTP management API already supports publishing binary messages by
encoding them in base64, but this feature is not exposed to the frontend.
This change adds a new field to the message publishing form that allows
the user to send base64-encoded messages right from the Management UI.
2022-02-14 17:20:27 +01:00
Michael Klishin ea284ce47e
Manually apply ideas from #4141 (contributed by @ktdreyer) 2022-02-12 10:30:57 +03:00
Philip Kuryloski c94a46994a Allow clearing of user tags while also setting a user password 2022-02-09 15:41:08 +01:00
Loïc Hoguin 50e6635761
Merge pull request #3029 from rabbitmq/modern-classic-queue-index
Introduce classic queues version 2 (CQv2)
2022-01-28 09:41:09 +01:00
David Ansari edfc4b056f Use different colour for each queue type 2022-01-25 20:21:17 +01:00
David Ansari 120732d1cf Change 'Queues' to 'Queues and Streams' in memory details 2022-01-25 19:29:07 +01:00
David Ansari 36f8ba4710 Fix color for queues in memory details
Before this commit, the colour for queues was white in the memory bar
although the captions shows color #bd4688 for queues.
2022-01-25 19:05:06 +01:00
Loïc Hoguin f5b0f0d601
Add queue version to management queue/policy forms 2022-01-25 11:23:15 +01:00
Philip Kuryloski efcd881658 Use rules_erlang v2
bazel-erlang has been renamed rules_erlang. v2 is a substantial
refactor that brings Windows support. While this alone isn't enough to
run all rabbitmq-server suites on windows, one can at least now start
the broker (bazel run broker) and run the tests that do not start a
background broker process
2022-01-18 13:43:46 +01:00
Luke Bakken 7f0285834e
Fix all uses of file:read_file/1
This is to address another memory leak on win32 reported here:

https://groups.google.com/g/rabbitmq-users/c/UE-wxXerJl8

"RabbitMQ constant memory increase (binary_alloc) in idle state"

The root cause is the Prometheus plugin making repeated calls to `rabbit_misc:otp_version/0` which then calls `file:read_file/1` and leaks memory on win32.

See https://github.com/erlang/otp/issues/5527 for the report to the Erlang team.

Turn `badmatch` into actual error
2022-01-03 11:33:36 -08:00
Johan Rhodin 998d2aeea3
Match help box to correct item
before it was right after Auto expire
2021-12-01 14:01:19 -06:00
Philip Kuryloski 9c70b3220a Generate the rabbitmqadmin cli under bazel 2021-11-12 11:34:19 +01:00
Michael Klishin 8e180c581a
Use a for loop here because IE 11 does not support lambdas
Closes #3688
2021-11-11 00:31:32 +03:00
Alexey Lebedeff a3b02bd01c Fix persistent message count display in mgmt UI
Fixes #3396

As can be seen in
9cf18e83f2/deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs (L171)
there should be 3 colums for a classic queue.

While it's possible to share the same field with the quorum queues
case, I did it this way so that conditions for the labels and for the
values will have the same shape.
2021-10-20 13:00:26 +02:00
Luis Cusihuaman 5f81fff959 fix: list exchanges only by current vhost in topic-permissions 2021-10-06 19:06:00 -03:00
GitHubPang 0f2a6123df
Fix typo in UI help hint 2021-10-04 08:01:43 +08:00
Alexey Lebedeff 46df4f1689 Update makefiles/bazel to reflect CT helpers repo merge-in 2021-09-30 10:48:11 +02:00
Gabriele Santomaggio 23d0e4d458 Add counters on detail pages
closes https://github.com/rabbitmq/rabbitmq-server/issues/3416
2021-09-14 17:26:05 +02:00
Gabriele Santomaggio 756282b056 Add counters on detail pages
closes https://github.com/rabbitmq/rabbitmq-server/issues/3416
2021-09-14 17:25:34 +02:00
Gabriele Santomaggio 346adc86af Add counters on detail pages
closes https://github.com/rabbitmq/rabbitmq-server/issues/3416
2021-09-14 17:18:49 +02:00
Arnaud Cogoluègnes b5700751cf
Add HTTP endpoint for stream publishers
References #3389
2021-09-10 15:14:09 +02:00
Arnaud Cogoluègnes 0038573f89
Display stream publishers in queue management page
If the queue is a stream. WIP, currently all the stream publishers
are listed, a new publishers per stream endpoint is required.

References #3389
2021-09-09 17:41:38 +02:00
Michael Klishin 11760f95bd
Don't run #3319 assertions in mixed version clusters 2021-08-19 23:03:09 +03:00
Michael Klishin f5fe419892
Make PUT /api/vhosts/{name} update tags and/or description 2021-08-18 19:07:25 +03:00
Philip Kuryloski 2a6a9c786b Bazel test timeouts 2021-07-27 10:57:50 +02:00
Iliia Khaprov 53d67fda1f
Merge pull request #3205 from rabbitmq/send-www-authenticate-when-basic-auth-present
Send www-authenticate header when basic auth present but it's wrong
2021-07-21 11:19:22 +02:00
Philip Kuryloski 5bc25fb2ff Fix accidental test case skip when not using mixed versions 2021-07-21 08:35:00 +02:00
Ilya Khaprov 39693cfb07
Send www-authenticate header when basic auth present but it's wrong
close #3181
2021-07-20 21:44:36 +02:00
Ilya Khaprov c5665d6da9
Validate AMQP0.9.1 queue name length when creating queue directly or via shovel in Management UI. close #3074 2021-07-19 14:57:50 +02:00
Philip Kuryloski d6399bbb5b
Mixed version testing in bazel (#3200)
Unlike with gnu make, mixed version testing with bazel uses a package-generic-unix for the secondary umbrella rather than the source. This brings the benefit of being able to mixed version test releases built with older erlang versions (even though all nodes will run under the single version given to bazel)

This introduces new test labels, adding a `-mixed` suffix for every existing test. They can be skipped if necessary with `--test_tag_filters` (see the github actions workflow for an example)

As part of the change, it is now possible to run an old release of rabbit with rabbitmq_run rule, such as:

`bazel run @rabbitmq-server-generic-unix-3.8.17//:rabbitmq-run run-broker`
2021-07-19 14:33:25 +02:00
Philip Kuryloski 8f9de08de7 Also assert no missing suites for all other deps 2021-07-12 18:05:55 +02:00
Philip Kuryloski 8421100008 Use bazel-erlang semi-automatic suite sharding 2021-07-09 10:05:16 +02:00
Philip Kuryloski 2fc112e29c Correct some test cleanup in rabbit_mgmt_http_SUITE 2021-07-07 18:05:55 +02:00
Philip Kuryloski 4a830a4709 Fixup deps/rabbitmq_management/BUILD.bazel
"True" -> True
2021-06-24 10:53:19 +02:00
Philip Kuryloski c234a5f37d Additional flaky test adjustments in bazel 2021-06-24 10:46:29 +02:00
Philip Kuryloski 8c7e7e0656 Revert "Default all `rabbitmq_integration_suite` to flaky in bazel"
This reverts commit 70cb8147b2.
2021-06-23 20:53:14 +02:00
Philip Kuryloski 70cb8147b2 Default all `rabbitmq_integration_suite` to flaky in bazel
Most tests that can start rabbitmq nodes have some chance of
flaking. Rather than chase individual flakes for now, this commit
changes the default (though it can still be overriden, as is the case
for config_scheme_SUITE in many places, since I have yet to see that
particular suite flake).
2021-06-21 16:10:38 +02:00
Michael Klishin 2826225cde
Drive-by change: speed up two tests in rabbit_mgmt_rabbitmqadmin_SUITE
This makes sure rabbitmqadmin suite doesn't spend minutes resolving
a non-existent hostname in environments with certain DNS client
settings.
2021-06-13 12:32:03 +08:00
Michael Klishin 300196ea4e
Second attempt at upgrading JSX to 3.1 2021-06-12 08:03:18 +08:00
Philip Kuryloski 30f9a95b9f Add dialyze for remaning tier-1 plugins 2021-06-01 10:19:10 +02:00
Karl Nilsson 4112cc6f77 Clarify x-max-age options in management ui 2021-05-24 14:31:32 +01:00
Philip Kuryloski 98e71c45d8 Perform xref checks on many tier-1 plugins 2021-05-21 12:03:22 +02:00
Arnaud Cogoluègnes c30e013d7a
Rename max-segment-size to stream-max-segment-size-bytes 2021-05-20 10:16:19 +02:00
Michael Klishin 040f8cc912
Replace a few more leftover MPLv1.1 license headers
Most files have been using the MPLv2 headers for months now.
These were detected by the OSL process.
2021-05-19 21:20:47 +03:00