Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] subscribe to all topics.

Hi guys, im using mosquito auth plugin.
I would like to create an user that can subscribe to all topics.
I created two listener on my conf.
1
1886 , will be for local user without certificate.
This user should be able to subscribe to root topic and receibe a copy pf all pushed  messages.
2
8883
Will use certificate and will accept push and subscribe according to acls.

Question:
How should I create my ACL for my for this user ?
This is what i did on acl table:
+-----+-------------------------+--------------+----+----------+
| id     | username               | topic           | rw | users_id |
+-----+-------------------------+--------------+----+----------+
| 621 | 08b5411f848a2581a41672a | activation/# |  2 |      216 |
+-----+-------------------------+--------------+----+----------+


How sould I subscribe in order to listen for all events?
this is what I did:
mosquitto_sub -h localhost -p 1886 -t activation/   -u 08b5411f848a2581a41672a -P 72f07038b0c47b421a1892cfbb38fd1c -i 08b5411f848a2581a41672a

This is my conf file:
bind_address 127.0.0.1
port 1886
pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest syslog
log_facility 7
log_dest file /var/log/mosquitto.log
log_timestamp false
log_type debug

include_dir /etc/mosquitto/conf.d

listener 8883
allow_anonymous false

cafile /etc/mosquitto/certificados/ca.crt
keyfile /etc/mosquitto/certificados/server.key
certfile /etc/mosquitto/certificados/server.crt

#require_certificate false

auth_plugin /etc/mosquitto/auth-plug.so
auth_opt_backends mysql
auth_opt_host localhost
auth_opt_port 3306
#auth_opt_dbname mosquitto_db
auth_opt_user mosquitto_user
auth_opt_pass mosquiTTo_2017
auth_opt_dbname provisioning
auth_opt_userquery SELECT pw FROM users WHERE username = '%s'
auth_opt_superquery SELECT IFNULL(COUNT(*), 0) FROM users WHERE username = '%s' AND super = 1
auth_opt_aclquery SELECT topic FROM acls WHERE username = '%s'
#auth_opt_anonusername AnonymouS


Any idea would be wellcome.
Leandro.


Back to the top