From 989214ae3dddb85721e6fbaf255fab71b9d5c12b Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Thu, 26 Feb 2026 16:54:00 +0100 Subject: [PATCH] package/mosquitto: add option to enable HTTP API on listeners The mosquitto broker (not the library) can have listeners configured to serve HTTP requests; it can optionally accept (some) HTTP API requests on such listeners. Add a new option to enable the availability of http_pi. Note that we do not just depend on libmicrohttpd to be enabled, because the HTTP API is a security boundary, and enabling it must be an explicit decision. Co-developped-by: Titouan Christophe [yann.morin@orange.com: make it an explicit option] Signed-off-by: Yann E. MORIN Cc: Peter Korsgaard Cc: Titouan Christophe Signed-off-by: Romain Naour --- package/mosquitto/Config.in | 11 ++++++++++- package/mosquitto/mosquitto.mk | 10 ++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/package/mosquitto/Config.in b/package/mosquitto/Config.in index 789e30f97f..87ecdc1076 100644 --- a/package/mosquitto/Config.in +++ b/package/mosquitto/Config.in @@ -79,15 +79,24 @@ config BR2_PACKAGE_MOSQUITTO_BROKER help Build and install the mosquitto broker onto target. +if BR2_PACKAGE_MOSQUITTO_BROKER + +config BR2_PACKAGE_MOSQUITTO_BROKER_HTTP_API + bool "http_api" + select BR2_PACKAGE_LIBMICROHTTPD + help + Add support for simple webserver as a listener to serve + some of the HTTP API. + config BR2_PACKAGE_MOSQUITTO_BROKER_DYNAMIC_SECURITY_PLUGIN bool "dynamic security plugin" - depends on BR2_PACKAGE_MOSQUITTO_BROKER select BR2_PACKAGE_OPENSSL help Build and install the dynamic security plugin for mosquitto broker onto target. endif +endif comment "mosquitto needs a toolchain w/ dynamic library" depends on BR2_USE_MMU diff --git a/package/mosquitto/mosquitto.mk b/package/mosquitto/mosquitto.mk index 9b3bcc1cf5..160945d6d9 100644 --- a/package/mosquitto/mosquitto.mk +++ b/package/mosquitto/mosquitto.mk @@ -18,8 +18,7 @@ MOSQUITTO_CONF_OPTS = \ -DWITH_DOCS=OFF \ -DWITH_TESTS=OFF \ -DWITH_STATIC_LIBRARIES=OFF \ - -DWITH_BUNDLED_DEPS=ON \ - -DWITH_HTTP_API=OFF + -DWITH_BUNDLED_DEPS=ON # adns uses getaddrinfo_a ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y) @@ -95,6 +94,13 @@ MOSQUITTO_CONF_OPTS += \ -DWITH_PLUGIN_PERSIST_SQLITE=OFF \ -DWITH_PLUGIN_SPARKPLUG_AWARE=OFF +ifeq ($(BR2_PACKAGE_MOSQUITTO_BROKER_HTTP_API),y) +MOSQUITTO_DEPENDENCIES += libmicrohttpd +MOSQUITTO_CONF_OPTS += -DWITH_HTTP_API=ON +else +MOSQUITTO_CONF_OPTS += -DWITH_HTTP_API=OFF +endif + ifeq ($(BR2_PACKAGE_MOSQUITTO_BROKER_DYNAMIC_SECURITY_PLUGIN),y) MOSQUITTO_CONF_OPTS += -DWITH_PLUGIN_DYNAMIC_SECURITY=ON else