安裝 emqx 4.3.5 版本,並啟動http 認證和授權,獲取動態訂閱topic
阿新 • • 發佈:2021-07-16
一、安裝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