could not setup mqtt backend: Identifier rejected
is there a way to set the Client ID ? We're connecting it to VerneMQ and getting the "Identifier rejected" response to a join for both loraserver and lora-gateway-bridge when we have password authentication on the broker
I'm not sure if our sever is not configured properly or the client connect is different from what it expects and mosquitto is ok with it
When we enable anonymous mode on our broker we can connect succesfully ( but this seems to negate the username password security ) We get this debug message from the broker when lora_gateway_bridge connects :
- [warning] <0.322.0>@vmq_mqtt_fsm:check_user:517 can't authenticate client {[],<<"anon-26oFeDnEZJWAhf3mewMbcTdnzG8=">>}
Thanks for reporting this issue. I'll look into it later today or tomorrow!
The clients are connecting with an empty client id since you might want to run multiple instances of LoRa Server, so I think it is easier leaving it blank and let the broker generate a random id. I've checked and CleanSession is true by default, so that is not the reason of the rejection (in reaction to your original issue).
I haven't had the time yet to setup VerneMQ, but I can't reproduce your issue with Mosquitto. Would you mind sharing your VerneMQ config (+ the version of VerneMQ you're using) so I'm able to reproduce your setup?
Additionally, could you verify with for example MQTTLens that you're able to connect with your credentials (test with both an empty client id and setting a client id) and subscribe to for example application/+/node/+/tx?
will do, I'll post those up later today
All tests were performed with username and password login.
While setting the brokers "allow_anonymous" = true and "allow_multiple_session" false :
anon and !multiple_session : connect and subscribe with ID success anon and !multiple_session : connect and subscribe without ID success anon and !multiple_session : connect with duplicate ID failure ( switches between clients -disconnects one to allow the other)
When I set "allow_anonymous" = false we can only connect when sending a client ID, !anon, !multiple_session : with ID success !anon, !multiple_session : without ID fail
Setting "allow_multiple_sessions" = true doesn't seem to do anything as the server still does not allow multiple clients with the same clientID to connect simultaneously
We've decided to install a separate instance of VerneMQ for use by ONLY the loraserver and lora-gateway-bridge ( so we can use it with anonomous logins enabled ) and then have a seperate broker with more strict security for the applications to access.
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html
I think that is the source of the issue you're experiencing. Following the specs a broker doesn't have to support an empty ClientId, so probably it is better when I generate a random ClientId at the client (LoRa Server / LoRa Gateway Bridge) instead of relying on the broker.
Dear Orne, hwo are you?
I am facing the same issue and it seems to be arround line 115 on loraserver/vendor/github.com/eclipse/paho.mqtt.golang/packets/connect.go where the CleanSession flag is incorrectly checked, IMHO.
Current: if len(c.ClientIdentifier) == 0 && c.CleanSession { //Bad client identifier return ErrRefusedIDRejected }
Should be: if len(c.ClientIdentifier) == 0 && !c.CleanSession { //Bad client identifier return ErrRefusedIDRejected }
Regards, Ariel