UP  |  HOME

Mosquitto

Mosquitto is an MQTT server. I configured it for simple use as a message relay for a IoT camera.

logrotate doesn't like mosquitto constantly writing to it's logfile while it tries to compress. Workaround this by changing /etc/logrotate.d/mosquitto's compress line to delaycompress.

Authentication is via a user/password for simplicity (although mosquitto is capable of using SSL/TLS with certificates). I created users with the command:

sudo mosquitto_passwd -c /etc/mosquitto/pwfile <username>

I copy pasted this config and edited the listener line, and removed one of the log_dest lines. Seems to work adequately, but nothing private is being sent over this setup.

Listing 1: /etc/mosquitto/conf.d/public.conf
listener 1883 192.168.1.2
persistence_file mosquitto.db
log_dest syslog
log_dest topic
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
allow_anonymous false
password_file /etc/mosquitto/pwfile