I'm following this tutorial to configure mosquitto.
This means that I'm storing my local configuration in
/etc/mosquitto/conf.d/default.conf. However, I've just now realized that I can put any password/username and it will access mosquitto meaning my config file isn't taken into account. I've just now discovered the
/etc/mosquitto/mosquitto.conf and its content can be seen below:
# Place your local configuration in /etc/mosquitto/conf.d/
# A full description of the configuration file is at
log_dest file /var/log/mosquitto/mosquitto.log
The contents of my configuration file that I want to use
/etc/mosquitto/conf.d/default.conf can be seen below.
Using the command
sudo pkill mosquitto and then
sudo mosquitto -c /etc/mosquitto/conf.d -d I stopped mosquitto and restarted it in the background running the new configuration file. When I first ran it (using the
/etc/mosquitto/conf.d/default.conf shown above), I got the
Error: Connection Refused. I then modified the
/etc/mosquitto/conf.d/default.conf file, killed mosquitto and ran it again using the same techinque. The new config file can be seen below.
For this version, the password and username protection works!!
Here are the logs for those operations
1610537764: mosquitto version 1.4.15 (build date Tue, 18 Jun 2019 11:42:22 -0300) starting
1610537764: Config loaded from /etc/mosquitto/mosquitto.conf.
1610537764: Opening ipv4 listen socket on port 1883.
1610537764: Opening ipv6 listen socket on port 1883.
1610537764: Opening ipv4 listen socket on port 8883.
1610537764: Opening ipv6 listen socket on port 8883.
1610537764: Error: Unable to load CA certificates. Check cafile "/etc/letsencrypt/live/184.108.40.206/chain.pem".
1610537909: mosquitto version 1.4.15 (build date Tue, 18 Jun 2019 11:42:22 -0300) starting
1610537909: Config loaded from /etc/mosquitto/mosquitto.conf.
1610537909: Opening ipv4 listen socket on port 1883.
1610537909: Opening ipv6 listen socket on port 1883.
1610537909: Opening ipv4 listen socket on port 8883.
1610537909: Opening ipv6 listen socket on port 8883.
1610537912: New connection from xx.xx.2.13 on port 1883.
1610537912: New client connected from xx.xx.2.13 as mqtt_f1f0a02.f7e396 (c1, k60, u'bigBoiTeam').
1610538010: mosquitto version 1.4.15 terminating