[ejabberd] Ejabberd listening on port 1212

Badlop badlop at gmail.com
Thu Oct 25 11:11:13 MSD 2007


2007/10/25, jesus at isaatc.ull.es <jesus at isaatc.ull.es>:
> Yes, this an odd thing. Many other people can get worried about have
> an open port for no reason at all.

> As you said, that port is opend by erlang for node communications.

So, as conclusion, that TCP listening has an important purpose in ejabberd:
it allows to do things with ejabberd from the command line that are
not possible with other programs.


For example, the Apache2 web server (that probably have more audience
than all Jabber servers together) has a script that only allows the
basic:

# apache2ctl
Usage: /usr/sbin/apache2ctl
start|stop|restart|graceful|graceful-stop|configtest|status|fullstatus
       /usr/sbin/apache2ctl <apache2 args>


When we look at ejabberdctl, thanks to Erlang node connectivity we can
implement almost any imaginable administration task. For example, this
is the default in ejabberd SVN:

$ ./ejabberdctl
Usage: ejabberdctl node command

Available commands:
  status                         get ejabberd status
  stop                           stop ejabberd
  restart                        restart ejabberd
  reopen-log                     reopen log file
  register user server password  register a user
  unregister user server         unregister a user
  backup file                    store a database backup to file
  restore file                   restore a database backup from file
  install-fallback file          install a database fallback from file
  dump file                      dump a database to a text file
  load file                      restore a database from a text file
  import-file file               import user data from jabberd 1.4 spool file
  import-dir dir                 import user data from jabberd 1.4
spool directory
  delete-expired-messages        delete expired offline messages from database
  delete-old-messages n          delete offline messages older than n
days from database
  vhost host ...                 execute host-specific commands
  incoming-s2s-number            print number of incoming s2s
connections on the node
  outgoing-s2s-number            print number of outgoing s2s
connections on the node
  user-resources user server     print user's connected resources
  connected-users-number         print a number of established sessions
  connected-users                list all established sessions

Example:
  ejabberdctl ejabberd at host restart

Commands to start an ejabberd node:
  start    Start an ejabberd node in server mode
  debug    Attach an interactive Erlang shell to a running ejabberd node
  live     Start an ejabberd node in live (interactive) mode


Any ejabberd module can implement new commands. For example
mod_ctlextra provides commands to edit vCards, change passwords and
add roster items.

If all this is not enough, thanks to Erlang node connectivity it is
possible to start a live shell session in an ejabberd server which is
already running and execute Erlang instructions. For example, check
the local time, clear the table Offline_msg, check total number of
locally registered users roster items...

$ ./ejabberdctl debug
--------------------------------------------------------------------

IMPORTANT: we will attempt to attach an INTERACTIVE shell
to an already running ejabberd node.
If an ERROR is printed, it means the connection was not succesfull.
You can interact with the ejabberd node if you know how to use it.
Please be extremely cautious with your actions,
and exit immediately if you are not completely sure.

To detach this shell from ejabberd, press:
  control+c, control+c

--------------------------------------------------------------------
Press any key to continue

Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0]
[kernel-poll:false]

Eshell V5.5.5  (abort with ^G)
(ejabberd at localhost)1> calendar:now_to_local_time(now()).
{{2007,10,25},{8,33,48}}
(ejabberd at localhost)2> ejabberd_auth:try_register("badlop",
"localhost", "uuu6UUU47").
{atomic,exists}
(ejabberd at localhost)3> mnesia:clear_table(offline_msg).
{atomic,ok}
(ejabberd at localhost)4> mnesia:table_info(passwd, size).
3
(ejabberd at localhost)5> mnesia:table_info(passwd, memory).
462
(ejabberd at localhost)6> erlang:system_info(system_version).
"Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0]
[kernel-poll:false]\n"


Of course, with great power comes great responsibility:
 '' It is strongly recommended to block the port 4369 in the firewall
for external connections. ''
http://www.ejabberd.im/epmd

I've started a FAQ page for this topic:
http://www.ejabberd.im/listen-strange-port


More information about the ejabberd mailing list