Skip to content

Commit

Permalink
Mosquitto 2.x incompatible with default IOTstack config file
Browse files Browse the repository at this point in the history
References:

* [Mosquitto doc](https://mosquitto.org/documentation/migrating-to-2-0/)
* [Workaround](SensorsIot#265)
* [IOTstack new menu breaks Mosquitto configs](SensorsIot#258 (comment))
* [Pull Request on gcgarner/IOTstack](gcgarner#228)

Mosquitto 2.x has introduced a requirement for a `listener` in the
config file. If this is absent, Mosquitto will bind to the loopback
interface. When Mosquitto is running in a container, this implies no
connectivity.

Mosquitto 2.x has also changed the security defaults. Earlier versions
permitted passwordless access out-of-the box. The new version assumes
a password scheme will be implemented and requires passwordless
access to be an explicit configuration choice.

This PR maintains the IOTstack status quo by:

1. Adding `listener 1883`; and
2. Activating `allow_anonymous` with the value `true`.

Anyone who has already set up a password scheme will need to import
the `listener` line but, presumably, their `allow_anonymous` will
already be active and set to `false`, and that will not need to change.
  • Loading branch information
Paraphraser committed Feb 6, 2021
1 parent 63a54aa commit f8b4175
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .templates/mosquitto/mosquitto.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# required by https://mosquitto.org/documentation/migrating-to-2-0/
listener 1883

persistence true
persistence_location /mosquitto/data/
#log_dest file /mosquitto/log/mosquitto.log
# To avoid flash wearing
log_dest stdout

#Uncomment to enable passwords
# To enable passwords:
# 1. Uncomment "password_file"; and
# 2. Change "allow_anonymous" to "false"
#password_file /mosquitto/pwfile/pwfile
#allow_anonymous false
allow_anonymous true

#Uncomment to enable filters
#acl_file /mosquitto/config/filter.acl
Expand Down

0 comments on commit f8b4175

Please sign in to comment.