Skip to content
Contents
GuidesOpenWrt

Set per-device MQTT topic permissions with Mosquitto on OpenWrt

List the device publishers, subscribers, topic prefixes, and message purposes first.

List the device publishers, subscribers, topic prefixes, and message purposes first. Mosquitto only listens to LAN or IoT addresses allowed for access, with explicit authentication and ACLs enabled. Administrators, sensors, and automation clients use distinct identities based on their roles.

Start with a verifiable topic

Set up test devices and retrieve account credentials, then use the local subscription to view published messages. Use an unauthorized account to attempt reading and writing the topic, and verify that access is denied. When connecting across subnets, retain the correct certificate and firewall rules.

Start a temporary MQTT broker on OpenWrt and verify one sensor sample end to end. · OpenWrt 25.12.6 x86/64 (QEMU/KVM).
Check the terminal output
Start a temporary MQTT broker on OpenWrt and verify one sensor sample end to end. · OpenWrt 25.12.6 x86/64 (QEMU/KVM).
Start a temporary MQTT broker on OpenWrt and verify one sensor sample end to end. · OpenWrt 25.12.6 x86/64 (QEMU/KVM). Open the original image

Authorization comparison based on device accounts and topics

Set up separate accounts and distinct topics for two Mosquitto test devices. Verify that each device publishes and subscribes to its own topic, then attempt to access the target of the other account's topic.

Choose persistence and message retention based on business requirements, then test reconnection after a subscriber goes offline. Do not reexecute expiration control commands upon restart. Monitor memory usage, historical data, and disk write volume.

Topic approved, cross-access denied. After recovery test, revoke test account; retain LAN management interface accessibility.

Reference

Related guides

Reference

Check the model, region and hardware revision on the label before selecting firmware.

Explore hardware

Comments