From 2ae13092f126f46cbf97f59517ce646b64f4da8e Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 13 May 2021 17:37:26 +0100 Subject: [PATCH 01/18] Update notice file. --- Makefile | 2 +- NOTICE.md | 64 ++++++++++++++++++++++ installer/mosquitto.nsi | 1 + installer/mosquitto64.nsi | 1 + notice.html | 108 -------------------------------------- 5 files changed, 67 insertions(+), 109 deletions(-) create mode 100644 NOTICE.md delete mode 100644 notice.html diff --git a/Makefile b/Makefile index ebc2ee0e..3b206b36 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ DISTFILES= \ libmosquitto.pc.in \ libmosquittopp.pc.in \ mosquitto.conf \ - notice.html \ + NOTICE.md \ pskfile.example \ pwfile.example \ README-compiling.md \ diff --git a/NOTICE.md b/NOTICE.md new file mode 100644 index 00000000..1579f2ec --- /dev/null +++ b/NOTICE.md @@ -0,0 +1,64 @@ +# Notices for Mosquitto + +This content is produced and maintained by the Eclipse Mosquitto project. + + * Project home: https://projects.eclipse.org/projects/iot.mosquitto + +## Trademarks + +Eclipse Mosquitto trademarks of the Eclipse Foundation. Eclipse, and the +Eclipse Logo are registered trademarks of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. +For more information regarding authorship of content, please consult the +listed source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v2.0 which is available at +http://www.eclipse.org/legal/epl-v10.html, or the BSD 3 Clause license. + +SPDX-License-Identifier: EPL-2.0 or BSD-3-Clause + +## Source Code + +The project maintains the following source code repositories: + + * https://github.com/eclipse/mosquitto + +## Third-party Content + +This project makes use of the follow third party projects. + +cJSON (1.7.x) + +* License: MIT +* Project: https://github.com/DaveGamble/cJSON + +libwebsockets (4.x) + +* License: MIT +* Project: https://github.com/warmcat/libwebsockets + +openssl (1.1.1) + +* License: OpenSSL License and SSLeay License +* Project: https://openssl.org +* Source: https://github.com/openssl/openssl + +uthash (2.1.0) + +* License: BSD revised (https://troydhanson.github.io/uthash/license.html) +* Project: https://github.com/troydhanson/uthash + +## Cryptography + +Content may contain encryption software. The country in which you are currently +may have restrictions on the import, possession, and use, and/or re-export to +another country, of encryption software. BEFORE using any encryption software, +please check the country's laws, regulations and policies concerning the import, +possession, or use, and re-export of encryption software, to see if this is +permitted. diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 437bf95f..2021f953 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -53,6 +53,7 @@ Section "Files" SecInstall File "..\aclfile.example" File "..\ChangeLog.txt" File "..\mosquitto.conf" + File "..\NOTICE.md" File "..\pwfile.example" File "..\README.md" File "..\README-windows.txt" diff --git a/installer/mosquitto64.nsi b/installer/mosquitto64.nsi index aeb8548b..20664b06 100644 --- a/installer/mosquitto64.nsi +++ b/installer/mosquitto64.nsi @@ -54,6 +54,7 @@ Section "Files" SecInstall File "..\aclfile.example" File "..\ChangeLog.txt" File "..\mosquitto.conf" + File "..\NOTICE.md" File "..\pwfile.example" File "..\README.md" File "..\README-windows.txt" diff --git a/notice.html b/notice.html deleted file mode 100644 index 757b27eb..00000000 --- a/notice.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

February 1, 2011

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 2.0 -https://www.eclipse.org/legal/epl-2.0/. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- - - -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- - - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - From 5f34f27b5ecb39da398e5ef0d47f88a23d996a8b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 17 May 2021 11:43:17 +0100 Subject: [PATCH 02/18] Distribute licenses of self compiled components in docker images. --- docker/1.6-openssl/Dockerfile | 3 +++ docker/1.6/Dockerfile | 3 +++ docker/2.0-openssl/Dockerfile | 4 ++++ docker/2.0/Dockerfile | 4 ++++ docker/generic/Dockerfile | 4 ++++ docker/local/Dockerfile | 4 ++++ 6 files changed, 22 insertions(+) diff --git a/docker/1.6-openssl/Dockerfile b/docker/1.6-openssl/Dockerfile index 3c09a74d..a934f845 100644 --- a/docker/1.6-openssl/Dockerfile +++ b/docker/1.6-openssl/Dockerfile @@ -78,6 +78,9 @@ RUN set -x && \ install -s -m755 /build/mosq/src/mosquitto /usr/sbin/mosquitto && \ install -s -m755 /build/mosq/src/mosquitto_passwd /usr/bin/mosquitto_passwd && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ + install -Dm644 /build/lws/LICENSE /usr/share/licenses/libwebsockets/LICENSE && \ + install -Dm644 /build/mosq/epl-v10 /usr/share/licenses/mosquitto/epl-v10 && \ + install -Dm644 /build/mosq/edl-v10 /usr/share/licenses/mosquitto/edl-v10 && \ chown -R mosquitto:mosquitto /mosquitto && \ apk --no-cache add \ ca-certificates && \ diff --git a/docker/1.6/Dockerfile b/docker/1.6/Dockerfile index 86304cb8..727272ec 100644 --- a/docker/1.6/Dockerfile +++ b/docker/1.6/Dockerfile @@ -79,6 +79,9 @@ RUN set -x && \ install -s -m755 /build/mosq/src/mosquitto /usr/sbin/mosquitto && \ install -s -m755 /build/mosq/src/mosquitto_passwd /usr/bin/mosquitto_passwd && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ + install -Dm644 /build/lws/LICENSE /usr/share/licenses/libwebsockets/LICENSE && \ + install -Dm644 /build/mosq/epl-v10 /usr/share/licenses/mosquitto/epl-v10 && \ + install -Dm644 /build/mosq/edl-v10 /usr/share/licenses/mosquitto/edl-v10 && \ chown -R mosquitto:mosquitto /mosquitto && \ apk --no-cache add \ ca-certificates \ diff --git a/docker/2.0-openssl/Dockerfile b/docker/2.0-openssl/Dockerfile index 96875b04..7749d357 100644 --- a/docker/2.0-openssl/Dockerfile +++ b/docker/2.0-openssl/Dockerfile @@ -97,6 +97,10 @@ RUN set -x && \ install -s -m755 /build/mosq/apps/mosquitto_passwd/mosquitto_passwd /usr/bin/mosquitto_passwd && \ install -s -m755 /build/mosq/plugins/dynamic-security/mosquitto_dynamic_security.so /usr/lib/mosquitto_dynamic_security.so && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ + install -Dm644 /build/cjson/LICENSE /usr/share/licenses/cJSON/LICENSE && \ + install -Dm644 /build/lws/LICENSE /usr/share/licenses/libwebsockets/LICENSE && \ + install -Dm644 /build/mosq/epl-v20 /usr/share/licenses/mosquitto/epl-v20 && \ + install -Dm644 /build/mosq/edl-v10 /usr/share/licenses/mosquitto/edl-v10 && \ chown -R mosquitto:mosquitto /mosquitto && \ apk --no-cache add \ ca-certificates && \ diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index 7a322dde..b6b27e42 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -98,6 +98,10 @@ RUN set -x && \ install -s -m755 /build/mosq/apps/mosquitto_passwd/mosquitto_passwd /usr/bin/mosquitto_passwd && \ install -s -m755 /build/mosq/plugins/dynamic-security/mosquitto_dynamic_security.so /usr/lib/mosquitto_dynamic_security.so && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ + install -Dm644 /build/cjson/LICENSE /usr/share/licenses/cJSON/LICENSE && \ + install -Dm644 /build/lws/LICENSE /usr/share/licenses/libwebsockets/LICENSE && \ + install -Dm644 /build/mosq/epl-v20 /usr/share/licenses/mosquitto/epl-v20 && \ + install -Dm644 /build/mosq/edl-v10 /usr/share/licenses/mosquitto/edl-v10 && \ chown -R mosquitto:mosquitto /mosquitto && \ apk --no-cache add \ ca-certificates \ diff --git a/docker/generic/Dockerfile b/docker/generic/Dockerfile index 5a7e8e42..faa21dc0 100644 --- a/docker/generic/Dockerfile +++ b/docker/generic/Dockerfile @@ -99,6 +99,10 @@ RUN set -x && \ install -s -m755 /build/mosq/apps/mosquitto_passwd/mosquitto_passwd /usr/bin/mosquitto_passwd && \ install -s -m755 /build/mosq/plugins/dynamic-security/mosquitto_dynamic_security.so /usr/lib/mosquitto_dynamic_security.so && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ + install -Dm644 /build/cjson/LICENSE /usr/share/licenses/cJSON/LICENSE && \ + install -Dm644 /build/lws/LICENSE /usr/share/licenses/libwebsockets/LICENSE && \ + install -Dm644 /build/mosq/epl-v20 /usr/share/licenses/mosquitto/epl-v20 && \ + install -Dm644 /build/mosq/edl-v10 /usr/share/licenses/mosquitto/edl-v10 && \ chown -R mosquitto:mosquitto /mosquitto && \ apk --no-cache add \ ca-certificates && \ diff --git a/docker/local/Dockerfile b/docker/local/Dockerfile index 90b705e7..63652e84 100644 --- a/docker/local/Dockerfile +++ b/docker/local/Dockerfile @@ -67,6 +67,10 @@ RUN set -x && \ install -s -m755 /build/mosq/apps/mosquitto_ctrl/mosquitto_ctrl /usr/bin/mosquitto_ctrl && \ install -s -m755 /build/mosq/plugins/dynamic-security/mosquitto_dynamic_security.so /usr/lib/mosquitto_dynamic_security.so && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ + install -Dm644 /build/cjson/LICENSE /usr/share/licenses/cJSON/LICENSE && \ + install -Dm644 /build/lws/LICENSE /usr/share/licenses/libwebsockets/LICENSE && \ + install -Dm644 /build/mosq/epl-v20 /usr/share/licenses/mosquitto/epl-v20 && \ + install -Dm644 /build/mosq/edl-v10 /usr/share/licenses/mosquitto/edl-v10 && \ chown -R mosquitto:mosquitto /mosquitto && \ apk --no-cache add \ ca-certificates && \ From ff872cf9436bdc463af9e40ce3015cae56326a8d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 17 May 2021 16:37:37 +0100 Subject: [PATCH 03/18] Upgrade docker images to lws 4.2.0. --- docker/1.6-openssl/Dockerfile | 7 +++++-- docker/1.6/Dockerfile | 7 +++++-- docker/2.0-openssl/Dockerfile | 7 +++++-- docker/2.0/Dockerfile | 7 +++++-- docker/generic/Dockerfile | 7 +++++-- docker/local/Dockerfile | 7 +++++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/docker/1.6-openssl/Dockerfile b/docker/1.6-openssl/Dockerfile index a934f845..7729c65a 100644 --- a/docker/1.6-openssl/Dockerfile +++ b/docker/1.6-openssl/Dockerfile @@ -6,14 +6,15 @@ LABEL maintainer="Roger Light " \ ENV VERSION=1.6.14 \ DOWNLOAD_SHA256=5ea7e342bfbd212a0addb915036be168040dea945e5de5fe739c43c5ff3823e4 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ - LWS_VERSION=2.4.2 \ - LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 + LWS_VERSION=4.2.0 \ + LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 RUN set -x && \ apk --no-cache add --virtual build-deps \ build-base \ cmake \ gnupg \ + linux-headers \ openssl-dev \ util-linux-dev && \ wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \ @@ -25,11 +26,13 @@ RUN set -x && \ cmake . \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DDISABLE_WERROR=ON \ -DLWS_IPV6=ON \ -DLWS_WITHOUT_BUILTIN_GETIFADDRS=ON \ -DLWS_WITHOUT_CLIENT=ON \ -DLWS_WITHOUT_EXTENSIONS=ON \ -DLWS_WITHOUT_TESTAPPS=ON \ + -DLWS_WITH_EXTERNAL_POLL=ON \ -DLWS_WITH_SHARED=OFF \ -DLWS_WITH_ZIP_FOPS=OFF \ -DLWS_WITH_ZLIB=OFF && \ diff --git a/docker/1.6/Dockerfile b/docker/1.6/Dockerfile index 727272ec..47f39031 100644 --- a/docker/1.6/Dockerfile +++ b/docker/1.6/Dockerfile @@ -6,8 +6,8 @@ LABEL maintainer="Roger Light " \ ENV VERSION=1.6.14 \ DOWNLOAD_SHA256=5ea7e342bfbd212a0addb915036be168040dea945e5de5fe739c43c5ff3823e4 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ - LWS_VERSION=2.4.2 \ - LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 + LWS_VERSION=4.2.0 \ + LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 RUN set -x && \ apk --no-cache add --virtual build-deps \ @@ -15,6 +15,7 @@ RUN set -x && \ cmake \ gnupg \ libressl-dev \ + linux-headers \ util-linux-dev && \ wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \ echo "$LWS_SHA256 /tmp/lws.tar.gz" | sha256sum -c - && \ @@ -25,11 +26,13 @@ RUN set -x && \ cmake . \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DDISABLE_WERROR=ON \ -DLWS_IPV6=ON \ -DLWS_WITHOUT_BUILTIN_GETIFADDRS=ON \ -DLWS_WITHOUT_CLIENT=ON \ -DLWS_WITHOUT_EXTENSIONS=ON \ -DLWS_WITHOUT_TESTAPPS=ON \ + -DLWS_WITH_EXTERNAL_POLL=ON \ -DLWS_WITH_SHARED=OFF \ -DLWS_WITH_ZIP_FOPS=OFF \ -DLWS_WITH_ZLIB=OFF && \ diff --git a/docker/2.0-openssl/Dockerfile b/docker/2.0-openssl/Dockerfile index 7749d357..4be144a9 100644 --- a/docker/2.0-openssl/Dockerfile +++ b/docker/2.0-openssl/Dockerfile @@ -6,8 +6,8 @@ LABEL maintainer="Roger Light " \ ENV VERSION=2.0.10 \ DOWNLOAD_SHA256=0188f7b21b91d6d80e992b8d6116ba851468b3bd154030e8a003ed28fb6f4a44 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ - LWS_VERSION=2.4.2 \ - LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ + LWS_VERSION=4.2.0 \ + LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 \ CJSON_VERSION=1.7.14 \ CJSON_SHA256=fb50a663eefdc76bafa80c82bc045af13b1363e8f45cec8b442007aef6a41343 @@ -16,6 +16,7 @@ RUN set -x && \ build-base \ cmake \ gnupg \ + linux-headers \ openssl-dev \ util-linux-dev && \ wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \ @@ -27,11 +28,13 @@ RUN set -x && \ cmake . \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DDISABLE_WERROR=ON \ -DLWS_IPV6=ON \ -DLWS_WITHOUT_BUILTIN_GETIFADDRS=ON \ -DLWS_WITHOUT_CLIENT=ON \ -DLWS_WITHOUT_EXTENSIONS=ON \ -DLWS_WITHOUT_TESTAPPS=ON \ + -DLWS_WITH_EXTERNAL_POLL=ON \ -DLWS_WITH_SHARED=OFF \ -DLWS_WITH_ZIP_FOPS=OFF \ -DLWS_WITH_ZLIB=OFF && \ diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index b6b27e42..f6a8d6e5 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -6,8 +6,8 @@ LABEL maintainer="Roger Light " \ ENV VERSION=2.0.10 \ DOWNLOAD_SHA256=0188f7b21b91d6d80e992b8d6116ba851468b3bd154030e8a003ed28fb6f4a44 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ - LWS_VERSION=2.4.2 \ - LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ + LWS_VERSION=4.2.0 \ + LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 \ CJSON_VERSION=1.7.14 \ CJSON_SHA256=fb50a663eefdc76bafa80c82bc045af13b1363e8f45cec8b442007aef6a41343 @@ -17,6 +17,7 @@ RUN set -x && \ cmake \ gnupg \ libressl-dev \ + linux-headers \ util-linux-dev && \ wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \ echo "$LWS_SHA256 /tmp/lws.tar.gz" | sha256sum -c - && \ @@ -27,11 +28,13 @@ RUN set -x && \ cmake . \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DDISABLE_WERROR=ON \ -DLWS_IPV6=ON \ -DLWS_WITHOUT_BUILTIN_GETIFADDRS=ON \ -DLWS_WITHOUT_CLIENT=ON \ -DLWS_WITHOUT_EXTENSIONS=ON \ -DLWS_WITHOUT_TESTAPPS=ON \ + -DLWS_WITH_EXTERNAL_POLL=ON \ -DLWS_WITH_SHARED=OFF \ -DLWS_WITH_ZIP_FOPS=OFF \ -DLWS_WITH_ZLIB=OFF && \ diff --git a/docker/generic/Dockerfile b/docker/generic/Dockerfile index faa21dc0..81c1a37e 100644 --- a/docker/generic/Dockerfile +++ b/docker/generic/Dockerfile @@ -8,8 +8,8 @@ RUN test -n "${VERSION}" ENV \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ - LWS_VERSION=2.4.2 \ - LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ + LWS_VERSION=4.2.0 \ + LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 \ CJSON_VERSION=1.7.14 \ CJSON_SHA256=fb50a663eefdc76bafa80c82bc045af13b1363e8f45cec8b442007aef6a41343 @@ -18,6 +18,7 @@ RUN set -x && \ build-base \ cmake \ gnupg \ + linux-headers \ openssl-dev \ util-linux-dev && \ wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \ @@ -29,11 +30,13 @@ RUN set -x && \ cmake . \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DDISABLE_WERROR=ON \ -DLWS_IPV6=ON \ -DLWS_WITHOUT_BUILTIN_GETIFADDRS=ON \ -DLWS_WITHOUT_CLIENT=ON \ -DLWS_WITHOUT_EXTENSIONS=ON \ -DLWS_WITHOUT_TESTAPPS=ON \ + -DLWS_WITH_EXTERNAL_POLL=ON \ -DLWS_WITH_SHARED=OFF \ -DLWS_WITH_ZIP_FOPS=OFF \ -DLWS_WITH_ZLIB=OFF && \ diff --git a/docker/local/Dockerfile b/docker/local/Dockerfile index 63652e84..bed389d0 100644 --- a/docker/local/Dockerfile +++ b/docker/local/Dockerfile @@ -3,7 +3,7 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV LWS_VERSION=2.4.2 \ +ENV LWS_VERSION=4.2.0 \ CJSON_VERSION=1.7.14 COPY mosq.tar.gz /tmp @@ -13,6 +13,7 @@ RUN set -x && \ build-base \ cmake \ gnupg \ + linux-headers \ openssl-dev \ util-linux-dev && \ wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \ @@ -23,11 +24,13 @@ RUN set -x && \ cmake . \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DDISABLE_WERROR=ON \ -DLWS_IPV6=ON \ -DLWS_WITHOUT_BUILTIN_GETIFADDRS=ON \ -DLWS_WITHOUT_CLIENT=ON \ -DLWS_WITHOUT_EXTENSIONS=ON \ -DLWS_WITHOUT_TESTAPPS=ON \ + -DLWS_WITH_EXTERNAL_POLL=ON \ -DLWS_WITH_SHARED=OFF \ -DLWS_WITH_ZIP_FOPS=OFF \ -DLWS_WITH_ZLIB=OFF && \ @@ -43,7 +46,7 @@ RUN set -x && \ tar --strip=1 -xf /tmp/mosq.tar.gz -C /build/mosq && \ rm /tmp/mosq.tar.gz && \ make -C /build/mosq -j "$(nproc)" \ - CFLAGS="-Wall -O2 -I/build/lws/include -I/build/cjson" \ + CFLAGS="-Wall -O2 -I/build/lws/include -I/build" \ LDFLAGS="-L/build/lws/lib -L/build/cjson" \ WITH_ADNS=no \ WITH_CJSON=yes \ From 625e2a5060920abbef1c444bfd4b6378f389ae3d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 11:59:12 +0100 Subject: [PATCH 04/18] Refactor to remove duplicate code. --- lib/net_mosq.c | 68 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 16d0e8c9..06aa7e72 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -943,11 +943,42 @@ int net__socket_connect(struct mosquitto *mosq, const char *host, uint16_t port, } +#ifdef WITH_TLS +static net__handle_ssl(struct mosquitto* mosq, int ret) +{ + int err; + + err = SSL_get_error(mosq->ssl, ret); + if (err == SSL_ERROR_WANT_READ) { + ret = -1; + errno = EAGAIN; + } + else if (err == SSL_ERROR_WANT_WRITE) { + ret = -1; +#ifdef WITH_BROKER + mux__add_out(mosq); +#else + mosq->want_write = true; +#endif + errno = EAGAIN; + } + else { + net__print_ssl_error(mosq); + errno = EPROTO; + } + ERR_clear_error(); +#ifdef WIN32 + WSASetLastError(errno); +#endif + + return ret; +} +#endif + ssize_t net__read(struct mosquitto *mosq, void *buf, size_t count) { #ifdef WITH_TLS int ret; - int err; #endif assert(mosq); errno = 0; @@ -955,22 +986,7 @@ ssize_t net__read(struct mosquitto *mosq, void *buf, size_t count) if(mosq->ssl){ ret = SSL_read(mosq->ssl, buf, (int)count); if(ret <= 0){ - err = SSL_get_error(mosq->ssl, ret); - if(err == SSL_ERROR_WANT_READ){ - ret = -1; - errno = EAGAIN; - }else if(err == SSL_ERROR_WANT_WRITE){ - ret = -1; - mosq->want_write = true; - errno = EAGAIN; - }else{ - net__print_ssl_error(mosq); - errno = EPROTO; - } - ERR_clear_error(); -#ifdef WIN32 - WSASetLastError(errno); -#endif + ret = net__handle_ssl(mosq, ret); } return (ssize_t )ret; }else{ @@ -993,7 +1009,6 @@ ssize_t net__write(struct mosquitto *mosq, const void *buf, size_t count) { #ifdef WITH_TLS int ret; - int err; #endif assert(mosq); @@ -1003,22 +1018,7 @@ ssize_t net__write(struct mosquitto *mosq, const void *buf, size_t count) mosq->want_write = false; ret = SSL_write(mosq->ssl, buf, (int)count); if(ret < 0){ - err = SSL_get_error(mosq->ssl, ret); - if(err == SSL_ERROR_WANT_READ){ - ret = -1; - errno = EAGAIN; - }else if(err == SSL_ERROR_WANT_WRITE){ - ret = -1; - mosq->want_write = true; - errno = EAGAIN; - }else{ - net__print_ssl_error(mosq); - errno = EPROTO; - } - ERR_clear_error(); -#ifdef WIN32 - WSASetLastError(errno); -#endif + ret = net__handle_ssl(mosq, ret); } return (ssize_t )ret; }else{ From 5851713f3e7fe5eda5694c63b2b144e2d951a9f0 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 12:00:05 +0100 Subject: [PATCH 05/18] Refactor to remove duplicate code. --- src/mux_poll.c | 74 ++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 44 deletions(-) diff --git a/src/mux_poll.c b/src/mux_poll.c index ca61cd5c..eefd1c93 100644 --- a/src/mux_poll.c +++ b/src/mux_poll.c @@ -106,36 +106,44 @@ int mux_poll__init(struct mosquitto__listener_sock *listensock, int listensock_c } -int mux_poll__add_out(struct mosquitto *context) +static mux_poll__add(struct mosquitto* context, int evt) { size_t i; - if(!(context->events & POLLOUT)) { - if(context->pollfd_index != -1){ - pollfds[context->pollfd_index].fd = context->sock; - pollfds[context->pollfd_index].events = POLLIN | POLLOUT; - pollfds[context->pollfd_index].revents = 0; - }else{ - for(i=0; isock; - pollfds[i].events = POLLIN | POLLOUT; - pollfds[i].revents = 0; - context->pollfd_index = (int )i; - if(i > pollfd_current_max){ - pollfd_current_max = i; - } - break; - } - } - } - context->events = POLLIN | POLLOUT; + if(context->events == evt){ + return MOSQ_ERR_SUCCESS; } + if(context->pollfd_index != -1){ + pollfds[context->pollfd_index].fd = context->sock; + pollfds[context->pollfd_index].events = evt; + pollfds[context->pollfd_index].revents = 0; + }else{ + for(i=0; isock; + pollfds[i].events = POLLIN; + pollfds[i].revents = 0; + context->pollfd_index = (int)i; + if(i > pollfd_current_max){ + pollfd_current_max = i; + } + break; + } + } + } + context->events = evt; + return MOSQ_ERR_SUCCESS; } +int mux_poll__add_out(struct mosquitto *context) +{ + return mux_poll__add(context, POLLIN | POLLOUT); +} + + int mux_poll__remove_out(struct mosquitto *context) { if(context->events & POLLOUT) { @@ -148,29 +156,7 @@ int mux_poll__remove_out(struct mosquitto *context) int mux_poll__add_in(struct mosquitto *context) { - size_t i; - - if(context->pollfd_index != -1){ - pollfds[context->pollfd_index].fd = context->sock; - pollfds[context->pollfd_index].events = POLLIN; - pollfds[context->pollfd_index].revents = 0; - }else{ - for(i=0; isock; - pollfds[i].events = POLLIN; - pollfds[i].revents = 0; - context->pollfd_index = (int )i; - if(i > pollfd_current_max){ - pollfd_current_max = i; - } - break; - } - } - } - context->events = POLLIN; - - return MOSQ_ERR_SUCCESS; + return mux_poll__add(context, POLLIN); } int mux_poll__delete(struct mosquitto *context) From 104b94db57b37c1c21bc5ca277a498ae53bf77ff Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 12:07:24 +0100 Subject: [PATCH 06/18] Fix non-reachable bridge blocking the broker on Windows. Closes #2172. Thanks to Niclas Lindgren. --- ChangeLog.txt | 1 + lib/packet_mosq.c | 12 +++++------- src/bridge.c | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index dd7ec248..a705ca97 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -8,6 +8,7 @@ Broker: - Fix bridge not reconnectng if the first reconnection attempt fails. Closes #2207. - Improve QoS 0 outgoing packet queueing. +- Fix non-reachable bridge blocking the broker on Windows. Closes #2172. Clients: - If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c index d9647182..bce1fe8b 100644 --- a/lib/packet_mosq.c +++ b/lib/packet_mosq.c @@ -236,11 +236,7 @@ int packet__write(struct mosquitto *mosq) #endif state = mosquitto__get_state(mosq); -#if defined(WITH_TLS) && !defined(WITH_BROKER) if(state == mosq_cs_connect_pending || mosq->want_connect){ -#else - if(state == mosq_cs_connect_pending){ -#endif pthread_mutex_unlock(&mosq->current_out_packet_mutex); return MOSQ_ERR_SUCCESS; } @@ -324,15 +320,17 @@ int packet__write(struct mosquitto *mosq) #ifdef WITH_BROKER mosq->next_msg_out = db.now_s + mosq->keepalive; - if(mosq->current_out_packet == NULL){ - mux__remove_out(mosq); - } #else pthread_mutex_lock(&mosq->msgtime_mutex); mosq->next_msg_out = mosquitto_time() + mosq->keepalive; pthread_mutex_unlock(&mosq->msgtime_mutex); #endif } +#ifdef WITH_BROKER + if (mosq->current_out_packet == NULL) { + mux__remove_out(mosq); + } +#endif pthread_mutex_unlock(&mosq->current_out_packet_mutex); return MOSQ_ERR_SUCCESS; } diff --git a/src/bridge.c b/src/bridge.c index 3fc0dce8..bb7b9c35 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -285,6 +285,7 @@ int bridge__connect_step2(struct mosquitto *context) if(rc == MOSQ_ERR_CONN_PENDING){ mosquitto__set_state(context, mosq_cs_connect_pending); + mux__add_out(context); } return rc; } @@ -447,6 +448,7 @@ int bridge__connect(struct mosquitto *context) return rc; }else if(rc == MOSQ_ERR_CONN_PENDING){ mosquitto__set_state(context, mosq_cs_connect_pending); + mux__add_out(context); } HASH_ADD(hh_sock, db.contexts_by_sock, sock, sizeof(context->sock), context); From 238b68686a3cf66511aa147ec8980d88b367a3ac Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 12:57:17 +0100 Subject: [PATCH 07/18] Fix bridge pollfd corruption on Windows. Closes #2173. Thanks to Niclas Lindgren. --- ChangeLog.txt | 2 ++ src/bridge.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index a705ca97..57d60df7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -9,6 +9,8 @@ Broker: Closes #2207. - Improve QoS 0 outgoing packet queueing. - Fix non-reachable bridge blocking the broker on Windows. Closes #2172. +- Fix possible corruption of pollfd array on Windows when bridges were + reconnecting. Closes #2173. Clients: - If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect diff --git a/src/bridge.c b/src/bridge.c index bb7b9c35..9ca367a9 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -245,6 +245,7 @@ int bridge__connect_step1(struct mosquitto *context) rc = net__try_connect_step1(context, context->bridge->addresses[context->bridge->cur_address].address); if(rc > 0 ){ if(rc == MOSQ_ERR_TLS){ + mux__delete(context); net__socket_close(context); return rc; /* Error already printed */ }else if(rc == MOSQ_ERR_ERRNO){ @@ -270,6 +271,7 @@ int bridge__connect_step2(struct mosquitto *context) rc = net__try_connect_step2(context, context->bridge->addresses[context->bridge->cur_address].port, &context->sock); if(rc > 0){ if(rc == MOSQ_ERR_TLS){ + mux__delete(context); net__socket_close(context); return rc; /* Error already printed */ }else if(rc == MOSQ_ERR_ERRNO){ @@ -298,6 +300,7 @@ int bridge__connect_step3(struct mosquitto *context) rc = net__socket_connect_step3(context, context->bridge->addresses[context->bridge->cur_address].address); if(rc > 0){ if(rc == MOSQ_ERR_TLS){ + mux__delete(context); net__socket_close(context); return rc; /* Error already printed */ }else if(rc == MOSQ_ERR_ERRNO){ @@ -326,6 +329,7 @@ int bridge__connect_step3(struct mosquitto *context) }else if(rc == MOSQ_ERR_EAI){ log__printf(NULL, MOSQ_LOG_ERR, "Error creating bridge: %s.", gai_strerror(errno)); } + mux__delete(context); net__socket_close(context); return rc; } @@ -437,6 +441,7 @@ int bridge__connect(struct mosquitto *context) if(rc > 0){ if(rc == MOSQ_ERR_TLS){ + mux__delete(context); net__socket_close(context); return rc; /* Error already printed */ }else if(rc == MOSQ_ERR_ERRNO){ @@ -466,6 +471,7 @@ int bridge__connect(struct mosquitto *context) }else if(rc2 == MOSQ_ERR_EAI){ log__printf(NULL, MOSQ_LOG_ERR, "Error creating bridge: %s.", gai_strerror(errno)); } + mux__delete(context); net__socket_close(context); return rc2; } @@ -751,6 +757,7 @@ void bridge_check(void) COMPAT_CLOSE(context->bridge->primary_retry_sock); context->bridge->primary_retry_sock = INVALID_SOCKET; context->bridge->primary_retry = 0; + mux__delete(context); net__socket_close(context); context->bridge->cur_address = 0; } @@ -761,6 +768,7 @@ void bridge_check(void) COMPAT_CLOSE(context->bridge->primary_retry_sock); context->bridge->primary_retry_sock = INVALID_SOCKET; context->bridge->primary_retry = 0; + mux__delete(context); net__socket_close(context); context->bridge->cur_address = context->bridge->address_count-1; }else{ From 403691ce402d412c9bc8f2279bd8990f4d2e132c Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 16:51:23 +0100 Subject: [PATCH 08/18] Add missing return types. --- lib/net_mosq.c | 2 +- src/mux_poll.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 06aa7e72..550592a7 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -944,7 +944,7 @@ int net__socket_connect(struct mosquitto *mosq, const char *host, uint16_t port, #ifdef WITH_TLS -static net__handle_ssl(struct mosquitto* mosq, int ret) +static int net__handle_ssl(struct mosquitto* mosq, int ret) { int err; diff --git a/src/mux_poll.c b/src/mux_poll.c index eefd1c93..8d6bb2f1 100644 --- a/src/mux_poll.c +++ b/src/mux_poll.c @@ -106,7 +106,7 @@ int mux_poll__init(struct mosquitto__listener_sock *listensock, int listensock_c } -static mux_poll__add(struct mosquitto* context, int evt) +static int mux_poll__add(struct mosquitto* context, uint16_t evt) { size_t i; @@ -116,7 +116,7 @@ static mux_poll__add(struct mosquitto* context, int evt) if(context->pollfd_index != -1){ pollfds[context->pollfd_index].fd = context->sock; - pollfds[context->pollfd_index].events = evt; + pollfds[context->pollfd_index].events = (short int)evt; pollfds[context->pollfd_index].revents = 0; }else{ for(i=0; i Date: Tue, 8 Jun 2021 16:52:46 +0100 Subject: [PATCH 09/18] Fix leak on crafted MQTT v5 CONNECT. If a MQTT v5 client connects with a crafted CONNECT packet a memory leak will occur. Thanks to Kathrin Kleinhammer. --- ChangeLog.txt | 6 +++++- src/handle_connect.c | 2 ++ test/broker/Makefile | 1 + test/broker/test.py | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 57d60df7..4fecec55 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,10 @@ -2.0.11 - 2021-xx-xx +2.0.11 - 2021-06-08 =================== +Security: +- If a MQTT v5 client connects with a crafted CONNECT packet a memory leak + will occur. This has been fixed. + Broker: - Fix possible crash having just upgraded from 1.6 if `per_listener_settings true` is set, and a SIGHUP is sent to the broker before a client has diff --git a/src/handle_connect.c b/src/handle_connect.c index b031d200..c1a096b6 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -924,11 +924,13 @@ handle_connect_error: mosquitto__free(will_struct->msg.topic); mosquitto__free(will_struct); } + context->will = NULL; #ifdef WITH_TLS if(client_cert) X509_free(client_cert); #endif /* We return an error here which means the client is freed later on. */ context->clean_start = true; context->session_expiry_interval = 0; + context->will_delay_interval = 0; return rc; } diff --git a/test/broker/Makefile b/test/broker/Makefile index c874d67b..d012c91a 100644 --- a/test/broker/Makefile +++ b/test/broker/Makefile @@ -135,6 +135,7 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ./06-bridge-reconnect-local-out.py 07 : + ./07-will-delay-invalid-573191.py ./07-will-delay-reconnect.py ./07-will-delay-recover.py ./07-will-delay-session-expiry.py diff --git a/test/broker/test.py b/test/broker/test.py index abf94143..91a4ca4c 100755 --- a/test/broker/test.py +++ b/test/broker/test.py @@ -114,6 +114,7 @@ tests = [ (3, './06-bridge-per-listener-settings.py'), (2, './06-bridge-reconnect-local-out.py'), + (1, './07-will-delay-invalid-573191.py'), (1, './07-will-delay-reconnect.py'), (1, './07-will-delay-recover.py'), (1, './07-will-delay-session-expiry.py'), From 8416f928df380de092f8bb80fbad85ecab86631a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 17:02:38 +0100 Subject: [PATCH 10/18] Revert premature want_connect fix. --- lib/packet_mosq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c index bce1fe8b..43611bcd 100644 --- a/lib/packet_mosq.c +++ b/lib/packet_mosq.c @@ -236,7 +236,11 @@ int packet__write(struct mosquitto *mosq) #endif state = mosquitto__get_state(mosq); +#if defined(WITH_TLS) && !defined(WITH_BROKER) if(state == mosq_cs_connect_pending || mosq->want_connect){ +#else + if(state == mosq_cs_connect_pending){ +#endif pthread_mutex_unlock(&mosq->current_out_packet_mutex); return MOSQ_ERR_SUCCESS; } From ea7e2a6bcad97679c74f1680515826c346a61312 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 22:23:58 +0100 Subject: [PATCH 11/18] Bump version, add post. --- CMakeLists.txt | 2 +- config.mk | 2 +- include/mosquitto.h | 2 +- installer/mosquitto.nsi | 2 +- installer/mosquitto64.nsi | 2 +- set-version.sh | 2 +- snap/snapcraft.yaml | 2 +- www/pages/download.md | 8 ++-- www/posts/2021/06/version-2-0-11-released.md | 43 ++++++++++++++++++++ 9 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 www/posts/2021/06/version-2-0-11-released.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a0be9b1..4ddba1ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0) cmake_policy(SET CMP0042 NEW) project(mosquitto) -set (VERSION 2.0.10) +set (VERSION 2.0.11) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") diff --git a/config.mk b/config.mk index fe6a822a..619c1e13 100644 --- a/config.mk +++ b/config.mk @@ -127,7 +127,7 @@ WITH_XTREPORT=no # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi -VERSION=2.0.10 +VERSION=2.0.11 # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 diff --git a/include/mosquitto.h b/include/mosquitto.h index cb1786ef..2cc32634 100644 --- a/include/mosquitto.h +++ b/include/mosquitto.h @@ -66,7 +66,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 2 #define LIBMOSQUITTO_MINOR 0 -#define LIBMOSQUITTO_REVISION 10 +#define LIBMOSQUITTO_REVISION 11 /* LIBMOSQUITTO_VERSION_NUMBER looks like 1002001 for e.g. version 1.2.1. */ #define LIBMOSQUITTO_VERSION_NUMBER (LIBMOSQUITTO_MAJOR*1000000+LIBMOSQUITTO_MINOR*1000+LIBMOSQUITTO_REVISION) diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 437bf95f..dbea4bc1 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.10 +!define VERSION 2.0.11 OutFile "mosquitto-${VERSION}-install-windows-x86.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto64.nsi b/installer/mosquitto64.nsi index aeb8548b..2dc64cc9 100644 --- a/installer/mosquitto64.nsi +++ b/installer/mosquitto64.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.10 +!define VERSION 2.0.11 OutFile "mosquitto-${VERSION}-install-windows-x64.exe" !include "x64.nsh" diff --git a/set-version.sh b/set-version.sh index af1fc52d..3ab0982f 100755 --- a/set-version.sh +++ b/set-version.sh @@ -2,7 +2,7 @@ MAJOR=2 MINOR=0 -REVISION=10 +REVISION=11 sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 1ca29c0f..5e0cf01b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: mosquitto -version: 2.0.10 +version: 2.0.11 summary: Eclipse Mosquitto MQTT broker description: This is a message broker that supports version 5.0, 3.1.1, and 3.1 of the MQTT protocol. diff --git a/www/pages/download.md b/www/pages/download.md index 974476d3..96c53083 100644 --- a/www/pages/download.md +++ b/www/pages/download.md @@ -1,7 +1,7 @@ + +Versions 2.0.11 of Mosquitto has been released. This is a security and bugfix +release. + +# Security +- If an authenticated client connected with MQTT v5 sent a crafted CONNECT + message to the broker a memory leak would occur. + Affects versions 1.6 to 2.0.10 inclusive. + +# Broker +- Fix possible crash having just upgraded from 1.6 if `per_listener_settings + true` is set, and a SIGHUP is sent to the broker before a client has + reconnected to the broker. Closes [#2167]. +- Fix bridge not reconnectng if the first reconnection attempt fails. + Closes [#2207]. +- Improve QoS 0 outgoing packet queueing. +- Fix non-reachable bridge blocking the broker on Windows. Closes #2172. +- Fix possible corruption of pollfd array on Windows when bridges were + reconnecting. Closes [#2173]. + +# Clients +- If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect + that the pipe has closed and disconnect. Closes [#2164]. +- Fix `mosquitto_pub -l` quitting if a message publication is attempted when + the broker is temporarily unavailable. Closes [#2187]. + + +[#2164]: https://github.com/eclipse/mosquitto/issues/2164 +[#2167]: https://github.com/eclipse/mosquitto/issues/2167 +[#2172]: https://github.com/eclipse/mosquitto/issues/2172 +[#2173]: https://github.com/eclipse/mosquitto/issues/2173 +[#2187]: https://github.com/eclipse/mosquitto/issues/2187 +[#2207]: https://github.com/eclipse/mosquitto/issues/2207 From 99d7299b243309aab28e6bc2893e57a74468d530 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Jun 2021 13:19:37 +0100 Subject: [PATCH 12/18] Fix qos0 messages not being queued when queue_qos0_message enabled. Closes #2224. Thanks to Luigi Caiffa. --- ChangeLog.txt | 2 ++ src/database.c | 2 +- www/posts/2021/06/version-2-0-11-released.md | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4fecec55..15dd0f6a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -15,6 +15,8 @@ Broker: - Fix non-reachable bridge blocking the broker on Windows. Closes #2172. - Fix possible corruption of pollfd array on Windows when bridges were reconnecting. Closes #2173. +- Fix QoS 0 messages not being queued when `queue_qos0_messages` was enabled. + Closes #2224. Clients: - If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect diff --git a/src/database.c b/src/database.c index 4dfceb26..94c9e006 100644 --- a/src/database.c +++ b/src/database.c @@ -110,7 +110,7 @@ bool db__ready_for_queue(struct mosquitto *context, int qos, struct mosquitto_ms return true; } - if(qos == 0){ + if(qos == 0 && db.config->queue_qos0_messages == false){ return false; /* This case is handled in db__ready_for_flight() */ }else{ source_bytes = (ssize_t)msg_data->msg_bytes12; diff --git a/www/posts/2021/06/version-2-0-11-released.md b/www/posts/2021/06/version-2-0-11-released.md index 0768dd47..bd34de71 100644 --- a/www/posts/2021/06/version-2-0-11-released.md +++ b/www/posts/2021/06/version-2-0-11-released.md @@ -27,6 +27,8 @@ release. - Fix non-reachable bridge blocking the broker on Windows. Closes #2172. - Fix possible corruption of pollfd array on Windows when bridges were reconnecting. Closes [#2173]. +- Fix QoS 0 messages not being queued when `queue_qos0_messages` was enabled. + Closes [#2224]. # Clients - If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect @@ -41,3 +43,4 @@ release. [#2173]: https://github.com/eclipse/mosquitto/issues/2173 [#2187]: https://github.com/eclipse/mosquitto/issues/2187 [#2207]: https://github.com/eclipse/mosquitto/issues/2207 +[#2224]: https://github.com/eclipse/mosquitto/issues/2224 From c4ca718ea7cbd9844637092d003574c56e3aa767 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 8 Jun 2021 22:45:55 +0100 Subject: [PATCH 13/18] Add man page deps to readme. --- README-compiling.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README-compiling.md b/README-compiling.md index eb1b11da..827aba59 100644 --- a/README-compiling.md +++ b/README-compiling.md @@ -10,6 +10,8 @@ are optional. * libsystemd-dev (optional, if building with systemd support on Linux) * On Windows, a pthreads library is required if threading support is to be included. +* xsltproc (only if building from git) +* docbook-xsl (only if building from git) To compile, run "make", but also see the file config.mk for more details on the various options that can be compiled in. From 3b89bb2e3532f99f0394b11a09ccc481cebcb0b2 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Jun 2021 13:36:28 +0100 Subject: [PATCH 14/18] Update post to include 1.6.15 information. --- www/posts/2021/06/version-2-0-11-released.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/www/posts/2021/06/version-2-0-11-released.md b/www/posts/2021/06/version-2-0-11-released.md index bd34de71..1041d3cc 100644 --- a/www/posts/2021/06/version-2-0-11-released.md +++ b/www/posts/2021/06/version-2-0-11-released.md @@ -9,15 +9,17 @@ .. type: text --> -Versions 2.0.11 of Mosquitto has been released. This is a security and bugfix -release. +Versions 2.0.11 and 1.6.15 of Mosquitto has been released. These are a security +and bugfix releases. -# Security +# 2.0.11 + +## Security - If an authenticated client connected with MQTT v5 sent a crafted CONNECT message to the broker a memory leak would occur. Affects versions 1.6 to 2.0.10 inclusive. -# Broker +## Broker - Fix possible crash having just upgraded from 1.6 if `per_listener_settings true` is set, and a SIGHUP is sent to the broker before a client has reconnected to the broker. Closes [#2167]. @@ -30,12 +32,18 @@ release. - Fix QoS 0 messages not being queued when `queue_qos0_messages` was enabled. Closes [#2224]. -# Clients +## Clients - If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect that the pipe has closed and disconnect. Closes [#2164]. - Fix `mosquitto_pub -l` quitting if a message publication is attempted when the broker is temporarily unavailable. Closes [#2187]. +# 1.6.15 + +## Security +- If an authenticated client connected with MQTT v5 sent a crafted CONNECT + message to the broker a memory leak would occur. + Affects versions 1.6 to 2.0.10 inclusive. [#2164]: https://github.com/eclipse/mosquitto/issues/2164 [#2167]: https://github.com/eclipse/mosquitto/issues/2167 From 1ab6b28e2644faf4ec02de2e98bcf693d865dd65 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Jun 2021 14:22:21 +0100 Subject: [PATCH 15/18] Add missing test file. --- test/broker/07-will-delay-invalid-573191.py | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 test/broker/07-will-delay-invalid-573191.py diff --git a/test/broker/07-will-delay-invalid-573191.py b/test/broker/07-will-delay-invalid-573191.py new file mode 100755 index 00000000..18f4acfc --- /dev/null +++ b/test/broker/07-will-delay-invalid-573191.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +# Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=573191 +# Check under valgrind/asan for leaks. + +from mosq_test_helper import * + +def do_test(): + rc = 1 + keepalive = 60 + + mid = 1 + props = mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_WILL_DELAY_INTERVAL, 3) + connect_packet = mosq_test.gen_connect("will-573191-test", keepalive=keepalive, proto_ver=5, will_topic="", will_properties=props) + connack_packet = b"" + + port = mosq_test.get_port() + broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) + + try: + sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=30, port=port) + sock.close() + rc = 0 + finally: + broker.terminate() + broker.wait() + (stdo, stde) = broker.communicate() + if rc: + print(stde.decode('utf-8')) + exit(rc) + +do_test() From 5217863b8b210f22df81c6b95d1eb89ed4af9b50 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Jun 2021 16:21:55 +0100 Subject: [PATCH 16/18] Bump docker files. --- docker/1.6-openssl/Dockerfile | 4 ++-- docker/1.6/Dockerfile | 4 ++-- docker/2.0-openssl/Dockerfile | 4 ++-- docker/2.0/Dockerfile | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/1.6-openssl/Dockerfile b/docker/1.6-openssl/Dockerfile index 7729c65a..ff6b729e 100644 --- a/docker/1.6-openssl/Dockerfile +++ b/docker/1.6-openssl/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=1.6.14 \ - DOWNLOAD_SHA256=5ea7e342bfbd212a0addb915036be168040dea945e5de5fe739c43c5ff3823e4 \ +ENV VERSION=1.6.15 \ + DOWNLOAD_SHA256=5ff2271512f745bf1a451072cd3768a5daed71e90c5179fae12b049d6c02aa0f \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=4.2.0 \ LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 diff --git a/docker/1.6/Dockerfile b/docker/1.6/Dockerfile index 47f39031..46231c8e 100644 --- a/docker/1.6/Dockerfile +++ b/docker/1.6/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=1.6.14 \ - DOWNLOAD_SHA256=5ea7e342bfbd212a0addb915036be168040dea945e5de5fe739c43c5ff3823e4 \ +ENV VERSION=1.6.15 \ + DOWNLOAD_SHA256=5ff2271512f745bf1a451072cd3768a5daed71e90c5179fae12b049d6c02aa0f \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=4.2.0 \ LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 diff --git a/docker/2.0-openssl/Dockerfile b/docker/2.0-openssl/Dockerfile index 4be144a9..841878bd 100644 --- a/docker/2.0-openssl/Dockerfile +++ b/docker/2.0-openssl/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.10 \ - DOWNLOAD_SHA256=0188f7b21b91d6d80e992b8d6116ba851468b3bd154030e8a003ed28fb6f4a44 \ +ENV VERSION=2.0.11 \ + DOWNLOAD_SHA256=7b36a7198bce85cf31b132f5c6ee36dcf5dadf86fb768501eb1e11ce95d4f78a \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=4.2.0 \ LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 \ diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index f6a8d6e5..f08e6dfe 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.10 \ - DOWNLOAD_SHA256=0188f7b21b91d6d80e992b8d6116ba851468b3bd154030e8a003ed28fb6f4a44 \ +ENV VERSION=2.0.11 \ + DOWNLOAD_SHA256=7b36a7198bce85cf31b132f5c6ee36dcf5dadf86fb768501eb1e11ce95d4f78a \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=4.2.0 \ LWS_SHA256=a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40 \ From 6028d0e33e0ca2a215caa556633e3418e45b094b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Jun 2021 21:16:57 +0100 Subject: [PATCH 17/18] mosquitto_sub and mosquitto_rr now open stdout in binary mode on Windows This is so binary payloads are not modified when printing. Thanks to Steve Mullock. --- ChangeLog.txt | 7 +++++++ client/rr_client.c | 1 + client/sub_client.c | 2 +- client/sub_client_output.c | 7 ++++++- client/sub_client_output.h | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 3bb53195..0dfdcdb2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +2.0.12 - 2021-07-xx +=================== + +Clients: +- mosquitto_sub and mosquitto_rr now open stdout in binary mode on Windows + so binary payloads are not modified when printing. + 2.0.11 - 2021-06-08 =================== diff --git a/client/rr_client.c b/client/rr_client.c index 4b1edba4..52b0d2e5 100644 --- a/client/rr_client.c +++ b/client/rr_client.c @@ -309,6 +309,7 @@ int main(int argc, char *argv[]) #endif mosquitto_lib_init(); + output_init(); rc = client_config_load(&cfg, CLIENT_RR, argc, argv); if(rc){ diff --git a/client/sub_client.c b/client/sub_client.c index 5e5e570c..304eb914 100644 --- a/client/sub_client.c +++ b/client/sub_client.c @@ -324,7 +324,7 @@ int main(int argc, char *argv[]) mosquitto_lib_init(); - rand_init(); + output_init(); rc = client_config_load(&cfg, CLIENT_SUB, argc, argv); if(rc){ diff --git a/client/sub_client_output.c b/client/sub_client_output.c index 1cb984b6..c3fb5c33 100644 --- a/client/sub_client_output.c +++ b/client/sub_client_output.c @@ -21,6 +21,8 @@ Contributors: #ifdef WIN32 /* For rand_s on Windows */ # define _CRT_RAND_S +# include +# include #endif #include @@ -764,7 +766,7 @@ static void formatted_print(const struct mosq_config *lcfg, const struct mosquit } -void rand_init(void) +void output_init(void) { #ifndef WIN32 struct tm *ti = NULL; @@ -773,6 +775,9 @@ void rand_init(void) if(!get_time(&ti, &ns)){ srandom((unsigned int)ns); } +#else + /* Disable text translation so binary payloads aren't modified */ + _setmode(_fileno(stdout), _O_BINARY); #endif } diff --git a/client/sub_client_output.h b/client/sub_client_output.h index 9bca8b67..bf116be6 100644 --- a/client/sub_client_output.h +++ b/client/sub_client_output.h @@ -22,7 +22,7 @@ Contributors: #include "mosquitto.h" #include "client_shared.h" -void rand_init(void); +void output_init(void); void print_message(struct mosq_config *cfg, const struct mosquitto_message *message, const mosquitto_property *properties); #endif From 30b54ba124079ed0d52e63628ae77b856733091d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 29 Jun 2021 13:51:31 +0100 Subject: [PATCH 18/18] Add platform limitations section to man page. --- man/mosquitto.8.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/man/mosquitto.8.xml b/man/mosquitto.8.xml index bd90678c..108aba5d 100644 --- a/man/mosquitto.8.xml +++ b/man/mosquitto.8.xml @@ -91,6 +91,17 @@ + + Platform limitations + + Some versions of Windows have limitations on the number of + concurrent connections due to the Windows API being used. In + modern versions of Windows, e.g. Windows 10 or Windows Server + 2019, this is approximately 8192 connections. In earlier + versions of Windows, this limit is 2048 connections. + + + MQTT Support Mosquitto supports MQTT v5.0, v3.1.1, and v3.1.