ejabberd listen error in CentOS 7 with firewalld

Hi all,

I've compiled and installed ejabberd from source (using the github repo). It compiles/installs ok.

However, it doesn't start. I've narrowed it down to a firewall issue - if I disable firewalld, it runs fine. I have the following ports open in firewalld:

  <port protocol="tcp" port="5223"/>
  <port protocol="tcp" port="5222"/>
  <port protocol="tcp" port="4369"/>
  <port protocol="tcp" port="4560"/>
  <port protocol="tcp" port="5269"/>
  <port protocol="tcp" port="5280"/>

Anyone have any idea how I can let ejabberd run succesfully?

Here's the full error:

# ejabberdctl start
# ejabberdctl status
{error_logger,{{2015,5,6},{18,28,58}},"Protocol: ~tp: register/listen error: ~tp~n",["inet_tcp",epmd_close]}
{error_logger,{{2015,5,6},{18,28,58}},crash_report,[[{initial_call,{net_kernel,init,['Argument__1']}},{pid,<0.20.0>},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,320}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}},{ancestors,[net_sup,kernel_sup,<0.10.0>]},{messages,[]},{links,[#Port<0.101>,<0.17.0>]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},{reductions,768}],[]]}
{error_logger,{{2015,5,6},{18,28,58}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfargs,{net_kernel,start_link,[['ejabberdctl-1',shortnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2015,5,6},{18,28,58}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}},{offender,[{pid,undefined},{name,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
{error_logger,{{2015,5,6},{18,28,58}},crash_report,[[{initial_call,{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.9.0>},{registered_name,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,133}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}},{ancestors,[<0.8.0>]},{messages,[{'EXIT',<0.10.0>,normal}]},{links,[<0.8.0>,<0.7.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,117}],[]]}
{error_logger,{{2015,5,6},{18,28,58}},std_info,[{application,kernel},{exited,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}}"}

Crash dump was written to: //var/log/ejabberd/erl_crash_20150506-182858.dump
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{k

Here's my full firewalld zone settings:

<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Work</short>
  <description>For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <interface name="lo"/>
  <interface name="127.0.0.1"/>
  <service name="samba"/>
  <service name="https"/>
  <service name="dhcpv6-client"/>
  <service name="ssh"/>
  <service name="dns"/>
  <service name="openvpn"/>
  <port protocol="tcp" port="5223"/>
  <port protocol="tcp" port="5222"/>
  <port protocol="tcp" port="4369"/>
  <port protocol="tcp" port="4560"/>
  <port protocol="tcp" port="5269"/>
  <port protocol="tcp" port="5280"/>
  <icmp-block name="echo-reply"/>
  <icmp-block name="echo-request"/>
  <masquerade/>
</zone>

A few questions to help

A few questions to help diagnose the problem:

1) Have you reloaded firewalld since you made this change? sudo service restart firewalld
2) Have you checked which zone your machine actually thinks it's running in? sudo firewall-cmd --get-active-zone
3) Have you looked in /var/log/messages to see if there's anything related to ejabberd?

The clustering part of the

The clustering part of the Erlang VM use random ports as default. There is an option in ejabberdctl.cfg called FIREWALL_WINDOW that you can use to tell Erlang to limit the port range to use. You need to set that window and your firewall configuration accordingly.

Syndicate content