Configure password authentication
Edit chart config
Section titled “Edit chart config”Change the chart’s config to disable allow_anonymous by setting authentication to enabled.
auth: # -- By enabling this, `allow_anonymous` gets set to `false` in the mosquitto config. # highlight-next-line enabled: trueCreate password and config files
Section titled “Create password and config files”Open the Mosquitto container shell and execute the following commands, one by one, in order:
cd /etc/mosquitto/conf.dmosquitto_passwd -c passwordfile usernameecho "password_file /etc/mosquitto/conf.d/passwordfile" > passwordconfig.conf- Navigate to
/etc/mosquitto/conf.d, the persistent storage location inside the container where the password files go - Create a password file. This is interactive. Change
usernameto your username. It will ask you to input the password twice - Create a config file that points to the password file
Restart the chart so Mosquitto loads the new configuration file.