Mosquitto authentication

Viewed 12

Hi all,
I'm new to chirpstack.
I have installed Chirpstack trhrough the docker-compose.yml file given as template.
Everything works correctly.
Now I am trying to configure Mosquitto authentication.
I followed the guide here and created a password file.
Then I disabled anonymous mqtt usage.
And then I edited the configuration/chirpstack/chirpstack.toml file and changes the mqtt section like this:

[integration]
  enabled=["mqtt"]

  [integration.mqtt]
    server="tcp://$MQTT_BROKER_HOST:1883/"
    json=true

    # Connect with the given username (optional)
    username="my_user"

    # Connect with the given password (optional)
    password="my_password"

    # Quality of service level
    #
    # 0: at most once
    # 1: at least once
    # 2: exactly once
    #
    # Note: an increase of this value will decrease the performance.
    # For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
    qos=2

However, when I restart the docker compose I get plenty of authentication errors like these:

chirpstack-gateway-bridge-basicstation-1  | time="2026-03-19T12:48:10.828133609Z" level=error msg="integration/mqtt: connection error" error="not Authorized"
chirpstack-gateway-bridge-1               | time="2026-03-19T12:48:10.911842045Z" level=warning msg="[client]   status is already disconnected" module=mqtt
mosquitto-1                               | 1773924490: New connection from 172.30.0.6:39914 on port 1883.
mosquitto-1                               | 1773924490: Client auto-6328DF75-213E-90B9-A125-9476131A8BDA [172.30.0.6:39914] disconnected: not authorised.

I have tried two times to recreate the password file for mosquitto, as I thought I maybe had botched the password during creation, but I always get the same errors.

Any suggestions?

Thank you in advance
Cris

1 Answers

chirpstack-gateway-bridge-basicstation-1 | time="2026-03-19T12:48:10.828133609Z" level=error msg="integration/mqtt: connection error" error="not Authorized"

Please note the service in the logs, it is not ChirpStack failing, it is the Gateway Bridge. You probably did not configure this service yet with the username / password.

Thank you very much @brocaar !
However, that was just a little excerpt of the output: unfortunately ChirpStack is failing, too.
You were right though, that I did not configure correctly the Gateway Bridge.
So I have added the credentials to the configuration/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml file, too.
Unfortunately, nothing changed :'-(

Have you restarted the Mosquitto service? If that is the case: try to narrow down the issue: use e.g. mosquitto_sub to make sure the issue is with the Mosquitto.