安裝 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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM