-
Describe the bugIn the current version of RabbitMQ (3.13) with AMQP1.0 enabled (using rabbitmq_amqp1_0 plugin), it is not possible to correctly evaluate permissions to specific queues. I need to use rabbitmq_auth_backend_http plugin to handle authorization to queues for users based on some business configuration that is stored in my datastore, but the RabbitMQ server is not providing enough information about the client request. here is my rabbitmq_auth_backend_http plugin configuration:
As a client application, I have a Java Server that publishes messages to RabbitMQ using standard JmsQueues from Apache Qpid JMS (see https://qpid.apache.org/components/jms/index.html). I also tried the swiftmq and Apache Qpid ProtonJ clients, but the result was the same. Here is the object RabbitMQ passes to the auth/resource method on the configured authorization server:
All write operations to any queue are handled via the amqp.default exchange without any additional information about the target queue. I think the RabbitMQ server should either provide information with something like Reproduction steps
Expected behaviorRabbitMQ server with AMQP1.0 enabled should provide queue name information to the authentication/resource request. This can be something like Additional contextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
@Amerrak please put together an executable way to reproduce. We do not guess in this community and your claim does not include any specific examples. In fact, you start with a claim that you'd like to not use the HTTP authN/authZ backend but then the only example there is does use it. |
Beta Was this translation helpful? Give feedback.
-
To be more specific, what we need to try to reproduce this behavior and debug the root cause is:
Docker Compose is a very commonly used tool for such executable examples. Once we have it, we will have a look because improving AMQP 1.0 support is one of the priorities for RabbitMQ. Without it we cannot investigate much. Our team is small, we don't have all the information needed to re-create this behavior, and guessing is an extremely expensive way of troubleshooting distributed systems and infrastructure in general. |
Beta Was this translation helpful? Give feedback.
-
I have prepared an executable example that is available here. How-to is described in the README file and should contain all the information you need to reproduce my issue. /auth/user interface always returns "allow", but there is a logger for all information that is passed to this function by RabbitMQ server. For queue authorization, these parameters include the following:
As you can see, there is only information that the client is accessing the amq.default exchange, but there is no information about which queue the client wants to write to. These parameters are the same for all users and in AMQP1.0 all requests are sent through the amq.default exchange, so it is not possible to recognize which queue the user wants to write to. In AMQP0.9 this was not a problem as there could be a specific exchange for each queue. Write operations are then performed through this exchange and routed to queues so authorization is processed based on a specific exchange name. AMQP1.0 does not use exchanges in the same way as AMQP0.9 and all operations are handled by the amq.default exchange, so authorization cannot be done as before and requires routingKey information to determine the QueueName. |
Beta Was this translation helpful? Give feedback.
-
@Amerrak thanks for your example.
This is due to the fact that the message routing key is only provided when doing checks for access to a topic exchange. Since the Pinging @ansd and @kjnilsson since they may have additional input about how authorization may change with regard to #9022 and #10559 |
Beta Was this translation helpful? Give feedback.
-
@lukebakken The RabbitMQ authorisation model doesn't change with Native AMQP 1.0 in RabbitMQ 4.0. As documented in https://www.rabbitmq.com/docs/access-control#authorisation a client that publishes a message needs merely @Amerrak if you, as a RabbitMQ operator, grant write permissions to the This authorisation model works exactly the same way for both AMQP 0.9.1 and AMQP 1.0. So, if you need more fine grained authorisations, do not grant publishers access to the
This statement is wrong. AMQP 1.0 re-uses the AMQ 0.9.1 model including exchanges, queues, and bindings. Again, the RabbitMQ permission model doesn't change either.
Instead, your AMQP 1.0 clients could use one of the following target address schemes:
Therefore, for AMQP 1.0 you can achieve the same authorisation model that you outlined for AMQP 0.9.1. Note that AMQP 1.0 clients creating dynamic routing topologies including exchanges, queues, and bindings gets implemented in #10559 |
Beta Was this translation helpful? Give feedback.
@lukebakken The RabbitMQ authorisation model doesn't change with Native AMQP 1.0 in RabbitMQ 4.0.
As documented in https://www.rabbitmq.com/docs/access-control#authorisation a client that publishes a message needs merely
write
access to the exchange it is publishing to.@Amerrak if you, as a RabbitMQ operator, grant write permissions to the
amq.default
exchange to the RabbitMQ users which your publishers authenticate with, it means that your publishers can indeed write into any queue because every queue implicitly binds to the default exchange with its queue name being the binding key.This authorisation model works exactly the same way for both AMQP 0.9.1 and AMQP 1.0.
So, if you need mo…