Skip to content

Commit

Permalink
mosquitto: enable websockets, using libwebsockets 3.0.0
Browse files Browse the repository at this point in the history
A websocket listener is configured on port 9001

The default libwebsockets version in Rocko, 2.1.0, doesn't work with this
mosquitto version; 1.4.14, see:
eclipse-mosquitto/mosquitto#336 (comment)

Therefore install a newer libwebsockets version, 3.0.0, copied from master:
openembedded/meta-openembedded@abead52

Security considerations: by default mosquitto is disabled. When enabled, it
listens on all interfaces, port 1883. Adding a websockets listener on port
9001 doesn't change the level of security.
  • Loading branch information
mpvader committed Aug 19, 2018
1 parent 4337aab commit 4debdc1
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SUMMARY = "Canonical libwebsockets.org websocket library"
HOMEPAGE = "https://libwebsockets.org/"
LICENSE = "LGPL-2.1"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4ce87f3facb6f911c142c8bef9bfb380"

DEPENDS = "zlib"

S = "${WORKDIR}/git"
SRCREV = "eaa935a80adb38b5cc4d09ce06ec987b87dcddfa"
SRC_URI = "git://github.com/warmcat/libwebsockets.git;protocol=https;"

inherit cmake pkgconfig

PACKAGECONFIG ?= "libuv client server http2 ssl"
PACKAGECONFIG[client] = "-DLWS_WITHOUT_CLIENT=OFF,-DLWS_WITHOUT_CLIENT=ON,"
PACKAGECONFIG[http2] = "-DLWS_WITH_HTTP2=ON,-DLWS_WITH_HTTP2=OFF,"
PACKAGECONFIG[ipv6] = "-DLWS_IPV6=ON,-DLWS_IPV6=OFF,"
PACKAGECONFIG[libev] = "-DLWS_WITH_LIBEV=ON,-DLWS_WITH_LIBEV=OFF,libev"
PACKAGECONFIG[libuv] = "-DLWS_WITH_LIBUV=ON,-DLWS_WITH_LIBUV=OFF,libuv"
PACKAGECONFIG[server] = "-DLWS_WITHOUT_SERVER=OFF,-DLWS_WITHOUT_SERVER=ON,"
PACKAGECONFIG[ssl] = "-DLWS_WITH_SSL=ON,-DLWS_WITH_SSL=OFF,openssl"
PACKAGECONFIG[testapps] = "-DLWS_WITHOUT_TESTAPPS=OFF,-DLWS_WITHOUT_TESTAPPS=ON,"

PACKAGES =+ "${PN}-testapps"

FILES_${PN}-dev += "${libdir}/cmake"
FILES_${PN}-testapps += "${datadir}/libwebsockets-test-server/*"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 029d6fc74db276b50578b57ee824e3dcd07ad3c5 Mon Sep 17 00:00:00 2001
From: mpvader <[email protected]>
Date: Fri, 17 Aug 2018 22:03:07 +0200
Subject: [PATCH] config.mk: enable websockets

---
config.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mk b/config.mk
index 71f17e5..eef9c84 100644
--- a/config.mk
+++ b/config.mk
@@ -65,7 +65,7 @@ WITH_SRV:=yes
WITH_UUID:=yes

# Build with websockets support on the broker.
-WITH_WEBSOCKETS:=no
+WITH_WEBSOCKETS:=yes

# Use elliptic keys in broker
WITH_EC:=yes
--
2.7.4

Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
user mosquitto
port 1883
listener 9001
protocol websockets
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

DEPENDS += "libwebsockets"

SRC_URI += " \
file://mosquitto.conf \
file://0001-config.mk-enable-websockets.patch \
"

PR = "2"

INITSCRIPT_PARAMS = "remove"

MOSQUITTO_D = "/data/conf/mosquitto.d"
Expand Down

0 comments on commit 4debdc1

Please sign in to comment.