To use passwords with the MQTT broker, you need a file with usernames and passwords. The password in the file also needs to be hashed. So the initial content of the passwordfile.txt could be:
Then, if you are using Linux and have mosquitto installed, the following command can be used to hash the password in the file:
- mosquitto_passwd -U passwordfile.txt
The command should hash the password in the file. Then, you can upload the file to the MQTT broker in Services -> MQTT -> Broker -> Broker settings -> Miscellaneous.
Then, the file needs to be uploaded via WebUI.
If you want to restrict access for anonymous users, make sure you disable the 'Allow anonymous' option on that page as well.
Another thing to mention is that, when users fail to authenticate with the broker, their attempt is added to the IP block list. These can be viewed and unblocked in System -> Administration -> Access Control -> Security.