Mosquitto MQTT user/password config ACLS

Hi @brocaar . Can you help me?

I’m following this guide to setup my ACLS and User/Password, but Im having a problem.

When I setup everything and restart Mosquitto, my device and gateway stop working on the Application Server! I checked the logs and this is what it shows:

chirpstack-gateway-bridge[1144]: time=“2021-07-14T17:41:33.888232031-03:00” level=error msg="[client] Connecting to tcp:// CONNACK was not CONN_ACCEPTED, but rather Connection Refused: Not Authorised" module=mqtt

chirpstack-gateway-bridge[1144]: time=“2021-07-14T17:41:33.888306389-03:00” level=error msg="[client] Failed to connect to a broker" module=mqtt

chirpstack-gateway-bridge[1144]: time=“2021-07-14T17:41:33.888359459-03:00” level=error msg=“integration/mqtt: connection error” error="not Authorized"

but when I delete everything I made on the guide above, they start to work again. What am i doing wrong?

my ACLS file is:

user chirpstack_gw
topic write gateway/+/event/+
topic read gateway/+/command/+

user chirpstack_ns
topic read gateway/+/event/+
topic write gateway/+/command/+

user chirpstack_as
topic write application/+/device/+/event/+
topic read application/+/device/+/command/+

file in conf.d:

allow_anonymous false
password_file /etc/mosquitto/passwd
acl_file /etc/mosquitto/acls

obs: I’m setting up the users and passwords on the toml files as well

Hello I think there is a problem with your passwd configuration file or broker configuration, did you try a mosquitto_sub / mosquitto_pub with your users ?

hello @Stimaleger ! tks for replying.

Actually, I forgot to configure my chirpstack-gateway-bridge.toml file with user/password, but now I’m having another problem hahaha

When I run “tail -f /var/log/syslog”, I have this logs:

Jul 16 17:00:07 inovfablab chirpstack-gateway-bridge[1144]: time=“2021-07-16T17:00:07.830741227-03:00” level=info msg=“integration/mqtt: subscribing to topic” qos=0 topic=“gateway/b827ebfffe2debef/command/#”

Jul 16 17:00:07 inovfablab chirpstack-gateway-bridge[1144]: time=“2021-07-16T17:00:07.830847147-03:00” level=error msg=“integration/mqtt: subscribe gateway error” error=“subscribe topic error: not currently connected and ResumeSubs not set” gateway_id=b827ebfffe2debef

I know that this line: “gateway/b827ebfffe2debef/command/#” is about the gateway-bridge toml, but what is causing this issue I really dont know.

Any thoughts?

hi @brocaar , good evening. Could you help me with this one, please? Im really stuck in this error and I dont know anymore what can I try to fix it :slight_smile: