Why does ejabberd also listen in a strange port?

Question

I configured ejabberd to listen in ports 5222, 5269 and 5280. However, when I start ejabberd and look at the ports it opens for listening, he also opened a strange port. In fact, the port number varies every time I start ejabberd.

Why does ejabberd listen in that port?

Explanation

That listening socket is not opened by ejabberd itself, it's opened by Erlang. It is related to epmd and the node connectivity. There is a complete shell session that you can try yourself. The epmd program shows which programs have such a port open in the machine:

$ epmd -names
epmd: up and running on port 4369 with data:
name ejabberd at port 33581

Erlang node connectivity allows to stop ejabberd, and perform many other administrative tasks implemented in ejabberdctl. It also allows to attach an interactive Erlang shell to the ejabberd node. Finally, it also allows ejabberd clustering.

To have Erlang node connectivity it is required to have epmd and this port listening in ejabberd.

As a side note: It is strongly recommended to block the port 4369 in the firewall for external connections. epmd listens in this port, and usually epmd is not needed from outside the machine.

Related Links

Syndicate content