我使用 sim800c 模块作为带有 ssl (tls 1.2) 连接的 mosquitto 服务器客户端。 sim800c 在发送 ssl 握手时,不会发送传输层安全中的扩展参数(SNI),并且 mosquitto 在握手数据包(Client Hello)后断开连接。 我测试了与Mqtt.Fx等支持SNI的客户端软件的连接并建立了连接。 有没有办法让 Mosquitto 忽略 SNI ??
致以最诚挚的问候。
有没有办法让 Mosquitto 忽略 SNI ??
@hardillb .
这似乎不是证书的问题,因为我使用代理进行了测试: mqtt.eclipseprojects.io 使用 ssl 并且这不是问题。 我猜如果broker在握手中没有找到sni参数,就会断开连接。
配置文件:
allow_anonymous true
listener 1883
listener 8883
protocol mqtt
certfile /etc/letsencrypt/live/******.com/cert.pem
cafile /etc/letsencrypt/live/******.com/chain.pem
keyfile /etc/letsencrypt/live/*****.com/privkey.pem
listener 8083
protocol websockets
certfile /etc/letsencrypt/live/******.com/cert.pem
cafile /etc/letsencrypt/live/******.com/chain.pem
keyfile /etc/letsencrypt/live/******.com/privkey.pem
log_type all
tls_version tlsv1.2
与wireshark的握手包: 如您所见,sim800c 不发送 SNI 扩展数据包。
Transport Layer Security
TLSv1.2 Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.2 (0x0303)
Length: 63
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 59
Version: TLS 1.2 (0x0303)
Random: 64e73d36d7a2df47dd2e8ae80637f9483ed057f5a4b4f1f4…
GMT Unix Time: Aug 24, 2023 14:51:26.000000000 +0330
Random Bytes: d7a2df47dd2e8ae80637f9483ed057f5a4b4f1f4fb4793fb…
Session ID Length: 0
Cipher Suites Length: 20
Cipher Suites (10 suites)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (0xc023)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (0xc027)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
Cipher Suite: TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256 (0x003c)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)
Compression Methods Length: 1
Compression Methods (1 method)
Compression Method: null (0)
考虑到我可以使用 ssl 连接到 mqtt.eclipseprojects.io 但不能连接到我的私人代理,我认为 Mosquitto 应该有一种方法来免除客户端缺少 SNI 的问题