feat(M06-A): 建立MQTT连接与Broker基础

This commit is contained in:
Codex
2026-06-22 17:25:33 +08:00
parent a8c3e7d2fe
commit c140613718
15 changed files with 875 additions and 36 deletions
+14 -14
View File
@@ -1,25 +1,25 @@
%% Qipai EMQX ACL baseline for device topic isolation.
%% Qipai EMQX ACL for the selected Jilian device protocol.
%% EMQX ACL files use Erlang tuple rules and are matched from top to bottom.
%% Replace example usernames and topic namespaces after M06 device onboarding.
%% Device MQTT username must equal its DeviceID. Credentials are created outside Git.
%% Device clients may publish telemetry/status under their own client id.
%% A device may publish only its uplink and will topics.
{allow, {clientid, {re, "^qipai-device-[A-Za-z0-9_-]+$"}}, publish, [
"qipai/${clientid}/telemetry",
"qipai/${clientid}/status",
"qipai/${clientid}/event/#"
"/devicesend/${username}",
"/devicewill/${username}"
]}.
%% Device clients may subscribe only to commands for their own client id.
%% A device may subscribe only to its command topic.
{allow, {clientid, {re, "^qipai-device-[A-Za-z0-9_-]+$"}}, subscribe, [
"qipai/${clientid}/command/#"
"/deviceaccept/${username}"
]}.
%% Backend service may publish commands and subscribe to device events.
{allow, {username, "qipai_backend"}, all, [
"qipai/+/command/#",
"qipai/+/telemetry",
"qipai/+/status",
"qipai/+/event/#"
%% Backend service subscribes to uplink/will and publishes commands.
{allow, {username, "qipai_backend_prod"}, subscribe, [
"/devicesend/+",
"/devicewill/+"
]}.
{allow, {username, "qipai_backend_prod"}, publish, [
"/deviceaccept/+"
]}.
%% Do not expose system topics or broad wildcards to ordinary clients.