5

Is there a simple method to verify a RabbitMQ user password from command line? By simple I mean:

  • without rabbitmq_management plugin enabled

  • without extra dependencies, like ruby/python/etc. libraries not usually present on a Linux machine by default.

badbishop
  • 928
  • 4
  • 12
  • 21
  • I've asked the RabbitMQ team to introduce such a feature at https://github.com/rabbitmq/rabbitmq-server/issues/1576 . – Richlv Apr 10 '18 at 07:18
  • Actually, it looks like normal user credentials cannot even be tested with rabbitmqadmin - it fails with "Not management user". – Richlv Apr 10 '18 at 07:24

3 Answers3

7

sudo rabbitmqctl authenticate_user <username> <password>

If the password is appropriate it shows:

Authenticating user "username"
Success

If the password is wrong it shows the below:

Authenticating user "username"
Error: failed to authenticate user "username"
Sandy
  • 181
  • 1
  • 1
3
  • There is rabbitmqctl authenticate_user
  • rabbitmqadmin can be used if the user has the management tag (which can be added temporarily)
  • Alternative authN backends have more options: LDAP tooling for the LDAP backend, curl for the HTTP backend and so on.
  • Ahh, dang - I was checking this on RabbitMQ on an RHEL box, which still has 3.3. Looks like `authenticate_user` was added in 3.6.5 - https://rabbitmq.docs.pivotal.io/36/relnotes/release-notes-rabbitmq3.6.5.html . – Richlv Apr 10 '18 at 11:47
0

You can attempt to login with the username/password using rabbitmqadmin, although this is not included by default when installing RabbitMQ.

IMHO the simplest thing to do is write a Python script that connects to RabbitMQ, but this requires either a) the Kombu library or equivalent, or b) writing your own minimalistic AMQP client.

Mike Ryan
  • 288
  • 2
  • 11
  • Thanks, but my question was is there a way to avoid both of your suggestions. – badbishop Dec 08 '15 at 15:54
  • Sure, I thought that was the case. rabbitmqadmin is not the same as rabbitmq_management plugin, so I thought it worth mentioning. AKAICT your only options are to download a program that can authenticate against AMQP, or write your own implementation of AMQP's authentication protocol: http://www.rabbitmq.com/blog/2011/02/07/who-are-you-authentication-and-authorisation-in-rabbitmq-231/ – Mike Ryan Dec 09 '15 at 07:40