Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep getting "Connection refused: Not Authorized" error #9

Open
ccuono opened this issue May 7, 2018 · 3 comments
Open

Keep getting "Connection refused: Not Authorized" error #9

ccuono opened this issue May 7, 2018 · 3 comments

Comments

@ccuono
Copy link

ccuono commented May 7, 2018

Hello,

My MQTT server uses username/password authentication; I set the username and password values in the config yaml and still keep getting this error. Here is some print out from journalctl:

May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]: info: Loading configuration
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]: info: Connecting to MQTT at mqtt://192.168.45.120
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]: events.js:137
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:       throw er; // Unhandled 'error' event
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:       ^
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]: Error: Connection refused: Not authorized
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at MqttClient._handleConnack (/usr/lib/node_modules/mqtt-dasher/node_modules/mqtt/lib/client.js:735:9)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at MqttClient._handlePacket (/usr/lib/node_modules/mqtt-dasher/node_modules/mqtt/lib/client.js:296:12)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at process (/usr/lib/node_modules/mqtt-dasher/node_modules/mqtt/lib/client.js:238:12)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at Writable.writable._write (/usr/lib/node_modules/mqtt-dasher/node_modules/mqtt/lib/client.js:248:5)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at doWrite (/usr/lib/node_modules/mqtt-dasher/node_modules/readable-stream/lib/_stream_writable.js:237:10)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at writeOrBuffer (/usr/lib/node_modules/mqtt-dasher/node_modules/readable-stream/lib/_stream_writable.js:227:5)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at Writable.write (/usr/lib/node_modules/mqtt-dasher/node_modules/readable-stream/lib/_stream_writable.js:194:11)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at Socket.ondata (_stream_readable.js:646:20)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at Socket.emit (events.js:160:13)
May 06 20:06:21 arch.asgard.local mqtt-dasher[29930]:     at addChunk (_stream_readable.js:269:12)

Beginning of config.yml looks like:

mqtt:
    # Specify your MQTT Broker's hostname or IP address here
    host: 192.168.45.120
    port: 1883
    #leave empty if none
    username: mosquitto_user
    password: fakePAsS}},,,222
    # Preface for the topics $PREFACE/$TOPIC
    preface: dash

And here is some version details about what I'm running for my mqtt server:

mosquitto version 1.4.14 (build date 2017-10-21 18:07:04+0200)

mosquitto is an MQTT v3.1.1/v3.1 broker.
@ccuono
Copy link
Author

ccuono commented May 7, 2018

I was able to produce some log output from my mqtt server, here are some more details:

1525661121: New connection from 192.168.82.120 on port 1883.
1525661121: Socket error on client <unknown>, disconnecting.
1525661122: New connection from 192.168.82.223 on port 1883.
1525661122: New client connected from 192.168.82.223 as DVES_808E3F (c1, k15, u'mosquitto_user').
1525661129: New connection from 192.168.82.224 on port 1883.
1525661129: New client connected from 192.168.82.224 as DVES_3BBC21 (c1, k15, u'mosquitto_user').
1525661131: New connection from 192.168.82.222 on port 1883.
1525661131: New client connected from 192.168.82.222 as DVES_808ADA (c1, k15, u'mosquitto_user').
1525661131: New connection from 192.168.82.221 on port 1883.
1525661131: New client connected from 192.168.82.221 as DVES_3C1F00 (c1, k15, u'mosquitto_user').

The first item in the output is when I attempt to spin up the daemon - I get the same error but it looks like the mqtt server is kicking it out because of some socket error?

@stjohnjohnson
Copy link
Owner

Hmm, strange. Under the hood I just use this library: https://www.npmjs.com/package/mqtt#client

I would add some debugging, make sure your complex password is being read correctly. Also, it might be a port/protocol problem. By default I think it uses mqtt protocol.

@imranaalam
Copy link

@stjohnjohnson thanks. the port hint helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants