RabbitMQ Security
Message Broker Security 2026
TLS, OAuth 2.0, Management UI Security, Federation, Shovel & Resource Limits
TLS 1.3OAuth 2.0mTLSFederation
RabbitMQ TLS Configuration
# rabbitmq.conf - TLS 1.3 Only Configuration # Main listener with TLS listeners.ssl.default = 5671 ssl_options.cacertfile = /etc/rabbitmq/ssl/ca.crt ssl_options.certfile = /etc/rabbitmq/ssl/server.crt ssl_options.keyfile = /etc/rabbitmq/ssl/server.key # TLS 1.3 with modern cipher suites ssl_options.versions.1 = tlsv1.3 ssl_options.ciphers.1 = TLS_AES_256_GCM_SHA384 ssl_options.ciphers.2 = TLS_CHACHA20_POLY1305_SHA256 ssl_options.ciphers.3 = TLS_AES_128_GCM_SHA256 # Require peer verification (mTLS) ssl_options.verify = verify_peer ssl_options.fail_if_no_peer_cert = true # Management UI HTTPS management.ssl.port = 15671 management.ssl.cacertfile = /etc/rabbitmq/ssl/ca.crt management.ssl.certfile = /etc/rabbitmq/ssl/management.crt management.ssl.keyfile = /etc/rabbitmq/ssl/management.key # Clustering (inter-node TLS) clustering.use_tls = true clustering.tls.cacertfile = /etc/rabbitmq/ssl/ca.crt clustering.tls.certfile = /etc/rabbitmq/ssl/cluster.crt clustering.tls.keyfile = /etc/rabbitmq/ssl/cluster.key clustering.tls.verify = verify_peer # Disable non-TLS listeners listeners.tcp = none
OAuth 2.0 / OIDC Integration
# rabbitmq.conf - OAuth 2.0 Authentication auth_mechanisms.1 = PLAIN auth_mechanisms.2 = AMQPLAIN auth_mechanisms.3 = EXTERNAL # OAuth 2.0 Backend auth_backends.1 = oauth2 auth_backends.2 = internal # OAuth 2.0 Configuration oauth2.issuer = https://auth.company.com oauth2.token_endpoint = https://auth.company.com/token oauth2.jwks_url = https://auth.company.com/.well-known/jwks.json oauth2.scopes.openid_profile = openid profile # Resource Server ID (RabbitMQ itself) oauth2.resource_server_id = rabbitmq-production # Scope-to-Permission Mapping oauth2.additional_scopes = rabbitmq.read:*/* rabbitmq.write:*/* rabbitmq.configure:*/* # Token verification transport.oauth2.refresh_interval_in_seconds = 300 transport.oauth2.https.verify_peer = true transport.oauth2.https.fail_if_no_peer_cert = true # Advanced: Token transformation oauth2.preferred_username_claims.1 = sub oauth2.preferred_username_claims.2 = preferred_username oauth2.preferred_username_claims.3 = email # JWT Algorithm restrictions oauth2.signing_keys = RS256 RS384 RS512
Management UI Security
# rabbitmq.conf - Management Plugin Security # Enable management with security restrictions management.load_definitions = /etc/rabbitmq/definitions.json # Session timeout (security) management.session_timeout = 1800 # 30 minutes management.sample_retention_policies.global.minute = 5 management.sample_retention_policies.global.hour = 60 management.sample_retention_policies.global.day = 1200 # CORS restrictions management.cors.allow_origins.1 = https://rabbitmq-ui.company.com management.cors.allow_origins.2 = https://internal-admin.company.com management.cors.allow_credentials = false management.cors.max_age = 3600 # Path prefix (security through obscurity, not primary defense) management.path_prefix = /admin/messaging # Disable HTTP Basic Auth (use OAuth/mTLS only) management.basic_auth = false # Enable Prometheus metrics (with auth) management.prometheus.path = /metrics management.prometheus.port = 15692 # Strict Content-Type validation management.content_security_policy = "default-src 'self'; script-src 'self'; object-src 'none';" # Clickjacking protection management.clickjacking_protection = true
Resource Limits & DoS Protection
# rabbitmq.conf - Resource Limits (Prevent DoS) # Connection limits per user/virtual host max_connections = 10000 # Queue limits max_queues = 5000 # Message size limit (prevent memory exhaustion) max_message_size = 16777216 # 16 MB # Queue length limits (overflow handling) overflow = reject-publish # or drop-head, dead-letter # Per-virtual host limits vhost_limits.vhost1.max_connections = 1000 vhost_limits.vhost1.max_queues = 500 # Disk space thresholds disk_free_limit.absolute = 2GB # Memory thresholds vm_memory_high_watermark.relative = 0.7 vm_memory_high_watermark_paging_ratio = 0.5 # Consumer timeout (detect stuck consumers) consumer_timeout = 900000 # 15 minutes # Channel limits per connection channel_max = 2047 # Frame size limits frame_max = 131072 # 128 KB # Heartbeat (detect dead connections) heartbeat = 60 # TCP buffer sizes (tune for your network) tcp_listen_options.backlog = 4096 tcp_listen_options.nodelay = true tcp_listen_options.linger.on = true tcp_listen_options.linger.timeout = 0 tcp_listen_options.sndbuf = 196608 tcp_listen_options.recbuf = 196608
Policy-Based Authorization
# definitions.json - User & Permission Definitions
{
"users": [
{
"name": "app-producer",
"password_hash": "HASH_HERE",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": ""
},
{
"name": "app-consumer",
"password_hash": "HASH_HERE",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": ""
},
{
"name": "monitoring",
"password_hash": "HASH_HERE",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": "monitoring"
},
{
"name": "admin",
"password_hash": "HASH_HERE",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": "administrator"
}
],
"vhosts": [
{
"name": "production"
},
{
"name": "staging"
}
],
"permissions": [
{
"user": "app-producer",
"vhost": "production",
"configure": "^$", # No queue/exchange creation
"write": "orders\.exchange|payments\.exchange",
"read": "^$"
},
{
"user": "app-consumer",
"vhost": "production",
"configure": "^$",
"write": "^$",
"read": "orders\.queue|payments\.queue"
},
{
"user": "monitoring",
"vhost": "production",
"configure": "^$",
"write": "^$",
"read": "^$" # Read-only monitoring
}
],
"topic_permissions": [
{
"user": "app-producer",
"vhost": "production",
"exchange": "amq.topic",
"write": "orders\..*",
"read": "^$"
}
]
}Federation & Shovel Security
# rabbitmq.conf - Federation Configuration # Federation plugin federation-upstream-set.add = all # Upstream definition (secure remote cluster) federation-upstream.upstream1.uri = amqps://federation-user:password@remote-rabbitmq:5671/production federation-upstream.upstream1.uri = amqps://federation-user:password@remote-rabbitmq-backup:5671/production federation-upstream.upstream1.expires = 3600000 federation-upstream.upstream1.message-ttl = 300000 federation-upstream.upstream1.prefetch-count = 1000 federation-upstream.upstream1.reconnect-delay = 5 federation-upstream.upstream1.ack-mode = on-confirm federation-upstream.upstream1.trust-user-id = false # Security! # Shovel configuration (one-way bridge) shovel shovel1.src-uri = amqps://shovel-user:password@source-rabbitmq:5671/ shovel shovel1.src-queue = source-queue shovel shovel1.dest-uri = amqps://shovel-user:password@dest-rabbitmq:5671/ shovel shovel1.dest-queue = dest-queue shovel shovel1.prefetch-count = 1000 shovel shovel1.ack-mode = on-confirm shovel shovel1.reconnect-delay = 5 shovel shovel1.add-forward-headers = false shovel shovel1.publish-properties.content-type = application/json # TLS for federation/shovel ssl_options.verify = verify_peer ssl_options.cacertfile = /etc/rabbitmq/ssl/ca.crt ssl_options.certfile = /etc/rabbitmq/ssl/federation.crt ssl_options.keyfile = /etc/rabbitmq/ssl/federation.key
Security Best Practices Checklist
Network Security
☐TLS 1.3 enforced (no older versions)
☐mTLS for sensitive connections
☐Management UI behind VPN/reverse proxy
☐Firewall: 5671, 15671 only from known IPs
☐Network segmentation (VLANs)
☐Disable non-TLS listeners completely
Authentication & Authorization
☐OAuth 2.0 or LDAP (not default users)
☐Principle of least privilege
☐Regular password rotation (90 days)
☐Separate users per service/app
☐No guest user in production
☐Topic-level permissions configured