安装 emqx 4.3.5 版本,并启动http 认证和授权,获取动态订阅topic

一、安装emqx 4.3.5

安装前,请确保 erlang 版本号 11.1.8

配置文件修改

1、 acl.conf 屏蔽所有权限

##{allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}.
##{allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}.
##{deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
##{allow, all}.

2、emqx.conf 配置文件修改,
修改acl 权限,
增加删除ACL缓存项的时间

allow_anonymous = false
acl_nomatch = deny
acl_cache_ttl = 5m 

3、emqx_auth_http.conf 配置文件修改
修改 auth_req 地址和参数
屏蔽超管super_req配置
修改 acl_req 地址和参数

auth.http.auth_req.url = http://${iot-auth-url:port}/iot/auth/authentication
auth.http.auth_req.params = clientId=%c,userName=%u,ipAddress=%a,passWord=%P
## auth.http.super_req.url = http://127.0.0.1:80/mqtt/superuser
## auth.http.super_req.method = post
## auth.http.super_req.headers.content-type = application/x-www-form-urlencoded
## auth.http.super_req.params = clientid=%c,username=%u
auth.http.acl_req.url = http://${iot-auth-url:port}/iot/auth/authorization
auth.http.acl_req.params = access=%A,username=%u,clientid=%c,ipaddr=%a,topic=%t

4、emqx_proxy_subscribe.conf 配置文件修改

proxy.http.url = http://${iot-auth-url:port}/iot/auth/listSubscribeTopic

启动插件

# ./bin/emqx start
# ./bin/emqx_ctl plugins load emqx_auth_http
# ./bin/emqx_ctl plugins load emqx_proxy_subscribe
posted @ 2021-07-16 18:01  currentTimeMillis  阅读(1218)  评论(0编辑  收藏  举报