Deployment guide

HiveMQ CE

Overview

HiveMQ Community Edition is an open-source, production-grade, single-node MQTT broker. It implements the full MQTT 3.1, 3.1.1 and 5.0 specifications. It provides reliable publish and subscribe messaging with quality-of-service delivery guarantees. This makes it a common backbone for IoT telemetry, device command and control, and event-driven communication between applications and services.

This SecureAnyCloud image installs HiveMQ Community Edition 2026.5 from the official release. It runs under systemd as an unprivileged hivemq user on the Java 21 runtime and answers MQTT on port 1883 on all interfaces.

The broker is headless. It has no web interface, because the HiveMQ Control Center is part of the commercial Enterprise edition. You operate it with any standard MQTT client, such as mosquitto_pub and mosquitto_sub, which ship in the image.

Secure by default: authentication required, no default credentials. HiveMQ Community Edition by itself ships with no authentication, so an out-of-the-box broker accepts anonymous connections. This image closes that gap. It bundles the official HiveMQ File RBAC Authentication Extension. On the very first boot of every VM, it generates a unique MQTT admin password and stores it as a salted PBKDF2 hash in the extension's credentials file. It records the login in /root/hivemq-credentials.txt (mode 0600, root only). As a result, the broker rejects anonymous connections and connections with wrong credentials, and no two instances share a credential.

What you get:

  • HiveMQ Community Edition 2026.5 from the official release, run under systemd as the unprivileged hivemq user (hivemq.service) on OpenJDK 21
  • An MQTT endpoint on 0.0.0.0:1883 that supports MQTT 3.1, 3.1.1 and 5.0 clients
  • The HiveMQ File RBAC Authentication Extension, configured with password-type HASHED so that passwords are stored as salted PBKDF2 hashes, never in plain text
  • A single admin MQTT user, cimgadmin, with a per-instance password generated on first boot and documented in /root/hivemq-credentials.txt (0600)
  • mosquitto-clients (mosquitto_pub / mosquitto_sub) preinstalled, so you can publish and subscribe from the broker VM immediately

Prerequisites

  • An active Azure subscription, an SSH public key, and a VNet and subnet in the target region
  • A subscription to the HiveMQ Community Edition listing on Azure Marketplace
  • Network Security Group rules that allow TCP 22 (admin) and TCP 1883 (MQTT) from the client networks and devices that connect to the broker

Recommended virtual machine size: Standard_B2s (2 vCPU, 4 GB RAM) is ample for development and small production workloads. The broker runs with a 1500 MB JVM heap on this size. Scale to a larger size for high connection counts or message throughput.

1

Deploy from the Azure Portal

Search the Azure Marketplace for HiveMQ Community Edition, select the SecureAnyCloud publisher, and select Create.

Configure the Network Security Group to allow TCP 1883 (MQTT) from the device and application networks that connect, and TCP 22 for administration. Restrict 1883 to your own client subnets rather than the whole internet.

2

Deploy from the Azure CLI

RG="mqtt-prod"; LOCATION="eastus"; VM_NAME="hivemq1" IMAGE_URN="sac1647283583153:hivemq-ce-ubuntu-24-04:default:latest" SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" az group create --name "$RG" --location "$LOCATION"
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:hivemq-ce-ubuntu-24-04:default:latest
az vm create \
  --resource-group "$RG" --name "$VM_NAME" \
  --image "$IMAGE_URN" \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values "$SSH_KEY" \
  --public-ip-sku Standard
az vm open-port --resource-group "$RG" --name "$VM_NAME" --port 1883 --priority 1001
az vm open-port --resource-group "$RG" --name "$VM_NAME" --port 22 --priority 1002
3

First boot

On first boot, the image generates a unique MQTT admin password and hashes it with the File RBAC extension. It then renders the extension credentials file and starts hivemq. This completes within a minute or two while the JVM warms up.

SSH in as azureuser and read the details:

sudo cat /root/hivemq-credentials.txt

The file records the admin username (cimgadmin), the generated password and the MQTT URI for this VM. Store the password somewhere safe. It is unique to this instance and is the only credential that can connect to the broker.

4

Confirm the service is running

Confirm that hivemq.service is active, that the runtime is OpenJDK 21, and that ss shows the broker listening on :1883 on all interfaces.

systemctl is-active hivemq.service java -version ss -tlnp | grep ':1883 '
5

Publish and subscribe with the per-instance credential

Read the admin password from the credentials file into a shell variable. Publish a retained message, then subscribe to receive it.

Both the publish and the subscribe present the cimgadmin username and the per-instance password. The broker delivers the message end to end.

PW=$(sudo grep '^HIVEMQ_ADMIN_PASSWORD=' /root/hivemq-credentials.txt | cut -d= -f2-) mosquitto_pub -h 127.0.0.1 -p 1883 -u cimgadmin -P "$PW" -t demo/hello -m 'hello from sac' -q 1 -r mosquitto_sub -h 127.0.0.1 -p 1883 -u cimgadmin -P "$PW" -t 'demo/#' -v -C 1 -W 8

The subscriber prints demo/hello hello from SecureAnyCloud and exits. This confirms an authenticated publish and subscribe round trip.

6

Confirm anonymous and wrong credentials are rejected

The File RBAC extension enforces authentication. The broker refuses a connection with no credentials or with a wrong password. Each command below therefore exits with a non-zero status and prints the confirmation.

The screenshot shows the exact client messages: Connection Refused: bad user name or password for anonymous, and Connection Refused: not authorised for a wrong password.

mosquitto_pub -h 127.0.0.1 -p 1883 -t demo/x -m nope 2>/dev/null && echo 'UNEXPECTED: anonymous accepted' || echo 'anonymous connect refused by the broker (expected)' mosquitto_pub -h 127.0.0.1 -p 1883 -u cimgadmin -P wrong-password -t demo/x -m nope 2>/dev/null && echo 'UNEXPECTED: wrong password accepted' || echo 'wrong password refused by the broker (expected)'
7

Review the secure-by-default configuration

No default or shared credentials ship in the image. The credentials file is 0600 root:root, and the admin password is unique to this VM. The File RBAC extension stores the password as a salted PBKDF2 hash (password-type HASHED), never in plain text.

sudo stat -c '%n %a %U:%G' /root/hivemq-credentials.txt
sudo grep -E '<password-type>' /opt/hivemq/current/extensions/hivemq-file-rbac-extension/conf/config.xml
sudo grep -c '<password>' /opt/hivemq/current/extensions/hivemq-file-rbac-extension/conf/credentials.xml
8

Add your own MQTT users and topic permissions

You manage users and their topic permissions in the File RBAC credentials file, /opt/hivemq/current/extensions/hivemq-file-rbac-extension/conf/credentials.xml.

Passwords are stored as salted PBKDF2 hashes. Generate a hash for a new user's password with the extension's own generator. The -q flag prints only the hash string. In this example, replace <new-password> with a real password you choose.

sudo java -jar /opt/hivemq/current/extensions/hivemq-file-rbac-extension/hivemq-file-rbac-extension-4.6.15.jar -p '<new-password>' -q

Add a <user> entry (referencing a <role> you define) to the <users> section of credentials.xml. Paste the hash above into <password>.

The role's <permission> blocks scope which topics the user may publish or subscribe to. The following role grants publish and subscribe only under a per-device prefix:

<user> <name>device01</name> <password>PASTE_THE_HASH_HERE</password> <roles> <id>device</id> </roles> </user> <!-- add this role under the <roles> section --> <role> <id>device</id> <permissions> <permission> <topic>devices/device01/#</topic> <activity>ALL</activity> </permission> </permissions> </role>

The File RBAC extension reloads credentials.xml automatically within 60 seconds, so changes take effect without restarting the broker.

For production, create a narrowly scoped role per device or application rather than reusing the superuser admin.

9

Connect an application or IoT device

Any standard MQTT client can connect using the broker IP, port 1883, and the username and password from the credentials file. The values below map directly onto /root/hivemq-credentials.txt.

This example uses the Eclipse Paho Python client. The same host, port, username and password apply to any MQTT 3.1.1 or 5.0 library.

import paho.mqtt.client as mqtt client = mqtt.Client(protocol=mqtt.MQTTv5) client.username_pw_set("cimgadmin", "the-password-from-the-credentials-file") client.connect("<hivemq-vm-ip>", 1883) client.publish("telemetry/sensor1", payload="23.4", qos=1) client.loop_forever()

For production, create a dedicated per-application MQTT user (Step 8) rather than reusing the admin account.

10

Enable TLS on port 8883 (optional hardening)

By default, the image serves plain MQTT on port 1883, which is appropriate inside a trusted VNet.

To carry credentials and payloads over the public internet, add an encrypted tls-tcp-listener on the standard MQTTS port 8883 in /opt/hivemq/current/conf/config.xml. Reference a Java keystore that contains a certificate for your server's hostname. Restart the broker after you edit the config, and open TCP 8883 in the NSG.

Keeping TLS optional lets you run plain MQTT for local development and add MQTTS for exposed deployments.

11

Security recommendations

  • Restrict the NSG. Allow TCP 1883 only from the device and application subnets that connect to the broker, and TCP 22 for administration only. Do not expose the MQTT port to the public internet without TLS.
  • Use TLS for untrusted networks. Add an 8883 tls-tcp-listener (Step 10) for any traffic that leaves a trusted VNet, so that credentials and payloads are encrypted in transit.
  • Use scoped per-client users. Create a narrowly scoped File RBAC role and user per device or application (Step 8) rather than reusing the superuser admin. A compromised client then cannot read or write every topic.
  • Protect the credentials. /root/hivemq-credentials.txt is 0600 root:root, and credentials.xml stores only salted PBKDF2 hashes. Keep both root-owned. Back up your credentials.xml, which is the source of truth for who may connect.
  • Keep the OS patched. Unattended security upgrades remain enabled on the running VM.
12

Support and Licensing

HiveMQ Community Edition is an open-source project distributed under the Apache License 2.0. This SecureAnyCloud image bundles the unmodified official HiveMQ Community Edition release and the official HiveMQ File RBAC Authentication Extension.

SecureAnyCloud provides the packaging, the systemd hardening, the secure-by-default File RBAC configuration, the per-instance credential automation, the paired deploy guide, and 24/7 support with a guaranteed 24-hour response SLA.

SecureAnyCloud is not affiliated with or endorsed by HiveMQ GmbH. HiveMQ is a mark of its respective owner and is used here only to identify the software.

Deploy on Azure

Find HiveMQ Community Edition on Ubuntu 24.04 LTS on the Azure Marketplace, published by SecureAnyCloud. Deploy from the Portal or the Azure CLI as shown above.

Need Help?

Email sales@secureanycloud.com for deployment help, configuration questions or licensing enquiries.

Deploy on Azure

Launch HiveMQ Community Edition 2026.5 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