Tutorial escrito para Ubuntu 10.04, habiendo instalado Jabberd14 desde los repositorios. Hay que configurar el dominio correcto tanto en /etc/default/jabberd14 como en /etc/jabber/jabber.xml y reiniciar el daemon. Al intentar conectarnos con una cuenta debería devolvernos 401: No autorizado.
Instalar las dependencias de Perl.
apt-get install libyaml-perl libdigest-sha1-perl libxml-simple-perl libnet-ldap-perl
Luego instalar el módulo Jabber::Connection desde CPAN.
cpan Jabber::Connection
Agregamos lo siguiente dentro de la etiqueta <jabber>, casi al principio del archivo /etc/jabber/jabber.xml:
<xdb id="xdb_auth_cpile"> <host/> <ns>jabber:iq:auth</ns> <accept> <ip>127.0.0.1</ip> <port>5999</port> <secret>testing</secret> </accept> </xdb>
El 'port' y el 'secret' puede cambiarse a los que quieran. Luego buscar lo siguiente:
<xdb id="xdb"> <host/> <load> <xdb_file>/usr/lib/jabberd14/libjabberdxdbfile.so</xdb_file> </load> <xdb_file xmlns="jabber:config:xdb_file"> <spool>/var/spool/jabberd</spool> </xdb_file> </xdb>
Y agregar <ns/>:
<xdb id="xdb"> <host/> <ns/> <load> <xdb_file>/usr/lib/jabberd14/libjabberdxdbfile.so</xdb_file> </load> <xdb_file xmlns="jabber:config:xdb_file"> <spool>/var/spool/jabberd</spool> </xdb_file> </xdb>
Comentar la autenticación con Digest. Solo se admite autenticación con texto plano (por lo que se recomienda utilizar únicamente conexiones seguras):
<!--<mod_auth_digest>/usr/lib/jabberd14/libjabberdsm.so</mod_auth_digest>--> <mod_auth_plain>/usr/lib/jabberd14/libjabberdsm.so</mod_auth_plain>
Reiniciamos el jabberd14:
invoke-rc.d jabberd14 restart
Lo descargamos de http://www.snoogans.co.uk/jabber/, concretamente http://www.snoogans.co.uk/jabber/files/xdb_auth_cpile.tar.gz.
cd /tmp wget http://www.snoogans.co.uk/jabber/files/xdb_auth_cpile.tar.gz tar xzfv xdb_auth_cpile.tar.gz mv xdb_auth_cpile.pm.ldap xdb_auth_cpile.pm mkdir /usr/local/lib/jabberd14 cp xdb_auth_cpile.pl xdb_auth_cpile.xml xdb_auth_cpile.pm /usr/local/lib/jabberd14
Editamos el archivo /usr/local/lib/jabberd14/xdb_auth_cpile.pl para establecer la ruta correcta de la biblioteca, cambiando:
use lib qw(/usr/local/jabber/xdb_auth_cpile);
Por lo siguiente:
use lib qw(/usr/local/lib/jabberd14);
Y también editamos /usr/local/lib/jabberd14/xdb_auth_cpile.pm para establecer los parámetros del servidor LDAP:
# Change the "ldap.example.com" below my $ldapserver="ldap.example.com";
# most normal LDAP servers will want something like this my $DN = "CN=$user, OU=Users, DC=Example, DC=com";
Por último, editar el archivo /usr/local/lib/jabberd14/xdb_auth_cpile.xml estableciendo el port y el secret correcto, además de corregir las rutas del pidfile y el logfile como sigue:
<config> <script> <logfile>/var/log/jabberd/xdb_auth.log</logfile> <pidfile>/var/run/jabberd/xdb_auth.pid</pidfile> <!-- debug can be "1" or "0" (on/off) --> <debug>0</debug> </script> <connection> <!-- make sure these values match those in your jabber.xml config --> <id>xdb_auth_cpile</id> <ip>127.0.0.1</ip> <port>5999</port> <secret>testing</secret> </connection> </config>
En este momento ya se puede probar ejecutando el archivo /usr/local/lib/jabberd14/xdb_auth_cpile.pl. Una vez has comprobado que funciona, puedes usar el siguiente script para arrancarlo al inicio:
Utilizar el siguiente script de arranque, que debe ejecutarse siempre DESPUÉS del jabberd14:
#! /bin/sh
### BEGIN INIT INFO
# Provides: jabberd14_ldap
# Required-Start: $local_fs $syslog jabberd14
# Required-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Jabber/XMPP server LDAP Auth
# Description: Jabberd14 is the original server implementation of the
# Jabber protocol, now known as XMPP.
### END INIT INFO
#
# Init script to start the Jabberd14 daemon
#
# Created from Bernd Eckenfels <ecki@lina.inka.de>
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# LSBized by Paul van Tilburg <paulvt@debian.org>
#
# Modified for LDAP Auth by Jorge Suárez de Lis <jorge.suarez@usc.es>
#
# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl
#
# This file was automatically customized by dh-make on Sun, 21 May 2000 12:31:20 +0200
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/lib/jabberd14/xdb_auth_cpile.pl
NAME="jabberd14_ldap"
DESC="Jabber/XMPP server LDAP Auth"
CONF=/usr/local/lib/jabberd14/xdb_auth_cpile.xml
PID=/var/run/jabberd/xdb_auth.pid
LOG=/var/log/jabberd/xdb_auth.log
test -f $DAEMON -a -f $CONF || exit 0
. /lib/lsb/init-functions
PARAMS=""
case "$1" in
start)
if ! [ -d $(dirname $PID) ]; then
mkdir -p -m 0755 $(dirname $PID)
chown jabberd:jabberd $(dirname $PID)
fi
if ! [ -d $(dirname $LOG) ]; then
mkdir -p -m 0755 $(dirname $LOG)
chown jabberd:jabberd $(dirname $LOG)
fi
if [ -e $PID ]; then
PIDDIR=/proc/$(cat $PID)
if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
log_success_msg "$DESC already started; not starting."
exit
else
log_success_msg "Removing stale PID file $PID."
rm -f $PIDFILE
fi
fi
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --pidfile $PID \
--chuid jabberd:jabberd --background --exec $DAEMON $CONF
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --oknodo --pidfile $PID
log_end_msg $?
rm -f $PID
;;
reload|force-reload)
log_action_begin_msg "Reloading $DESC" "$NAME"
start-stop-daemon --stop --signal 1 --quiet -pidfile $PID \
--chuid jabberd:jabberd --exec $DAEMON
log_action_end_msg $?
;;
restart)
$0 stop
$0 start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
Descomentar las siguientes líneas para no permitir registros ni cambios de contraseña:
<nounregister/> <noregistrationchange/> <nopasswordchange/>
Cambiar la sección de register eliminando los elementos que solicitaa para registrarse.
<register xmlns="jabber:iq:register"> <instructions>Este servizo fai uso da Identidade CITIUS, polo que non require rexistro.</instructions> <x xmlns='jabber:x:oob'><url>http://citius.usc.es/identidade-citius/</url></x> </register>