Mosquitto中的acl文件配置

Acl file configuration in Mosquitto

我的mosquito里面有acl文件:

user b
topic read s1#
topic write s1#

topic write s2
topic read s2


pattern write s3_%c#
pattern read s3_%c#

pattern write s4_%c
pattern read s4_%c


pattern  write s5_%u#
pattern  read s5_%u#

pattern  write s6_%u
pattern  read s6_%u

从客户端 ID abc 向主题 s4_abc 发出的以下请求工作正常:

mosquitto_pub -h servername -t s4_abc -m "test" -p 1883 -u b -P b -i abc -d

从客户端 ID abc 到主题 s3_abcA 的以下请求失败:

mosquitto_pub -h servername -t s3_abcA -m "test" -p 1883 -u b -P b -i abc -d

为什么会失败?我希望模式 s3_%c# 表示主题中 "s3_abc" 之后的任何短语都可以。

ACL 文件中的主题和模式无效,通配符之间需要 /

通配符只匹配整个主题片段。

%u%c

也是如此

来自 mosquitto.conf 手册页:

The patterns available for substition are:

%c to match the client id of the client %u to match the username of the client. The substitution pattern must be the only text for that level of hierarchy. Pattern ACLs apply to all users even if the "user" keyword has previously been given.

Example:

pattern write sensor/%u/data

Allow access for bridge connection messages:

pattern write $SYS/broker/connection/%c/state