-
Notifications
You must be signed in to change notification settings - Fork 175
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
Cannot subscribe when using MQTT Over Websockets Over TLS #255
Comments
Sorry, that's too little information to so anything about it. |
#MQTT Over Websockets Over TLS I am able to connect with 1883 port with mqtt protocol, but not able to connect with websockets (wss). above is the configuration for wss. |
@akshayvaji I meant more like do you have any logs, what have you tried, do websockets over TLS work with plain Mosquitto (i.e., without the plugin), etc. I'm sorry but I don't have the time to grab your configuration and try to run it to see if I hit any of the problems you may be facing. What I can do is point out something that looks odd, like for example you have |
@iegomez Thanks for pointing it out. But it did not help. Added below into the conf. auth_opt_log_level debug its shows data while connecting with 1883 Plain mosquitto as below, but nothing showing for websockets ime="2022-12-29T08:44:48+08:00" level=debug msg="checking user Jasmine with backend Mysql"
Yes, it worked without the plugin |
If it works with plain Mosquitto but not with the plugin, are you sure you're setting expected fields in your websocket client? I'm not saying that's the actual issue since, again, I can't debug your own app, but you might want to take a look at that given your original report mentioned |
thanks for the reply, it's working now. But I am now able to subscribe , but unable to publish for ACL-configured users Denied PUBLISH from mqttx_e647dd95 (d0, q1, r1, m27149, 'Hiloo', ... (0 bytes)) 4 -subscribe Trying to restrict to specific topics for non-superusers. how to authorize users to have publish privilege with the values mentioned above, I tired with 4,2 and 1 , No luck |
@akshayvaji I'd need to see the actual data you're trying to publish and your DB records to check if your ACL query is doing what it needs to do. That said, this is most likely not an issue with the plugin and instead something specific to your app logic. So though I might help with spotting obvious errors, I must insist that you need to debug your app and only post an issue when you think there might be a real problem with the plugin. Dcos are up to date and there are plenty of closed issues that might be related, please try to go through those before when you hit a problem. |
What is the value we get for " ? " in the below query? SELECT topic FROM acl WHERE (username = ?) AND rw = ? what is passing as the argument? Able to subscribe, but still denying publishing my Query - auth_opt_mysql_aclquery select test_acl.topic from test_acl join test_user on test_user_id=test_user.id where test_user.username = ? AND ( test_acl.rw = 3 OR test_acl.rw = ? ) |
The positional arguments, i.e. the first |
@iegomez I tried value 4 , able to subscribe, but how to use both write and subscribe When I use only write which is 2, I am not able to subscribe. No connection was made |
Again, I'd need to see how you modeled your data and the actual records you have, I can't guess what you're doing. |
@iegomez this is the data structure mysql> SELECT * FROM test_user; mysql> SELECT * FROM test_acl; auth_opt_mysql_aclquery SELECT topic FROM test_acl WHERE (username = ?) AND rw = ? Thanks |
That should work just fine given you're trying to subscribe or write to |
@iegomez can I subscribe and publish? both together? In my env, publish is only possible if its a superuser. Any idea ? I am sorry for many questions |
You can do whatever your data allows you to do. What you're presenting shows an scenario where You really need to pull logs and do some serious debugging if you are experiencing issues with that data, we're just blindly guessing otherwise. |
Auth log time="2023-01-10T10:35:30+08:00" level=debug msg="Acl check with backend Mysql" mosquitto log 1673318123: Sending CONNACK to mqttx_e647dd95 (0, 0) No other details I am getting |
Sorry, not much I can do on my side but suggest a few debugging steps. Out of the top of my head:
|
Write means Publish right? so If I apply value 2, it would publish ? |
Yes, publish means write. |
Subscription value 4 is working for me, so I think the sql query is correct. Since I am able to subscribe to the topic without any issues Value 1 and 2 is not working, do you think its an issue with mosquitto ? I tried 2.0.14 and 2.0.15 version, getting the same error on both Write and Read, its shows always "Denied PUBLISH from mqttx_e647dd95 (d0, q0, r1, m0, 'Hi MC', ... (0 bytes))" Never granting write permission for the user, if its a superuser it works |
I don't know, maybe try a different backend to discard that option. |
Were you able to fix your problem? |
getting below while trying to connect MQTT Over Websockets Over TLS
mosquitto_sub -h 127.0.0.1 -p 8084 -d -t testtopic -u test -P password
Client null sending CONNECT
Client null sending CONNECT
Client null sending CONNECT
Client null sending CONNECT
Client null sending CONNECT
Client null sending CONNECT
Client null sending CONNECT
The text was updated successfully, but these errors were encountered: