authenticationrabbitmqconnection-refused

RabbitMQ access refused


I try establish a Connection with pika.BlockingConnection to a rabbitMQ broker. However I get the following error:

ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

The rabbitMQ log says:

2024-01-08 14:41:26.352697+00:00 [error] <0.854.0> PLAIN login refused: user 'sw_test' can only connect via localhost
2024-01-08 14:41:26.353310+00:00 [info] <0.854.0> closing AMQP connection <0.854.0>

All comparable issues I found for this error, were about the user "guest". However, I'm not connecting with "guest", but with "sw_test" and a password "9999-****-**". Has anybody experienced the same? Thanks for help in advance.

What I did:

credentials = pika.PlainCredentials('sw_test','9999-****-**')
connection_params = pika.ConnectionParameters(host='host-name', port=5672, virtual_host='/', credentials= credentials)

connection= pika.BlockingConnection(connection_params)

What I expect: sucessful connection, instead of access_refused error.


Solution

  • I found the problem. I had the enableLoopbackUser property enabled in the helm chart.

    correct settings would be:

    auth:
      username: sw_test
      password: "some_pw"
      enableLoopbackUser: false