Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ user permission format

Tags:

rabbitmq

amqp

I am trying to configure user permissions in RabbitMQ using rabbitmqctl. The RabbitMQ documentation http://www.rabbitmq.com/man/rabbitmqctl.1.man.html gives a basic example of setting configure, write, and read permissions:

rabbitmqctl set_permissions -p /myvhost tonyg "^tonyg-.*" ".*" ".*"

but does not give any more detailed examples. I have looked at several posts on this topic but have not found answers to my specific questions.

First question: Is it necessary to grant permissions to both exchanges and queues to which a user can write, or just the exchanges? Similarly for reading, is it enough to specify the queues? The documentation just talks about granting access to "resources".

Second question: The example above uses a caret to mark the beginning of the resource name. If I omit this, and just use "tonyg-.*", would that allow the specified text to appear anywhere in the resource name? Similarly, if I wanted to specify the entire resource name, must I bracket it with ^ and $, as in "^myqueue$"?

Third question: Say I want to specify more than one pattern for a given permission. Can I just separate the patterns with commas, something like

rabbitmqctl set_permissions -p /myvhost tonyg "^tonyg-.*,^test-.*" ".*" ".*"

Is this the correct syntax for this? If not, what is?

Fourth question: What is the required syntax for vhost names? The other examples on the cited man page do not use a leading slash, as in

rabbitmqctl add_vhost test

Are the vhost names in some way structured, or is the slash just another character in the name?

Thanks for any suggestions!

like image 861
John Simmons Avatar asked Apr 29 '13 22:04

John Simmons


1 Answers

I hit the same issue but after some simple experiments I came up with the following:

I added a vhost called "/ASX" first, then added the "guest" user to it successfully using the following format:

rabbitmqctl set_permissions -p /ASX guest ".*" ".*" "."
Setting permissions for user "guest" in vhost "/ASX" ...
...done.

I also had to perform a restart of rabbitmq-server for the change to take effect.

like image 160
z900collector Avatar answered Sep 24 '22 21:09

z900collector