www/posts/2020/12/version-2-0-0-released.md
The Mosquitto project is happy to announce the release of version 2.0! This is a big change with breaking behaviour changes in the broker. Users, packages and plugin authors should read migrating from 1.x to 2.0 to help with the changes.
Mosquitto is now more secure by default and requires users to take an active decision in how they configure security on their broker, instead of possibly relying on the older very permissive behaviour, as well as dropping privileged access more quickly. More details are in migrating from 1.x to 2.0.
A new plugin interface has been introduced which goes beyond the existing authentication and access control plugin interface to offer more plugin capabilities, whilst being easier to develop for and easier to extend. More details will follow. Existing plugins are still supported, although plugin authors should look at migrating from 1.x to 2.0 to ensure their plugins remain compatible when compiled against Mosquitto 2.0 headers.
A new plugin has been introduced to provide client, group, and role based authentication and access control. The plugin configuration is managed over special topics and can be updated on the fly. It provides a flexible and straightforward means of configuring access to your broker. For more information, see [Dynamic Security plugin].
The broker performance has been improved, particularly for higher numbers of clients. We plan to run show some benchmarks to show the improvement.
A new utility, mosquitto_ctrl has been added for controlling aspects of a
running broker. At the present this is limited to controlling the dynamic
security plugin, but will be extended to other features in later releases.
Bridges now support MQTT v5.
The mosquitto command line clients have received a variety of small improvements. mosquitto_sub can now format its output in fixed column widths, for example, and filter its output randomly so you can keep an eye on the overall behaviour of a topic without having to see every message, for example.
When the Mosquitto broker is run without configuring any listeners it will now bind to the loopback interfaces 127.0.0.1 and/or ::1. This means that only connections from the local host will be possible.
Running the broker as mosquitto or mosquitto -p 1883 will bind to the
loopback interface.
Running the broker with a configuration file with no listeners configured will bind to the loopback interface with port 1883.
Running the broker with a listener defined will bind by default to 0.0.0.0
/ :: and so will be accessible from any interface. It is still possible to
bind to a specific address/interface.
If the broker is run as mosquitto -c mosquitto.conf -p 1884, and a
listener is defined in the configuration file, then the port defined on the
command line will be IGNORED, and no listener configured for it.
All listeners now default to allow_anonymous false unless explicitly set
to true in the configuration file. This means that when configuring a
listener the user must either configure an authentication and access control
method, or set allow_anonymous true. When the broker is run without a
configured listener, and so binds to the loopback interface, anonymous
connections are allowed.
If Mosquitto is run on as root on a unix like system, it will attempt to
drop privileges as soon as the configuration file has been read. This is in
contrast to the previous behaviour where elevated privileges were only
dropped after listeners had been started (and hence TLS certificates loaded)
and logging had been started. The change means that clients will never be
able to connect to the broker when it is running as root, unless the user
explicitly sets it to run as root, which is not advised. It also means that
all locations that the broker needs to access must be available to the
unprivileged user. In particular those people using TLS certificates from
Lets Encrypt will need to do something to allow Mosquitto to access
those certificates. An example deploy renewal hook script to help with this
is at misc/letsencrypt/mosquitto-copy.sh.
The user that Mosquitto will change to are the one provided in the
configuration, mosquitto, or nobody, in order of availability.
The pid_file option will now always attempt to write a pid file,
regardless of whether the -d argument is used when running the broker.
The tls_version option now defines the minimum TLS protocol version to
be used, rather than the exact version. Closes #1258.
The max_queued_messages option has been increased from 100 to 1000 by
default, and now also applies to QoS 0 messages, when a client is connected.
The mosquitto_sub, mosquitto_pub, and mosquitto_rr clients will now load
OS provided CA certificates by default if -L mqtts://... is used, or if
the port is set to 8883 and no other CA certificates are loaded.
Minimum support libwebsockets version is now 2.4.0
bridge_outgoing_retain option, to allow outgoing messages from a
bridge to have the retain bit completely disabled, which is useful when
bridging to e.g. Amazon or Google.log_dest dlt.
Closes #1735.mosquitto_plugin_publish() function, which can be used by plugins to
publish messages.mosquitto_client_protocol_version() function which can be used by
plugins to determine which version of MQTT a client has connected with.mosquitto_kick_client_by_clientid() and mosquitto_kick_client_by_username()
functions, which can be used by plugins to disconnect clients.bridge_max_packet_size option. Closes #265.bridge_bind_address option. Closes #1311.ciphers_tls1.3 option, to allow setting TLS v1.3 ciphersuites.
Closes #1825.malformed-packet reason code on invalid PUBLISH,
SUBSCRIBE, and UNSUBSCRIBE packets.per_listener_settings true is set and the client did not set a
username. Closes #1891.log_timestamp_format not applying to log_dest topic. Closes #1862.notifications_local_only was set true. Closes #1902.mosquitto_property_identifier(), for retrieving the identifier integer
for a property.mosquitto_property_identifier_to_string() for converting a property
identifier integer to the corresponding property name string.mosquitto_property_next() to retrieve the next property in a list, for
iterating over property lists.mosquitto_ssl_get() to allow clients to access their SSL structure and
perform additional verification.mosquitto_connect*() call.MOSQ_OPT_TLS_USE_OS_CERTS option, to instruct the client to load and
trust OS provided CA certificates for use with TLS connections.mosquitto_sub -W <secs> and
mosquitto_rr -W <secs>. Closes #275.--unix argument.--pretty option to mosquitto_sub/rr for formatted/unformatted JSON
output.--nodelay to all clients to allow them to use the MOSQ_OPT_TCP_NODELAY
option.-x to all clients to all the session-expiry-interval property to be
easily set for MQTT v5 clients.--random-filter to mosquitto_sub, to allow only a certain proportion
of received messages to be printed.--version for all clients.-L mqtts://..., or if port is set to 8883 and no other CA certificates are
used. Closes #1824.--tls-use-os-certs option to all clients.-f.-e and -t arguments in mosquitto_rr. Closes #1881.