eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.93k stars 2.37k forks source link

Minimal config changed without notice (socket_domain may be required for nonlocal websocket access) #2515

Open modellking opened 2 years ago

modellking commented 2 years ago

Hello! We set a mosquitto broker at every client we have up and today someone accidentally used 2.0.13 instead of 2.0.7, which worked previously using this config:

listener 1883
listener 1884
protocol websockets

allow_anonymous true

After the upgrade mosquittos websocket connection couldn't be established from a nonlocal connection anymore. After reading some issues I explicitly added 0.0.0.0 and :: as listener ips, which did not help on it's own. Added explicit socket_domain fixed the issue.

allow_anonymous true

listener 1883 0.0.0.0
socket_domain ipv4

listener 1883 ::
socket_domain ipv6

listener 1884 0.0.0.0
protocol websockets
socket_domain ipv4

listener 1884 ::
protocol websockets
socket_domain ipv6

Is this a bug? The changelog didn't mention anything regarding this and both among the issues here and other internet sources the minimal websocket config seems to be the one we used previously. If this is intended, please publicize this in the changelog or similar.

bicijinlian commented 2 years ago

确实如此,经过的我的测试。各版本支持情况如下 mosquitto版本 MQTTX[1.7.3] MQTTnetApp[1.3.0] MQTT-Explorer[0.4.0] 1.6.9 能连接 能连接 能连接 2.0.0 不能 能 能 2.0.8 能 能 能 2.0.9 能 能 能 2.0.10 能 能 能
2.0.11 能 能 能 2.0.12 不能 不能 不能 2.0.13 不能 不能 不能 2.0.14 不能 不能 不能

ralight commented 2 years ago

@modellking There should have been no changes that affect this aspect of the networking. The only thought I have is that the libwebsockets library was also changed at the same time. Could that be the case? libwebsockets compilation can be configured with/without IPv6 support and the networking behaves differently in both cases. Also, mosquitto requires the libwebsockets external poll support to be included, although that shouldn't be causing the problem you are seeing.

@bicijinlian I think what you are seeing is a different problem. Version 2.0.12 introduced a change to disallow a keepalive of 0 by default, to address a CVE against the MQTT protocol v3.1.1 itself. Could you be using the tools with a keepalive value of 0, which would be disallowed?