Я пытаюсь построить мост PSK Encryption с помощью mosquitto, следуя этому руководству. Я использую два док-контейнера. Один как мост, а другой как сервер. Оба они на разных компьютерах. Соединение работает нормально без шифрования. Для подписки на темы я использую node-red.
Это файл конфигурации для сервера:
port 1883
persistence true
persistence_location /mosquitto/data/
#persistence_file mosquitto.db
#cleansession false
#clientid nodered
listener 8883
psk_hint broker-server
psk_file /mosquitto/certs/psk_file.txt
log_type all
log_dest file /mosquitto/log/mosquitto.log
connection_messages true
log_timestamp true
allow_anonymous true
#password_file /mosquitto/config/passwd
Для мостового соединения мне нужны файлы.
mosquitto.conf:
#include_dir /etc/mosquitto/conf.d
# GENERAL CONFIGURATION BROKER
# ----------------------------------------------------------------
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_type all
log_dest file /etc/mosquitto/log/mosquitto.log
include_dir /etc/mosquitto/bridges
# ----------------------------------------------------------------
# SECURITY (comm. Nordic -> RPI): Password
#password_file /etc/mosquitto/passwd
allow_anonymous true
И bridge.conf:
# =================================================================
# Bridges to Node Red
# =================================================================
# IP address
#connection client-bridgeport
connection bridge-01
address 192.168.1.34:8883
bridge_identity bridgeport
bridge_psk 123456789987654321
# -----------------------------------------------------------------
# TOPICS
topic # out 1 ""
topic # in 1 ""
# ------------------------------------------------------------------
# Setting protocol version explicitly
#bridge_protocol_version mqttv311
#bridge_insecure false
# Bridge connection name and MQTT client Id,
# enabling the connection automatically when the broker starts.
cleansession false
remote_clientid broker-server
start_type automatic
#notifications false
log_type all
В лог-файле сервера я вижу следующую ошибку:
Ошибка сокета на неизвестном клиенте, отключение.
А в мостовом соединении вижу следующую ошибку:
Брокер-сервер-бридж отправляет ошибку CONNECT Socket на клиент
local.broker-сервер, отключение.
Я не знаю, что я делаю неправильно. Если я снимаю шифрование, все работает нормально.