-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
microrain
authored and
microrain
committed
Sep 29, 2024
1 parent
9c753a5
commit bfe85b5
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,4 @@ ACL配置示例: | |
|
||
``` | ||
|
||
详细说明请参考[mqtt配置](../other/mqtt.md) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# mqtt 相关设置 | ||
|
||
## 启用系统订阅 | ||
|
||
如果想要mqtt的设备能即时感知上线与离线,需要你的mqtt服务器支持系统订阅功能。`emqx`支持系统订阅,但是默认是关闭的,需要在配置文件中开启。 | ||
|
||
进入`emqx`的管理端,客户端授权--》数据源--》File (启用)--》设置 | ||
|
||
![img.png](../imgs/other/emqx01.png) | ||
|
||
|
||
|
||
ACL配置示例: | ||
|
||
```shell | ||
|
||
%% 允许用户名是 dashboard 的客户端订阅 "$SYS/#" 这个主题 | ||
{allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}. | ||
|
||
%% 允许来自127.0.0.1 的用户发布和订阅 "$SYS/#" 以及 "#" | ||
{allow, {ipaddr, "127.0.0.1"}, all, ["$SYS/#", "#"]}. | ||
|
||
%% 拒绝其他所有用户订阅 `$SYS/#`,`#` 和 `+/#` 主题 | ||
{deny, all, subscribe, ["$SYS/#", {eq, "#"}, {eq, "+/#"}]}. | ||
|
||
%% 如果前面的规则都没有匹配到,则允许所有操作 | ||
%% 注意:在生产环境中,最后一条规则应该设置为 `{deny, all}`,并且配置 `authorization.no_match = deny` | ||
{allow, all}. | ||
|
||
``` | ||
|
||
详细说明请参考[emqx官方文档](https://docs.emqx.com/zh/emqx/latest/access-control/authz/file.html#acl-%E6%96%87%E4%BB%B6) |