Ejabberd administration console access

When configuring an ejabberd server, we have access to the administration console through port 5280 by default using the internal erlang http server, but normally we have other web applications running on the same server (like a messaging archive interface) listening directly on the http port and we can easily configure the admin console to be accessed through this port using a proxy module (in this case, Apache’s mod_proxy).

To configure the redirector, simply include the following rules in your virtual host:

ProxyRequests Off
SSLProxyEngine On
ProxyPass / http://localhost:5280/ keepalive=On
ProxyPassReverse / http://localhost:5280/

After adding this rules and reloading the httpd server, you can easily access the ejabberd administration console directly from:

http://your.jabber.server.com/admin

The same rules can be applied on a secure virtual host running under mod_ssl (port 443), as this is the recommended and secure way to access an administration console.

OpenSuSE 11.3

OpenSuSE 11.3A versão 11.3 do OpenSuSE foi lançada trazendo inúmeras atualizações e melhorias no sistema, entre elas Kernel 2.6.34, suporte nativo a MariaDB, Gnome 2.30.1 e KDE SC 4.4.4 nas versões de 32 e 64 bits.

Obs. Está disponível também no sistema o preview do Gnome 3.0!

Mais informações no site oficial do projeto…

[ejabberd] Reload module via Erlang console

It is possible to reload some ejabberd modules from disk without restarting ejabberd service.
This allows you to modify erlang source files (.erl) and reload them without the need of restarting.

Obs. Reloading modules is also possible via the web interface since ejabberd 0.9.1.

Open an Erlang console on the ejabberd node with:
# ejabberdctl debug

And select the module you wish to compile with:
c(mod_version).

If you just want to reload the .beam file (without recompiling the module), use:
l(mod_version).

Obs. Replace “mod_version” with the name of the file you want to recompile / reload.

Export user list in ejabberd

There are lots of ways to upgrade ejabberd service without downtime, but sometimes when managing a corporate instant messaging server we need to reformulate our entire messaging architecture in a new server and we can just export all users and passwords to a list and then import them to the new server using just the command line and mod_cltextra / mod_admin module.

There’s no automated way to export all users like Openfire does, but we can dump our entire database, consider that you are using the internal erlang mnesia database, to a text file and filter just the values we want (in this case, users and passwords) using the following steps:

  1. Dump the database to a text file:
  2. # ejabberd_ctl ejabberd@localhost dump /tmp/mnesia.dump

  3. Filter the dump to get only registered users
  4. # cat /tmp/mnesia.dump | grep ‘{passwd,{‘ > /tmp/tmplist.txt

  5. Convert your temporary generated file to the format you prefer, in this case getting a list (username, hostname, password):

    # sed -e ‘s/{passwd,{“//g;s/”,”/ /g;s/”},”/ /g;s/”}.//g’ /tmp/tmplist.txt > /tmp/userlist.txt

Obs. The database registers that store user information in the dump have the following format:
{passwd,{“USER”,”VIRTUAL-HOST”},”PASSWORD”}.

[Irssi] Conectando a vários servidores IRC

Muitas pessoas tem duvidas quando a conexão em multiplos servidores com o Irssi, que apesar de utilizar uma forma diferente dos outros IRC clients mais tradicionais apresenta muita eficiência e facilidade durante o uso!

Para abrir conexão em um novo servidor sem perder a conexão atual utilize:

/CONNECT irc.server.net

Lembrando que para se conectar a um novo servidor, finalizando a conexão anterior o comando chamado é “/SERVER irc.newserver.net”.

Para listar os servidores atualmente conectados na máquina utilize o comando /SERVER sem nenhum parâmetro adicional, que mostrará uma saída parecida com:

-!- oftc: irc.oftc.net:6667 ()
-!- freenode: irc.freenode.net:6667 ()
-!- efnet: irc.efnet.org:6667 ()

Como mostrado acima, cada conexão com servidor é classificada por uma tag diferente (normalmente o nome do servidor, logo após o sinal -!-) que será utilizada para fazer referência durante a execução de comandos.

Para se desconectar de algum dos servidores utilize:

/DISCONNECT freenode

Onde “freenode” é a tag que faz referência à conexão realizada no irc.freenode.net.

A tag de referência pode ser utilizada em boa parte dos comandos disponíveis, assim como:

/MSG -tag nick mensagem
/JOIN -tag #channel
/QUERY -tag nick
/TOPIC -tag #channel novo topico

Para aqueles que ainda não conhecem o Irssi, ele é um IRC client rico em funcionalidades, leve, flexível, tem suporte a temas, possui suporte a SILC, tem uma ótima integração com o GNU Screen e não necessita de bibliotecas gráficas para a execução. Recomendo a todos!

Recomendo a leitura do “A Guide to Efficiently Using Irssi and Screen” para quem está iniciando sua utilização.