Hello
The problem is when user try to connect to the broker its work normally but when he try to subscribe to unauthorized topic the package disconnecting the user socket from broker, its happened only with subscribe, publish works fine.

Backend log

mqtt client app
`
var mqtt = require('mqtt');
var mqttClient = mqtt.connect('mqtt://localhost:1883', {
username: "device_1",
password: "secret",
});
mqttClient.on('connect', function () {
mqttClient.subscribe("topic2");
console.log("App connected to MQTT Broker!");
});
`
p.s: same result in auth-plug and go-auth packages.
Thanks.
Could you provide some more details on the configuration you're using please?
@ralight Thanks for your response.
Its default configuration nothing changed in mosquitto.conf file I have just added auth data
auth_plugin /home/ubuntu/mosquitto/go-auth.so
auth_opt_backends http
auth_opt_http_host 127.0.0.1
auth_opt_http_port 3000
auth_opt_http_getuser_uri /auth/mqtt/check
auth_opt_http_superuser_uri /auth/mqtt/superuser
auth_opt_http_aclcheck_uri /auth/mqtt/acl
auth package owner said its from mosquitto.
auth packager said it's from mosquitto what? There's no go-auth.so package provided here at least. Are you sure the plugin is not crashing on something unexpected and that's causing it to drop things?
@karlp
I tried these two packages:
https://github.com/jpmens/mosquitto-auth-plug
https://github.com/iegomez/mosquitto-go-auth
mosquitto-go-auth issue:
https://github.com/iegomez/mosquitto-go-auth/issues/10#issuecomment-435880410
same result client disconnect when he try to subscribe to unauthorized topic.
if the topic is authorized it's works fine.
Testing with my own golang plugin: returning false from mosquitto_auth_acl_check when access flag is MOSQ_ACL_SUBSCRIBE will indeed result in "Socket error on client", but not when it's MOSQ_ACL_READ.
Running a minimal plugin in c display the same behavior.
https://github.com/Daedaluz/mosquitto_plugin_template_c
mosquitto_sub continues to reconnect when using the plugin.
Just tried with tag v1.5.3
Thanks for the description @ibrahimkoujar and for confirming @Daedaluz. This should now be fixed in the fixes branch, could you check and close the issue if it's working for you?
Thanks for you @ralight @Daedaluz , problem has been resolved :)
Most helpful comment
Testing with my own golang plugin: returning false from mosquitto_auth_acl_check when access flag is MOSQ_ACL_SUBSCRIBE will indeed result in "Socket error on client", but not when it's MOSQ_ACL_READ.
Running a minimal plugin in c display the same behavior.
https://github.com/Daedaluz/mosquitto_plugin_template_c
mosquitto_sub continues to reconnect when using the plugin.
Just tried with tag v1.5.3