GithubHelp home page GithubHelp logo

Comments (6)

jpmens avatar jpmens commented on August 23, 2024

Nice idea, but hard to do because it would mean a table scan over the database to find all possible combinations. In short: no. ;-)

Unless, that is, you have some clever way of doing this.

from mosquitto-auth-plug.

manolodd avatar manolodd commented on August 23, 2024

I do not mean that %u and %c is used in the SQL query that retrieve topics, but they could be interpreted once retrieved by the query. For example, in the dafult query

SELECT topic FROM acls WHERE (username = '%s') AND (rw >= %d)

returned topics could be:

/foo
/foo/%u/#
/foo/%c/+

then, if the user 'joe' is trying to subscribe /foo/joe/score, it will be feasible due to /foo/%u/#

Allowing the use of %c and %u in the query itself, of course, will be hard to do.

from mosquitto-auth-plug.

gallog avatar gallog commented on August 23, 2024

You can solve using something like:
auth_opt_aclquery SET @username = '%s'; SET @rw = %d; SELECT CONCAT(topic,'/',@username,'/+') FROM acls WHERE (username = @username) AND (rw >= @rw)

from mosquitto-auth-plug.

jpmens avatar jpmens commented on August 23, 2024

That is very clever. ;-)

I will, nevertheless, revisit this in the coming weeks; maybe we can do
something along the lines of what OP requested.

from mosquitto-auth-plug.

manolodd avatar manolodd commented on August 23, 2024

Hi JPMens, gallog,

a clever solution, indeed. However it is not completely suitable for me. Maybe the substitution of %s instead of %u is valid for me. But what I need is that mosquitto-auth-plug supports the same substitution patterns that Mosquitto uses.

http://mosquitto.org/man/mosquitto-conf-5.html (the acl_file file option)

So, I need %c (for client ID substitution) and %u (for username substitution). As %s in mosquitto-auth-plug is the same than %u in mosquitto, your solution could be interesting. But what about %c? %d (in mosquitto-auth-plug) is not the same that %c (in mosquitto).

Well.... unless %c and %u are present in the context of mosquitto-auth-plug. If they are present (I did not try it) then I could use them in the way you have suggested. However, I thing this should be a temporary solution and mosquitto-auth-plug should maintaint the same ACL features that Mosquitto (I know... this is opensource so I could do it myself; do not flame me :-)). So, ACL management will be done only using our management UI, that configures them directly to the database. Using your suggestion requires the modification of mosquitto.conf in all the mosquitto bridges and restarting the mosquitto itself. :-(

Thanks both for your replies. Regards.

from mosquitto-auth-plug.

manolodd avatar manolodd commented on August 23, 2024

Great!! Many, many thanks... very useful. I'll try it in a few hours.

Regards.

from mosquitto-auth-plug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.