This authentication plugin for Mosquitto uses MySQL as the primary data store and Redis as a caching layer to optimize authentication and ACL checks.
- Authenticates MQTT clients using user credentials stored in MySQL.
- ACL (Access Control List) checks for MQTT topics based on data stored in MySQL.
- Caches credentials and ACLs in Redis for faster subsequent checks.
- Mosquitto MQTT Broker
- MySQL Server.
- Redis Server
Add the following lines to your mosquitto.conf
:
auth_plugin /path/to/your/plugin.so
auth_opt_redis_url redis://localhost:6379
auth_opt_mysql_host localhost
auth_opt_mysql_db mqttacl
auth_opt_mysql_user your_mysql_user
auth_opt_mysql_pass your_mysql_password
Replace paths and connection details to match your setup.
Feel free to fork this repository, create a feature branch, and submit a pull request for any enhancements or bug fixes.