Toto je starší verze dokumentu!
Mosquitto
Jak funguje MQTT
V tutoriálu je srozumitelně popsané, jak MQTT funguje.
Zabezpečení Mosquitto v Dockeru
Zapnutí autentizace
Vycházím z návodu Configuring the Mosquitto MQTT Docker container for use with Home Assistant, který popisuje zapnutí autentizace pro Mosquitto.
V konfiguračním souboru mosquitto.conf nastavím/změním toto:
password_file /mosquitto/pwfile/pwfile allow_anonymous false
Pak se připojím do kontejneru s mosquitto a vytvořím uživatele s heslem:
docker exec -it mosqutto sh mosquitto_passwd -c /mosquitto/pwfile/pwfile majordomus
Nakonec retartovat docker.
Podrobnější logování v Mosquitto
Do konfiguračního souboru lze dle zdroje přidat tyto řádky:
# Types of messages to log. Use multiple log_type lines for logging # multiple types of messages. # Possible types are: debug, error, warning, notice, information, # none, subscribe, unsubscribe, websockets, all. # Note that debug type messages are for decoding the incoming/outgoing # network packets. They are not logged in "topics". log_type error log_type warning log_type notice log_type information