PortGate

Blueprints · Docker & Databases

Production 15 min · RabbitMQ

RabbitMQ localhost bind

Keeps AMQP and the management UI on localhost. The default guest user is limited to loopback by RabbitMQ itself.

Why this should not be public

The management UI on 15672 and AMQP on 5672 expose every queue and message. The default guest account only works from localhost; adding a weak remote user to reach it from outside removes that protection.

Live config

Baked-in protections

Step 1 · yaml

Compose file

/opt/rabbitmq/compose.yaml

Change the default password before you start this on a shared machine. guest/guest only works from localhost even if you forget.

services:
  rabbitmq:
    image: rabbitmq:3-management
    environment:
      RABBITMQ_DEFAULT_USER: app
      RABBITMQ_DEFAULT_PASS: change-me
    ports:
      - "127.0.0.1:5672:5672"
      - "127.0.0.1:15672:15672"
    security_opt:
      - no-new-privileges:true
    restart: unless-stopped

Step 2 · bash

Start script

/opt/rabbitmq/up.sh

Written, not run. It refuses the placeholder password.

#!/bin/sh
set -eu
if grep -q 'change-me' "/opt/rabbitmq/compose.yaml"; then
  echo "Set RABBITMQ_DEFAULT_PASS before starting." >&2
  exit 1
fi
cd "/opt/rabbitmq"
docker compose up -d