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 <titouan.christophe@mind.be>
[yann.morin@orange.com: make it an explicit option]
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Titouan Christophe <titouan.christophe@mind.be>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
This commit is contained in:
Yann E. MORIN
2026-02-26 16:54:00 +01:00
committed by Romain Naour
parent c5ed4f5223
commit 989214ae3d
2 changed files with 18 additions and 3 deletions

View File

@@ -79,15 +79,24 @@ config BR2_PACKAGE_MOSQUITTO_BROKER
help help
Build and install the mosquitto broker onto target. 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 config BR2_PACKAGE_MOSQUITTO_BROKER_DYNAMIC_SECURITY_PLUGIN
bool "dynamic security plugin" bool "dynamic security plugin"
depends on BR2_PACKAGE_MOSQUITTO_BROKER
select BR2_PACKAGE_OPENSSL select BR2_PACKAGE_OPENSSL
help help
Build and install the dynamic security plugin for Build and install the dynamic security plugin for
mosquitto broker onto target. mosquitto broker onto target.
endif endif
endif
comment "mosquitto needs a toolchain w/ dynamic library" comment "mosquitto needs a toolchain w/ dynamic library"
depends on BR2_USE_MMU depends on BR2_USE_MMU

View File

@@ -18,8 +18,7 @@ MOSQUITTO_CONF_OPTS = \
-DWITH_DOCS=OFF \ -DWITH_DOCS=OFF \
-DWITH_TESTS=OFF \ -DWITH_TESTS=OFF \
-DWITH_STATIC_LIBRARIES=OFF \ -DWITH_STATIC_LIBRARIES=OFF \
-DWITH_BUNDLED_DEPS=ON \ -DWITH_BUNDLED_DEPS=ON
-DWITH_HTTP_API=OFF
# adns uses getaddrinfo_a # adns uses getaddrinfo_a
ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y) ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
@@ -95,6 +94,13 @@ MOSQUITTO_CONF_OPTS += \
-DWITH_PLUGIN_PERSIST_SQLITE=OFF \ -DWITH_PLUGIN_PERSIST_SQLITE=OFF \
-DWITH_PLUGIN_SPARKPLUG_AWARE=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) ifeq ($(BR2_PACKAGE_MOSQUITTO_BROKER_DYNAMIC_SECURITY_PLUGIN),y)
MOSQUITTO_CONF_OPTS += -DWITH_PLUGIN_DYNAMIC_SECURITY=ON MOSQUITTO_CONF_OPTS += -DWITH_PLUGIN_DYNAMIC_SECURITY=ON
else else