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

MySQL backend: ACL query example not suited for mosquitto 1.5 and up #84

Closed
synweap15 opened this issue Jul 5, 2020 · 3 comments
Closed

Comments

@synweap15
Copy link

synweap15 commented Jul 5, 2020

mosquitto: 1.6.10
mosquitto-go-auth: 0.8.1 + modifications

I've followed the setup details for MySQL plugin as in README, and found ACL rejects for subscribe calls. After setting up additional logging, it seems that the acc value mosquitto is querying with is not from the [1, 2, 3] range - it's actually MOSQ_ACL_SUBSCRIBE, as defined in mosquitto_plugin.h:

#define MOSQ_ACL_NONE 0x00
#define MOSQ_ACL_READ 0x01
#define MOSQ_ACL_WRITE 0x02
#define MOSQ_ACL_SUBSCRIBE 0x04

MySQL query in README:

SELECT topic FROM acl WHERE (username = ?) AND rw >= ?

Therefore if you follow the README docs and examples and assume:

READ - 1
WRITE - 2
READWRITE - 3

you'd get git with Acl check is false upon subscription attempt since the query does not support MOSQ_ACL_SUBSCRIBE.

More information: jpmens/mosquitto-auth-plug#356
https://mosquitto.org/api/files2/mosquitto_plugin-h.html

@iegomez
Copy link
Owner

iegomez commented Jul 6, 2020

Yeah, the examples were written before MOSQ_ACL_SUBSCRIBE was introduced. I'll rewrite them along other docs on an ongoing PR.

@iegomez
Copy link
Owner

iegomez commented Jul 12, 2020

I'm adding some docs for this in a PR I'll merge in a few minutes, but in any case there's some more info in older/closed issues like #46 and #18.

Hopefully the additions to the README will help in clarifying this. Thanks again for your report and contributions!

@iegomez
Copy link
Owner

iegomez commented Jul 14, 2020

Merged!

@iegomez iegomez closed this as completed Jul 14, 2020
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

2 participants