Deployment guide

rumqttd

Overview

rumqttd is a fast, lightweight MQTT broker written in Rust, from the rumqtt project (Apache-2.0). The SecureAnyCloud image ships rumqttd 0.20.0 as a single static binary managed by systemd, configured to require authentication on every connection.

The VM generates a unique broker credential on first boot, so no two deployments share a password and nothing is baked into the image.

What you get:

  • rumqttd 0.20.0 (pinned static musl binary, Apache-2.0) at /usr/local/bin/rumqttd
  • mosquitto-clients (mosquitto_pub, mosquitto_sub) for testing
  • MQTT v3.1.1 listener on TCP 1883
  • Per-VM SecureAnyCloud broker credential rotated at first boot into /etc/rumqttd/rumqttd.toml
  • Anonymous and wrong-credential connections rejected by the broker
  • rumqttd.service running as an unprivileged rumqttd user
  • Hardened Ubuntu 24.04 LTS base, patched at build time
  • 24/7 SecureAnyCloud support

Prerequisites

  • An Azure VM launched from this SecureAnyCloud image (recommended size Standard_B2s or larger)
  • A network security group (NSG) that allows inbound TCP 22 (SSH) and TCP 1883 (MQTT) from only the client and device networks that need them
  • SSH access as azureuser

Restrict TCP 1883 in your NSG to your device and application subnets. Do not expose the broker to the whole internet.

1

Verify the broker is running

SSH in as azureuser. Then confirm that the service is active and listening on 1883:

sudo systemctl status rumqttd.service --no-pager -n 0
sudo ss -tln | grep 1883 /usr/local/bin/rumqttd --version

Expected output:

● rumqttd.service - rumqttd MQTT broker (sac) Loaded: loaded (/etc/systemd/system/rumqttd.service; enabled; preset: enabled) Active: active (running) Docs: https://secureanycloud.com/stacks/rumqttd/ Main PID: 1477 (rumqttd) LISTEN 0 1024 0.0.0.0:1883 0.0.0.0:* rumqttd 0.20.0
2

Read the per-VM broker credential

First boot writes the SecureAnyCloud username and its randomly generated password to a root-only credentials file. Read it:

sudo cat /stage/scripts/rumqttd-credentials.log

Expected output (your password differs, because it is unique to this VM):

# rumqttd — Per-VM Credentials
# MQTT v3.1.1 broker, port 1883. Anonymous connections are rejected. RUMQTTD_USER=sac RUMQTTD_PASSWORD=<set-at-first-boot> RUMQTTD_HOST=<your-vm-ip> RUMQTTD_PORT=1883
3

Publish and subscribe

Use the generated credential to prove an end-to-end publish and subscribe round trip. This snippet subscribes for two messages, then publishes them:

PASS=$(sudo grep '^RUMQTTD_PASSWORD=' /stage/scripts/rumqttd-credentials.log | cut -d= -f2-) mosquitto_sub -h 127.0.0.1 -p 1883 -u sac -P "$PASS" -t 'demo/#' -C 2 -W 5 -v & sleep 1 mosquitto_pub -h 127.0.0.1 -p 1883 -u sac -P "$PASS" -t demo/temp -m '22.5' mosquitto_pub -h 127.0.0.1 -p 1883 -u sac -P "$PASS" -t demo/state -m 'online' wait

Expected output, where the subscriber receives both messages:

demo/temp 22.5 demo/state online

To connect from a remote client, open TCP 1883 in your NSG first. Then replace 127.0.0.1 with the VM's IP.

4

Anonymous connections are rejected

The broker refuses any connection that lacks the correct credential. A publish with no username fails:

if mosquitto_pub -h 127.0.0.1 -p 1883 -t demo/temp -m 'nope' 2>/dev/null; then echo 'UNEXPECTED: anonymous accepted' else echo 'anonymous connection correctly rejected' fi

Expected output:

anonymous connection correctly rejected
5

Components

Component Path

Broker binary /usr/local/bin/rumqttd

Config /etc/rumqttd/rumqttd.toml (mode 0640 root:rumqttd)

Config template /usr/local/share/sac/rumqttd.toml.template

systemd unit /etc/systemd/system/rumqttd.service

First-boot unit /etc/systemd/system/rumqttd-firstboot.service

Credentials /stage/scripts/rumqttd-credentials.log (mode 0600 root:root)

Service user rumqttd (unprivileged, nologin)

The authentication table lives in the config under [v4.1.connections.auth]. Its entries look like this:

[v4.1] name = "v4-1" listen = "0.0.0.0:1883" [v4.1.connections.auth] sac = "<per-VM-password>"
6

Security hardening

  • Restrict the NSG so that TCP 1883 reaches only your device and application subnets.
  • Add more users by adding username = "password" lines under [v4.1.connections.auth] in /etc/rumqttd/rumqttd.toml. Then run sudo systemctl restart rumqttd.
  • Enable TLS by adding a [v4.2] server block with a tls section (certificate and key paths) that listens on 8883, as described in the rumqttd documentation.
  • Patch regularly with sudo apt-get update && sudo apt-get upgrade && sudo reboot.
  • Rotate the password by editing the auth table and restarting the service.

Licensing

The rumqtt project distributes rumqttd under the Apache-2.0 license, and it is free to use. SecureAnyCloud provides the pre-built, hardened image and commercial support separately. For questions, contact sales@secureanycloud.com.

Deploy on Azure

Launch rumqttd MQTT Broker on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure