eclipse / mosquitto

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

AWS Bridge stops working when upgrading from 1.5.5 to 2.0.14 on Windows when interacts with aws iot core outside service Region #2488

Open fabianotuccillo opened 2 years ago

fabianotuccillo commented 2 years ago

When upgrading from 1.5.5 to 2.0.14 the bridge (ssl mode) stops working with a protocol error (this appends when mosquitto broker starts connection out of region where aws service is), the same issue is for both AWS IOT Core and ActiveMQ .

Here log for 2.0.14 version:

image

here that for 1.5.5:

image

attached mosquitto config

#Start

# Connection name
connection awsiot

# Host and port of endpoint (your AWS IoT endpoint
address xxxxxxx.iot.ap-southeast-2.amazonaws.com:8883

# Default but you should start the bridge automatically
start_type automatic

# Name of the user used to connect to local Mosquitto Broker
local_clientid awsiotbridge

# Looks like AWS IoT Broker supports bridges, so we should enable this to for better loop detection
try_private true

# Set the mqtt protocoll to 3.1.1
bridge_protocol_version mqttv311

# AWS IoT Broker will only accept session with cleansession set to true
cleansession true

# AWS IoT Broker will immediately close connections if you try to publish to $SYS, therefore we need to turn off bridge notification (took me a while to find out!)
notifications false

# Topic configuration
# topic pattern [[[ out | in | both ] qos-level] local-prefix remote-prefix]
# topic clients/total in 0 test/mosquitto/org $SYS/broker/
topic topic/topic_1 out 0

# Set client ID used on AWS IoT
remote_clientid awsiotbridge

# ============================================================
# Certificate based SSL/TLS support
# ============================================================

#Path to the rootCA
bridge_cafile cert/AmazonRootCA1.pem

# Path to the PEM encoded client certificate
bridge_certfile cert/awsiotbridge.cert.pem

# Path to the PEM encoded client private key
bridge_keyfile cert/awsiotbridge.private.key

#END of bridge.conf

mosquitto_awsiot.conf.txt

The operating System where mosquitto is installed is Windows 10 Home.

All mosquitto brokers come from official mosquitto site.

Any suggestion?

vladas-tamosaitis-tfs commented 1 year ago

Same issue for me. When using mosquitto 2.0.14 installed on EC2 instance in eu-west-1 region, bridge connects to IoT Core in the same region with no issues. However, when I install mosquito to the EC2 instance in ap-southeast-2 (Sydney) and trying to connect to the IoT Core in eu-west-1, I get protocol error

vladas-tamosaitis-tfs commented 1 year ago

I did a small investigation and it showed that a protocol error started to happen since 2.0.11. Though, in 2.0.10 it shows closed its connection so it seems like starting from 2.0.11 it was a try to provide some meaningful error reason. I think the issue itself is in some of the earlier versions

1672835117: mosquitto version 2.0.10 starting
1672835117: Config loaded from mosquitto.conf.
1672835117: Starting in local only mode. Connections will only be possible from clients running on this machine.
1672835117: Create a configuration file which defines a listener to allow remote access.
1672835117: Opening ipv4 listen socket on port 1883.
1672835117: Opening ipv6 listen socket on port 1883.
1672835117: Bridge local.thing doing local SUBSCRIBE on topic #
1672835117: Connecting bridge awsiot (aaabbbcccdddee-ats.iot.eu-west-1.amazonaws.com:8883)
1672835117: Bridge thing sending CONNECT
1672835117: mosquitto version 2.0.10 running
1672835119: Client local.thing closed its connection.