订阅对 Mosquitto 中的访问控制产生影响

物联网 MQTT 蚊子
2021-06-03 15:22:25

我在 Mosquitto ACL 文件中有一行:

pattern read write s2

我正在尝试发布到s2

mosquitto_pub -h 192.168.1.8 -t s2 --cafile ca.crt -m "test" -p 8883 -d -u b -P b -i b

在下面的 Mosquitto 和客户端控制台中得到了结果。

蚊子:

1577876055: New connection from 192.168.1.222 on port 8883.
1577876055: New client connected from 192.168.1.222 as b (c1, k60, ub).
1577876055: Sending CONNACK to b (0)
1577876055: Denied PUBLISH from b (d0, q0, r0, m0, 's2', ... (4 bytes))
1577876055: Received DISCONNECT from b

客户:

Client b sending CONNECT
Client b received CONNACK
Client b sending PUBLISH (d0, q0, r0, m1, 's2', ... (4 bytes))
Client b sending DISCONNECT

然后我订阅了s2

mosquitto_sub -h 192.168.1.8 -t s2 --cafile ca.crt -p 8883 -d -u b -P b

并再次尝试相同的发布:

mosquitto_pub -h 192.168.1.8 -t s2 --cafile ca.crt -m "test" -p 8883 -d -u b -P b -i b

现在 Mosquitto 拒绝了我的发布:

蚊子:

1577876215: New connection from 192.168.1.222 on port 8883.
1577876215: New client connected from 192.168.1.222 as b (c1, k60, ub).
1577876215: Sending CONNACK to b (0)
1577876215: Denied PUBLISH from b (d0, q0, r0, m0, 's2', ... (4 bytes))
1577876215: Received DISCONNECT from b

客户:

Client b sending CONNECT
Client b received CONNACK
Client b sending PUBLISH (d0, q0, r0, m1, 's2', ... (4 bytes))
Client b sending DISCONNECT

现在 Mosquitto 报告拒绝发布。为什么只有在有活跃订阅者时才拒绝发布?

ACL 记录有什么问题?为什么我完全不能发布和订阅?

0个回答
没有发现任何回复~