Of course. You've hit on a very important and often misunderstood aspect of using Meshtastic with an internet gateway.
You are absolutely correct. Your understanding is spot on. When a Meshtastic node acts as an MQTT gateway and connects to a public broker like mqtt.meshtastic.org, it effectively bridges your private, encrypted LoRa network to a public, unencrypted internet message bus.
Let's break down what's happening and how to prevent it.
The Problem: Public MQTT is a Public Square
-
On the LoRa Network (The Airwaves): Your messages, including administrative commands, are encrypted. Only nodes that have your channel's Pre-Shared Key (PSK) can decrypt the content of the messages. An outside observer with a LoRa radio can only see encrypted gibberish and the unencrypted metadata (like which node ID sent a packet to which other node ID).
-
The MQTT Gateway Node: A node with MQTT enabled does the following:
- It receives an encrypted LoRa packet from one of your nodes.
- Using its knowledge of the channel PSK, it decrypts the packet.
- It then takes the plaintext, decrypted content and publishes it as a JSON object to the public MQTT broker.
-
On the Public MQTT Broker (e.g., mqtt.meshtastic.org):
- Anyone in the world can connect to this broker and subscribe to topics.
- The topic is usually based on your channel name (e.g.,
msh/US/MySecretChannel).
- If someone subscribes to your channel's topic, they will see the fully decrypted JSON payloads for all messages, including text messages and administrative commands. They can easily see which node sent a command and what that command was.
This is how people can map your network, see which nodes belong to you, and observe your activity if you are using a public MQTT broker.
How to Prevent Logging and Spying on MQTT
You have several options, ranging from simple to more involved. The best choice depends on whether you need the internet gateway functionality at all.
Option 1: Disable the MQTT Module (Easiest)
If you don't need to bridge your mesh to the internet, simply turn off the MQTT module on your gateway node. This is the most secure option as your data never leaves your private LoRa network.
Your node will no longer connect to any MQTT broker, and your packets will remain private to the LoRa mesh.
Option 2: Run Your Own Private MQTT Broker (Most Secure & Flexible)
This is the recommended solution if you do want the internet gateway functionality but demand privacy. You host your own MQTT broker that only you and your nodes can access.
-
Set up the Broker: You can run an MQTT broker like Mosquitto very easily and for free on:
- A Raspberry Pi or similar single-board computer at your home.
- A cheap cloud server (VPS) from providers like DigitalOcean, Vultr, or Hetzner.
- A spare computer or NAS (like Synology) you have running 24/7.
-
Secure Your Broker: This is critical. When setting up your broker (e.g., Mosquitto), you must:
- Configure Usernames and Passwords: Don't allow anonymous connections. Create a strong, unique username and password.
- Enable TLS Encryption: Set up TLS (SSL) to encrypt the connection between your Meshtastic node and your private broker. This prevents eavesdropping on the internet connection itself.
-
Configure Your Meshtastic Node:
- Using the Web UI: Go to the MQTT Module configuration.
- Enabled: Check the box.
- MQTT Server: Enter the IP address or domain name of your private broker.
- Username: Enter the username you configured.
- Password: Enter the password you configured.
- Encryption: Set to
TLS Enabled.
- Using the Command Line (CLI):
# First, enable the module
meshtastic --set mqtt.enabled true
# Configure your private server details
meshtastic --set mqtt.server "your-private-broker.com"
meshtastic --set mqtt.username "your-mqtt-user"
meshtastic --set mqtt.password "your-strong-password"
# IMPORTANT: Enable TLS encryption
meshtastic --set mqtt.tls_enabled true
Now, your decrypted packets are only sent to your private, password-protected server, which nobody else can access.
Summary: Your Privacy Checklist
| Goal | Action | Security Level |
|---|
| Maximum Privacy (No internet needed) | Disable the MQTT module entirely on your gateway node. | Highest |
| Privacy with Internet Gateway | Run your own private MQTT broker with mandatory username/password and TLS encryption. | High |
| Connecting to a Friend's Broker | Ensure their broker is private, requires a unique login for you, and uses TLS. | High |
| Public Experimentation (No Privacy) | Use the public mqtt.meshtastic.org broker, understanding that all your traffic is publicly visible. | None |
You were right to be cautious. By default, Meshtastic prioritizes ease of use and community features, but with these simple configuration changes, you can make your network as private as you need it to be.