├── www ├── man ├── themes │ └── mosquitto │ │ ├── engine │ │ ├── parent │ │ └── templates │ │ ├── base.tmpl │ │ ├── story.tmpl │ │ └── base_footer.tmpl ├── plugins │ ├── __init__.py │ └── docbookmanpage │ │ ├── docbookmanpage.plugin │ │ └── html.xsl ├── README.md ├── files │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── mstile-144x144.png │ ├── mstile-150x150.png │ ├── mstile-310x150.png │ ├── mstile-310x310.png │ ├── mstile-70x70.png │ ├── apple-touch-icon.png │ ├── images │ │ ├── iot-logo.png │ │ ├── github-icon.jpg │ │ ├── mosquitto-logo.png │ │ ├── mosquitto-logo-47.png │ │ ├── eclipse_logo_colour.png │ │ ├── mosquitto-text-side.png │ │ └── mosquitto-text-side-28.png │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── stickers │ │ ├── mosquitto-mono.png │ │ ├── mosquitto-colour.png │ │ ├── mosquitto-mono-deselected.png │ │ └── mosquitto-colour-deselected.png │ ├── blog │ │ └── uploads │ │ │ ├── 2010 │ │ │ └── 06 │ │ │ │ ├── powermeter-example.png │ │ │ │ ├── powermeter-example-150x150.png │ │ │ │ └── powermeter-example-300x138.png │ │ │ ├── 2011 │ │ │ └── 08 │ │ │ │ ├── image.png │ │ │ │ ├── image-150x150.png │ │ │ │ └── image-300x225.png │ │ │ ├── 2012 │ │ │ └── 08 │ │ │ │ ├── IMAG0006.jpg │ │ │ │ ├── IMAG0006-150x150.jpg │ │ │ │ └── IMAG0006-300x199.jpg │ │ │ ├── 2014 │ │ │ └── 05 │ │ │ │ ├── 14098345978_c15d12f19a_z.jpg │ │ │ │ ├── 14098345978_c15d12f19a_z-150x150.jpg │ │ │ │ └── 14098345978_c15d12f19a_z-300x200.jpg │ │ │ ├── 2016 │ │ │ └── 05 │ │ │ │ ├── stickers.jpg │ │ │ │ ├── stickers-150x150.jpg │ │ │ │ └── stickers-300x225.jpg │ │ │ └── 2017 │ │ │ └── 03 │ │ │ ├── img_20170308_155049248_33196894011_o.jpg │ │ │ ├── img_20170308_155049248_33196894011_o-1024x576.jpg │ │ │ ├── img_20170308_155049248_33196894011_o-150x150.jpg │ │ │ ├── img_20170308_155049248_33196894011_o-300x169.jpg │ │ │ └── img_20170308_155049248_33196894011_o-768x432.jpg │ └── manifest.json └── posts │ ├── 2009 │ └── 12 │ │ ├── version-0-2-released.md │ │ └── version-0-3-released.md │ ├── 2010 │ ├── 10 │ │ └── version-0-8-3-released.md │ ├── 12 │ │ └── version-0-9-1-released.md │ ├── 01 │ │ ├── version-0-4-1-released.md │ │ ├── mailing-list-irc.md │ │ └── version-0-4-released.md │ ├── 05 │ │ ├── mqtt-wiki.md │ │ ├── mosquitto-org.md │ │ ├── version-0-6-1-released.md │ │ ├── gentoo-ebuilds-available.md │ │ ├── mqtt-push-on-android.md │ │ └── fedora-packages-available.md │ ├── 02 │ │ └── version-0-4-2-released.md │ ├── 04 │ │ ├── oggcamp.md │ │ └── mind-control-mqtt.md │ ├── 06 │ │ ├── google-powermeter-step-by-step.attachments.json │ │ └── mosquitto-0-7rc1.md │ ├── 08 │ │ ├── mosquitto-running-on-mac-os-x.md │ │ ├── compiling-mosquitto-on-mac-os-x.md │ │ ├── version-0-8-2.md │ │ └── mqtt-v3-1.md │ ├── 03 │ │ ├── version-0-5-4-released.md │ │ └── version-0-5-3-released.md │ ├── 07 │ │ └── mosquitto-on-opensuse-11-3.md │ └── 09 │ │ ├── debian-packages.md │ │ └── mqtt-with-php.md │ ├── 2011 │ ├── 10 │ │ └── mqtt-power-usage-on-android.md │ ├── 11 │ │ ├── version-0-14-1-released.md │ │ ├── version-0-14-2-released.md │ │ └── new-linux-repositories.md │ ├── 12 │ │ ├── version-0-14-3-released.md │ │ └── mqtt-on-nanode.md │ ├── 08 │ │ ├── facebook-using-mqtt.attachments.json │ │ ├── arch-linux-package.md │ │ ├── mqtt-standardisation.md │ │ └── mosquitto-on-openwrt.md │ ├── 06 │ │ ├── version-0-11-2-released.md │ │ ├── version-0-11-1-released.md │ │ ├── version-0-10-2-released.md │ │ └── nanode-a-cheap-networked-arduino-clone.md │ ├── 02 │ │ ├── mosquitto-on-maemo.md │ │ ├── mqtt-on-android.md │ │ ├── lightweight-messaging-and-linux.md │ │ └── version-0-9-2-released.md │ ├── 03 │ │ ├── mosquitto-in-mac-homebrew.md │ │ ├── api-documentation.md │ │ └── version-0-9-3-released.md │ ├── 07 │ │ ├── wireshark-mqtt-decoder.md │ │ ├── lua-mqtt-client.md │ │ ├── version-0-11-3-released.md │ │ ├── mosquitto-on-qnx.md │ │ └── debian-and-ubuntu-packaging.md │ ├── 01 │ │ ├── mosquitto-for-slackware.md │ │ └── mqtt-news.md │ └── 05 │ │ ├── version-0-10-1-released.md │ │ └── mqtt-ontology.md │ ├── 2012 │ ├── 10 │ │ └── version-1-0-4-released.md │ ├── 11 │ │ └── version-1-0-5-released.md │ ├── 12 │ │ └── libmosquitto-go-bindings.md │ ├── 01 │ │ ├── mosquitto-test-server.md │ │ ├── version-0-14-4-released.md │ │ └── do-you-use-mqtt.md │ ├── 08 │ │ ├── baby.md │ │ ├── baby.attachments.json │ │ ├── bugfix-coming-soon.md │ │ └── version-1-0-2-released.md │ ├── 06 │ │ └── ipv6-on-test-server.md │ ├── 09 │ │ └── updating-password-files.md │ └── 03 │ │ └── upcoming-incompatible-library-changes.md │ ├── 2013 │ ├── 10 │ │ └── version-1-2-2-released.md │ ├── 08 │ │ ├── mosquitto-on-fedora.md │ │ └── mqtt-watchdir.md │ ├── 01 │ │ ├── version-1-1-1-released.md │ │ └── version-1-1-2-released.md │ ├── 02 │ │ ├── version-1-1-3-released.md │ │ └── mqtt-standardisation-oasis-call-for-participation.md │ ├── 05 │ │ └── mosquitto-javascript-client-deprecated.md │ ├── 04 │ │ └── some-interesting-mqtt-things.md │ └── 07 │ │ └── version-1-2-near-complete.md │ ├── 2014 │ ├── 10 │ │ ├── mosquitto-and-poodle.md │ │ └── version-1-3-5-released.md │ ├── 08 │ │ ├── version-1-3-3-released.md │ │ └── version-1-3-4-released.md │ └── 05 │ │ ├── new-arrival.attachments.json │ │ └── new-arrival.md │ ├── 2015 │ ├── 11 │ │ └── version-1-4-5-released.md │ ├── 12 │ │ ├── version-1-4-7-released.md │ │ └── using-lets-encrypt-certificates-with-mosquitto.md │ ├── 09 │ │ └── version-1-4-4-released.md │ └── 05 │ │ └── mosquitto-and-current-unreleased-libwebsockets-branch.md │ ├── 2016 │ ├── 01 │ │ └── test6-mosquitto-org.md │ ├── 05 │ │ └── stickers.attachments.json │ └── 03 │ │ ├── logo-contest.md │ │ ├── logo-contest-results-for-shortlisting.md │ │ └── repository-moved-to-github.md │ ├── 2017 │ ├── 07 │ │ └── version-1-4-14-released.md │ ├── 03 │ │ ├── for-the-final-time.md │ │ └── for-the-final-time.attachments.json │ └── 06 │ │ ├── citing-eclipse-mosquitto.md │ │ └── security-advisory-cve-2017-9868.md │ ├── 2018 │ ├── 01 │ │ └── mosquitto-debian-repo-key-updated.md │ └── 08 │ │ └── updated-debian-repository-backend.md │ ├── 2020 │ └── 06 │ │ ├── test-mosquitto-org-cert-updated.md │ │ └── mosquitto-ubuntu-appliance.md │ ├── 2021 │ └── 11 │ │ └── version-2-0-14-released.md │ └── 2023 │ ├── 09 │ └── version-2-0-18-released.md │ └── 08 │ └── version-2-0-17-released.md ├── test ├── ssl │ ├── rootCA │ │ ├── crlnumber │ │ ├── serial │ │ └── index.txt.attr │ ├── signingCA │ │ ├── serial │ │ ├── crlnumber │ │ └── index.txt.attr │ ├── readme.txt │ ├── crl-empty.pem │ └── crl.pem ├── unit │ ├── files │ │ ├── persist_read │ │ │ ├── empty.test-db │ │ │ ├── corrupt-header-short.test-db │ │ │ ├── corrupt-header-long.test-db │ │ │ ├── v3-cfg.test-db │ │ │ ├── v3-sub.test-db │ │ │ ├── v4-cfg.test-db │ │ │ ├── v6-cfg.test-db │ │ │ ├── v6-sub.test-db │ │ │ ├── v3-client.test-db │ │ │ ├── v3-retain.test-db │ │ │ ├── v5-client.test-db │ │ │ ├── v6-client.test-db │ │ │ ├── v6-retain.test-db │ │ │ ├── v3-bad-chunk.test-db │ │ │ ├── v5-bad-chunk.test-db │ │ │ ├── v3-cfg-bad-dbid.test-db │ │ │ ├── v3-cfg-truncated.test-db │ │ │ ├── v3-message-store.test-db │ │ │ ├── v4-message-store.test-db │ │ │ ├── v5-cfg-truncated.test-db │ │ │ ├── v6-message-store.test-db │ │ │ ├── v3-client-message.test-db │ │ │ ├── v6-client-message.test-db │ │ │ ├── unsupported-version.test-db │ │ │ ├── v6-client-message-props.test-db │ │ │ └── v6-message-store-props.test-db │ │ └── persist_write │ │ │ ├── empty.test-db │ │ │ ├── v4-full.test-db │ │ │ └── v6-message-store-no-ref.test-db │ ├── utf8.c │ ├── stubs.c │ └── tls_stubs.c ├── broker │ ├── 08-tls-psk-pub.psk │ ├── 08-tls-psk-bridge.psk │ ├── 01-connect-uname-password-success-no-tls.pwfile │ ├── 03-publish-qos1-queued-bytes.conf │ ├── 01-connect-uname-or-anon.pwfile │ ├── 01-connect-uname-no-password-denied.pwfile │ ├── 01-connect-uname-password-denied.pwfile │ ├── data │ │ └── ZZ-broker-check.json │ ├── 06-bridge-clean-session-csF-lcsF.py │ ├── 06-bridge-clean-session-csF-lcsN.py │ ├── 06-bridge-clean-session-csF-lcsT.py │ ├── 06-bridge-clean-session-csT-lcsF.py │ ├── 06-bridge-clean-session-csT-lcsN.py │ ├── 06-bridge-clean-session-csT-lcsT.py │ ├── readme.txt │ ├── mosq_test_helper.py │ ├── 12-prop-subpub-content-type.py │ ├── 08-ssl-bridge-helper.py │ ├── 12-prop-subpub-payload-format.py │ ├── 09-auth-bad-method.py │ ├── 03-publish-dollar.py │ ├── 07-will-delay-invalid-573191.py │ └── c │ │ └── Makefile ├── random │ ├── pwfile │ └── Makefile ├── old │ ├── msgsps_common.h │ ├── Makefile │ └── msgsps_sub.c ├── client │ └── Makefile ├── mqtt5_opts.py ├── Makefile └── lib │ ├── mosq_test_helper.py │ ├── 09-util-topic-tokenise.py │ ├── c │ ├── 08-ssl-bad-cacert.c │ ├── 01-no-clean-session.c │ ├── 01-unpwd-set.c │ ├── 01-will-set.c │ ├── 01-will-unpwd-set.c │ ├── 01-keepalive-pingreq.c │ ├── 01-server-keepalive-pingreq.c │ ├── 03-publish-b2c-qos1-unexpected-puback.c │ ├── 03-publish-b2c-qos2-unexpected-pubcomp.c │ ├── 04-retain-qos0.c │ ├── 08-ssl-fake-cacert.c │ ├── 01-con-discon-success.c │ └── 08-ssl-connect-no-auth.c │ ├── 08-ssl-bad-cacert.py │ └── cpp │ ├── 08-ssl-bad-cacert.cpp │ ├── 01-unpwd-set.cpp │ ├── 01-no-clean-session.cpp │ ├── 01-keepalive-pingreq.cpp │ ├── 01-will-unpwd-set.cpp │ ├── 01-will-set.cpp │ ├── 04-retain-qos0.cpp │ ├── 08-ssl-fake-cacert.cpp │ └── 01-con-discon-success.cpp ├── pskfile.example ├── snap └── local │ └── default_config.conf ├── logo ├── mosquitto.ico └── legacy │ ├── mosquitto-14x14.png │ └── mosquitto-16x16.png ├── apps ├── CMakeLists.txt ├── mosquitto_passwd │ ├── CMakeLists.txt │ └── get_password.h ├── Makefile └── db_dump │ └── db_dump.h ├── service ├── svscan │ └── run ├── monit │ └── mosquitto.monit ├── upstart │ └── mosquitto.conf └── systemd │ ├── README │ ├── mosquitto.service.simple │ └── mosquitto.service.notify ├── plugins ├── deny-protocol-version │ ├── test.conf │ ├── test.sh │ ├── CMakeLists.txt │ └── Makefile ├── CMakeLists.txt ├── auth-by-ip │ ├── CMakeLists.txt │ └── Makefile ├── message-timestamp │ ├── CMakeLists.txt │ └── Makefile ├── Makefile └── payload-modification │ ├── CMakeLists.txt │ └── Makefile ├── man ├── mosquitto.8.meta ├── libmosquitto.3.meta ├── mosquitto-tls.7.meta ├── mosquitto_pub.1.meta ├── mosquitto_rr.1.meta ├── mosquitto_sub.1.meta ├── mqtt.7.meta ├── mosquitto.conf.5.meta ├── mosquitto_ctrl.1.meta ├── mosquitto_passwd.1.meta ├── mosquitto_ctrl_dynsec.1.meta ├── html.xsl ├── manpage.xsl └── libmosquitto.3.xml ├── misc └── currentcost │ ├── gnome-panel │ └── currentcost.png │ ├── cc128_read.py │ └── cc128_read.pl ├── travis-configure.sh ├── LICENSE.txt ├── doc ├── historical │ └── topic-match.kds └── joss-paper │ └── codemeta.json ├── docker ├── 2.0 │ ├── mosquitto-no-auth.conf │ └── docker-entrypoint.sh ├── 2.0-openssl │ ├── mosquitto-no-auth.conf │ └── docker-entrypoint.sh ├── generic │ ├── mosquitto-no-auth.conf │ └── docker-entrypoint.sh ├── 1.5 │ └── docker-entrypoint.sh ├── 1.6 │ └── docker-entrypoint.sh ├── local │ └── docker-entrypoint.sh ├── 1.5-openssl │ └── docker-entrypoint.sh └── 1.6-openssl │ └── docker-entrypoint.sh ├── vcpkg.json ├── SECURITY.md ├── aclfile.example ├── libmosquitto.pc.in ├── libmosquittopp.pc.in ├── examples ├── temperature_conversion │ ├── readme.txt │ ├── main.cpp │ ├── temperature_conversion.h │ └── Makefile ├── mysql_log │ └── Makefile └── subscribe_simple │ ├── single.c │ ├── callback.c │ ├── multiple.c │ └── Makefile ├── pwfile.example ├── lib ├── dummypthread.h ├── time_mosq.h ├── socks_mosq.h ├── logging_mosq.h ├── misc_mosq.h ├── alias_mosq.h └── will_mosq.h ├── .github ├── workflows │ ├── lock.yml │ ├── delete-old-workflow-runs.yml │ ├── coverity-scan-fixes.yml │ └── coverity-scan-develop.yml └── issue_template.md ├── travis-install.sh ├── security └── mosquitto.apparmor ├── README-tests.md ├── set-version.sh ├── cmake └── FindcJSON.cmake ├── appveyor.yml ├── client ├── sub_client_output.h └── pub_test_properties ├── README-letsencrypt.md └── src ├── linker-macosx.syms └── linker.syms /www/man: -------------------------------------------------------------------------------- 1 | ../man -------------------------------------------------------------------------------- /test/ssl/rootCA/crlnumber: -------------------------------------------------------------------------------- 1 | 01 2 | -------------------------------------------------------------------------------- /test/ssl/rootCA/serial: -------------------------------------------------------------------------------- 1 | 03 2 | -------------------------------------------------------------------------------- /test/ssl/signingCA/serial: -------------------------------------------------------------------------------- 1 | 07 2 | -------------------------------------------------------------------------------- /test/ssl/signingCA/crlnumber: -------------------------------------------------------------------------------- 1 | 03 2 | -------------------------------------------------------------------------------- /www/themes/mosquitto/engine: -------------------------------------------------------------------------------- 1 | mako 2 | -------------------------------------------------------------------------------- /www/themes/mosquitto/parent: -------------------------------------------------------------------------------- 1 | base 2 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/empty.test-db: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pskfile.example: -------------------------------------------------------------------------------- 1 | id:deadbeef 2 | easy:12345 3 | -------------------------------------------------------------------------------- /www/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | # Plugin modules go here. -------------------------------------------------------------------------------- /test/broker/08-tls-psk-pub.psk: -------------------------------------------------------------------------------- 1 | psk-id:deadbeef 2 | -------------------------------------------------------------------------------- /test/broker/08-tls-psk-bridge.psk: -------------------------------------------------------------------------------- 1 | psk-test:deadbeef 2 | -------------------------------------------------------------------------------- /test/ssl/rootCA/index.txt.attr: -------------------------------------------------------------------------------- 1 | unique_subject = yes 2 | -------------------------------------------------------------------------------- /test/ssl/signingCA/index.txt.attr: -------------------------------------------------------------------------------- 1 | unique_subject = yes 2 | -------------------------------------------------------------------------------- /snap/local/default_config.conf: -------------------------------------------------------------------------------- 1 | persistence false 2 | user root 3 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/corrupt-header-short.test-db: -------------------------------------------------------------------------------- 1 | corrupt 2 | -------------------------------------------------------------------------------- /test/broker/01-connect-uname-password-success-no-tls.pwfile: -------------------------------------------------------------------------------- 1 | user:password 2 | -------------------------------------------------------------------------------- /logo/mosquitto.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/logo/mosquitto.ico -------------------------------------------------------------------------------- /test/unit/utf8.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/utf8.c -------------------------------------------------------------------------------- /apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(mosquitto_ctrl) 2 | add_subdirectory(mosquitto_passwd) 3 | -------------------------------------------------------------------------------- /service/svscan/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf 4 | -------------------------------------------------------------------------------- /www/README.md: -------------------------------------------------------------------------------- 1 | This is the mosquitto website, it can be built with `nikola`: 2 | 3 | `nikola build` -------------------------------------------------------------------------------- /www/files/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/favicon.ico -------------------------------------------------------------------------------- /test/unit/files/persist_read/corrupt-header-long.test-db: -------------------------------------------------------------------------------- 1 | corruptcorruptcorruptcorruptcorruptcorrupt 2 | -------------------------------------------------------------------------------- /www/files/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/favicon-16x16.png -------------------------------------------------------------------------------- /www/files/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/favicon-32x32.png -------------------------------------------------------------------------------- /www/files/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/mstile-144x144.png -------------------------------------------------------------------------------- /www/files/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/mstile-150x150.png -------------------------------------------------------------------------------- /www/files/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/mstile-310x150.png -------------------------------------------------------------------------------- /www/files/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/mstile-310x310.png -------------------------------------------------------------------------------- /www/files/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/mstile-70x70.png -------------------------------------------------------------------------------- /www/files/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/apple-touch-icon.png -------------------------------------------------------------------------------- /www/files/images/iot-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/images/iot-logo.png -------------------------------------------------------------------------------- /logo/legacy/mosquitto-14x14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/logo/legacy/mosquitto-14x14.png -------------------------------------------------------------------------------- /logo/legacy/mosquitto-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/logo/legacy/mosquitto-16x16.png -------------------------------------------------------------------------------- /www/files/images/github-icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/images/github-icon.jpg -------------------------------------------------------------------------------- /www/files/images/mosquitto-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/images/mosquitto-logo.png -------------------------------------------------------------------------------- /www/files/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/android-chrome-192x192.png -------------------------------------------------------------------------------- /www/files/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/android-chrome-512x512.png -------------------------------------------------------------------------------- /www/files/images/mosquitto-logo-47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/images/mosquitto-logo-47.png -------------------------------------------------------------------------------- /www/files/stickers/mosquitto-mono.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/stickers/mosquitto-mono.png -------------------------------------------------------------------------------- /test/broker/03-publish-qos1-queued-bytes.conf: -------------------------------------------------------------------------------- 1 | sys_interval 1 2 | max_queued_messages 0 3 | max_queued_bytes 400 4 | port 1888 5 | -------------------------------------------------------------------------------- /www/files/blog/uploads/2011/08/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2011/08/image.png -------------------------------------------------------------------------------- /www/files/images/eclipse_logo_colour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/images/eclipse_logo_colour.png -------------------------------------------------------------------------------- /www/files/images/mosquitto-text-side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/images/mosquitto-text-side.png -------------------------------------------------------------------------------- /www/files/stickers/mosquitto-colour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/stickers/mosquitto-colour.png -------------------------------------------------------------------------------- /plugins/deny-protocol-version/test.conf: -------------------------------------------------------------------------------- 1 | listener 1883 2 | 3 | plugin ./mosquitto_deny_protocol_version.so 4 | password_file pwfile 5 | -------------------------------------------------------------------------------- /test/random/pwfile: -------------------------------------------------------------------------------- 1 | test:$6$cBP7e6sUriMSh8yf$+Z3E9P1g+Hui8zDJA+XJpTHl6+0eym0MtWokmOY4j1svAR5RtjZoXB4OQuHYzrGrdp1e8gXoqcKlcP+1lmepmg== 2 | -------------------------------------------------------------------------------- /test/ssl/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains certificates and keys required for SSL testing. 2 | The CA key has password "password". 3 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-cfg.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-cfg.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-sub.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-sub.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v4-cfg.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v4-cfg.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-cfg.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-cfg.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-sub.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-sub.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_write/empty.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_write/empty.test-db -------------------------------------------------------------------------------- /www/files/blog/uploads/2012/08/IMAG0006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2012/08/IMAG0006.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2016/05/stickers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2016/05/stickers.jpg -------------------------------------------------------------------------------- /www/files/images/mosquitto-text-side-28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/images/mosquitto-text-side-28.png -------------------------------------------------------------------------------- /man/mosquitto.8.meta: -------------------------------------------------------------------------------- 1 | .. title: Mosquitto man page 2 | .. slug: mosquitto-8 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /misc/currentcost/gnome-panel/currentcost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/misc/currentcost/gnome-panel/currentcost.png -------------------------------------------------------------------------------- /test/unit/files/persist_write/v4-full.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_write/v4-full.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-client.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-client.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-retain.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-retain.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v5-client.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v5-client.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-client.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-client.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-retain.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-retain.test-db -------------------------------------------------------------------------------- /travis-configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 4 | cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl . 5 | fi 6 | -------------------------------------------------------------------------------- /www/files/blog/uploads/2011/08/image-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2011/08/image-150x150.png -------------------------------------------------------------------------------- /www/files/blog/uploads/2011/08/image-300x225.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2011/08/image-300x225.png -------------------------------------------------------------------------------- /www/files/stickers/mosquitto-mono-deselected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/stickers/mosquitto-mono-deselected.png -------------------------------------------------------------------------------- /man/libmosquitto.3.meta: -------------------------------------------------------------------------------- 1 | .. title: libmosquitto man page 2 | .. slug: libmosquitto-3 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /man/mosquitto-tls.7.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto-tls man page 2 | .. slug: mosquitto-tls-7 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /man/mosquitto_pub.1.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto_pub man page 2 | .. slug: mosquitto_pub-1 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /man/mosquitto_rr.1.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto_rr man page 2 | .. slug: mosquitto_rr-1 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /man/mosquitto_sub.1.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto_sub man page 2 | .. slug: mosquitto_sub-1 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /man/mqtt.7.meta: -------------------------------------------------------------------------------- 1 | .. title: MQTT man page 2 | .. slug: mqtt-7 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | .. hide_title: True 7 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-bad-chunk.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-bad-chunk.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v5-bad-chunk.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v5-bad-chunk.test-db -------------------------------------------------------------------------------- /www/files/stickers/mosquitto-colour-deselected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/stickers/mosquitto-colour-deselected.png -------------------------------------------------------------------------------- /man/mosquitto.conf.5.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto.conf man page 2 | .. slug: mosquitto-conf-5 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /man/mosquitto_ctrl.1.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto_ctrl man page 2 | .. slug: mosquitto_ctrl-1 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-cfg-bad-dbid.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-cfg-bad-dbid.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-cfg-truncated.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-cfg-truncated.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-message-store.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-message-store.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v4-message-store.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v4-message-store.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v5-cfg-truncated.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v5-cfg-truncated.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-message-store.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-message-store.test-db -------------------------------------------------------------------------------- /www/files/blog/uploads/2010/06/powermeter-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2010/06/powermeter-example.png -------------------------------------------------------------------------------- /www/files/blog/uploads/2012/08/IMAG0006-150x150.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2012/08/IMAG0006-150x150.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2012/08/IMAG0006-300x199.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2012/08/IMAG0006-300x199.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2016/05/stickers-150x150.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2016/05/stickers-150x150.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2016/05/stickers-300x225.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2016/05/stickers-300x225.jpg -------------------------------------------------------------------------------- /man/mosquitto_passwd.1.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto_passwd man page 2 | .. slug: mosquitto_passwd-1 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /test/broker/01-connect-uname-or-anon.pwfile: -------------------------------------------------------------------------------- 1 | user:$6$Ut1cUS9PG8+gC3vn$tOjCfSJJDe1Alu9HktxxyyzwN4+6mAMSWGRAF9gmMN8pzcGTPVEYYMAZpCEp96Oz2ZRRz5YKM6lPMf1tUbb6zA== 2 | -------------------------------------------------------------------------------- /test/old/msgsps_common.h: -------------------------------------------------------------------------------- 1 | #define HOST "127.0.0.1" 2 | #define PORT 1883 3 | 4 | #define PUB_QOS 1 5 | #define SUB_QOS 1 6 | #define MESSAGE_SIZE 1024L 7 | 8 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/v3-client-message.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v3-client-message.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-client-message.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-client-message.test-db -------------------------------------------------------------------------------- /test/client/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all check test ptest clean 2 | 3 | all : 4 | 5 | check : test 6 | ptest : test 7 | test : 8 | ./test.sh 9 | 10 | clean: 11 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/unsupported-version.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/unsupported-version.test-db -------------------------------------------------------------------------------- /test/broker/01-connect-uname-no-password-denied.pwfile: -------------------------------------------------------------------------------- 1 | user:$6$Ut1cUS9PG8+gC3vn$tOjCfSJJDe1Alu9HktxxyyzwN4+6mAMSWGRAF9gmMN8pzcGTPVEYYMAZpCEp96Oz2ZRRz5YKM6lPMf1tUbb6zA== 2 | -------------------------------------------------------------------------------- /test/broker/01-connect-uname-password-denied.pwfile: -------------------------------------------------------------------------------- 1 | user:$6$vZY4TS+/HBxHw38S$vvjVFECzb8dyuu/mruD2QKTfdFn0WmKxbc+1TsdB0L8EdHk3v9JRmfjHd56+VaTnUcSZOZ/hzkdvWCtxlX7AUQ== 2 | -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-client-message-props.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-client-message-props.test-db -------------------------------------------------------------------------------- /test/unit/files/persist_read/v6-message-store-props.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_read/v6-message-store-props.test-db -------------------------------------------------------------------------------- /www/files/blog/uploads/2014/05/14098345978_c15d12f19a_z.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2014/05/14098345978_c15d12f19a_z.jpg -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | This project is dual licensed under the Eclipse Public License 2.0 and the 2 | Eclipse Distribution License 1.0 as described in the epl-v20 and edl-v10 files. 3 | -------------------------------------------------------------------------------- /plugins/deny-protocol-version/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ../../apps/mosquitto_passwd/mosquitto_passwd -c -b pwfile username password 4 | ../../src/mosquitto -c test.conf -v 5 | -------------------------------------------------------------------------------- /service/monit/mosquitto.monit: -------------------------------------------------------------------------------- 1 | check process mosquitto with pidfile /run/mosquitto.pid 2 | start = "/etc/init.d/mosquitto start" 3 | stop = "/etc/init.d/mosquitto stop" 4 | 5 | -------------------------------------------------------------------------------- /test/unit/files/persist_write/v6-message-store-no-ref.test-db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/test/unit/files/persist_write/v6-message-store-no-ref.test-db -------------------------------------------------------------------------------- /www/files/blog/uploads/2010/06/powermeter-example-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2010/06/powermeter-example-150x150.png -------------------------------------------------------------------------------- /www/files/blog/uploads/2010/06/powermeter-example-300x138.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2010/06/powermeter-example-300x138.png -------------------------------------------------------------------------------- /man/mosquitto_ctrl_dynsec.1.meta: -------------------------------------------------------------------------------- 1 | .. title: mosquitto_ctrl dynamic security man page 2 | .. slug: mosquitto_ctrl_dynsec-1 3 | .. category: man 4 | .. type: man 5 | .. pretty_url: False 6 | -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(dynamic-security) 2 | if(NOT WIN32) 3 | add_subdirectory(message-timestamp) 4 | endif(NOT WIN32) 5 | add_subdirectory(payload-modification) 6 | -------------------------------------------------------------------------------- /www/files/blog/uploads/2014/05/14098345978_c15d12f19a_z-150x150.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2014/05/14098345978_c15d12f19a_z-150x150.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2014/05/14098345978_c15d12f19a_z-300x200.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2014/05/14098345978_c15d12f19a_z-300x200.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o.jpg -------------------------------------------------------------------------------- /test/broker/data/ZZ-broker-check.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "group": "BROKER CHECK", 4 | "tests": [ 5 | { "name": "END OF TEST", "ver":4, "expect_disconnect": false, "msgs": []} 6 | ] 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /doc/historical/topic-match.kds: -------------------------------------------------------------------------------- 1 | S'^(?:(?:(a|\\+)(?!$))(?:(?:/(?:(b|\\+)(?!$)))(?:(?:/(?:c|\\+))|/#)?|/#)?|#)$' 2 | p1 3 | .S'a/#\na/b/c\na/b/+\na/b\na/+\n+\n+/b\n+/+/+\n+/b/c\na/c' 4 | p2 5 | .I8 6 | .S'' 7 | . -------------------------------------------------------------------------------- /docker/2.0/mosquitto-no-auth.conf: -------------------------------------------------------------------------------- 1 | # This is a Mosquitto configuration file that creates a listener on port 1883 2 | # that allows unauthenticated access. 3 | 4 | listener 1883 5 | allow_anonymous true 6 | -------------------------------------------------------------------------------- /vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mosquitto", 3 | "version-string": "2.0.19", 4 | "dependencies": [ 5 | "cjson", 6 | "libwebsockets", 7 | "openssl", 8 | "pthreads" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /docker/2.0-openssl/mosquitto-no-auth.conf: -------------------------------------------------------------------------------- 1 | # This is a Mosquitto configuration file that creates a listener on port 1883 2 | # that allows unauthenticated access. 3 | 4 | listener 1883 5 | allow_anonymous true 6 | -------------------------------------------------------------------------------- /docker/generic/mosquitto-no-auth.conf: -------------------------------------------------------------------------------- 1 | # This is a Mosquitto configuration file that creates a listener on port 1883 2 | # that allows unauthenticated access. 3 | 4 | listener 1883 5 | allow_anonymous true 6 | -------------------------------------------------------------------------------- /www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-1024x576.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-1024x576.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-150x150.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-150x150.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-300x169.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-300x169.jpg -------------------------------------------------------------------------------- /www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-768x432.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mgdm/mosquitto/master/www/files/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-768x432.jpg -------------------------------------------------------------------------------- /test/mqtt5_opts.py: -------------------------------------------------------------------------------- 1 | MQTT_SUB_OPT_NO_LOCAL = 0x04 2 | MQTT_SUB_OPT_RETAIN_AS_PUBLISHED = 0x08 3 | MQTT_SUB_OPT_SEND_RETAIN_ALWAYS = 0x00 4 | MQTT_SUB_OPT_SEND_RETAIN_NEW = 0x10 5 | MQTT_SUB_OPT_SEND_RETAIN_NEVER = 0x20 6 | -------------------------------------------------------------------------------- /service/upstart/mosquitto.conf: -------------------------------------------------------------------------------- 1 | description "Mosquitto MQTTv3.1 broker" 2 | author "Roger Light " 3 | 4 | start on net-device-up 5 | 6 | respawn 7 | 8 | exec /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf 9 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | If you think you have found a security vulnerability in Mosquitto, please follow the steps on [Eclipse Security](https://www.eclipse.org/security/) page to report it. 6 | -------------------------------------------------------------------------------- /docker/1.5/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /docker/1.6/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /docker/2.0/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /docker/generic/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /docker/local/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /docker/1.5-openssl/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /docker/1.6-openssl/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /docker/2.0-openssl/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | set -e 3 | 4 | # Set permissions 5 | user="$(id -u)" 6 | if [ "$user" = '0' ]; then 7 | [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true 8 | fi 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /aclfile.example: -------------------------------------------------------------------------------- 1 | # This affects access control for clients with no username. 2 | topic read $SYS/# 3 | 4 | # This only affects clients with username "roger". 5 | user roger 6 | topic foo/bar 7 | 8 | # This affects all clients. 9 | pattern write $SYS/broker/connection/%c/state 10 | -------------------------------------------------------------------------------- /libmosquitto.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=${prefix}/include 4 | libdir=${exec_prefix}/lib 5 | 6 | Name: mosquitto 7 | Description: mosquitto MQTT library (C bindings) 8 | Version: @VERSION@ 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -lmosquitto 11 | -------------------------------------------------------------------------------- /libmosquittopp.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=${prefix}/include 4 | libdir=${exec_prefix}/lib 5 | 6 | Name: mosquittopp 7 | Description: mosquitto MQTT library (C++ bindings) 8 | Version: @VERSION@ 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -lmosquittopp 11 | -------------------------------------------------------------------------------- /www/posts/2009/12/version-0-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Version 0.2 released - please see the [change log](/ChangeLog.txt). 13 | -------------------------------------------------------------------------------- /www/posts/2011/11/version-0-14-1-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Fix Python syntax errors (bug #891673). 15 | -------------------------------------------------------------------------------- /examples/temperature_conversion/readme.txt: -------------------------------------------------------------------------------- 1 | This is a simple example of the C++ library mosquittopp. 2 | 3 | It is a client that subscribes to the topic temperature/celsius which should 4 | have temperature data in text form being published to it. It reads this data as 5 | a Celsius temperature, converts to Fahrenheit and republishes on 6 | temperature/fahrenheit. 7 | -------------------------------------------------------------------------------- /pwfile.example: -------------------------------------------------------------------------------- 1 | roger:$6$clQ4Ocu312S0qWgl$Cv2wUxgEN73c6C6jlBkswqR4AkHsvDLWvtEXZZ8NpsBLgP1WAo/qA+WXcmEN/mjDNgdUwcxRAveqNMs2xUVQYA== 2 | sub_client:$6$U+qg0/32F0g2Fh+n$fBPSkq/rfNyEQ/TkEjRgwGTTVBpvNhKSyGShovH9KHewsvJ731tD5Zx26IHhR5RYCICt0L9qBW0/KK31UkCliw== 3 | pub_client:$6$vxQ89y+7WrsnL2yn$fSPMmEZn9TSrC8s/jaPmxJ9NijWpkP2e7bMJLz78JXR1vW2x8+T3FZ23byJA6xs5Mt+LeOybAHwcUv0OCl40rA== 4 | -------------------------------------------------------------------------------- /examples/mysql_log/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -ggdb 2 | LDFLAGS=../../lib/libmosquitto.so.1 -lmysqlclient 3 | 4 | .PHONY: all clean 5 | 6 | all : mosquitto_mysql_log 7 | 8 | mosquitto_mysql_log : mysql_log.o 9 | ${CC} $^ -o $@ ${LDFLAGS} 10 | 11 | mysql_log.o : mysql_log.c 12 | ${CC} -c $^ -o $@ ${CFLAGS} -I../../lib 13 | 14 | clean : 15 | -rm -f *.o mosquitto_mysql_log 16 | -------------------------------------------------------------------------------- /examples/temperature_conversion/main.cpp: -------------------------------------------------------------------------------- 1 | #include "temperature_conversion.h" 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | class mqtt_tempconv *tempconv; 6 | int rc; 7 | 8 | mosqpp::lib_init(); 9 | 10 | tempconv = new mqtt_tempconv("tempconv", "localhost", 1883); 11 | tempconv->loop_forever(); 12 | 13 | mosqpp::lib_cleanup(); 14 | 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /lib/dummypthread.h: -------------------------------------------------------------------------------- 1 | #ifndef DUMMYPTHREAD_H 2 | #define DUMMYPTHREAD_H 3 | 4 | #define pthread_create(A, B, C, D) 5 | #define pthread_join(A, B) 6 | #define pthread_cancel(A) 7 | #define pthread_testcancel() 8 | 9 | #define pthread_mutex_init(A, B) 10 | #define pthread_mutex_destroy(A) 11 | #define pthread_mutex_lock(A) 12 | #define pthread_mutex_unlock(A) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /www/posts/2010/01/version-0-4-1-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release: 13 | 14 | * Fix regex used for finding retained messages to send on new subscription. 15 | -------------------------------------------------------------------------------- /www/posts/2011/11/version-0-14-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release: 13 | 14 | * Add uninstall target for libs. 15 | * Don't try to write packet whilst in a callback. 16 | -------------------------------------------------------------------------------- /www/plugins/docbookmanpage/docbookmanpage.plugin: -------------------------------------------------------------------------------- 1 | [Core] 2 | Name = docbookmanpage 3 | Module = docbookmanpage 4 | 5 | [Nikola] 6 | PluginCategory = PageCompiler 7 | 8 | [Documentation] 9 | Author = Roger Light (asciidoc code by Roberto Alsina) 10 | Version = 0.4 11 | Website = https://github.com/ralight/nikola-docbook-manpage 12 | Description = Compile Docbook manpages into html, based on asciidoc plugin. 13 | -------------------------------------------------------------------------------- /www/posts/2013/08/mosquitto-on-fedora.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Mosquitto has been packaged for Fedora thanks to Rich Mattes. Fedora 19 users 13 | will be able to install with "yum install mosquitto". 14 | 15 | Thanks Rich! 16 | -------------------------------------------------------------------------------- /.github/workflows/lock.yml: -------------------------------------------------------------------------------- 1 | name: 'Lock Threads' 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * 0' 6 | workflow_dispatch: 7 | 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | 12 | concurrency: 13 | group: lock 14 | 15 | jobs: 16 | action: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: dessant/lock-threads@v3 20 | with: 21 | issue-inactive-days: '90' 22 | -------------------------------------------------------------------------------- /test/broker/06-bridge-clean-session-csF-lcsF.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Test whether a broker handles cleansession and local_cleansession correctly on bridges 3 | 4 | from mosq_test_helper import * 5 | from collections import namedtuple 6 | 7 | (port_a_listen, port_b_listen) = mosq_test.get_port(2) 8 | subprocess.run(['./06-bridge-clean-session-core.py', str(port_a_listen), str(port_b_listen), "False", "False"]) 9 | 10 | -------------------------------------------------------------------------------- /test/broker/06-bridge-clean-session-csF-lcsN.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Test whether a broker handles cleansession and local_cleansession correctly on bridges 3 | 4 | from mosq_test_helper import * 5 | from collections import namedtuple 6 | 7 | (port_a_listen, port_b_listen) = mosq_test.get_port(2) 8 | subprocess.run(['./06-bridge-clean-session-core.py', str(port_a_listen), str(port_b_listen), "False", "None"]) 9 | 10 | -------------------------------------------------------------------------------- /test/broker/06-bridge-clean-session-csF-lcsT.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Test whether a broker handles cleansession and local_cleansession correctly on bridges 3 | 4 | from mosq_test_helper import * 5 | from collections import namedtuple 6 | 7 | (port_a_listen, port_b_listen) = mosq_test.get_port(2) 8 | subprocess.run(['./06-bridge-clean-session-core.py', str(port_a_listen), str(port_b_listen), "False", "True"]) 9 | 10 | -------------------------------------------------------------------------------- /test/broker/06-bridge-clean-session-csT-lcsF.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Test whether a broker handles cleansession and local_cleansession correctly on bridges 3 | 4 | from mosq_test_helper import * 5 | from collections import namedtuple 6 | 7 | (port_a_listen, port_b_listen) = mosq_test.get_port(2) 8 | subprocess.run(['./06-bridge-clean-session-core.py', str(port_a_listen), str(port_b_listen), "True", "False"]) 9 | 10 | -------------------------------------------------------------------------------- /test/broker/06-bridge-clean-session-csT-lcsN.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Test whether a broker handles cleansession and local_cleansession correctly on bridges 3 | 4 | from mosq_test_helper import * 5 | from collections import namedtuple 6 | 7 | (port_a_listen, port_b_listen) = mosq_test.get_port(2) 8 | subprocess.run(['./06-bridge-clean-session-core.py', str(port_a_listen), str(port_b_listen), "True", "None"]) 9 | 10 | -------------------------------------------------------------------------------- /test/broker/06-bridge-clean-session-csT-lcsT.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Test whether a broker handles cleansession and local_cleansession correctly on bridges 3 | 4 | from mosq_test_helper import * 5 | from collections import namedtuple 6 | 7 | (port_a_listen, port_b_listen) = mosq_test.get_port(2) 8 | subprocess.run(['./06-bridge-clean-session-core.py', str(port_a_listen), str(port_b_listen), "True", "True"]) 9 | 10 | -------------------------------------------------------------------------------- /www/posts/2010/05/mqtt-wiki.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | A new wiki has been created, devoted to MQTT. If you want to share what you're 13 | doing with MQTT and how to do it, or want to find any of that out, head over to 14 | . 15 | -------------------------------------------------------------------------------- /www/posts/2012/01/mosquitto-test-server.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | A publicly accessible Mosquitto server is now available to use. Details are at 13 | [test.mosquitto.org] 14 | 15 | [test.mosquitto.org]: http:/test.mosquitto.org/ 16 | -------------------------------------------------------------------------------- /www/posts/2014/08/version-1-3-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | # Broker 15 | 16 | * Fix incorrect handling of anonymous bridges on the local broker. 17 | 18 | Binaries will follow shortly. 19 | -------------------------------------------------------------------------------- /www/posts/2011/08/facebook-using-mqtt.attachments.json: -------------------------------------------------------------------------------- 1 | {"165": {"wordpress_user_name": "roger", "title": "iphone-app", "date_utc": "2011-08-17 15:40:22", "files_meta": [{"height": 768, "width": 1024}, {"height": 225, "size": "medium", "width": 300}, {"height": 150, "size": "thumbnail", "width": 150}], "files": ["/wp-content/uploads/2011/08/image.png", "/wp-content/uploads/2011/08/image-300x225.png", "/wp-content/uploads/2011/08/image-150x150.png"]}} -------------------------------------------------------------------------------- /www/posts/2010/05/mosquitto-org.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I'm pleased to annouce that the mosquitto website is now available at 13 | so please update your bookmarks! I'll be updating the 14 | links here in a few days when the change has propagated. 15 | -------------------------------------------------------------------------------- /www/posts/2011/06/version-0-11-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Don't free contexts in mqtt3_context_disconnect() (bug #799688 / #801678). 15 | * Only free will if present when freeing a client context. 16 | -------------------------------------------------------------------------------- /www/posts/2011/08/arch-linux-package.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Gordon Pearce has packaged Mosquitto on Arch Linux through an Arch User 13 | Repository. The package details are at 14 | 15 | 16 | Thanks Gordon! 17 | -------------------------------------------------------------------------------- /www/posts/2010/02/version-0-4-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Fix segfault on client connect with invalid protocol name/version. 15 | 16 | Get it at the [download page]. 17 | 18 | [download page]: /download 19 | -------------------------------------------------------------------------------- /www/posts/2010/04/oggcamp.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I'm going to be at [oggcamp] this coming weekend. If you're there, try and find 13 | me and say hello! I'm planning a talk on mosquitto/mqtt with Andy 14 | Stanford-Clark, so should be relatively easy to find. 15 | 16 | [oggcamp]: http://oggcamp.org/ 17 | -------------------------------------------------------------------------------- /www/posts/2012/08/baby.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | [![baby](/blog/uploads/2012/08/IMAG0006-300x199.jpg)](/blog/uploads/2012/08/IMAG0006.jpg) 14 | 15 | I've recently become a father, so please don't be offended if I take a while to 16 | respond to any mosquitto related queries. 17 | -------------------------------------------------------------------------------- /www/posts/2011/10/mqtt-power-usage-on-android.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Stephen Nicholas has carried out some power usage analysis of MQTT on Android. 13 | Details are at and the conclusion is 14 | that it doesn't use much power. 15 | -------------------------------------------------------------------------------- /www/posts/2011/08/mqtt-standardisation.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | IBM have announced that MQTT is to be formally standardised. If you're 13 | interested in taking part in the process, there are full details at 14 | 15 | -------------------------------------------------------------------------------- /www/posts/2011/11/new-linux-repositories.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I've just added some more Linux repositories to the download page for Fedora 16 13 | and SLE 10, 11 and 11 SP1. 14 | 15 | Note that mosquitto-python isn't available on SLE 10. 16 | 17 | See the [download page](/download). 18 | -------------------------------------------------------------------------------- /www/posts/2010/06/google-powermeter-step-by-step.attachments.json: -------------------------------------------------------------------------------- 1 | {"54": {"wordpress_user_name": "roger", "title": "powermeter-example", "date_utc": "2010-06-15 13:52:24", "files_meta": [{"height": 292, "width": 632}, {"height": 138, "size": "medium", "width": 300}, {"height": 150, "size": "thumbnail", "width": 150}], "files": ["/wp-content/uploads/2010/06/powermeter-example.png", "/wp-content/uploads/2010/06/powermeter-example-300x138.png", "/wp-content/uploads/2010/06/powermeter-example-150x150.png"]}} -------------------------------------------------------------------------------- /www/posts/2014/10/mosquitto-and-poodle.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Details of the POODLE attack that targets SSLv3 have been released recently. 13 | Mosquitto has never provided support for SSLv3 (or SSLv2) so should not be 14 | vulnerable to this attack and does not require any configuration 15 | changes. 16 | -------------------------------------------------------------------------------- /www/posts/2014/05/new-arrival.attachments.json: -------------------------------------------------------------------------------- 1 | {"322": {"wordpress_user_name": "roger", "title": "14098345978_c15d12f19a_z", "date_utc": "2014-05-27 22:29:02", "files_meta": [{"height": 427, "width": 640}, {"height": 200, "size": "medium", "width": 300}, {"height": 150, "size": "thumbnail", "width": 150}], "files": ["/wp-content/uploads/2014/05/14098345978_c15d12f19a_z.jpg", "/wp-content/uploads/2014/05/14098345978_c15d12f19a_z-300x200.jpg", "/wp-content/uploads/2014/05/14098345978_c15d12f19a_z-150x150.jpg"]}} -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | include ../config.mk 2 | 3 | .PHONY: all check test ptest clean 4 | 5 | all : 6 | 7 | check : test 8 | 9 | test : utest 10 | $(MAKE) -C broker test 11 | $(MAKE) -C lib test 12 | $(MAKE) -C client test 13 | 14 | ptest : utest 15 | $(MAKE) -C broker ptest 16 | $(MAKE) -C lib ptest 17 | $(MAKE) -C client test 18 | 19 | utest : 20 | $(MAKE) -C unit test 21 | 22 | reallyclean : clean 23 | clean : 24 | $(MAKE) -C lib clean 25 | $(MAKE) -C broker clean 26 | $(MAKE) -C unit clean 27 | -------------------------------------------------------------------------------- /www/files/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mosquitto", 3 | "icons": [ 4 | { 5 | "src": "/android-chrome-192x192.png", 6 | "sizes": "192x192", 7 | "type": "image/png" 8 | }, 9 | { 10 | "src": "/android-chrome-512x512.png", 11 | "sizes": "512x512", 12 | "type": "image/png" 13 | } 14 | ], 15 | "theme_color": "#ffffff", 16 | "background_color": "#ffffff", 17 | "display": "standalone" 18 | } -------------------------------------------------------------------------------- /test/broker/readme.txt: -------------------------------------------------------------------------------- 1 | ----- Broker Tests ----- 2 | 3 | This folder contains a number of tests to exercise the functionality of the 4 | broker. Feel free to add more. 5 | 6 | Numbering is as follows: 7 | 8 | 01: Connection tests 9 | 02: Subscribe/unsubscribe tests 10 | 03: Publish tests 11 | 04: Retained message tests 12 | 05: Session management tests 13 | 06: Bridge tests 14 | 07: Will tests 15 | 08: TLS tests 16 | 09: Auth tests 17 | 10: Listener tests 18 | 11: Persistence tests 19 | 12: Property tests 20 | -------------------------------------------------------------------------------- /test/lib/mosq_test_helper.py: -------------------------------------------------------------------------------- 1 | import inspect, os, sys 2 | 3 | # From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder 4 | cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) 5 | if cmd_subfolder not in sys.path: 6 | sys.path.insert(0, cmd_subfolder) 7 | 8 | import mosq_test 9 | import mqtt5_props 10 | 11 | import socket 12 | import ssl 13 | import struct 14 | import subprocess 15 | import time 16 | -------------------------------------------------------------------------------- /www/posts/2010/06/mosquitto-0-7rc1.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Mosquitto 0.7 release candidate 1 is available for testing. Please give it a 13 | try and report back any problems you find. The source code is available at  14 | and I'll hopefully have various 15 | binaries available soon. 16 | -------------------------------------------------------------------------------- /misc/currentcost/cc128_read.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -u 2 | 3 | import mosquitto 4 | import serial 5 | 6 | usb = serial.Serial(port='/dev/ttyUSB0', baudrate=57600) 7 | 8 | mosq = mosquitto.Mosquitto() 9 | mosq.connect("localhost") 10 | mosq.loop_start() 11 | 12 | running = True 13 | try: 14 | while running: 15 | line = usb.readline() 16 | mosq.publish("sensors/cc128/raw", line) 17 | except usb.SerialException, e: 18 | running = False 19 | 20 | mosq.disconnect() 21 | mosq.loop_stop() 22 | 23 | -------------------------------------------------------------------------------- /test/lib/09-util-topic-tokenise.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from mosq_test_helper import * 4 | 5 | rc = 1 6 | 7 | client_args = sys.argv[1:] 8 | env = dict(os.environ) 9 | env['LD_LIBRARY_PATH'] = '../../lib:../../lib/cpp' 10 | try: 11 | pp = env['PYTHONPATH'] 12 | except KeyError: 13 | pp = '' 14 | env['PYTHONPATH'] = '../../lib/python:'+pp 15 | 16 | client = mosq_test.start_client(filename=sys.argv[1].replace('/', '-'), cmd=client_args, env=env) 17 | client.wait() 18 | exit(client.returncode) 19 | -------------------------------------------------------------------------------- /www/posts/2010/05/version-0-6-1-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This fixes an important bug that didn't get caught for 0.6 that can prevent old 13 | database versions being upgraded. 14 | 15 | From 0.7 onwards, mosquitto will be using release candidates to ensure this 16 | kind of problem doesn't occur in the future. 17 | -------------------------------------------------------------------------------- /www/posts/2011/02/mosquitto-on-maemo.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Yuvraaj Kelkar got in touch to say he's packaged up mosquitto and the client 13 | libraries for Maemo. If you want to use MQTT on your Maemo device then take a 14 | look at the details on 15 | 16 | Thanks Yuvraaj! 17 | -------------------------------------------------------------------------------- /www/posts/2012/01/version-0-14-4-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release: 13 | 14 | * Fix local bridge notification messages. 15 | * Fix return values for more internal library calls. 16 | * Fix incorrect out of memory checks in library and broker. 17 | * Never time out local bridge connections. 18 | -------------------------------------------------------------------------------- /www/posts/2013/01/version-1-1-1-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | # Broker 15 | 16 | * Fix crash on reload if using acl patterns. 17 | 18 | # Client library 19 | 20 | * Fix static C++ functions not being exported on Windows. Fixes bug #1098256. 21 | 22 | Binaries should be available shortly. 23 | -------------------------------------------------------------------------------- /examples/temperature_conversion/temperature_conversion.h: -------------------------------------------------------------------------------- 1 | #ifndef TEMPERATURE_CONVERSION_H 2 | #define TEMPERATURE_CONVERSION_H 3 | 4 | #include 5 | 6 | class mqtt_tempconv : public mosqpp::mosquittopp 7 | { 8 | public: 9 | mqtt_tempconv(const char *id, const char *host, int port); 10 | ~mqtt_tempconv(); 11 | 12 | void on_connect(int rc); 13 | void on_message(const struct mosquitto_message *message); 14 | void on_subscribe(int mid, int qos_count, const int *granted_qos); 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /www/posts/2011/03/mosquitto-in-mac-homebrew.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Thanks to work done by Adam Rudd, mosquitto is now available in the Mac 13 | [homebrew](https://brew.sh) package manager. Once you've installed homebrew 14 | (see the link), you can install mosquitto with: 15 | 16 | ``` 17 | brew install mosquitto 18 | ``` 19 | -------------------------------------------------------------------------------- /www/posts/2012/08/baby.attachments.json: -------------------------------------------------------------------------------- 1 | {"243": {"wordpress_user_name": "roger", "title": "IMAG0006", "date_utc": "2012-08-22 09:39:33", "files_meta": [{"height": 333, "width": 500, "meta": {"camera": "HTC Wildfire S A510e", "created_timestamp": 1345456796.0, "focal_length": 3.53, "iso": 165.0}}, {"height": 199, "size": "medium", "width": 300}, {"height": 150, "size": "thumbnail", "width": 150}], "files": ["/wp-content/uploads/2012/08/IMAG0006.jpg", "/wp-content/uploads/2012/08/IMAG0006-300x199.jpg", "/wp-content/uploads/2012/08/IMAG0006-150x150.jpg"]}} -------------------------------------------------------------------------------- /.github/workflows/delete-old-workflow-runs.yml: -------------------------------------------------------------------------------- 1 | name: Delete old workflow runs 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '0 0 1 * *' 6 | # Run monthly, at 00:00 on the 1st day of month. 7 | 8 | jobs: 9 | del_runs: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Delete workflow runs 13 | uses: Mattraks/delete-workflow-runs@v2 14 | with: 15 | token: ${{ github.token }} 16 | repository: ${{ github.repository }} 17 | retain_days: 30 18 | keep_minimum_runs: 6 19 | -------------------------------------------------------------------------------- /travis-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | if [ "$TRAVIS_OS_NAME" == "linux" ]; then 5 | sudo apt-get update -qq 6 | sudo apt-get install -y debhelper libc-ares-dev libssl-dev libwrap0-dev python-all python3-all uthash-dev xsltproc docbook-xsl libcunit1-dev 7 | git clone https://github.com/DaveGamble/cJSON 8 | make -C cJSON 9 | sudo make PREFIX=/usr -C cJSON install 10 | fi 11 | 12 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 13 | HOMEBREW_NO_AUTO_UPDATE=1 brew install c-ares cjson openssl libwebsockets 14 | fi 15 | 16 | sudo pip install paho-mqtt 17 | -------------------------------------------------------------------------------- /www/posts/2016/01/test6-mosquitto-org.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Thanks to a short discussion on irc, test6.mosquitto.org now exists. This is a 13 | DNS entry that points to the same address as test.mosquitto.org, but only with 14 | an AAAA record. This means that test6.mosquitto.org can be used to test clients 15 | using IPv6 and to be sure that IPv6 is actually being used. 16 | -------------------------------------------------------------------------------- /www/posts/2011/06/version-0-11-1-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is an important bugfix release. It fixes a buffer overrun that affects 13 | 0.11 only. Users of 0.11 should upgrade immediately. 14 | 15 | * Fix buffer overrun when checking for + and # in topics (bug #799688). 16 | * Pub client now quits if publish fails. 17 | 18 | Thanks to Karl Palsson. 19 | -------------------------------------------------------------------------------- /examples/temperature_conversion/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -ggdb -I../../lib -I../../lib/cpp 2 | LDFLAGS=-L../../lib ../../lib/cpp/libmosquittopp.so.1 ../../lib/libmosquitto.so.1 3 | 4 | .PHONY: all clean 5 | 6 | all : mqtt_temperature_conversion 7 | 8 | mqtt_temperature_conversion : main.o temperature_conversion.o 9 | ${CXX} $^ -o $@ ${LDFLAGS} 10 | 11 | main.o : main.cpp 12 | ${CXX} -c $^ -o $@ ${CFLAGS} 13 | 14 | temperature_conversion.o : temperature_conversion.cpp 15 | ${CXX} -c $^ -o $@ ${CFLAGS} 16 | 17 | clean : 18 | -rm -f *.o mqtt_temperature_conversion 19 | -------------------------------------------------------------------------------- /service/systemd/README: -------------------------------------------------------------------------------- 1 | Select appropriate systemd service based on your compile settings. If you 2 | enabled WITH_SYSTEMD, use mosquitto.service.notify, otherwise use 3 | mosquitto.service.simple. The service must be renamed to mosquitto.service 4 | before usage. Don't forget to change default paths in service file if you 5 | changed the default build settings. 6 | 7 | With WITH_SYSTEMD mosquitto will notify a complete startup after 8 | initialization. This means that follow-up units can be started after full 9 | initialization of mosquitto (i.e. sockets are opened). 10 | -------------------------------------------------------------------------------- /www/posts/2011/07/wireshark-mqtt-decoder.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | If you're trying to debug your MQTT connection, you may be interested in 13 | something Karl P has written - an MQTT decoder/dissector for Wireshark. It 14 | doesn't have complete protocol support yet, but is a good start. 15 | 16 | * 17 | -------------------------------------------------------------------------------- /test/broker/mosq_test_helper.py: -------------------------------------------------------------------------------- 1 | import inspect, os, sys 2 | 3 | # From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder 4 | cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) 5 | if cmd_subfolder not in sys.path: 6 | sys.path.insert(0, cmd_subfolder) 7 | 8 | import mosq_test 9 | import mqtt5_opts 10 | import mqtt5_props 11 | import mqtt5_rc 12 | 13 | import socket 14 | import ssl 15 | import struct 16 | import subprocess 17 | import time 18 | import errno 19 | -------------------------------------------------------------------------------- /www/posts/2016/05/stickers.attachments.json: -------------------------------------------------------------------------------- 1 | {"385": {"wordpress_user_name": "roger", "title": "stickers", "date_utc": "2016-05-10 14:43:38", "files_meta": [{"height": 253, "width": 338, "meta": {"created_timestamp": 1462563610.0, "shutter_speed": 0.5, "focal_length": 48.0, "camera": "NIKON D3200", "aperture": 5.3, "iso": 800.0}}, {"height": 225, "size": "medium", "width": 300}, {"height": 150, "size": "thumbnail", "width": 150}], "files": ["/wp-content/uploads/2016/05/stickers.jpg", "/wp-content/uploads/2016/05/stickers-300x225.jpg", "/wp-content/uploads/2016/05/stickers-150x150.jpg"]}} -------------------------------------------------------------------------------- /www/posts/2017/07/version-1-4-14-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | Version 1.4.13 contained a regression that meant persistence data was only 15 | being saved after client information had been freed. This release fixes that. 16 | 17 | If you use persistence then it is strongly recommended to avoid 1.4.13 so you 18 | do not suffer data loss. 19 | -------------------------------------------------------------------------------- /misc/currentcost/cc128_read.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # Reads data from a Current Cost device via serial port. 4 | # Spawns 5 | 6 | use strict; 7 | use Device::SerialPort qw( :PARAM :STAT 0.07 ); 8 | 9 | my $pubclient = "mosquitto_pub -t sensors/cc128/raw -q 1 -l"; 10 | my $PORT = "/dev/ttyUSB0"; 11 | local $| = 1; 12 | 13 | my $ob = Device::SerialPort->new($PORT); 14 | $ob->baudrate(57600); 15 | $ob->write_settings; 16 | 17 | open(SERIAL, "+<$PORT"); 18 | open(MQTT, "|$pubclient"); 19 | while (my $line = ) { 20 | print(MQTT "$line"); 21 | } 22 | 23 | close(MQTT); 24 | -------------------------------------------------------------------------------- /www/posts/2017/03/for-the-final-time.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | This guy arrived on Tuesday, two weeks early and weighing 9lb 6oz / 4.26kg. 14 | Apologies if I'm a bit out of touch for a while. 15 | 16 | [![baby picture](/blog/uploads/2017/03/img_20170308_155049248_33196894011_o-300x169.jpg "baby picture")](/blog/uploads/2017/03/img_20170308_155049248_33196894011_o.jpg) 17 | -------------------------------------------------------------------------------- /www/posts/2010/05/gentoo-ebuilds-available.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Thanks to Neil Bothwick, there are now some Gentoo ebuilds available for 13 | mosquitto and sqlite3-pcre. You can grab them from the links below - hopefully 14 | they'll be integrated in the near future. 15 | 16 | * 17 | * 18 | -------------------------------------------------------------------------------- /www/posts/2010/10/version-0-8-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Fix compliance with the MQTT protocol for messages published at QoS 2. This 15 | means that messages that time out are dealt with correctly and duplicate 16 | messages are also dealt with correctly. 17 | 18 | See the [download page] for the update. 19 | 20 | [download page]: /download 21 | -------------------------------------------------------------------------------- /www/posts/2016/03/logo-contest.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | We have initiated a paid contest to create a new logo for the Mosquitto 13 | project. 14 | 15 | If you have graphics design skills or know someone who has,  please head over 16 | to the link below to see the design brief and submit your idea. 17 | 18 | 19 | -------------------------------------------------------------------------------- /www/posts/2012/06/ipv6-on-test-server.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The public Mosquitto test server, [test.mosquitto.org] has supported IPv6 since 13 | it was originally put online but the required DNS record was missing. This has 14 | now been fixed so once the record has propagated across the internet you should 15 | be able to test your IPv6 clients. 16 | 17 | [test.mosquitto.org]: http://test.msoquitto.org/ 18 | -------------------------------------------------------------------------------- /plugins/auth-by-ip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/include 2 | ${OPENSSL_INCLUDE_DIR} ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | 4 | add_library(mosquitto_auth_by_ip MODULE mosquitto_auth_by_ip.c) 5 | set_target_properties(mosquitto_auth_by_ip PROPERTIES 6 | POSITION_INDEPENDENT_CODE 1 7 | ) 8 | set_target_properties(mosquitto_auth_by_ip PROPERTIES PREFIX "") 9 | 10 | # Don't install, these are example plugins only. 11 | #install(TARGETS mosquitto_auth_by_ip RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") 12 | -------------------------------------------------------------------------------- /test/lib/c/08-ssl-bad-cacert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | int rc = 1; 10 | struct mosquitto *mosq; 11 | 12 | mosquitto_lib_init(); 13 | 14 | mosq = mosquitto_new("08-ssl-bad-cacert", true, NULL); 15 | if(mosq == NULL){ 16 | return 1; 17 | } 18 | if(mosquitto_tls_set(mosq, "this/file/doesnt/exist", NULL, NULL, NULL, NULL) == MOSQ_ERR_INVAL){ 19 | rc = 0; 20 | } 21 | mosquitto_destroy(mosq); 22 | mosquitto_lib_cleanup(); 23 | return rc; 24 | } 25 | -------------------------------------------------------------------------------- /www/posts/2010/08/mosquitto-running-on-mac-os-x.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Andy Piper has put together a 2 minute screencast demoing mosquitto running on 13 | Mac OS X and showing publishing and subscribing using the mosquitto command 14 | line clients and the IBM java gui client. 15 | 16 | View the screen cast here: . 17 | 18 | Thanks Andy! 19 | -------------------------------------------------------------------------------- /test/random/Makefile: -------------------------------------------------------------------------------- 1 | include ../../config.mk 2 | 3 | .PHONY: all test 4 | 5 | ifeq ($(WITH_SHARED_LIBRARIES),yes) 6 | LIB_DEP:=../../lib/libmosquitto.so.${SOVERSION} 7 | else 8 | LIB_DEP:=../../lib/libmosquitto.a 9 | endif 10 | 11 | all : auth_plugin.so 12 | 13 | auth_plugin.so : auth_plugin.c 14 | $(CC) ${CFLAGS} -fPIC -shared $< -o $@ -I../../lib -I../../src 15 | 16 | ../lib/libmosquitto.so.${SOVERSION} : 17 | $(MAKE) -C ../../lib 18 | 19 | ../lib/libmosquitto.a : 20 | $(MAKE) -C ../../lib libmosquitto.a 21 | 22 | clean : 23 | -rm -f *.o random_client *.gcda *.gcno 24 | 25 | test : all 26 | ./test.py 27 | -------------------------------------------------------------------------------- /www/posts/2012/12/libmosquitto-go-bindings.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I just discovered that Shane Hanna has written a Go language binding for 13 | libmosquitto available at . 14 | Good work Shane! Note that the readme file states: 15 | 16 | > Doesn't expose all of libmosquitto, just what I've needed so far. 17 | 18 | so you shouldn't necessarily expect everything to work. 19 | -------------------------------------------------------------------------------- /www/posts/2012/09/updating-password-files.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Mosquitto 1.0 introduced the use of password files with hashed passwords but 13 | had no way to convert from the old plain text password files. This feature will 14 | be available in version 1.1 but if it is important to you then you can already 15 | get the updated code for the mosquitto_passwd utility at 16 | 17 | -------------------------------------------------------------------------------- /www/posts/2011/03/api-documentation.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I've rewritten the API documentation for the C library using the [NaturalDocs] 13 | format. This covers the whole C library and so should give enough information 14 | for anybody using the C++ or Python wrappers as well. 15 | 16 | The documentation generated from mosquitto.h is available at 17 | 18 | 19 | [NaturalDocs]: http://www.naturaldocs.org/ 20 | -------------------------------------------------------------------------------- /service/systemd/mosquitto.service.simple: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mosquitto MQTT Broker 3 | Documentation=man:mosquitto.conf(5) man:mosquitto(8) 4 | After=network.target 5 | Wants=network.target 6 | 7 | [Service] 8 | ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf 9 | ExecReload=/bin/kill -HUP $MAINPID 10 | Restart=on-failure 11 | ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto 12 | ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto 13 | ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto 14 | ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /test/lib/08-ssl-bad-cacert.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from mosq_test_helper import * 4 | 5 | if sys.version < '2.7': 6 | print("WARNING: SSL not supported on Python 2.6") 7 | exit(0) 8 | 9 | rc = 1 10 | 11 | client_args = sys.argv[1:] 12 | env = dict(os.environ) 13 | env['LD_LIBRARY_PATH'] = '../../lib:../../lib/cpp' 14 | try: 15 | pp = env['PYTHONPATH'] 16 | except KeyError: 17 | pp = '' 18 | env['PYTHONPATH'] = '../../lib/python:'+pp 19 | 20 | client = mosq_test.start_client(filename=sys.argv[1].replace('/', '-'), cmd=client_args, env=env) 21 | client.wait() 22 | 23 | rc = client.returncode 24 | 25 | exit(rc) 26 | -------------------------------------------------------------------------------- /www/posts/2010/12/version-0-9-1-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Add missing code for parsing the `bind_address` configuration option. 15 | * Fix missing include when compiling with tcp-wrappers support. 16 | * Add linker version script for C library to control exported functions. 17 | 18 | Source code is on the [download page], binary packages will follow on later. 19 | 20 | [download page]: /download 21 | -------------------------------------------------------------------------------- /www/posts/2011/01/mosquitto-for-slackware.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Chris Willing of the University of Queensland has very kindly put together some 13 | mosquitto packages for Slackware 13.0 and 13.1 as well as instruction on how to 14 | build your own packages. 15 | 16 | The packages and instructions are here: 17 | I've also put the link on 18 | the downloads page. 19 | 20 | Thanks Chris! 21 | -------------------------------------------------------------------------------- /plugins/message-timestamp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/include 2 | ${OPENSSL_INCLUDE_DIR} ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | 4 | add_library(mosquitto_message_timestamp MODULE mosquitto_message_timestamp.c) 5 | set_target_properties(mosquitto_message_timestamp PROPERTIES 6 | POSITION_INDEPENDENT_CODE 1 7 | ) 8 | set_target_properties(mosquitto_message_timestamp PROPERTIES PREFIX "") 9 | 10 | # Don't install, these are example plugins only. 11 | #install(TARGETS mosquitto_message_timestamp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") 12 | -------------------------------------------------------------------------------- /www/posts/2010/03/version-0-5-4-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Fix memory allocation in `mqtt3_fix_sub_topic()` ([bug #531861]). 15 | * Remove accidental limit of 100 client connections. 16 | * Fix mosquitto_pub handling of messages with QoS>0 ([bug #537061]). 17 | 18 | [bug #531861]: https://bugs.launchpad.net/mosquitto/+bug/531861 19 | [bug #537061]: https://bugs.launchpad.net/mosquitto/+bug/537061 20 | -------------------------------------------------------------------------------- /www/posts/2011/05/version-0-10-1-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release primarily for Windows users. 13 | 14 | * Fix Windows compilation. 15 | * Fix mosquitto.py on Windows - call lib init/cleanup. 16 | * Don't abort when connecting if given an unknown address type (assuming 17 | an IPv4 or IPv6 address is given). 18 | 19 | Please see the [download page]. 20 | 21 | Thanks to Karl Palsson. 22 | 23 | [download page]: /download 24 | -------------------------------------------------------------------------------- /test/broker/12-prop-subpub-content-type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Test whether a client subscribed to a topic receives its own message sent to that topic. 4 | # Does the Content Type property get sent through? 5 | # MQTT v5 6 | 7 | import prop_subpub_helper as helper 8 | from mosq_test_helper import * 9 | 10 | props_out = mqtt5_props.gen_string_prop(mqtt5_props.PROP_CONTENT_TYPE, "text") 11 | props_out = props_out+mqtt5_props.gen_uint16_prop(mqtt5_props.PROP_TOPIC_ALIAS, 1) 12 | 13 | props_in = mqtt5_props.gen_string_prop(mqtt5_props.PROP_CONTENT_TYPE, "text") 14 | 15 | helper.prop_subpub_helper(props_out, props_in, expect_proto_error=False) 16 | -------------------------------------------------------------------------------- /www/posts/2011/02/mqtt-on-android.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Dale Lane has written an enormous blog post [Using MQTT in Android Mobile 13 | Applications in which he talks about a lot of the points you are likely to want 14 | to consider if you're writing MQTT applications for Android. There's lots of 15 | useful information and he even includes a complete source code 16 | implementation. 17 | 18 | [Using MQTT in Android Mobile Applications]: http://dalelane.co.uk/blog/?p=1599 19 | -------------------------------------------------------------------------------- /www/posts/2012/03/upcoming-incompatible-library-changes.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Version 0.16 of the mosquitto client libraries will have some binary 13 | incompatible changes to their APIs. This means that it is a good time to make 14 | other changes that are incompatible. If you think any part of the interface 15 | (see ) is crazy or could be improved in any way, 16 | please get in touch or add a comment below. 17 | -------------------------------------------------------------------------------- /www/posts/2013/01/version-1-1-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | # Client library 15 | 16 | * Fix `tls_cert_reqs` not being set to `SSL_VERIFY_PEER` by default. This 17 | meant that clients were not verifying the server certificate when connecting 18 | over TLS. This affects the C, C++ and Python libraries. 19 | 20 | Source and binaries are available on the [download page]. 21 | 22 | [download page]: /download 23 | -------------------------------------------------------------------------------- /www/posts/2014/05/new-arrival.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | I'm pleased to say that I'm a new father again. My 7lb 12 (3.57kg) boy arrived 14 | today and is quite happy, as is his mother. 15 | 16 | Apologies to anybody who has emailed me recently and I've not yet replied - 17 | this is the main reason! 18 | 19 | [![baby][baby]](/blog/uploads/2014/05/14098345978_c15d12f19a_z.jpg) 20 | 21 | [baby]:/blog/uploads/2014/05/14098345978_c15d12f19a_z-300x200.jpg 22 | -------------------------------------------------------------------------------- /www/posts/2013/02/version-1-1-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a minor bugfix release that addresses some problems identified during 13 | Debian packaging. 14 | 15 | # Broker 16 | 17 | * mosquitto_passwd utility now uses tmpfile() to generate its temporary data 18 | storage file. It also creates a backup file that can be used to recover data 19 | if an errors occur. 20 | 21 |

Other

22 | 23 | * Build script fixes to help packaging on Debian. 24 | -------------------------------------------------------------------------------- /test/old/Makefile: -------------------------------------------------------------------------------- 1 | include ../../config.mk 2 | 3 | CC=cc 4 | CFLAGS=-I../../src -I../../include -I. -I../.. -Wall -ggdb -DDEBUG -DWITH_CLIENT 5 | LDFLAGS= 6 | SOVERSION=1 7 | 8 | .PHONY: all test clean 9 | 10 | all : msgsps_pub msgsps_sub 11 | 12 | msgsps_pub : msgsps_pub.o 13 | ${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION} 14 | 15 | msgsps_pub.o : msgsps_pub.c msgsps_common.h 16 | ${CC} $(CFLAGS) -c $< -o $@ 17 | 18 | msgsps_sub : msgsps_sub.o 19 | ${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION} 20 | 21 | msgsps_sub.o : msgsps_sub.c msgsps_common.h 22 | ${CC} $(CFLAGS) -c $< -o $@ 23 | 24 | clean : 25 | -rm -f *.o msgsps_pub msgsps_sub 26 | -------------------------------------------------------------------------------- /service/systemd/mosquitto.service.notify: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mosquitto MQTT Broker 3 | Documentation=man:mosquitto.conf(5) man:mosquitto(8) 4 | After=network.target 5 | Wants=network.target 6 | 7 | [Service] 8 | Type=notify 9 | NotifyAccess=main 10 | ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf 11 | ExecReload=/bin/kill -HUP $MAINPID 12 | Restart=on-failure 13 | ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto 14 | ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto 15 | ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto 16 | ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /test/broker/08-ssl-bridge-helper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from mosq_test_helper import * 4 | 5 | port = mosq_test.get_port() 6 | 7 | rc = 1 8 | keepalive = 60 9 | connect_packet = mosq_test.gen_connect("test-helper", keepalive=keepalive) 10 | connack_packet = mosq_test.gen_connack(rc=0) 11 | 12 | publish_packet = mosq_test.gen_publish("bridge/ssl/test", qos=0, payload="message") 13 | 14 | disconnect_packet = mosq_test.gen_disconnect() 15 | 16 | sock = mosq_test.do_client_connect(connect_packet, connack_packet, port=port, connack_error="helper connack") 17 | sock.send(publish_packet) 18 | sock.send(disconnect_packet) 19 | sock.close() 20 | 21 | exit(0) 22 | -------------------------------------------------------------------------------- /www/posts/2009/12/version-0-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | * Added logging support. 13 | * Now restarts much more quickly even when the network socket was in use. 14 | * Can now be configured to run on multiple network ports and restricted to 15 | specific network addresses. 16 | * Added host access control in the form of tcp-wrappers support. 17 | 18 | See the [change log](/ChangeLog.txt) for full details. 19 | 20 | Wild card support in topics is coming in the next version. 21 | -------------------------------------------------------------------------------- /test/broker/12-prop-subpub-payload-format.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Test whether a client subscribed to a topic receives its own message sent to that topic. 4 | # Does the Payload Format Indicator property get sent through? 5 | # MQTT v5 6 | 7 | import prop_subpub_helper as helper 8 | from mosq_test_helper import * 9 | 10 | props_out = mqtt5_props.gen_byte_prop(mqtt5_props.PROP_PAYLOAD_FORMAT_INDICATOR, 0xed) 11 | props_out = props_out+mqtt5_props.gen_uint16_prop(mqtt5_props.PROP_TOPIC_ALIAS, 1) 12 | 13 | props_in = mqtt5_props.gen_byte_prop(mqtt5_props.PROP_PAYLOAD_FORMAT_INDICATOR, 0xed) 14 | 15 | helper.prop_subpub_helper(props_out, props_in, expect_proto_error=True) 16 | -------------------------------------------------------------------------------- /test/lib/c/01-no-clean-session.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | int main(int argc, char *argv[]) 9 | { 10 | int rc; 11 | struct mosquitto *mosq; 12 | 13 | int port = atoi(argv[1]); 14 | 15 | mosquitto_lib_init(); 16 | 17 | mosq = mosquitto_new("01-no-clean-session", false, NULL); 18 | if(mosq == NULL){ 19 | return 1; 20 | } 21 | 22 | rc = mosquitto_connect(mosq, "localhost", port, 60); 23 | 24 | while(run == -1){ 25 | mosquitto_loop(mosq, -1, 1); 26 | } 27 | mosquitto_destroy(mosq); 28 | 29 | mosquitto_lib_cleanup(); 30 | return run; 31 | } 32 | -------------------------------------------------------------------------------- /www/posts/2010/07/mosquitto-on-opensuse-11-3.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The upcoming release of [openSUSE], version 11.3, includes extension support 13 | for sqlite3 which means it now has everything required for mosquitto. 14 | 15 | I've created packages for this new version of openSUSE and details can be found 16 | on the [download page]. You just need to wait three days until the release of 17 | 11.3! 18 | 19 | [openSUSE]: http://www.opensuse.org/ 20 | [download page]: /download 21 | -------------------------------------------------------------------------------- /www/posts/2011/07/lua-mqtt-client.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Andy Gelme [reports] that his Lua MQTT client is ready for use. The downloads, 13 | installation and usage instructions, example code and api information are all 14 | available at . I particularly like the 15 | image of it running on a PSP. 16 | 17 | Well done Andy! 18 | 19 | I wonder what the next language to get MQTT support will be? 20 | 21 | [reports]: https://twitter.com/#%21/geekscape/status/96710950979256323 22 | -------------------------------------------------------------------------------- /test/unit/stubs.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | #include 5 | 6 | struct mosquitto_db{ 7 | 8 | }; 9 | 10 | int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...) 11 | { 12 | UNUSED(mosq); 13 | UNUSED(priority); 14 | UNUSED(fmt); 15 | 16 | return 0; 17 | } 18 | 19 | time_t mosquitto_time(void) 20 | { 21 | return 123; 22 | } 23 | 24 | int net__socket_close(struct mosquitto_db *db, struct mosquitto *mosq) 25 | { 26 | UNUSED(db); 27 | UNUSED(mosq); 28 | 29 | return MOSQ_ERR_SUCCESS; 30 | } 31 | 32 | int send__pingreq(struct mosquitto *mosq) 33 | { 34 | UNUSED(mosq); 35 | 36 | return MOSQ_ERR_SUCCESS; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /www/posts/2011/01/mqtt-news.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Here are some MQTT updates from out there on the internet: 13 | 14 | A new perl client implementation by Mark Hindess 15 | 16 | * 17 | 18 | A [homebrew] recipe for installing mosquitto on Mac by Adam Rudd 19 | 20 | * 21 | 22 | MQTT implemented for the mbed processor by Yiluin Fan 23 | 24 | * 25 | 26 | [homebrew]: http://brew.sh/ 27 | -------------------------------------------------------------------------------- /www/posts/2011/02/lightweight-messaging-and-linux.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Andy Piper was at [Linux Conf Australia] this year and gave a talk on MQTT. 13 | 14 | His blog post Lightweight Messaging and Linux] gives a few details and has a 15 | link to the slides. The video can be seen at 16 | 17 | 18 | [Linux Conf Australia]: http://linux.conf.au/ 19 | [Lightweight Messaging and Linux]: http://andypiper.co.uk/2011/01/28/lightweight-messaging-and-linux/ 20 | -------------------------------------------------------------------------------- /www/posts/2018/01/mosquitto-debian-repo-key-updated.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | If you are using the [debian repository] at repo.mosquitto.org you may have 13 | noticed that the repository signing key expired at the end of 2017. To get the 14 | updated key use the following commands: 15 | 16 | ``` 17 | wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key 18 | sudo apt-key add mosquitto-repo.gpg.key 19 | ``` 20 | 21 | [debian repository]:/blog/2013/01/mosquitto-debian-repository 22 | -------------------------------------------------------------------------------- /man/html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | man.css 6 | 7 | ansi 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/subscribe_simple/single.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "mosquitto.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | int rc; 8 | struct mosquitto_message *msg; 9 | 10 | mosquitto_lib_init(); 11 | 12 | rc = mosquitto_subscribe_simple( 13 | &msg, 1, true, 14 | "irc/#", 0, 15 | "test.mosquitto.org", 1883, 16 | NULL, 60, true, 17 | NULL, NULL, 18 | NULL, NULL); 19 | 20 | if(rc){ 21 | printf("Error: %s\n", mosquitto_strerror(rc)); 22 | mosquitto_lib_cleanup(); 23 | return rc; 24 | } 25 | 26 | printf("%s %s\n", msg->topic, (char *)msg->payload); 27 | mosquitto_message_free(&msg); 28 | 29 | mosquitto_lib_cleanup(); 30 | 31 | return 0; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /www/posts/2010/09/debian-packages.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I've created some packages for Debian on i386 and amd64. They can be found at 13 | . They are almost identical to the 14 | Ubuntu packages (Debian doesn't use upstart, so there is a different init 15 | script), but compiled against Debian testing (Squeeze) instead. This is because 16 | Debian 5 (Lenny) doesn't include a recent enough version of sqlite3. 17 | 18 | Please let me know if you have any problems with the packages. 19 | -------------------------------------------------------------------------------- /apps/mosquitto_passwd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/include 2 | ${mosquitto_SOURCE_DIR}/lib ${mosquitto_SOURCE_DIR}/src 3 | ${OPENSSL_INCLUDE_DIR} ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 4 | 5 | if (WITH_TLS) 6 | add_executable(mosquitto_passwd 7 | mosquitto_passwd.c 8 | get_password.c get_password.h 9 | ../../lib/memory_mosq.c ../../lib/memory_mosq.h 10 | ../../src/memory_public.c 11 | ../../lib/misc_mosq.c 12 | ../../src/password_mosq.c ../../src/password_mosq.h 13 | ) 14 | 15 | 16 | target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES}) 17 | install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") 18 | endif (WITH_TLS) 19 | -------------------------------------------------------------------------------- /test/ssl/crl-empty.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN X509 CRL----- 2 | MIIBwDCBqQIBATANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQGEwJHQjETMBEGA1UE 3 | CAwKRGVyYnlzaGlyZTEaMBgGA1UECgwRTW9zcXVpdHRvIFByb2plY3QxEDAOBgNV 4 | BAsMB1Rlc3RpbmcxEzARBgNVBAMMClNpZ25pbmcgQ0EXDTIwMDIyNTE0NTQxOVoY 5 | DzIxMDIwNDE2MTQ1NDE5WqAOMAwwCgYDVR0UBAMCAQEwDQYJKoZIhvcNAQELBQAD 6 | ggEBADXrRSpMfj+Iuz/Uy/ti4k0Qx+H/e93pown8Cgx/w9FwtsTsaTKOff0r3uKb 7 | KpKJJ4BSkysUOaZ72cLoooNYoEcYgpcqx3PlhmjuBGcOH1YG5ca+nzIayZgQe3Nl 8 | hGBvYfpX+YMpG7gHy5WPxi0T+uUF7XfTEfpmw8asVSZvZNy0nMB3cZCCA4yiICay 9 | vaOIrrHshSlDPw6iafhcBNLAdq5Xz+KF4Pv78Wfs+zwnm0BzRGtVB7cWCaGvUi3v 10 | dAqzzBsdP0naFYVaZ1BJcE06Dn5O6LSA6snOswCTGOYI50zMZzRXkUo3pZ/xqVPc 11 | Cdo6QspVlxGedSxXD13KbGPAoak= 12 | -----END X509 CRL----- 13 | -------------------------------------------------------------------------------- /www/posts/2010/08/compiling-mosquitto-on-mac-os-x.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | In a follow up to his screencast [demoing mosquitto on Mac OS X], Andy Piper 13 | has written a blog post detailing how he got compiled mosquitto and, more 14 | importantly, the dependencies, on the Mac. 15 | 16 | Take a look over at [OS X mosquitto "bites"...] 17 | 18 | [demoing mosquitto on Mac OS X]: /blog/2010/08/mosquitto-running-on-mac-os-x/ 19 | [OS X mosquitto "bites"...]: http://andypiper.co.uk/2010/08/08/os-x-mosquitto-bites/ 20 | -------------------------------------------------------------------------------- /test/lib/c/01-unpwd-set.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | int main(int argc, char *argv[]) 9 | { 10 | int rc; 11 | struct mosquitto *mosq; 12 | 13 | int port = atoi(argv[1]); 14 | 15 | mosquitto_lib_init(); 16 | 17 | mosq = mosquitto_new("01-unpwd-set", true, NULL); 18 | if(mosq == NULL){ 19 | return 1; 20 | } 21 | mosquitto_username_pw_set(mosq, "uname", ";'[08gn=#"); 22 | 23 | rc = mosquitto_connect(mosq, "localhost", port, 60); 24 | 25 | while(run == -1){ 26 | mosquitto_loop(mosq, -1, 1); 27 | } 28 | mosquitto_destroy(mosq); 29 | 30 | mosquitto_lib_cleanup(); 31 | return run; 32 | } 33 | -------------------------------------------------------------------------------- /test/lib/cpp/08-ssl-bad-cacert.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int run = -1; 4 | 5 | class mosquittopp_test : public mosqpp::mosquittopp 6 | { 7 | public: 8 | mosquittopp_test(const char *id); 9 | }; 10 | 11 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 12 | { 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct mosquittopp_test *mosq; 18 | int rc = 1; 19 | 20 | mosqpp::lib_init(); 21 | 22 | mosq = new mosquittopp_test("08-ssl-bad-cacert"); 23 | 24 | mosq->tls_opts_set(1, "tlsv1", NULL); 25 | if(mosq->tls_set("this/file/doesnt/exist") == MOSQ_ERR_INVAL){ 26 | rc = 0; 27 | } 28 | delete mosq; 29 | mosqpp::lib_cleanup(); 30 | 31 | return rc; 32 | } 33 | -------------------------------------------------------------------------------- /apps/Makefile: -------------------------------------------------------------------------------- 1 | DIRS= \ 2 | db_dump \ 3 | mosquitto_ctrl \ 4 | mosquitto_passwd 5 | 6 | .PHONY : all binary check clean reallyclean test install uninstall 7 | 8 | all : 9 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d}; done 10 | 11 | binary : 12 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 13 | 14 | clean : 15 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 16 | 17 | reallyclean : 18 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 19 | 20 | check : test 21 | test : 22 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 23 | 24 | install : 25 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 26 | 27 | uninstall : 28 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 29 | -------------------------------------------------------------------------------- /test/unit/tls_stubs.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | #include 5 | 6 | int tls_ex_index_mosq; 7 | 8 | struct mosquitto_db{ 9 | 10 | }; 11 | 12 | int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...) 13 | { 14 | UNUSED(mosq); 15 | UNUSED(priority); 16 | UNUSED(fmt); 17 | 18 | return 0; 19 | } 20 | 21 | time_t mosquitto_time(void) 22 | { 23 | return 123; 24 | } 25 | 26 | int net__socket_close(struct mosquitto_db *db, struct mosquitto *mosq) 27 | { 28 | UNUSED(db); 29 | UNUSED(mosq); 30 | 31 | return MOSQ_ERR_SUCCESS; 32 | } 33 | 34 | int send__pingreq(struct mosquitto *mosq) 35 | { 36 | UNUSED(mosq); 37 | 38 | return MOSQ_ERR_SUCCESS; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /www/posts/2011/12/version-0-14-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Fix potential crash when client connects with an invalid CONNECT packet. 15 | * Fix incorrect invalid socket comparison on Windows. 16 | * Server shouldn't crash when a message is published to foo/ when a 17 | subscription to foo/# exists (bug #901697). 18 | * SO_REUSEADDR doesn't work the same on Windows, so don't use it. 19 | * Cygwin builds now support Windows service features. 20 | * Fix $SYS/broker/bytes/sent reporting. 21 | -------------------------------------------------------------------------------- /www/posts/2012/11/version-1-0-5-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | # Broker 15 | 16 | * Fix crash when the broker has `use_identity_as_username` set to true but a 17 | client connects without a certificate. 18 | * mosquitto_passwd should only be installed if `WITH_TLS=yes`. 19 | 20 | # Library 21 | 22 | * Use symbolic errno values rather than numbers in Python module to avoid 23 | cross platform issues (incorrect errno on Mac OS). 24 | 25 | # Other 26 | 27 | * Build script fixes for FreeBSD. 28 | -------------------------------------------------------------------------------- /www/posts/2014/08/version-1-3-4-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. The reason for the rapid release of the past two 13 | versions is down to a Debian developer reviewing the mosquitto package. This is 14 | a good opportunity to ensure that as bug free a version as possible is present 15 | in Debian. 16 | 17 | # Broker 18 | 19 | * Don't ask client for certificate when `require_certificate` is **false**. 20 | * Backout incomplete functionality that was incorrectly included in 1.3.2. 21 | 22 | Binaries will follow shortly. 23 | -------------------------------------------------------------------------------- /www/posts/2023/09/version-2-0-18-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Version 2.0.18 of Mosquitto has been released. This is a bugfix release. 13 | 14 | Broker: 15 | - Fix crash on subscribe under certain unlikely conditions. Closes [#2885]. 16 | Closes [#2881]. 17 | 18 | Clients: 19 | - Fix mosquitto_rr not honouring `-R`. Closes [#2893]. 20 | 21 | [#2881]: https://github.com/eclipse/mosquitto/issues/2881 22 | [#2885]: https://github.com/eclipse/mosquitto/issues/2885 23 | [#2893]: https://github.com/eclipse/mosquitto/issues/2893 24 | -------------------------------------------------------------------------------- /test/ssl/crl.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN X509 CRL----- 2 | MIIB1jCBvwIBATANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQGEwJHQjETMBEGA1UE 3 | CAwKRGVyYnlzaGlyZTEaMBgGA1UECgwRTW9zcXVpdHRvIFByb2plY3QxEDAOBgNV 4 | BAsMB1Rlc3RpbmcxEzARBgNVBAMMClNpZ25pbmcgQ0EXDTIwMDIyNTE0NTQxOVoY 5 | DzIxMDIwNDE2MTQ1NDE5WjAUMBICAQUXDTIwMDIyNTE0NTQxOVqgDjAMMAoGA1Ud 6 | FAQDAgECMA0GCSqGSIb3DQEBCwUAA4IBAQCMM5PyBAY5BuNVk0k2Bqn5FvlIrSnS 7 | LMZaoUVG/OtgjMD6g47dSXVHgIXmuFu3Bp44mRM85ZVd1URjmjR4ZwfVfcprkqo7 8 | L655K+nyPUoq5IZh7y4MKVYwbEfetu0HjWuOqFI9T7zalOF9MfeoOx6u93CTgUvy 9 | 1s5EVnG0d0qon3CEHTJwpzYQDgXVesUX0ZqNwvKnMGQhB8YQ/NOX807xQR5Ckl7s 10 | 6CYkAySe84lMascnwe1nFp3nGIxbOTxXqohWkvscM6933+veisgh6F4p63oF4rKs 11 | Xr93Bf9FsvwfitI/PfMWkKzFEEaZTjAM26ioLgBBcBxxIJleLysyudd2 12 | -----END X509 CRL----- 13 | -------------------------------------------------------------------------------- /.github/workflows/coverity-scan-fixes.yml: -------------------------------------------------------------------------------- 1 | name: Coverity Scan fixes branch on a weekly basis 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "7 3 * * 3" 7 | 8 | jobs: 9 | coverity: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | with: 14 | ref: fixes 15 | 16 | - name: Dependencies 17 | run: sudo apt-get install -y libcjson-dev libsqlite3-dev libssl-dev uthash-dev 18 | 19 | - uses: vapier/coverity-scan-action@v1 20 | with: 21 | build_language: 'cxx' 22 | project: "eclipse/mosquitto" 23 | token: ${{ secrets.COVERITY_SCAN_TOKEN }} 24 | email: ${{ secrets.COVERITY_SCAN_EMAIL }} 25 | command: "make binary" 26 | 27 | -------------------------------------------------------------------------------- /www/posts/2010/03/version-0-5-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Will messages are now only sent when a client disconnects unexpectedly. 15 | * Fix all incoming topics/subscriptions that start with a / or contain 16 | multiple / in a row (//). This should finally fix bug [#530099]. 17 | * Do actually disconnect client when it sends an empty subscription/topic 18 | string. 19 | * Add missing $SYS/broker/clients/total to man page. 20 | 21 | [#530099]: https://bugs.launchpad.net/mosquitto/+bug/530099 22 | -------------------------------------------------------------------------------- /.github/workflows/coverity-scan-develop.yml: -------------------------------------------------------------------------------- 1 | name: Coverity Scan develop branch on a weekly basis 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "7 3 * * 0" 7 | 8 | jobs: 9 | coverity: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | with: 14 | ref: develop 15 | 16 | - name: Dependencies 17 | run: sudo apt-get install -y libcjson-dev libsqlite3-dev libssl-dev uthash-dev 18 | 19 | - uses: vapier/coverity-scan-action@v1 20 | with: 21 | build_language: 'cxx' 22 | project: "eclipse/mosquitto" 23 | token: ${{ secrets.COVERITY_SCAN_TOKEN }} 24 | email: ${{ secrets.COVERITY_SCAN_EMAIL }} 25 | command: "make binary" 26 | 27 | -------------------------------------------------------------------------------- /www/posts/2010/05/mqtt-push-on-android.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | If you want to use MQTT for push in Android apps, you'll probably want to head 13 | over to Anton L's blog post [How to Implement Push Notifications for Android]. 14 | He has a sample Android app that uses the IBM Java library to implement push 15 | notifications using MQTT, as well as a web page solution to demo pushing 16 | notifications to your phone. 17 | 18 | [How to Implement Push Notifications for Android]: http://tokudu.com/2010/how-to-implement-push-notifications-for-android/ 19 | -------------------------------------------------------------------------------- /www/posts/2010/04/mind-control-mqtt.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | If you're in the UK, you may be interested in watching the Wednesday 21st April 13 | episode of "Bang Goes the Theory". IBM employees [Nicholas O'Leary] and [Kevin 14 | Brown] will be in one of the segments, on controlling remote control cars with 15 | their minds - all with MQTT under the covers! 16 | 17 | * [BBC programme link] 18 | 19 | [Nicholas O'Leary]: http://twitter.com/knolleary 20 | [Kevin Brown]: http://twitter.com/kevinxbrown 21 | [BBC programme link]: https://www.bbc.co.uk/programmes/b00s5fvq 22 | -------------------------------------------------------------------------------- /www/posts/2012/08/bugfix-coming-soon.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | A few bugs have been identified with the 1.0 release; thanks to everyone who 13 | has got in touch about it. They're mostly documentation/build script mistakes 14 | (see [ChangeLog.txt]), but there is a Python bug that makes it worthwhile 15 | making a quick bugfix release. 16 | 17 | I intend to make the release this evening (in around 8 hours from this post), 18 | so if you have anything you think needs fixing please try and get in touch 19 | before then. 20 | 21 | [ChangeLog.txt]: /ChangeLog.txt 22 | -------------------------------------------------------------------------------- /examples/subscribe_simple/callback.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "mosquitto.h" 4 | 5 | int on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg) 6 | { 7 | printf("%s %s (%d)\n", msg->topic, (const char *)msg->payload, msg->payloadlen); 8 | return 0; 9 | } 10 | 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | int rc; 15 | 16 | mosquitto_lib_init(); 17 | 18 | rc = mosquitto_subscribe_callback( 19 | on_message, NULL, 20 | "irc/#", 0, 21 | "test.mosquitto.org", 1883, 22 | NULL, 60, true, 23 | NULL, NULL, 24 | NULL, NULL); 25 | 26 | if(rc){ 27 | printf("Error: %s\n", mosquitto_strerror(rc)); 28 | } 29 | 30 | mosquitto_lib_cleanup(); 31 | 32 | return rc; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /security/mosquitto.apparmor: -------------------------------------------------------------------------------- 1 | /usr/sbin/mosquitto { 2 | #include 3 | #include 4 | 5 | /usr/sbin/mosquitto r, 6 | /etc/mosquitto/mosquitto.conf r, 7 | /etc/mosquitto/ca_certificates/* r, 8 | /etc/mosquitto/certs/* r, 9 | /etc/mosquitto/conf.d/* r, 10 | /var/lib/mosquitto/ r, 11 | /var/lib/mosquitto/mosquitto.db rwk, 12 | /var/lib/mosquitto/mosquitto.db.new rwk, 13 | /var/run/mosquitto.pid rw, 14 | 15 | network inet stream, 16 | network inet6 stream, 17 | network inet dgram, 18 | network inet6 dgram, 19 | 20 | # For drop privileges 21 | capability setgid, 22 | capability setuid, 23 | 24 | # For tcp-wrappers 25 | /lib{,32,64}/libwrap.so* rm, 26 | /etc/hosts.allow r, 27 | /etc/hosts.deny r, 28 | } 29 | -------------------------------------------------------------------------------- /plugins/deny-protocol-version/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (PLUGIN_NAME mosquitto_deny_protocol_version) 2 | 3 | add_library(${PLUGIN_NAME} MODULE 4 | ${PLUGIN_NAME}.c 5 | ) 6 | 7 | target_include_directories(${PLUGIN_NAME} PRIVATE 8 | "${OPENSSL_INCLUDE_DIR}" 9 | "${STDBOOL_H_PATH} ${STDINT_H_PATH}" 10 | "${mosquitto_SOURCE_DIR}" 11 | "${mosquitto_SOURCE_DIR}/include" 12 | ) 13 | 14 | set_target_properties(${PLUGIN_NAME} PROPERTIES 15 | PREFIX "" 16 | POSITION_INDEPENDENT_CODE 1 17 | ) 18 | 19 | if(WIN32) 20 | target_link_libraries(${PLUGIN_NAME} PRIVATE mosquitto) 21 | endif() 22 | 23 | # Don't install, these are example plugins only. 24 | #install(TARGETS ${PLUGIN_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") 25 | -------------------------------------------------------------------------------- /www/posts/2015/11/version-1-4-5-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release: 13 | 14 | # Broker 15 | 16 | * Fix possible memory leak if bridge using SSL attempts to connect to a host 17 | that is not up. 18 | * Free unused topic tree elements (fix in 1.4.3 was incomplete). Closes 19 | [#468987]. 20 | 21 | # Clients 22 | 23 | * `mosquitto_pub -l` now no longer limited to 1024 byte lines. Closes 24 | [#478917]. 25 | 26 | [#468987]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=468987 27 | [#478917]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=478917 28 | -------------------------------------------------------------------------------- /www/posts/2021/11/version-2-0-14-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Versions 2.0.14 of Mosquitto has been released. This is a bugfix release. 13 | 14 | # Broker 15 | - Fix bridge not respecting receive-maximum when reconnecting with MQTT v5. 16 | 17 | # Client library 18 | - Fix `mosquitto_topic_matches_sub2()` not using the length parameters. 19 | Closes [#2364]. 20 | - Fix incorrect `subscribe_callback` in mosquittopp.h. Closes [#2367]. 21 | 22 | [#2364]: https://github.com/eclipse/mosquitto/issues/2364 23 | [#2367]: https://github.com/eclipse/mosquitto/issues/2367 24 | -------------------------------------------------------------------------------- /test/lib/c/01-will-set.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | int main(int argc, char *argv[]) 9 | { 10 | int rc; 11 | struct mosquitto *mosq; 12 | 13 | int port = atoi(argv[1]); 14 | 15 | mosquitto_lib_init(); 16 | 17 | mosq = mosquitto_new("01-will-set", true, NULL); 18 | if(mosq == NULL){ 19 | return 1; 20 | } 21 | mosquitto_will_set(mosq, "topic/on/unexpected/disconnect", strlen("will message"), "will message", 1, true); 22 | 23 | rc = mosquitto_connect(mosq, "localhost", port, 60); 24 | 25 | while(run == -1){ 26 | mosquitto_loop(mosq, -1, 1); 27 | } 28 | mosquitto_destroy(mosq); 29 | 30 | mosquitto_lib_cleanup(); 31 | return run; 32 | } 33 | -------------------------------------------------------------------------------- /README-tests.md: -------------------------------------------------------------------------------- 1 | # Tests 2 | 3 | ## Running 4 | 5 | The Mosquitto test suite can be invoked using either of 6 | 7 | ``` 8 | make test 9 | make check 10 | ``` 11 | 12 | The tests run in series and due to the nature of some of the tests being made 13 | can take a while. 14 | 15 | ## Parallel Tests 16 | 17 | To run the tests with some parallelism, use 18 | 19 | ``` 20 | make ptest 21 | ``` 22 | 23 | This runs up to 20 tests in parallel at once, yielding much faster overall run 24 | time at the expense of having up to 20 instances of Python running at once. 25 | This is not a particularly CPU intensive option, but does require more memory 26 | and may be unsuitable on e.g. a Raspberry Pi. 27 | 28 | ## Dependencies 29 | 30 | The tests require Python 3 and CUnit to be installed. 31 | -------------------------------------------------------------------------------- /www/posts/2011/05/mqtt-ontology.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Mark Hindess has written a blog post titled [Home Automation Protocols: MQTT], 13 | where he asks for suggestions on how to go forward making "a specification for 14 | topic usage and semantics". I think this kind of work is really valuable to 15 | make it easy to have different MQTT systems that can interoperate. If you've 16 | got any suggestions you can make, please go and leave a comment 17 | there. 18 | 19 | [Home Automation Protocols: MQTT]: http://www.temporalanomaly.com/blog/2011/05/02/home-automation-protocols:-mqtt 20 | -------------------------------------------------------------------------------- /www/posts/2010/01/mailing-list-irc.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | We've created some new support channels for mosquitto - a mailing list and an 13 | irc channel. Although they are both intended for providing support for 14 | mosquitto itself, general discussion of anything to do with mqtt is strongly 15 | encouraged. We want to reduce the barrier to getting started and provide a 16 | place where people can share their experiences. 17 | 18 | The mailing list is at 19 | 20 | The irc channel is #mqtt on the [freenode network] 21 | 22 | [freenode network]: http://freenode.net/ 23 | -------------------------------------------------------------------------------- /doc/joss-paper/codemeta.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld", 3 | "@type": "Code", 4 | "author": [ 5 | { 6 | "@id": "http://orcid.org/0000-0001-9218-7797", 7 | "@type": "Person", 8 | "email": "", 9 | "name": "Roger A. Light", 10 | "affiliation": "" 11 | } 12 | ], 13 | "identifier": "", 14 | "codeRepository": "https://github.com/eclipse/mosquitto", 15 | "datePublished": "2017-05-17", 16 | "dateModified": "2017-05-17", 17 | "dateCreated": "2017-05-17", 18 | "description": "Broker and client implementation of the MQTT protocol.", 19 | "keywords": "IoT, MQTT, messaging, pubsub", 20 | "license": "EPL 2.0 / EDL 2.0", 21 | "title": "Mosquitto", 22 | "version": "v1.4.11" 23 | } -------------------------------------------------------------------------------- /plugins/auth-by-ip/Makefile: -------------------------------------------------------------------------------- 1 | include ../../config.mk 2 | 3 | .PHONY : all binary check clean reallyclean test install uninstall 4 | 5 | PLUGIN_NAME=mosquitto_auth_by_ip 6 | 7 | all : binary 8 | 9 | binary : ${PLUGIN_NAME}.so 10 | 11 | ${PLUGIN_NAME}.so : ${PLUGIN_NAME}.c 12 | $(CROSS_COMPILE)$(CC) $(PLUGIN_CPPFLAGS) $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) -fPIC -shared $< -o $@ 13 | 14 | reallyclean : clean 15 | clean: 16 | -rm -f *.o ${PLUGIN_NAME}.so *.gcda *.gcno 17 | 18 | check: test 19 | test: 20 | 21 | install: ${PLUGIN_NAME}.so 22 | # Don't install, these are examples only. 23 | #$(INSTALL) -d "${DESTDIR}$(libdir)" 24 | #$(INSTALL) ${STRIP_OPTS} ${PLUGIN_NAME}.so "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 25 | 26 | uninstall : 27 | -rm -f "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 28 | -------------------------------------------------------------------------------- /www/posts/2012/10/version-1-0-4-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | # Broker 15 | 16 | * Deal with poll() POLLIN/POLLOUT before POLL[RD]HUP to correctly handle the 17 | case where a client sends data and immediately closes its socket. 18 | 19 | # Library 20 | 21 | * Fix memory leak with messages of QoS=2. Fixes bug #1064981. 22 | * Fix potential thread synchronisation problem with outgoing packets in the 23 | Python module. Fixes bug #1064977. 24 | 25 | # Clients 26 | 27 | * Fix `mosquitto_sub -l` incorrectly only sending one message per second. 28 | -------------------------------------------------------------------------------- /www/posts/2015/09/version-1-4-4-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Don't leak sockets when outgoing bridge with multiple addresses cannot 15 | * connect. Closes [#477571]. 16 | * Fix cross compiling of websockets. Closes [#475807]. 17 | * Fix memory free related crashes on openwrt and FreeBSD. Closes [#475707]. 18 | * Fix excessive calls to message retry check. 19 | 20 | [#477571]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=477571 21 | [#475707]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475707 22 | [#475807]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475807 23 | -------------------------------------------------------------------------------- /plugins/Makefile: -------------------------------------------------------------------------------- 1 | DIRS= \ 2 | auth-by-ip \ 3 | deny-protocol-version \ 4 | dynamic-security \ 5 | message-timestamp \ 6 | payload-modification 7 | 8 | .PHONY : all binary check clean reallyclean test install uninstall 9 | 10 | all : 11 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d}; done 12 | 13 | binary : 14 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 15 | 16 | clean : 17 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 18 | 19 | reallyclean : 20 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 21 | 22 | check : test 23 | test : 24 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 25 | 26 | install : 27 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 28 | 29 | uninstall : 30 | set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done 31 | -------------------------------------------------------------------------------- /plugins/message-timestamp/Makefile: -------------------------------------------------------------------------------- 1 | include ../../config.mk 2 | 3 | .PHONY : all binary check clean reallyclean test install uninstall 4 | 5 | PLUGIN_NAME=mosquitto_message_timestamp 6 | 7 | all : binary 8 | 9 | binary : ${PLUGIN_NAME}.so 10 | 11 | ${PLUGIN_NAME}.so : ${PLUGIN_NAME}.c 12 | $(CROSS_COMPILE)$(CC) $(PLUGIN_CPPFLAGS) $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) -fPIC -shared $< -o $@ 13 | 14 | reallyclean : clean 15 | clean: 16 | -rm -f *.o ${PLUGIN_NAME}.so *.gcda *.gcno 17 | 18 | check: test 19 | test: 20 | 21 | install: ${PLUGIN_NAME}.so 22 | # Don't install, these are examples only. 23 | #$(INSTALL) -d "${DESTDIR}$(libdir)" 24 | #$(INSTALL) ${STRIP_OPTS} ${PLUGIN_NAME}.so "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 25 | 26 | uninstall : 27 | -rm -f "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 28 | -------------------------------------------------------------------------------- /plugins/payload-modification/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/include 2 | ${OPENSSL_INCLUDE_DIR} ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_SOURCE_DIR}) 4 | 5 | add_library(mosquitto_payload_modification MODULE mosquitto_payload_modification.c) 6 | set_target_properties(mosquitto_payload_modification PROPERTIES 7 | POSITION_INDEPENDENT_CODE 1 8 | ) 9 | set_target_properties(mosquitto_payload_modification PROPERTIES PREFIX "") 10 | if(WIN32) 11 | target_link_libraries(mosquitto_payload_modification mosquitto) 12 | endif(WIN32) 13 | 14 | # Don't install, these are example plugins only. 15 | #install(TARGETS mosquitto_payload_modification RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") 16 | -------------------------------------------------------------------------------- /test/lib/cpp/01-unpwd-set.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static int run = -1; 5 | 6 | class mosquittopp_test : public mosqpp::mosquittopp 7 | { 8 | public: 9 | mosquittopp_test(const char *id); 10 | }; 11 | 12 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 13 | { 14 | } 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | struct mosquittopp_test *mosq; 19 | 20 | int port = atoi(argv[1]); 21 | 22 | mosqpp::lib_init(); 23 | 24 | mosq = new mosquittopp_test("01-unpwd-set"); 25 | mosq->username_pw_set("uname", ";'[08gn=#"); 26 | 27 | mosq->connect("localhost", port, 60); 28 | 29 | while(run == -1){ 30 | mosq->loop(); 31 | } 32 | delete mosq; 33 | 34 | delete mosq; 35 | mosqpp::lib_cleanup(); 36 | 37 | return run; 38 | } 39 | -------------------------------------------------------------------------------- /lib/time_mosq.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2020 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License 2.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | https://www.eclipse.org/legal/epl-2.0/ 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 14 | 15 | Contributors: 16 | Roger Light - initial implementation and documentation. 17 | */ 18 | 19 | #ifndef TIME_MOSQ_H 20 | #define TIME_MOSQ_H 21 | 22 | void mosquitto_time_init(void); 23 | time_t mosquitto_time(void); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /plugins/payload-modification/Makefile: -------------------------------------------------------------------------------- 1 | include ../../config.mk 2 | 3 | .PHONY : all binary check clean reallyclean test install uninstall 4 | 5 | PLUGIN_NAME=mosquitto_payload_modification 6 | 7 | all : binary 8 | 9 | binary : ${PLUGIN_NAME}.so 10 | 11 | ${PLUGIN_NAME}.so : ${PLUGIN_NAME}.c 12 | $(CROSS_COMPILE)$(CC) $(PLUGIN_CPPFLAGS) $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) -fPIC -shared $< -o $@ 13 | 14 | reallyclean : clean 15 | clean: 16 | -rm -f *.o ${PLUGIN_NAME}.so *.gcda *.gcno 17 | 18 | check: test 19 | test: 20 | 21 | install: ${PLUGIN_NAME}.so 22 | # Don't install, these are examples only. 23 | #$(INSTALL) -d "${DESTDIR}$(libdir)" 24 | #$(INSTALL) ${STRIP_OPTS} ${PLUGIN_NAME}.so "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 25 | 26 | uninstall : 27 | -rm -f "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 28 | -------------------------------------------------------------------------------- /www/posts/2023/08/version-2-0-17-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Version 2.0.17 of Mosquitto has been released. This is a bugfix release. 13 | 14 | Broker: 15 | - Fix `max_queued_messages 0` stopping clients from receiving messages. 16 | Closes [#2879]. 17 | - Fix `max_inflight_messages` not being set correctly. Closes [#2876]. 18 | 19 | Apps: 20 | - Fix `mosquitto_passwd -U` backup file creation. Closes [#2873]. 21 | 22 | [#2873]: https://github.com/eclipse/mosquitto/issues/2873 23 | [#2876]: https://github.com/eclipse/mosquitto/issues/2876 24 | [#2879]: https://github.com/eclipse/mosquitto/issues/2879 25 | -------------------------------------------------------------------------------- /test/lib/cpp/01-no-clean-session.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static int run = -1; 5 | 6 | class mosquittopp_test : public mosqpp::mosquittopp 7 | { 8 | public: 9 | mosquittopp_test(const char *id, bool clean_session); 10 | }; 11 | 12 | mosquittopp_test::mosquittopp_test(const char *id, bool clean_session) : mosqpp::mosquittopp(id, clean_session) 13 | { 14 | } 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | struct mosquittopp_test *mosq; 19 | 20 | int port = atoi(argv[1]); 21 | 22 | mosqpp::lib_init(); 23 | 24 | mosq = new mosquittopp_test("01-no-clean-session", false); 25 | 26 | mosq->connect("localhost", port, 60); 27 | 28 | while(run == -1){ 29 | mosq->loop(); 30 | } 31 | delete mosq; 32 | 33 | delete mosq; 34 | mosqpp::lib_cleanup(); 35 | 36 | return run; 37 | } 38 | -------------------------------------------------------------------------------- /www/posts/2020/06/test-mosquitto-org-cert-updated.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The CA certificate and server certificate for the broker running at 13 | [test.mosquitto.org] has been updated to use a stronger key. 14 | 15 | This means that if you have downloaded the CA certificate, you will need to do 16 | so again. 17 | 18 | Likewise, if you have used the [client certificate generator] then your 19 | certificate will no longer be accepted and you must generate a new one. 20 | 21 | [test.mosquitto.org]: https://test.mosquitto.org 22 | [client certificate generator]: https://test.mosquitto.org/ssl/ 23 | -------------------------------------------------------------------------------- /examples/subscribe_simple/multiple.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "mosquitto.h" 4 | 5 | #define COUNT 3 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | int rc; 10 | int i; 11 | struct mosquitto_message *msg; 12 | 13 | mosquitto_lib_init(); 14 | 15 | rc = mosquitto_subscribe_simple( 16 | &msg, COUNT, true, 17 | "irc/#", 0, 18 | "test.mosquitto.org", 1883, 19 | NULL, 60, true, 20 | NULL, NULL, 21 | NULL, NULL); 22 | 23 | if(rc){ 24 | printf("Error: %s\n", mosquitto_strerror(rc)); 25 | mosquitto_lib_cleanup(); 26 | return rc; 27 | } 28 | 29 | for(i=0; i 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License 2.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | https://www.eclipse.org/legal/epl-2.0/ 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 14 | 15 | Contributors: 16 | Roger Light - initial implementation and documentation. 17 | */ 18 | 19 | #ifndef SOCKS_MOSQ_H 20 | #define SOCKS_MOSQ_H 21 | 22 | int socks5__send(struct mosquitto *mosq); 23 | int socks5__read(struct mosquitto *mosq); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /test/lib/c/01-will-unpwd-set.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | int main(int argc, char *argv[]) 9 | { 10 | int rc; 11 | struct mosquitto *mosq; 12 | 13 | int port = atoi(argv[1]); 14 | 15 | mosquitto_lib_init(); 16 | 17 | mosq = mosquitto_new("01-will-unpwd-set", true, NULL); 18 | if(mosq == NULL){ 19 | return 1; 20 | } 21 | mosquitto_username_pw_set(mosq, "oibvvwqw", "#'^2hg9a&nm38*us"); 22 | mosquitto_will_set(mosq, "will-topic", strlen("will message"), "will message", 2, false); 23 | 24 | rc = mosquitto_connect(mosq, "localhost", port, 60); 25 | 26 | while(run == -1){ 27 | mosquitto_loop(mosq, -1, 1); 28 | } 29 | mosquitto_destroy(mosq); 30 | 31 | mosquitto_lib_cleanup(); 32 | return run; 33 | } 34 | -------------------------------------------------------------------------------- /www/posts/2015/12/version-1-4-7-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. The changes below include the changes for 1.4.6, 13 | which wasn't announced. 14 | 15 | # Broker 16 | 17 | * Add support for libwebsockets 1.6. 18 | 19 | # Client library 20 | 21 | * Fix `_mosquitto_socketpair()` on Windows, reducing the chance of delays when 22 | * publishing. Closes [#483979]. 23 | 24 | # Clients 25 | 26 | * Fix `mosquitto_pub -l` stripping the final character on a line. Closes 27 | [#483981]. 28 | 29 | [#483979]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=483979 30 | [#483981]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=483981 31 | -------------------------------------------------------------------------------- /www/posts/2020/06/mosquitto-ubuntu-appliance.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Ubuntu has just announced their new [Ubuntu Appliance] initiative, which provides self contained images for a number of different applications, for use on a Raspberry Pi or PC. These are full Ubuntu derivatives that use snap packages, so will keep up to date with the latest releases. 13 | 14 | There are five different applications in the first set of appliances, and Mosquitto is one of them. 15 | 16 | Read more at the [Ubuntu blog]. 17 | 18 | [Ubuntu Appliance]: http://ubuntu.com/appliance 19 | [Ubuntu blog]: https://ubuntu.com/blog/the-ubuntu-appliance-portfolio 20 | -------------------------------------------------------------------------------- /www/posts/2011/03/version-0-9-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release: 13 | 14 | * Set retained message status for QoS 2 messages (bug #726535). 15 | * Only abort with an error when opening listening sockets if no address family is available, rather than aborting when any address family is not available. 16 | * Don't clean queued messages when a non clean session client reconnects. 17 | * Make mosquitto.py compatible with Python <2.6. 18 | * Fix mosquitto.h header includes for Windows. 19 | 20 | Please see the [download page]. 21 | 22 | Thanks to Joe B, David Monro,  Yuvraaj Kelkar and Colin Jones. 23 | 24 | [download page]: /download 25 | -------------------------------------------------------------------------------- /plugins/deny-protocol-version/Makefile: -------------------------------------------------------------------------------- 1 | R=../.. 2 | include ${R}/config.mk 3 | 4 | .PHONY : all binary check clean reallyclean test install uninstall 5 | 6 | PLUGIN_NAME=mosquitto_deny_protocol_version 7 | PLUGIN_CFLAGS+=-I${R}/include -I${R}/ 8 | 9 | all : binary 10 | 11 | binary : ${PLUGIN_NAME}.so 12 | 13 | ${PLUGIN_NAME}.so : ${PLUGIN_NAME}.c 14 | $(CROSS_COMPILE)$(CC) $(PLUGIN_CPPFLAGS) $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) -fPIC -shared $< -o $@ 15 | 16 | reallyclean : clean 17 | clean: 18 | -rm -f *.o ${PLUGIN_NAME}.so *.gcda *.gcno 19 | 20 | check: test 21 | test: 22 | 23 | install: ${PLUGIN_NAME}.so 24 | # Don't install, these are examples only. 25 | #$(INSTALL) -d "${DESTDIR}$(libdir)" 26 | #$(INSTALL) ${STRIP_OPTS} ${PLUGIN_NAME}.so "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 27 | 28 | uninstall : 29 | -rm -f "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" 30 | -------------------------------------------------------------------------------- /www/posts/2011/06/version-0-10-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Don't abort when connecting if the first connection fails. This is important 15 | on e.g. Windows 7, where IPV6 is offered as the first choice but may not be 16 | available. 17 | * Deal with long logging messages properly (bug #785882). 18 | * Fix library compilation on Symbian - no pselect() available. 19 | * Don't stop processing subscriptions on received messages after a 20 | subscription with # matches. (bug #791206). 21 | 22 | Please see the [download page]. 23 | 24 | Thanks again to Karl Palsson and Yuvraaj Kelkar. 25 | 26 | [download page]: /download 27 | -------------------------------------------------------------------------------- /man/manpage.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 0 7 | 0 8 | 9 | https://mosquitto.org/man/ 10 | 11 | 12 | 13 | ansi 14 | 15 | -------------------------------------------------------------------------------- /man/libmosquitto.3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | libmosquitto 7 | 3 8 | Mosquitto Project 9 | Library calls 10 | 11 | 12 | 13 | libmosquitto 14 | MQTT version 5.0/3.1.1 client library 15 | 16 | 17 | 18 | Documentation 19 | See 20 | 21 | 22 | 23 | Author 24 | Roger Light roger@atchoo.org 25 | 26 | 27 | -------------------------------------------------------------------------------- /set-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | MAJOR=2 4 | MINOR=0 5 | REVISION=19 6 | 7 | sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk 8 | 9 | sed -i "s/^#define LIBMOSQUITTO_MAJOR .*/#define LIBMOSQUITTO_MAJOR ${MAJOR}/" include/mosquitto.h 10 | sed -i "s/^#define LIBMOSQUITTO_MINOR .*/#define LIBMOSQUITTO_MINOR ${MINOR}/" include/mosquitto.h 11 | sed -i "s/^#define LIBMOSQUITTO_REVISION .*/#define LIBMOSQUITTO_REVISION ${REVISION}/" include/mosquitto.h 12 | 13 | sed -i "s/^set (VERSION .*)/set (VERSION ${MAJOR}.${MINOR}.${REVISION})/" CMakeLists.txt 14 | 15 | sed -i "s/^!define VERSION .*/!define VERSION ${MAJOR}.${MINOR}.${REVISION}/" installer/*.nsi 16 | 17 | sed -i "s/^version: .*/version: ${MAJOR}.${MINOR}.${REVISION}/" snap/snapcraft.yaml 18 | 19 | sed -i "s/\"version-string\": \".*\",/\"version-string\": \"${MAJOR}.${MINOR}.${REVISION}\",/" vcpkg.json 20 | -------------------------------------------------------------------------------- /www/posts/2010/05/fedora-packages-available.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Thanks to help from Chris Procter, there are now rpm packages available for 13 | Fedora Linux. As these are the first rpm packages, there may be problems so 14 | please report back if you find any. 15 | 16 | There are details on where to get the packages on the [download page]. 17 | 18 | Users of other rpm based distributions are currently out of luck - the versions 19 | of sqlite that they provide are typically either too old or else don't have 20 | support for some required features compiled in. 21 | 22 | Thanks to everybody else who got in touch about rpms as well! 23 | 24 | [download page]: /download 25 | -------------------------------------------------------------------------------- /www/posts/2013/08/mqtt-watchdir.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Recursively watch a directory for modifications and publish file content to an 13 | MQTT broker 14 | 15 | `mqtt-watchdir` is a Python program by [Jan-Piet Mens] to watch a directory and 16 | publish new or modified files in that directory hierarchy to an MQTT broker, 17 | using a matching topic. Source and instructions are available at 18 | and it is also available via pypi. 19 | 20 | It is a similar idea to my [mqttfs] fuse filesystem, but ultimately implemented 21 | in a better (and portable) manner. 22 | 23 | [Jan-Piet Mens]: https://twitter.com/jpmens 24 | [mqttfs]: https://bitbucket.org/oojah/mqttfs 25 | -------------------------------------------------------------------------------- /www/posts/2016/03/logo-contest-results-for-shortlisting.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The first round of the logo contest has closed and we now need to shortlist 6 13 | designers. A selection of 20 logos have been chosen out of the 100 entrants and 14 | you are invited to vote on them and make comments. If you like a particular 15 | logo but not the colour, or like an idea behind the logo but not another 16 | element then please say so. 17 | 18 | The links for voting (please do look at them all) are: 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/lib/cpp/01-keepalive-pingreq.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int run = -1; 4 | 5 | class mosquittopp_test : public mosqpp::mosquittopp 6 | { 7 | public: 8 | mosquittopp_test(const char *id); 9 | 10 | void on_connect(int rc); 11 | }; 12 | 13 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 14 | { 15 | } 16 | 17 | void mosquittopp_test::on_connect(int rc) 18 | { 19 | if(rc){ 20 | exit(1); 21 | } 22 | } 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | struct mosquittopp_test *mosq; 27 | 28 | int port = atoi(argv[1]); 29 | 30 | mosqpp::lib_init(); 31 | 32 | mosq = new mosquittopp_test("01-keepalive-pingreq"); 33 | 34 | mosq->connect("localhost", port, 5); 35 | 36 | while(run == -1){ 37 | mosq->loop(); 38 | } 39 | delete mosq; 40 | 41 | delete mosq; 42 | mosqpp::lib_cleanup(); 43 | 44 | return run; 45 | } 46 | -------------------------------------------------------------------------------- /test/lib/c/01-keepalive-pingreq.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static int run = -1; 7 | 8 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 9 | { 10 | if(rc){ 11 | exit(1); 12 | } 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | int rc; 18 | struct mosquitto *mosq; 19 | 20 | int port = atoi(argv[1]); 21 | 22 | mosquitto_lib_init(); 23 | 24 | mosq = mosquitto_new("01-keepalive-pingreq", true, NULL); 25 | if(mosq == NULL){ 26 | return 1; 27 | } 28 | mosquitto_connect_callback_set(mosq, on_connect); 29 | 30 | rc = mosquitto_connect(mosq, "localhost", port, 5); 31 | if(rc != 0) return rc; 32 | 33 | while(run == -1){ 34 | rc = mosquitto_loop(mosq, -1, 1); 35 | if(rc != 0) break; 36 | } 37 | 38 | mosquitto_destroy(mosq); 39 | mosquitto_lib_cleanup(); 40 | return run; 41 | } 42 | -------------------------------------------------------------------------------- /www/posts/2012/01/do-you-use-mqtt.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I saw this in the nanode irc channel: 13 | 14 | > I've never seen any real world projects with MQTT... it looks good though. 15 | 16 | So I'm looking for real world projects that use MQTT. If you've got a project 17 | it'd be great if you could mention it in the comments. A short sentence on what 18 | it does and how many clients you run on it - really anything you can say. If 19 | it's a secret please still comment if you can, just be very very vague. If 20 | you've got a blog post describing it, link that instead. I'm interested in 21 | everything from a single temperature sensor reporting to a computer up to 22 | millions of mobile users. 23 | 24 | Thanks! 25 | -------------------------------------------------------------------------------- /www/posts/2013/05/mosquitto-javascript-client-deprecated.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The [Paho] project recently made a new Javascript client available: 13 | 14 | 15 | The mosquitto Javascript client, mosquitto.js, is neither as functional nor as 16 | well written as the Paho client, so is being deprecated. If you are using 17 | mosquitto.js I strongly recommend that you look to the Paho client for the 18 | future. I will be carrying out minor bug fixes but no other development will 19 | take place. 20 | 21 | There are no plans to remove the existing files. 22 | 23 | [Paho]: http://www.eclipse.org/paho/ 24 | -------------------------------------------------------------------------------- /www/posts/2013/10/version-1-2-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release: 13 | 14 | # Broker 15 | 16 | * Fix compliance with `max_inflight_messages` when a non-clean session client 17 | reconnects. Closes one of the issues on bug #1237389. 18 | 19 | # Client library 20 | 21 | * Fix incorrect inflight message accounting, which caused messages to go 22 | * unsent. Partial fix for bug #1237351. 23 | * Fix potential memory corruption when sending QoS>0 messages at a high 24 | rate using the threaded interface. Further fix for #1237351. 25 | * Fix incorrect delay scaling when exponential_backoff=true in 26 | mosquitto_reconnect_delay_set(). 27 | * Some pep8 fixes for Python. 28 | -------------------------------------------------------------------------------- /cmake/FindcJSON.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE( FindPackageHandleStandardArgs ) 2 | 3 | # Checks an environment variable; note that the first check 4 | # does not require the usual CMake $-sign. 5 | IF( DEFINED ENV{CJSON_DIR} ) 6 | SET( CJSON_DIR "$ENV{CJSON_DIR}" ) 7 | ENDIF() 8 | 9 | FIND_PATH( 10 | CJSON_INCLUDE_DIR 11 | cjson/cJSON.h 12 | HINTS 13 | CJSON_DIR 14 | ) 15 | 16 | FIND_LIBRARY( CJSON_LIBRARY 17 | NAMES cjson 18 | HINTS ${CJSON_DIR} 19 | ) 20 | 21 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( cJSON DEFAULT_MSG 22 | CJSON_INCLUDE_DIR CJSON_LIBRARY 23 | ) 24 | 25 | IF( CJSON_FOUND ) 26 | SET( CJSON_INCLUDE_DIRS ${CJSON_INCLUDE_DIR} ) 27 | SET( CJSON_LIBRARIES ${CJSON_LIBRARY} ) 28 | 29 | MARK_AS_ADVANCED( 30 | CJSON_LIBRARY 31 | CJSON_INCLUDE_DIR 32 | CJSON_DIR 33 | ) 34 | ELSE() 35 | SET( CJSON_DIR "" CACHE STRING 36 | "An optional hint to a directory for finding `cJSON`" 37 | ) 38 | ENDIF() 39 | -------------------------------------------------------------------------------- /test/lib/cpp/01-will-unpwd-set.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static int run = -1; 5 | 6 | class mosquittopp_test : public mosqpp::mosquittopp 7 | { 8 | public: 9 | mosquittopp_test(const char *id); 10 | }; 11 | 12 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 13 | { 14 | } 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | struct mosquittopp_test *mosq; 19 | 20 | int port = atoi(argv[1]); 21 | 22 | mosqpp::lib_init(); 23 | 24 | mosq = new mosquittopp_test("01-will-unpwd-set"); 25 | mosq->username_pw_set("oibvvwqw", "#'^2hg9a&nm38*us"); 26 | mosq->will_set("will-topic", strlen("will message"), "will message", 2, false); 27 | 28 | mosq->connect("localhost", port, 60); 29 | 30 | while(run == -1){ 31 | mosq->loop(); 32 | } 33 | delete mosq; 34 | 35 | delete mosq; 36 | mosqpp::lib_cleanup(); 37 | 38 | return run; 39 | } 40 | -------------------------------------------------------------------------------- /www/posts/2010/09/mqtt-with-php.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Using MQTT in PHP has been possible for a long time using the [Simple 13 | Asynchronous Messaging] MQTT class. Unfortunately this is an imperfect solution 14 | due to unclear licensing, some slightly dubious design decisions and bugs. 15 | 16 | Thankfully, [Andrew Milstead] has started creating an alternative 17 | implementation. It is MIT licensed and available on [github]. It's very new, so 18 | if you have problems check back to see if there have been updates and then let 19 | Andrew know. 20 | 21 | [Simple Asynchronous Messaging]: http://project-sam.awardspace.com/ 22 | [Andrew Milstead]: http://twitter.com/bluerhinos 23 | [github]: http://github.com/bluerhinos/phpMQTT 24 | -------------------------------------------------------------------------------- /www/posts/2011/07/version-0-11-3-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Don't complain and quit if `persistence_file` option is given (bug #802423). 15 | * Initialise listeners correctly when clients with duplicate client ids 16 | connect. Bug #801678. 17 | * Memory tracking is now disabled for Symbian builds due to lack of malloc.h. 18 | * Fix memory tracking compilation for kFreeBSD. 19 | * Python callbacks can now be used with class member functions. 20 | * Fix persistent database writing of client message chunks which caused errors 21 | when restoring (bug #798164) 22 | 23 | Thanks to Neil Bothwick, Yuvraaj Kelkar, Craig Hollabaugh, Karl Palsson and 24 | Andy Piper. 25 | -------------------------------------------------------------------------------- /www/posts/2013/02/mqtt-standardisation-oasis-call-for-participation.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The MQTT protocol is going for standardisation at OASIS. A technical committee 13 | is being formed and there is a call for participation for interested parties. 14 | There are details at the link below: 15 | 16 | 17 | 18 | The plan seems to be to take the 3.1 spec as it is for standardisation and see 19 | about changes in the future. If you are interested in taking part see the link 20 | above, but note that you need to be a paid up member of 21 | OASIS. 22 | -------------------------------------------------------------------------------- /www/posts/2010/08/version-0-8-2.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | * Fix default loop() timeout value in mosquitto.py. Previous value was 0, 15 | causing high cpu load. 16 | * Fix message handling problem in client library when more than one message 17 | was in the client queue. 18 | * Fix the logic used to determine whether a QoS>0 message needs to be 19 | retried. 20 | * Fix the Python sub.py example so that it quits on error. 21 | 22 | See the [download page]. Includes Windows 32-bit binaries for the broker 23 | compiled with Cygwin, and the client library and clients compiled natively with 24 | Visual Studio to allow developing native Windows MQTT clients. 25 | 26 | [download page]: /download 27 | -------------------------------------------------------------------------------- /www/posts/2015/05/mosquitto-and-current-unreleased-libwebsockets-branch.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The current unreleased libwebsockets master branch defines the VERSION macro in 13 | its header files. I believe this to be a bug in libwebsockets. 14 | 15 | This bug causes compilation of mosquitto with websockets support to fail. 16 | 17 | Please use a released version of libwebsockets, either 1.2, 1.3 or 1.4. 18 | Mosquitto will compile with all of these versions. 19 | 20 | I do not recommend using an unreleased version of libwebsockets, the project is 21 | not shy about making ABI/API incompatible changes between releases so it is 22 | impractical to provide support for. 23 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | os: Visual Studio 2015 2 | 3 | environment: 4 | CMAKE_ARGS: -DCMAKE_BUILD_TYPE=Release 5 | 6 | configuration: 7 | - Release 8 | 9 | install: 10 | 11 | build: 12 | 13 | build_script: 14 | - md build 15 | - cd build 16 | - cmake -DCMAKE_BUILD_TYPE=Release -DWITH_THREADING=no .. 17 | - cmake --build . --config Release 18 | - cd .. 19 | 20 | after_build: 21 | - cd installer 22 | - '"%PROGRAMFILES(x86)%\NSIS\makensis" mosquitto.nsi' 23 | 24 | artifacts: 25 | - name: Installer 26 | path: 'installer/mosquitto-*-install-windows-x86.exe' 27 | #- path: build\src\Release\mosquitto.exe 28 | #- path: build\src\Release\mosquitto_passwd.exe 29 | #- path: build\lib\Release\mosquitto.dll 30 | #- path: build\lib\Release\mosquitto.lib 31 | #- path: build\client\Release\mosquitto_pub.exe 32 | #- path: build\client\Release\mosquitto_sub.exe 33 | #- path: build\src\Release\mosquitto.exe 34 | -------------------------------------------------------------------------------- /test/lib/c/01-server-keepalive-pingreq.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static int run = -1; 7 | 8 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 9 | { 10 | if(rc){ 11 | exit(1); 12 | } 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | int rc; 18 | struct mosquitto *mosq; 19 | 20 | int port = atoi(argv[1]); 21 | 22 | mosquitto_lib_init(); 23 | 24 | mosq = mosquitto_new("01-server-keepalive-pingreq", true, NULL); 25 | if(mosq == NULL){ 26 | return 1; 27 | } 28 | mosquitto_int_option(mosq, MOSQ_OPT_PROTOCOL_VERSION, MQTT_PROTOCOL_V5); 29 | mosquitto_connect_callback_set(mosq, on_connect); 30 | 31 | rc = mosquitto_connect(mosq, "localhost", port, 60); 32 | 33 | while(run == -1){ 34 | mosquitto_loop(mosq, -1, 1); 35 | } 36 | 37 | mosquitto_destroy(mosq); 38 | mosquitto_lib_cleanup(); 39 | return run; 40 | } 41 | -------------------------------------------------------------------------------- /test/lib/c/03-publish-b2c-qos1-unexpected-puback.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | 9 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 10 | { 11 | if(rc){ 12 | printf("Connect error: %d\n", rc); 13 | exit(1); 14 | } 15 | } 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | int rc; 20 | struct mosquitto *mosq; 21 | 22 | int port = atoi(argv[1]); 23 | 24 | mosquitto_lib_init(); 25 | 26 | mosq = mosquitto_new("publish-qos1-test", true, &run); 27 | if(mosq == NULL){ 28 | return 1; 29 | } 30 | mosquitto_connect_callback_set(mosq, on_connect); 31 | 32 | rc = mosquitto_connect(mosq, "localhost", port, 5); 33 | 34 | while(run == -1){ 35 | rc = mosquitto_loop(mosq, 300, 1); 36 | if(rc){ 37 | exit(0); 38 | } 39 | } 40 | 41 | mosquitto_lib_cleanup(); 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /test/lib/c/03-publish-b2c-qos2-unexpected-pubcomp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | 9 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 10 | { 11 | if(rc){ 12 | printf("Connect error: %d\n", rc); 13 | exit(1); 14 | } 15 | } 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | int rc; 20 | struct mosquitto *mosq; 21 | 22 | int port = atoi(argv[1]); 23 | 24 | mosquitto_lib_init(); 25 | 26 | mosq = mosquitto_new("publish-qos2-test", true, &run); 27 | if(mosq == NULL){ 28 | return 1; 29 | } 30 | mosquitto_connect_callback_set(mosq, on_connect); 31 | 32 | rc = mosquitto_connect(mosq, "localhost", port, 5); 33 | 34 | while(run == -1){ 35 | rc = mosquitto_loop(mosq, 300, 1); 36 | if(rc){ 37 | exit(0); 38 | } 39 | } 40 | 41 | mosquitto_lib_cleanup(); 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /test/lib/cpp/01-will-set.cpp: -------------------------------------------------------------------------------- 1 | //#include 2 | //#include 3 | //#include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | 9 | class mosquittopp_test : public mosqpp::mosquittopp 10 | { 11 | public: 12 | mosquittopp_test(const char *id); 13 | }; 14 | 15 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 16 | { 17 | } 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | struct mosquittopp_test *mosq; 22 | 23 | int port = atoi(argv[1]); 24 | 25 | mosqpp::lib_init(); 26 | 27 | mosq = new mosquittopp_test("01-will-set"); 28 | mosq->will_set("topic/on/unexpected/disconnect", strlen("will message"), "will message", 1, true); 29 | 30 | mosq->connect("localhost", port, 60); 31 | 32 | while(run == -1){ 33 | mosq->loop(); 34 | } 35 | delete mosq; 36 | 37 | delete mosq; 38 | mosqpp::lib_cleanup(); 39 | 40 | return run; 41 | } 42 | -------------------------------------------------------------------------------- /www/themes/mosquitto/templates/base.tmpl: -------------------------------------------------------------------------------- 1 | ## -*- coding: utf-8 -*- 2 | <%namespace name="base" file="base_helper.tmpl" import="*"/> 3 | <%namespace name="header" file="base_header.tmpl" import="*"/> 4 | <%namespace name="footer" file="base_footer.tmpl" import="*"/> 5 | <%namespace name="annotations" file="annotation_helper.tmpl"/> 6 | ${set_locale(lang)} 7 | ${base.html_headstart()} 8 | <%block name="extra_head"> 9 | ### Leave this block alone. 10 | 11 | ${template_hooks['extra_head']()} 12 | 13 | 14 | ${header.html_header()} 15 |
16 |
17 | <%block name="content"> 18 |
19 |
20 | ${footer.html_footer()} 21 | ${base.late_load_js()} 22 | <%block name="extra_js"> 23 | ${body_end} 24 | ${template_hooks['body_end']()} 25 | 26 | 27 | -------------------------------------------------------------------------------- /apps/mosquitto_passwd/get_password.h: -------------------------------------------------------------------------------- 1 | #ifndef GET_PASSWORD_H 2 | #define GET_PASSWORD_H 3 | /* 4 | Copyright (c) 2012-2020 Roger Light 5 | 6 | All rights reserved. This program and the accompanying materials 7 | are made available under the terms of the Eclipse Public License 2.0 8 | and Eclipse Distribution License v1.0 which accompany this distribution. 9 | 10 | The Eclipse Public License is available at 11 | https://www.eclipse.org/legal/epl-2.0/ 12 | and the Eclipse Distribution License is available at 13 | http://www.eclipse.org/org/documents/edl-v10.php. 14 | 15 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 16 | 17 | Contributors: 18 | Roger Light - initial implementation and documentation. 19 | */ 20 | 21 | #include 22 | 23 | void get_password__reset_term(void); 24 | int get_password(const char *prompt, const char *verify_prompt, bool quiet, char *password, size_t len); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /www/posts/2010/01/version-0-4-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | * Added support for wildcard subscriptions using + and #. 13 | * All network operations are now non-blocking and can cope with partial packets, meaning that networking should be a lot more reliable. 14 | * Total messsages/bytes sent/received are now available in $SYS. 15 | * Improved logging information - use client ip address and id instead of socket number. 16 | * Keepalive==0 is now correctly treated as "never disconnect". 17 | * Default logging destination no longer includes "topics" to prevent possible error logging to the db before it is initialised. 18 | * Periodic $SYS messages can now be disabled. 19 | 20 | See the [changelog] for full details. 21 | 22 | [changelog]: /ChangeLog.txt 23 | -------------------------------------------------------------------------------- /www/posts/2017/03/for-the-final-time.attachments.json: -------------------------------------------------------------------------------- 1 | {"410": {"wordpress_user_name": "roger", "title": "img_20170308_155049248_33196894011_o", "date_utc": "2017-03-09 19:08:45", "files_meta": [{"height": 720, "width": 1280, "meta": {"created_timestamp": 1488988249.0, "shutter_speed": 0.02999, "focal_length": 2.471, "camera": "MotoE2(4G-LTE)", "aperture": 2.2, "iso": 125.0}}, {"height": 432, "size": "medium_large", "width": 768}, {"height": 169, "size": "medium", "width": 300}, {"height": 150, "size": "thumbnail", "width": 150}, {"height": 576, "size": "large", "width": 1024}], "files": ["/wp-content/uploads/2017/03/img_20170308_155049248_33196894011_o.jpg", "/wp-content/uploads/2017/03/img_20170308_155049248_33196894011_o-768x432.jpg", "/wp-content/uploads/2017/03/img_20170308_155049248_33196894011_o-300x169.jpg", "/wp-content/uploads/2017/03/img_20170308_155049248_33196894011_o-150x150.jpg", "/wp-content/uploads/2017/03/img_20170308_155049248_33196894011_o-1024x576.jpg"]}} -------------------------------------------------------------------------------- /www/posts/2016/03/repository-moved-to-github.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The mosquitto repository is now hosted on github: 13 | This is now the canonical location for 14 | mosquitto development work. 15 | 16 | Bug reports should also be made on github and the existing bug reports will be 17 | migrated over shortly. 18 | 19 | The documentation still needs updating with the new location and processes, so 20 | please do be patient with regards that. 21 | 22 | Contributions can now be made through a github pull request. If you want to 23 | contribute a bug fix, please base your work off the "fixes" branch, if you are 24 | developing a new feature please use the "develop" branch. 25 | 26 | Here's to a new stage in the mosquitto project! 27 | -------------------------------------------------------------------------------- /lib/logging_mosq.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2020 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License 2.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | https://www.eclipse.org/legal/epl-2.0/ 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 14 | 15 | Contributors: 16 | Roger Light - initial implementation and documentation. 17 | */ 18 | #ifndef LOGGING_MOSQ_H 19 | #define LOGGING_MOSQ_H 20 | 21 | #include "mosquitto.h" 22 | 23 | #ifndef __GNUC__ 24 | #define __attribute__(attrib) 25 | #endif 26 | 27 | int log__printf(struct mosquitto *mosq, unsigned int level, const char *fmt, ...) __attribute__((format(printf, 3, 4))); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /www/posts/2017/06/citing-eclipse-mosquitto.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | A short paper has been published on Mosquitto in [The Journal of Open Source 13 | Software] If you use Mosquitto in your academic work, please now use this paper 14 | as your citation. 15 | 16 | > R. A. Light, "Mosquitto: server and client implementation of the MQTT 17 | > protocol," *The Journal of Open Source Software*, vol. 2, no. 13, May 2017, 18 | > DOI: [10.21105/joss.00265] 19 | 20 | The paper link is 21 | 22 | A [bibtex] entry is available. 23 | 24 | [The Journal of Open Source Software]: http://joss.theoj.org 25 | [10.21105/joss.00265]: http://dx.doi.org/10.21105/joss.00265 26 | [bibtek]: http://www.doi2bib.org/#/doi/10.21105/joss.00265 27 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | -------------------------------------------------------------------------------- /lib/misc_mosq.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2020 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License 2.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | https://www.eclipse.org/legal/epl-2.0/ 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 14 | 15 | Contributors: 16 | Roger Light - initial implementation and documentation. 17 | */ 18 | #ifndef MISC_MOSQ_H 19 | #define MISC_MOSQ_H 20 | 21 | #include 22 | #include 23 | 24 | FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read); 25 | char *misc__trimblanks(char *str); 26 | char *fgets_extending(char **buf, int *buflen, FILE *stream); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /test/lib/c/04-retain-qos0.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | 9 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 10 | { 11 | if(rc){ 12 | exit(1); 13 | }else{ 14 | mosquitto_publish(mosq, NULL, "retain/qos0/test", strlen("retained message"), "retained message", 0, true); 15 | } 16 | } 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | int rc; 21 | struct mosquitto *mosq; 22 | 23 | int port = atoi(argv[1]); 24 | 25 | mosquitto_lib_init(); 26 | 27 | mosq = mosquitto_new("retain-qos0-test", true, NULL); 28 | if(mosq == NULL){ 29 | return 1; 30 | } 31 | mosquitto_connect_callback_set(mosq, on_connect); 32 | 33 | rc = mosquitto_connect(mosq, "localhost", port, 60); 34 | 35 | while(run == -1){ 36 | mosquitto_loop(mosq, -1, 1); 37 | } 38 | mosquitto_destroy(mosq); 39 | 40 | mosquitto_lib_cleanup(); 41 | return run; 42 | } 43 | -------------------------------------------------------------------------------- /client/sub_client_output.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License 2.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | https://www.eclipse.org/legal/epl-2.0/ 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 14 | 15 | Contributors: 16 | Roger Light - initial implementation and documentation. 17 | */ 18 | 19 | #ifndef SUB_CLIENT_OUTPUT_H 20 | #define SUB_CLIENT_OUTPUT_H 21 | 22 | #include "mosquitto.h" 23 | #include "client_shared.h" 24 | 25 | void output_init(void); 26 | void print_message(struct mosq_config *cfg, const struct mosquitto_message *message, const mosquitto_property *properties); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /lib/alias_mosq.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019-2020 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License 2.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | https://www.eclipse.org/legal/epl-2.0/ 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 14 | 15 | Contributors: 16 | Roger Light - initial implementation and documentation. 17 | */ 18 | 19 | #ifndef ALIAS_MOSQ_H 20 | #define ALIAS_MOSQ_H 21 | 22 | #include "mosquitto_internal.h" 23 | 24 | int alias__add(struct mosquitto *mosq, const char *topic, uint16_t alias); 25 | int alias__find(struct mosquitto *mosq, char **topic, uint16_t alias); 26 | void alias__free_all(struct mosquitto *mosq); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /client/pub_test_properties: -------------------------------------------------------------------------------- 1 | LD_LIBRARY_PATH=../lib ./mosquitto_pub \ 2 | \ 3 | -t asdf -V mqttv5 -m '{"key":"value"}' \ 4 | \ 5 | -D connect authentication-data password \ 6 | -D connect authentication-method something \ 7 | -D connect maximum-packet-size 0191 \ 8 | -D connect receive-maximum 1000 \ 9 | -D connect request-problem-information 1 \ 10 | -D connect request-response-information 1 \ 11 | -D connect session-expiry-interval 39 \ 12 | -D connect topic-alias-maximum 123 \ 13 | -D connect user-property connect up \ 14 | \ 15 | -D publish content-type application/json \ 16 | -D publish correlation-data some-data \ 17 | -D publish message-expiry-interval 59 \ 18 | -D publish payload-format-indicator 1 \ 19 | -D publish response-topic /dev/null \ 20 | -D publish topic-alias 4 \ 21 | -D publish user-property publish up \ 22 | \ 23 | -D disconnect reason-string "reason" \ 24 | -D disconnect session-expiry-interval 40 \ 25 | -D disconnect user-property disconnect up 26 | 27 | -------------------------------------------------------------------------------- /examples/subscribe_simple/Makefile: -------------------------------------------------------------------------------- 1 | include ../../config.mk 2 | 3 | .PHONY: all 4 | 5 | all : sub_callback sub_single sub_multiple 6 | 7 | sub_callback : callback.o 8 | ${CROSS_COMPILE}${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION} 9 | 10 | sub_single : single.o 11 | ${CROSS_COMPILE}${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION} 12 | 13 | sub_multiple : multiple.o 14 | ${CROSS_COMPILE}${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION} 15 | 16 | callback.o : callback.c ../../lib/libmosquitto.so.${SOVERSION} 17 | ${CROSS_COMPILE}${CC} -c $< -o $@ -I../../lib ${CFLAGS} 18 | 19 | single.o : single.c ../../lib/libmosquitto.so.${SOVERSION} 20 | ${CROSS_COMPILE}${CC} -c $< -o $@ -I../../lib ${CFLAGS} 21 | 22 | multiple.o : multiple.c ../../lib/libmosquitto.so.${SOVERSION} 23 | ${CROSS_COMPILE}${CC} -c $< -o $@ -I../../lib ${CFLAGS} 24 | 25 | ../../lib/libmosquitto.so.${SOVERSION} : 26 | $(MAKE) -C ../../lib 27 | 28 | clean : 29 | -rm -f *.o sub_single sub_multiple 30 | -------------------------------------------------------------------------------- /www/posts/2011/07/mosquitto-on-qnx.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Andrea asked a [question on launchpad] about problems compiling Mosquitto on 13 | QNX. I've now managed to get an evaluation version of QNX and fix the 14 | compilation problems. These fixes will be in 0.12, but you can get them in the 15 | current snapshot if it's urgent. I've also put compiled binaries in the 16 | [downloads directory] but they are completely untested, so use at your own 17 | risk. 18 | 19 | Although I've provided these binaries I don't intend to keep doing so for each 20 | version of Mosquitto. I will endeavour to fix any other problems that arise in 21 | the future though. 22 | 23 | [question on launchpad]: https://answers.launchpad.net/mosquitto/+question/164154 24 | [downloads directory]: http://mosquitto.org/files/binary/qnx/ 25 | -------------------------------------------------------------------------------- /lib/will_mosq.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010-2020 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License 2.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | https://www.eclipse.org/legal/epl-2.0/ 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 14 | 15 | Contributors: 16 | Roger Light - initial implementation and documentation. 17 | */ 18 | 19 | #ifndef WILL_MOSQ_H 20 | #define WILL_MOSQ_H 21 | 22 | #include "mosquitto.h" 23 | #include "mosquitto_internal.h" 24 | 25 | int will__set(struct mosquitto *mosq, const char *topic, int payloadlen, const void *payload, int qos, bool retain, mosquitto_property *properties); 26 | int will__clear(struct mosquitto *mosq); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /README-letsencrypt.md: -------------------------------------------------------------------------------- 1 | # Using Lets Encrypt with Mosquitto 2 | 3 | On Unix like operating systems, Mosquitto will attempt to drop root access as 4 | soon as it has loaded its configuration file, but before it has activated any 5 | of that configuration. This means that if you are using Lets Encrypt TLS 6 | certificates, it will be unable to access the certificates and private keys 7 | typically located in /etc/letsencrypt/live/ 8 | 9 | To help with this problem there is an example `deploy` renewal hook script in 10 | `misc/letsencrypt/mosquitto-copy.sh` which shows how the certificate and 11 | private key for a mosquitto broker can be copied to /etc/mosquitto/certs/ and 12 | given the correct ownership and permissions so the broker can access them, but 13 | no other user can. It then signals Mosquitto to reload the certificates. 14 | 15 | Use of this script allows you to happily use Lets Encrypt certificates with 16 | Mosquitto without needing root access for Mosquitto, and without having to 17 | restart Mosquitto. 18 | -------------------------------------------------------------------------------- /test/lib/cpp/04-retain-qos0.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | static int run = -1; 6 | 7 | class mosquittopp_test : public mosqpp::mosquittopp 8 | { 9 | public: 10 | mosquittopp_test(const char *id); 11 | 12 | void on_connect(int rc); 13 | }; 14 | 15 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 16 | { 17 | } 18 | 19 | void mosquittopp_test::on_connect(int rc) 20 | { 21 | if(rc){ 22 | exit(1); 23 | }else{ 24 | publish(NULL, "retain/qos0/test", strlen("retained message"), "retained message", 0, true); 25 | } 26 | } 27 | 28 | int main(int argc, char *argv[]) 29 | { 30 | struct mosquittopp_test *mosq; 31 | 32 | int port = atoi(argv[1]); 33 | 34 | mosqpp::lib_init(); 35 | 36 | mosq = new mosquittopp_test("retain-qos0-test"); 37 | 38 | mosq->connect("localhost", port, 60); 39 | 40 | while(run == -1){ 41 | mosq->loop(); 42 | } 43 | delete mosq; 44 | 45 | delete mosq; 46 | mosqpp::lib_cleanup(); 47 | 48 | return run; 49 | } 50 | -------------------------------------------------------------------------------- /www/posts/2011/06/nanode-a-cheap-networked-arduino-clone.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The arduino, the open source microcontroller board, has had MQTT support for a 13 | long time in the form of [Nick O'Leary's arduino client]. It does however 14 | require networking support which has traditionally provided by an add on 15 | shield, which increases the cost of the system. 16 | 17 | The [Nanode] is an arduino compatible board which includes network support and 18 | can be built for approximately the same cost as a normal arduino board. It's 19 | still a work in progress, but is definitely worth a look if you want to use low 20 | power MQTT capable sensors/controllers. 21 | 22 | [Nick O'Leary's arduino client]: http://knolleary.net/arduino-client-for-mqtt/ 23 | [Nanode]: http://nanode.eu/ 24 | -------------------------------------------------------------------------------- /www/posts/2012/08/version-1-0-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | # Broker 15 | * If the broker was configured for persistence, a durable client had a 16 | subscription to topics in $SYS/# and had messages in its queue when the 17 | broker restarted, then the persistent database would have messages missing 18 | and so the broker would not restart properly. This has been fixed. 19 | 20 | # Library 21 | 22 | * Fix threading problem on some systems. 23 | 24 | # Tests 25 | 26 | * Close socket after 08-ssl-connect-no-auth-wrong-ca.py test to prevent 27 | * subsequent tests having problems. 28 | 29 | # Build scripts 30 | 31 | * Install pskfile.example in CMake. Fixes bug #1037504. 32 | 33 | # Other 34 | 35 | * Fix db_dump parameter printing message store and sub chunks. 36 | -------------------------------------------------------------------------------- /test/lib/c/08-ssl-fake-cacert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | 9 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 10 | { 11 | exit(1); 12 | } 13 | 14 | int main(int argc, char *argv[]) 15 | { 16 | int rc; 17 | struct mosquitto *mosq; 18 | 19 | int port = atoi(argv[1]); 20 | 21 | mosquitto_lib_init(); 22 | 23 | mosq = mosquitto_new("08-ssl-connect-crt-auth", true, NULL); 24 | if(mosq == NULL){ 25 | return 1; 26 | } 27 | mosquitto_tls_set(mosq, "../ssl/test-fake-root-ca.crt", NULL, "../ssl/client.crt", "../ssl/client.key", NULL); 28 | mosquitto_connect_callback_set(mosq, on_connect); 29 | 30 | rc = mosquitto_connect(mosq, "localhost", port, 60); 31 | 32 | rc = mosquitto_loop_forever(mosq, -1, 1); 33 | mosquitto_destroy(mosq); 34 | mosquitto_lib_cleanup(); 35 | if(rc == MOSQ_ERR_ERRNO && errno == EPROTO){ 36 | return 0; 37 | }else{ 38 | return 1; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /www/posts/2014/10/version-1-3-5-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release. 13 | 14 | # Broker 15 | 16 | * Fix possible memory leak when using a topic that has a leading slash. Fixes 17 | bug #1360985. 18 | * Fix saving persistent database on Windows. 19 | * Temporarily disable ACL checks on subscriptions when using MQTT v3.1.1. This 20 | is due to the complexity of checking wildcard ACLs against wildcard 21 | subscriptions. This does not have a negative impact on security because 22 | checks are still made before a message is sent to a client. Fixes bug 23 | #1374291. 24 | * When using -v and the broker receives a SIGHUP, verbose logging was being 25 | disabled. This has been fixed. 26 | 27 | # Client library 28 | 29 | * Fix mutex being incorrectly passed by value. Fixes bug #1373785. 30 | -------------------------------------------------------------------------------- /apps/db_dump/db_dump.h: -------------------------------------------------------------------------------- 1 | #ifndef DB_DUMP_H 2 | #define DB_DUMP_H 3 | /* 4 | Copyright (c) 2010-2019 Roger Light 5 | 6 | All rights reserved. This program and the accompanying materials 7 | are made available under the terms of the Eclipse Public License 2.0 8 | and Eclipse Distribution License v1.0 which accompany this distribution. 9 | 10 | The Eclipse Public License is available at 11 | https://www.eclipse.org/legal/epl-2.0/ 12 | and the Eclipse Distribution License is available at 13 | http://www.eclipse.org/org/documents/edl-v10.php. 14 | 15 | SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 16 | 17 | Contributors: 18 | Roger Light - initial implementation and documentation. 19 | */ 20 | 21 | #include 22 | 23 | void print__client(struct P_client *chunk, uint32_t length); 24 | void print__client_msg(struct P_client_msg *chunk, uint32_t length); 25 | void print__msg_store(struct P_msg_store *chunk, uint32_t length); 26 | void print__sub(struct P_sub *chunk, uint32_t length); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /www/themes/mosquitto/templates/story.tmpl: -------------------------------------------------------------------------------- 1 | ## -*- coding: utf-8 -*- 2 | <%namespace name="helper" file="post_helper.tmpl"/> 3 | <%namespace name="pheader" file="post_header.tmpl"/> 4 | <%namespace name="comments" file="comments_helper.tmpl"/> 5 | <%namespace name="math" file="math_helper.tmpl"/> 6 | <%inherit file="post.tmpl"/> 7 | 8 | <%block name="content"> 9 |
10 |
11 | ###${pheader.html_title()} 12 | ${pheader.html_translations(post)} 13 |
14 |
15 | ${post.text()} 16 |
17 | %if site_has_comments and enable_comments and not post.meta('nocomments'): 18 |
19 |

${messages("Comments")}

20 | ${comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path)} 21 |
22 | %endif 23 | ${math.math_scripts_ifpost(post)} 24 |
25 | 26 | -------------------------------------------------------------------------------- /www/posts/2011/08/mosquitto-on-openwrt.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | Thanks to work done by Karl Palsson, Mosquitto is now available on [OpenWrt], 13 | the embedded Linux distribution frequently used on wireless routers. This is 14 | exciting if you want a really low power way of running an MQTT broker. It also 15 | includes the mosquitto clients and development libraries. 16 | 17 | It's only in the source tree at the moment, so if you want to install it I 18 | believe you'll have to download everything and compile it yourself. 19 | 20 | Update: 21 | 22 | Karl tells me that if you're running a binary snapshot from trunk then you can do: 23 | 24 | ``` 25 | opkg update 26 | opkg install mosquitto mosquitto-client libmosquitto 27 | ``` 28 | 29 | You only need to build it yourself if you're running a stable binary. 30 | 31 | [OpenWrt]: https://openwrt.org/ 32 | -------------------------------------------------------------------------------- /test/lib/c/01-con-discon-success.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static int run = -1; 7 | 8 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 9 | { 10 | if(rc){ 11 | exit(1); 12 | }else{ 13 | mosquitto_disconnect(mosq); 14 | } 15 | } 16 | 17 | void on_disconnect(struct mosquitto *mosq, void *obj, int rc) 18 | { 19 | run = rc; 20 | } 21 | 22 | int main(int argc, char *argv[]) 23 | { 24 | int rc; 25 | struct mosquitto *mosq; 26 | 27 | int port = atoi(argv[1]); 28 | 29 | mosquitto_lib_init(); 30 | 31 | mosq = mosquitto_new("01-con-discon-success", true, NULL); 32 | if(mosq == NULL){ 33 | return 1; 34 | } 35 | mosquitto_connect_callback_set(mosq, on_connect); 36 | mosquitto_disconnect_callback_set(mosq, on_disconnect); 37 | 38 | rc = mosquitto_connect(mosq, "localhost", port, 60); 39 | 40 | while(run == -1){ 41 | mosquitto_loop(mosq, -1, 1); 42 | } 43 | 44 | mosquitto_destroy(mosq); 45 | 46 | mosquitto_lib_cleanup(); 47 | return run; 48 | } 49 | -------------------------------------------------------------------------------- /www/posts/2011/07/debian-and-ubuntu-packaging.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | I'm very pleased to say that Mosquitto is very nearly packaged in Debian and 13 | Ubuntu. In truth, 0.10 is packaged and uploaded for both Debian testing 14 | (Wheezy) and Ubuntu Oneiric Ocelot, but there is a problem with the config that 15 | means it won't restart properly. That is fixed with the 0.11.3 upload which is 16 | now in unstable. That means after 10 days and it will be in Debian testing for 17 | all to use. I've also submitted a sync request with Ubuntu ([bug #808530]) 18 | to ensure it makes it across. I'll still be maintaining the 19 | Launchpad PPA for older versions of Ubuntu. 20 | 21 | Thanks to the Debian developer Michael Tautschnig for reviewing my package and 22 | doing the upload. 23 | 24 | [bug #808530]: https://bugs.launchpad.net/ubuntu/+source/mosquitto/+bug/808530 25 | -------------------------------------------------------------------------------- /test/broker/09-auth-bad-method.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Test whether sending an Authentication Method produces the correct response 4 | # when no auth methods are defined. 5 | 6 | from mosq_test_helper import * 7 | 8 | rc = 1 9 | keepalive = 10 10 | props = mqtt5_props.gen_string_prop(mqtt5_props.PROP_AUTHENTICATION_METHOD, "basic") 11 | connect_packet = mosq_test.gen_connect("connect-test", proto_ver=5, keepalive=keepalive, properties=props) 12 | connack_packet = mosq_test.gen_connack(rc=mqtt5_rc.MQTT_RC_BAD_AUTHENTICATION_METHOD, proto_ver=5, properties=None) 13 | 14 | port = mosq_test.get_port() 15 | broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) 16 | 17 | try: 18 | sock = mosq_test.do_client_connect(connect_packet, connack_packet, port=port) 19 | sock.close() 20 | rc = 0 21 | except mosq_test.TestError: 22 | pass 23 | finally: 24 | broker.terminate() 25 | broker.wait() 26 | (stdo, stde) = broker.communicate() 27 | if rc: 28 | print(stde.decode('utf-8')) 29 | 30 | exit(rc) 31 | 32 | -------------------------------------------------------------------------------- /www/themes/mosquitto/templates/base_footer.tmpl: -------------------------------------------------------------------------------- 1 | ## -*- coding: utf-8 -*- 2 | <%namespace name="base" file="base_helper.tmpl" import="*"/> 3 | 4 | <%def name="html_footer()"> 5 | %if content_footer: 6 | 22 | %endif 23 | 24 | -------------------------------------------------------------------------------- /test/broker/03-publish-dollar.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Test whether a PUBLISH to a topic starting with $ succeeds 4 | 5 | from mosq_test_helper import * 6 | 7 | rc = 1 8 | mid = 19 9 | keepalive = 60 10 | connect_packet = mosq_test.gen_connect("pub-dollar-test", keepalive=keepalive) 11 | connack_packet = mosq_test.gen_connack(rc=0) 12 | 13 | publish_packet = mosq_test.gen_publish("$test/test", qos=1, mid=mid, payload="message") 14 | puback_packet = mosq_test.gen_puback(mid) 15 | 16 | port = mosq_test.get_port() 17 | broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) 18 | 19 | try: 20 | sock = mosq_test.do_client_connect(connect_packet, connack_packet, port=port) 21 | mosq_test.do_send_receive(sock, publish_packet, puback_packet, "puback") 22 | 23 | rc = 0 24 | 25 | sock.close() 26 | except mosq_test.TestError: 27 | pass 28 | finally: 29 | broker.terminate() 30 | broker.wait() 31 | (stdo, stde) = broker.communicate() 32 | if rc: 33 | print(stde.decode('utf-8')) 34 | 35 | exit(rc) 36 | 37 | -------------------------------------------------------------------------------- /test/lib/cpp/08-ssl-fake-cacert.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static int run = -1; 5 | 6 | class mosquittopp_test : public mosqpp::mosquittopp 7 | { 8 | public: 9 | mosquittopp_test(const char *id); 10 | 11 | void on_connect(int rc); 12 | }; 13 | 14 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 15 | { 16 | } 17 | 18 | void mosquittopp_test::on_connect(int rc) 19 | { 20 | exit(1); 21 | } 22 | 23 | int main(int argc, char *argv[]) 24 | { 25 | struct mosquittopp_test *mosq; 26 | int rc; 27 | 28 | int port = atoi(argv[1]); 29 | 30 | mosqpp::lib_init(); 31 | 32 | mosq = new mosquittopp_test("08-ssl-fake-cacert"); 33 | 34 | mosq->tls_opts_set(1, "tlsv1", NULL); 35 | mosq->tls_set("../ssl/test-fake-root-ca.crt", NULL, "../ssl/client.crt", "../ssl/client.key"); 36 | mosq->connect("localhost", port, 60); 37 | 38 | rc = mosq->loop_forever(); 39 | delete mosq; 40 | mosqpp::lib_cleanup(); 41 | if(rc == MOSQ_ERR_ERRNO && errno == EPROTO){ 42 | return 0; 43 | }else{ 44 | return 1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /www/posts/2010/08/mqtt-v3-1.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The MQTT v3 spec has been updated to v3.1. The significant change is the 13 | inclusion of the option to send a username and password as part of the connect 14 | command. The new spec is available at 15 | 16 | and is a lot more readable and clear than the original. 17 | 18 | Mosquitto will support the v3.1 spec in a future release, along with the 19 | ability to control both broker and topic access by username. In the meantime, 20 | if you need this functionality, the IBM proprietary [RSMB] broker may be 21 | suitable for testing purposes. The RSMB package now also includes an MQTT 22 | client library, a simple publish client and a simple subscribe client, just 23 | like mosquitto. Be sure to check the license terms before using it! 24 | 25 | [RSMB]: http://www.alphaworks.ibm.com/tech/rsmb 26 | -------------------------------------------------------------------------------- /www/posts/2011/02/version-0-9-2-released.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | This is a bugfix release: 13 | 14 | * Only send a single DISCONNECT command when using -l in the pub client. 15 | * Set QoS=1 on PUBREL commands to meet protocol spec. 16 | * Don't leak sockets on connection failure in the library. 17 | * Install man pages when building under cmake. 18 | * Fix crash bug on malformed CONNECT message. 19 | * Clients are now rejected if their socket peer name cannot be obtained on 20 | connection. 21 | * Fix a number of potential problems caused when a client with a duplicate id 22 | connects. 23 | * Install mosquitto.conf under cmake. 24 | 25 | Thanks to Mark Hindess, Joshua Lock, Adam Rudd and Ben Davenport for their 26 | help. 27 | 28 | The source code is available as always on the [download page]. Binaries will 29 | appear shortly. 30 | 31 | [download page]: /download 32 | -------------------------------------------------------------------------------- /test/broker/07-will-delay-invalid-573191.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=573191 4 | # Check under valgrind/asan for leaks. 5 | 6 | from mosq_test_helper import * 7 | 8 | def do_test(): 9 | rc = 1 10 | keepalive = 60 11 | 12 | mid = 1 13 | props = mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_WILL_DELAY_INTERVAL, 3) 14 | connect_packet = mosq_test.gen_connect("will-573191-test", keepalive=keepalive, proto_ver=5, will_topic="", will_properties=props) 15 | connack_packet = b"" 16 | 17 | port = mosq_test.get_port() 18 | broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) 19 | 20 | try: 21 | sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=30, port=port) 22 | sock.close() 23 | rc = 0 24 | finally: 25 | broker.terminate() 26 | broker.wait() 27 | (stdo, stde) = broker.communicate() 28 | if rc: 29 | print(stde.decode('utf-8')) 30 | exit(rc) 31 | 32 | do_test() 33 | -------------------------------------------------------------------------------- /www/posts/2013/04/some-interesting-mqtt-things.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | It's been a while since there has been an update here, so in lieu of one here 13 | are some interesting links I've come across recently. Add a comment to the post 14 | if you've done something cool not mentioned here! Work progresses on mosquitto 15 | 1.2. 16 | 17 | Initial release of an MQTT-S gateway, written in ruby: 18 | 19 | * 20 | 21 | And some MQTT-S tools: 22 | 23 | * 24 | 25 | A Pinoccio/MQTT/sensor powered Theramin: 26 | 27 | * 28 | 29 | Voice controlled MQTT LED: 30 | 31 | * 32 | 33 | An MQTT notification plugin for Jenkins/Hudson: 34 | 35 | * 36 | -------------------------------------------------------------------------------- /src/linker-macosx.syms: -------------------------------------------------------------------------------- 1 | _mosquitto_broker_publish 2 | _mosquitto_broker_publish_copy 3 | _mosquitto_callback_register 4 | _mosquitto_callback_unregister 5 | _mosquitto_calloc 6 | _mosquitto_client_address 7 | _mosquitto_client_certificate 8 | _mosquitto_client_clean_session 9 | _mosquitto_client_id 10 | _mosquitto_client_keepalive 11 | _mosquitto_client_protocol 12 | _mosquitto_client_protocol_version 13 | _mosquitto_client_sub_count 14 | _mosquitto_client_username 15 | _mosquitto_free 16 | _mosquitto_kick_client_by_clientid 17 | _mosquitto_kick_client_by_username 18 | _mosquitto_log_printf 19 | _mosquitto_malloc 20 | _mosquitto_property_add_binary 21 | _mosquitto_property_add_byte 22 | _mosquitto_property_add_int16 23 | _mosquitto_property_add_int32 24 | _mosquitto_property_add_string 25 | _mosquitto_property_add_string_pair 26 | _mosquitto_property_add_varint 27 | _mosquitto_property_free_all 28 | _mosquitto_pub_topic_check 29 | _mosquitto_realloc 30 | _mosquitto_set_username 31 | _mosquitto_strdup 32 | _mosquitto_sub_topic_check 33 | _mosquitto_topic_matches_sub 34 | _mosquitto_validate_utf8 35 | -------------------------------------------------------------------------------- /www/posts/2018/08/updated-debian-repository-backend.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | The backend software for administering the Debian repository at 13 | https://repo.mosquitto.org/ has been migrated from `reprepro` to `aptly`. This 14 | has the benefit of allowing multiple versions of a package to remain in the 15 | repository. 16 | 17 | For mosquitto, this now means that old versions of the Debian packages will 18 | remain available even after newer versions are published, and so you can depend 19 | on a particular version. The recommendation is always to use the latest version 20 | of course. 21 | 22 | This change should be transparent to all current users, but there is the 23 | possibility that something is different between the two repository tools. If 24 | you do find a problem, please let us know. 25 | 26 | The repository now has builds for versions 1.4.15 and 1.5. 27 | -------------------------------------------------------------------------------- /test/lib/cpp/01-con-discon-success.cpp: -------------------------------------------------------------------------------- 1 | //#include 2 | //#include 3 | //#include 4 | #include 5 | 6 | static int run = -1; 7 | 8 | class mosquittopp_test : public mosqpp::mosquittopp 9 | { 10 | public: 11 | mosquittopp_test(const char *id); 12 | 13 | void on_connect(int rc); 14 | void on_disconnect(int rc); 15 | }; 16 | 17 | mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id) 18 | { 19 | } 20 | 21 | void mosquittopp_test::on_connect(int rc) 22 | { 23 | if(rc){ 24 | exit(1); 25 | }else{ 26 | disconnect(); 27 | } 28 | } 29 | 30 | void mosquittopp_test::on_disconnect(int rc) 31 | { 32 | run = rc; 33 | } 34 | 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | struct mosquittopp_test *mosq; 39 | 40 | int port = atoi(argv[1]); 41 | 42 | mosqpp::lib_init(); 43 | 44 | mosq = new mosquittopp_test("01-con-discon-success"); 45 | 46 | mosq->connect("localhost", port, 60); 47 | 48 | while(run == -1){ 49 | mosq->loop(); 50 | } 51 | delete mosq; 52 | 53 | mosqpp::lib_cleanup(); 54 | 55 | return run; 56 | } 57 | -------------------------------------------------------------------------------- /www/plugins/docbookmanpage/html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | man.css 6 | 7 | ansi 8 | ansi 9 | ansi 10 | 11 | 12 | 13 | 14 | 15 | 16 | 1 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/old/msgsps_sub.c: -------------------------------------------------------------------------------- 1 | /* This provides a crude manner of testing the performance of a broker in messages/s. */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | static atomic_int message_count = 0; 14 | 15 | void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *msg) 16 | { 17 | message_count++; 18 | } 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | struct mosquitto *mosq; 23 | int c; 24 | 25 | mosquitto_lib_init(); 26 | 27 | mosq = mosquitto_new(NULL, true, NULL); 28 | mosquitto_message_callback_set(mosq, my_message_callback); 29 | 30 | mosquitto_connect(mosq, HOST, PORT, 600); 31 | mosquitto_subscribe(mosq, NULL, "perf/test", SUB_QOS); 32 | 33 | mosquitto_loop_start(mosq); 34 | while(1){ 35 | sleep(1); 36 | c = message_count; 37 | message_count = 0; 38 | printf("%d\n", c); 39 | 40 | } 41 | 42 | mosquitto_destroy(mosq); 43 | mosquitto_lib_cleanup(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /www/posts/2011/12/mqtt-on-nanode.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | [Nanode], the popular arduino-with-ethernet board started early in 2011 is 13 | ideal for small MQTT based projects but has so far lacked an implementation of 14 | MQTT. 15 | 16 | Nick O'Leary, the author of the original Arduino MQTT client, [has created a 17 | Nanode implementation], but it [isn't quite ready for the public]. 18 | 19 | Nicholas Humfrey has made public some code at 20 | that he says [still needs some work] but 21 | supports publishing QoS 0 messages of up to 127 bytes long and subscribing to 22 | topics with QoS 0. 23 | 24 | [Nanode]: http://nanode.eu/ 25 | [has created a Nanode implementation]: https://twitter.com/#!/knolleary/status/151057575775965184 26 | [isn't quite ready for the public]: https://twitter.com/#!/knolleary/status/151059089881960448 27 | [still needs some work]: https://twitter.com/#!/njh/status/152913104446038018 28 | -------------------------------------------------------------------------------- /www/posts/2015/12/using-lets-encrypt-certificates-with-mosquitto.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | If you want to use TLS certificates you've generated using the [Let's Encrypt] 13 | service, this is how you should configure your listener (replace "example.com" 14 | with your own domain of course): 15 | 16 | Then use the following for your mosquitto.conf: 17 | 18 | ``` 19 | listener 8883 20 | cafile /etc/ssl/certs/ISRG_Root_X1.pem 21 | certfile /etc/letsencrypt/live/example.com/fullchain.pem 22 | keyfile /etc/letsencrypt/live/example.com/privkey.pem 23 | ``` 24 | 25 | Since version 2.0 of Mosquitto, you can send a SIGHUP to the broker to cause it 26 | to reload certificates. Prior to this version, mosquitto would never update 27 | listener settings when running, so you will need to completely restart the 28 | broker. 29 | 30 | [Let's Encrypt]: https://letsencrypt.org/ 31 | -------------------------------------------------------------------------------- /www/posts/2017/06/security-advisory-cve-2017-9868.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | A vulnerability exists in Mosquitto versions 0.15 to 1.4.12 inclusive known as 13 | [CVE-2017-9868]. 14 | 15 | If persistence is enabled, then the persistence file is created world readable, 16 | which has the potential to make sensitive information available to any local 17 | user. 18 | 19 | Patches are available to fix this for Unix like operating systems (i.e. not 20 | Windows): 21 | 22 | This will be fixed in version 1.4.13, due to be released shortly. 23 | 24 | This can also be fixed administratively by removing world read permissions for 25 | the directory that the persistence file is stored in. In many systems this can 26 | be achieved with: 27 | 28 | ``` 29 | chmod 700 /var/lib/mosquitto 30 | ``` 31 | 32 | [CVE-2017-9868]: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9868 33 | -------------------------------------------------------------------------------- /test/broker/c/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all test clean reallyclean 2 | 3 | CFLAGS=-I../../../include -Wall -Werror 4 | 5 | PLUGIN_SRC = \ 6 | auth_plugin_acl.c \ 7 | auth_plugin_acl_change.c \ 8 | auth_plugin_acl_sub_denied.c \ 9 | auth_plugin_context_params.c \ 10 | auth_plugin_extended_multiple.c \ 11 | auth_plugin_extended_reauth.c \ 12 | auth_plugin_extended_single.c \ 13 | auth_plugin_extended_single2.c \ 14 | auth_plugin_msg_params.c \ 15 | auth_plugin_publish.c \ 16 | auth_plugin_pwd.c \ 17 | auth_plugin_v2.c \ 18 | auth_plugin_v4.c \ 19 | auth_plugin_v5.c \ 20 | auth_plugin_v5_handle_message.c \ 21 | auth_plugin_v5_handle_tick.c \ 22 | plugin_control.c 23 | 24 | PLUGINS = ${PLUGIN_SRC:.c=.so} 25 | 26 | SRC = \ 27 | 08-tls-psk-pub.c \ 28 | 08-tls-psk-bridge.c 29 | 30 | TESTS = ${SRC:.c=.test} 31 | 32 | 33 | all : ${PLUGINS} ${TESTS} 34 | 35 | ${PLUGINS} : %.so: %.c 36 | $(CC) ${CFLAGS} -fPIC -shared $< -o $@ 37 | 38 | 39 | ${TESTS} : %.test: %.c 40 | $(CC) ${CFLAGS} $< -o $@ ../../../lib/libmosquitto.so.1 41 | 42 | 43 | reallyclean : clean 44 | -rm -f *.orig 45 | 46 | clean : 47 | rm -f *.so *.test 48 | -------------------------------------------------------------------------------- /www/posts/2013/07/version-1-2-near-complete.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | With the most recent commit, "Implement TLSv1.2 and TLSv1.1 support," 13 | everything that is planned for version 1.2 has been completed. If you haven't 14 | tried it out yet, now would be a good time to take a look. 15 | 16 | Before the release is finalised, there still needs to be more testing done, 17 | particularly on Windows. If you use another platform than Windows or Linux, I'd 18 | be interested to hear if you have any problems with the 1.2 code. I will also 19 | be updating the packaging for all of the binaries that I build or contribute to 20 | directly, so there is still time for bug reports. 21 | 22 | You can get a copy of the source at one of the links below, or through the 23 | mercurial repository directly on the 1.2 branch. 24 | 25 | * 26 | * 27 | -------------------------------------------------------------------------------- /src/linker.syms: -------------------------------------------------------------------------------- 1 | { 2 | mosquitto_broker_publish; 3 | mosquitto_broker_publish_copy; 4 | mosquitto_callback_register; 5 | mosquitto_callback_unregister; 6 | mosquitto_calloc; 7 | mosquitto_client_address; 8 | mosquitto_client_certificate; 9 | mosquitto_client_clean_session; 10 | mosquitto_client_id; 11 | mosquitto_client_keepalive; 12 | mosquitto_client_protocol; 13 | mosquitto_client_protocol_version; 14 | mosquitto_client_sub_count; 15 | mosquitto_client_username; 16 | mosquitto_free; 17 | mosquitto_kick_client_by_clientid; 18 | mosquitto_kick_client_by_username; 19 | mosquitto_log_printf; 20 | mosquitto_malloc; 21 | mosquitto_property_add_binary; 22 | mosquitto_property_add_byte; 23 | mosquitto_property_add_int16; 24 | mosquitto_property_add_int32; 25 | mosquitto_property_add_string; 26 | mosquitto_property_add_string_pair; 27 | mosquitto_property_add_varint; 28 | mosquitto_property_free_all; 29 | mosquitto_pub_topic_check; 30 | mosquitto_realloc; 31 | mosquitto_set_username; 32 | mosquitto_strdup; 33 | mosquitto_sub_topic_check; 34 | mosquitto_topic_matches_sub; 35 | mosquitto_validate_utf8; 36 | }; 37 | -------------------------------------------------------------------------------- /test/lib/c/08-ssl-connect-no-auth.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int run = -1; 8 | 9 | void on_connect(struct mosquitto *mosq, void *obj, int rc) 10 | { 11 | if(rc){ 12 | exit(1); 13 | }else{ 14 | mosquitto_disconnect(mosq); 15 | } 16 | } 17 | 18 | void on_disconnect(struct mosquitto *mosq, void *obj, int rc) 19 | { 20 | run = rc; 21 | } 22 | 23 | int main(int argc, char *argv[]) 24 | { 25 | int rc; 26 | struct mosquitto *mosq; 27 | 28 | int port = atoi(argv[1]); 29 | 30 | mosquitto_lib_init(); 31 | 32 | mosq = mosquitto_new("08-ssl-connect-no-auth", true, NULL); 33 | if(mosq == NULL){ 34 | return 1; 35 | } 36 | mosquitto_tls_set(mosq, "../ssl/all-ca.crt", NULL, NULL, NULL, NULL); 37 | mosquitto_connect_callback_set(mosq, on_connect); 38 | mosquitto_disconnect_callback_set(mosq, on_disconnect); 39 | 40 | rc = mosquitto_connect(mosq, "localhost", port, 60); 41 | 42 | while(run == -1){ 43 | mosquitto_loop(mosq, -1, 1); 44 | } 45 | mosquitto_destroy(mosq); 46 | 47 | mosquitto_lib_cleanup(); 48 | return run; 49 | } 50 | --------------------------------------------------------------------------------