Search code examples
mqttmosquitto

Why can't I receive messages from mosquitto broker for a particular user in the ACL file?


I'm having trouble figuring out why I can subscribe to all topics with one user but not the other. I set them up at different points in time, maybe I forgot a step from the original user.

Mosquitto broker v1.5.5

acl_file contains

user foo
topic readwrite #

user bar
topic readwrite #

When I connect with user foo and subscribe to '#', I get all messages from my publish test.

When I connect with user bar and subscribe to '#', I get no messages from my publish test.

When I try to connect with a bad username/password for user bar I get an expected error. Mosquitto's log clearly shows bar connecting successfully.

When user foo is connected and a message is published, the mosquitto log shows Received PUBLISH then Sending PUBACK then Sending PUBLISH

When user bar is connected and a message is published, the mosquitto log shows Received PUBLISH then Sending PUBACK and does not show Sending PUBLISH

When I reverse the entries in my acl file to,

user bar
topic readwrite #

user foo
topic readwrite #

neither user gets the Sending PUBLISH message. I'm hoping someone else can spot the source of the problem, thank you.


Solution

  • While searching the mosquitto changelog I got the idea that some whitespace might be to blame. I checked my acl file again and found a space that was the source of the problem:

    For the offending user I had a space after the # wildcard in, topic readwrite #

    Now user foo is receiving messages