RabbitMQ队列发布访问被拒绝

时间:2019-01-07 07:37:19

标签: javascript rabbitmq rabbitmq-stomp

设置用户只授予发布到特定队列的权限 Q1

权限

配置:“”

写: ^(Q1)|(amqp.default)$

阅读:“”

使用的协议: STOMP

RMQ版本: 3.6.X

使用上述权限发布到 Q1 时,访问被拒绝。

如果“ Configure”设置为 ^(Q1)$ ,它将正常工作。但是,设置配置权限也将允许用户在 Q1 上进行queue.delete和queue.declare操作。

案例:从后端/ RMQ管理中创建一个队列,以便踏足客户端可以通过直接amqp.default交换和路由键作为队列名称发布到该队列。这样该客户端仅具有对队列的写入权限,而没有配置或读取权限

如果仅要求用户发布到队列而不需要读取或配置队列,那么最好的解决方案是什么?

2 个答案:

答案 0 :(得分:1)

First, remember that you publish to exchanges in RabbitMQ, not queues. Then, read this table to determine how configure, write and read permission applies to the operations you'd like to do.

Finally, since the STOMP plugin is used, the user must have configure permission to be able to create the reply queue. This is due to how STOMP is implemented in RabbitMQ (code).


NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

答案 1 :(得分:0)

STOMP 协议需要配置权限,因此必须提出另一种方法。(RabbitMQ code

创建了交易所 E1 ,并授予了具有写入权限的用户

将队列 Q1 绑定到 E1 ,因此每个发布到 E1 的消息都被路由到 Q1

在这种方法中,只有STOMP客户端需要写权限才能发布以交换 E1 ,而无需读取或配置权限

相关问题