gpt4 book ai didi

蚊子 PSK 加密不起作用

转载 作者:行者123 更新时间:2023-12-04 16:02:24 25 4
gpt4 key购买 nike

我正尝试按照 this 教程与 mosquitto 建立 PSK 加密桥连接。我正在使用两个码头容器。一个作为桥梁,另一个作为服务器。他们两个在不同的计算机上。连接工作正常,没有加密。对于主题的订阅,我使用的是 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

对于桥接连接,我必须提交文件。

蚊子配置文件:

#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

在服务器的日志文件中,我可以看到以下错误:

Socket error on client unknown, disconnecting.

在网桥连接中我看到以下错误:

Bridge broker-server sending CONNECT Socket error on client local.broker-server, disconnecting.

我不知道我做错了什么。如果我删除加密,一切正常。

最佳答案

看来mosquitto的默认docker容器在 docker hub 中没有在 mosquitto 构建中包含 psk 加密,如 this 所示。发布。

我必须构建自己的安装 mosquitto 的镜像,如下所示:

RUN apt-get -y update && \
apt-get -y install mosquitto mosquitto-clients

关于蚊子 PSK 加密不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50151028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com