How to set a topic permission for a user on a remote server using the rabbitmq CLI Tools

681 views Asked by At

is there a way to create a topic permission for a user with the cli tool rabbitmqadmin on a remote system?

Using the Bitnami Helm Chart https://github.com/bitnami/charts/tree/master/bitnami/rabbitmq

Will use it for scripting so the Web UI is not an option Found there is Method for the other CLI Tool rabbitmqctl can not connect via rabbitmqctl to my cluster even I have a kubernetes Service + Portforwarding for port 4369

I already created a User + host permissions via rabbitmqadmin So the rabbitmqadmin cli tool itself is working in general

rabbitmqadmin --help 

gives me the following methods

Object Manipulation
===================

  declare exchange name=... type=... [auto_delete=... durable=... internal=... arguments=...]
  declare queue name=... [auto_delete=... durable=... arguments=... node=... queue_type=...]
  declare binding source=... destination=... [destination_type=... routing_key=... arguments=...]
  declare vhost name=... [tracing=...]
  declare user name=... password=... OR password_hash=... tags=... [hashing_algorithm=...]
  declare permission vhost=... user=... configure=... write=... read=...
  declare parameter component=... name=... value=...
  declare policy name=... pattern=... definition=... [priority=... apply-to=...]
  declare operator_policy name=... pattern=... definition=... [priority=... apply-to=...]
  declare vhost_limit vhost=... name=... value=...
1

There are 1 answers

1
Harsh Manvar On BEST ANSWER

You have to use the command rabbitmqctl

rabbitmqctl set_topic_permissions -p my-vhost janeway amq.topic "^janeway-.*" "^janeway-.*"

Reference document : https://www.rabbitmq.com/rabbitmqctl.8.html#set_topic_permissions

if you can't connect using rabbitmqctl, you can try exec inside the POD of RabbitMQ manually.

kubectl exec -it <Rabbitmq-1 or POD name> -- /bin/bash inside it you can access the rabbitmqctl