Giter Site home page Giter Site logo

Comments (4)

jpmens avatar jpmens commented on June 11, 2024

@aep Can you help with this? You added it in #41 and I haven't had the oportunity to study; can you paste a snippet of config here please?

from mosquitto-auth-plug.

jpmens avatar jpmens commented on June 11, 2024

Fixed and closed in #63

from mosquitto-auth-plug.

TheAshwanik avatar TheAshwanik commented on June 11, 2024

Thank You. Will test and Let you know tonight.

from mosquitto-auth-plug.

TheAshwanik avatar TheAshwanik commented on June 11, 2024

Hello,

Thank You @jpmens and @oshoemaker Just tested it with following.. And it seems it works fine.

**pardon my limited skills in Redis.. if you can validate if I did it right or not, it would be great.

Setting in redis using redis-cli (is this method correct ?)

127.0.0.1:6379> set n2 <some_pasword_hash>
OK
127.0.0.1:6379> set "n2-hello/1" 2
OK

GDB output

$ gdb
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
(gdb) exec-file /usr/local/sbin/mosquitto
(gdb) handle SIGILL nostop noprint
Signal Stop Print Pass to program Description
SIGILL No No Yes Illegal instruction
(gdb) run -c /etc/mosquitto/mosquitto.conf
Starting program: /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
1426717945: |-- *** auth-plug: startup
1426717945: |-- ** Configured order: redis

1426717945: |-- }}}} Redis
1426717946: |-- mosquitto_auth_unpwd_check(n2)
1426717946: |-- ** checking backend redis
1426717946: |-- getuser(n2) AUTHENTICATED=1 by redis

1426719957: |-- mosquitto_auth_unpwd_check(n2)
1426719957: |-- ** checking backend redis
1426719957: |-- getuser(n2) AUTHENTICATED=1 by redis
1426719957: |-- mosquitto_auth_acl_check(..., mosqpub/13383-berryp, n2, hello/1, MOSQ_ACL_WRITE)
1426719957: |-- user n2 was authenticated in back-end 0 (redis)
1426719957: |-- aclcheck(n2, hello/1, 2) AUTHORIZED=1 by redis
1426719957: |-- Cached [45397CBD5E6611861D612C561E48B8D202A92A2A] for (mosqpub/13383-berryp,n2,2)
1426719957: |-- mosquitto_auth_acl_check(..., mqttwarn, anonymous, hello/1, MOSQ_ACL_READ)
1426719957: |-- aclcheck(anonymous, hello/1, 1) CACHEDAUTH: 12
1426719957: |-- mosquitto_auth_acl_check(..., mosqsub/13355-berryp, n2, hello/1, MOSQ_ACL_READ)
1426719957: |-- aclcheck(n2, hello/1, 1) CACHEDAUTH: 0

Mosquitto Sub

$ mosquitto_sub -t "hello/1" -u n2 -P password
hellothere <----Prints this once you publish message with Pub command below.

Mosquitto Pub

$ mosquitto_pub -t 'hello/1' -m hellothere -u n2 -P password

Negative scenarios

Unauthorized Topic - Fails (nothing sent to subscriber)

mosquitto_pub -t 'hello/2' -m hellothere -u n2 -P password

GDB output:
1426720139: |-- mosquitto_auth_unpwd_check(n2)
1426720139: |-- ** checking backend redis
1426720139: |-- getuser(n2) AUTHENTICATED=1 by redis
1426720139: |-- mosquitto_auth_acl_check(..., mosqpub/13391-berryp, n2, hello/2, MOSQ_ACL_WRITE)
1426720139: |-- user n2 was authenticated in back-end 0 (redis)
1426720139: |-- aclcheck(n2, hello/2, 2) AUTHORIZED=0 by redis
1426720139: |-- Cached [3E73EF89F336545CDA0B4EC82FDDCEF7E15265CA] for (mosqpub/13391-berryp,n2,2)

Unauthenticated User- Fails (nothing sent to subscriber)

$ mosquitto_pub -t 'hello/1' -m hellothere -u n2 -P wrongpassword
Connection Refused: bad user name or password.
Error: The connection was refused.

GDB Output:
1426720275: |-- mosquitto_auth_unpwd_check(n2)
1426720275: |-- ** checking backend redis
1426720276: |-- getuser(n2) AUTHENTICATED=0 by none

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.