Introduction
This article describes how to configure RabbitMQ to listen on localhost only.
Description
Some customers are working into highly restricted environment and may require to change default RabbitMQ configuration to listen on localhost only instead of whole network. Please note this kind of configuration is advised for single node architecture.
Procedure
Edit the /etc/rabbitmq/rabbitmq-env.conf file, then add following entries
RABBITMQ_NODE_IP_ADDRESS=127.0.0.1 ERL_EPMD_ADDRESS=127.0.0.1
Edit the /etc/rabbitmq/rabbitmq.config and add following entries (in bold)
[
{kernel, [
{inet_dist_use_interface,{127,0,0,1}}
]},
{rabbit, [
{tcp_listen_options, [binary, {packet,raw},
{reuseaddr,true},
{backlog,128},
{nodelay,true},
{exit_on_close,false},
{keepalive,false}]},
{hipe_compile, true},
{default_user, <<"guest">>},
{default_pass, <<"guest">>}
]},
{rabbitmq_management_agent, [
{force_fine_statistics, false}
]},
{rabbitmq_management, [
{listener, [{port, 15672}, {ip, "127.0.0.1"}]}
]}
].
Then restart RabbitMQ & SYSTRAN services (on CentOS / RedHat 7 or 8):
systemctl restart rabbitmq-server for i in $(systemctl -a | grep -o systran-.*.service); do systemctl restart $i; done
Source: https://serverfault.com/questions/235669/how-do-i-make-rabbitmq-listen-only-to-localhost