Skip to content

Instantly share code, notes, and snippets.

@quad
Created October 8, 2009 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quad/204648 to your computer and use it in GitHub Desktop.
Save quad/204648 to your computer and use it in GitHub Desktop.
jwz wants to try DJabberd
#!/bin/sh -e
#
# jwz wants to try DJabberd.
#
# Hope you're using Debian.
sudo aptitude install \
perl \
libdanga-socket-perl \
libdigest-hmac-perl \
liblog-log4perl-perl \
libnet-dns-perl \
libnet-ssleay-perl \
libxml-libxml-perl \
libxml-sax-perl \
apache2-utils \
libdbd-sqlite3-perl
# Grab the latest SVN. It's stable enough.
svn co http://code.sixapart.com/svn/djabberd/trunk/ trunk
# Grab the Ping plugin. Makes life sane.
(cd trunk && wget -c http://search.cpan.org/CPAN/authors/id/M/MI/MISC/DJabberd-Plugin-Ping-0.46.tar.gz && tar -zxf DJabberd-Plugin-Ping-0.46.tar.gz)
# Compile.
(cd trunk/DJabberd/ && perl Makefile.PL)
(cd trunk/DJabberd-Plugin-Ping-0.46/ && PERL5LIB="trunk/DJabberd/lib" perl Makefile.PL)
# Username and password?
htdigest -c jwz.users djabberd jwz
# djabberd config
cat > djabberd-jwz.conf << END
#
# Want SSL? Fuck around with openssl. Then, uncomment the following lines.
#
# My server's command-line history says something like the following is what you want:
#
# $ openssl req -new -x509 -key djabberd-key.pem -out djabberd-cert.pem -days 365 -nodes
#
# And my cert says:
#
# C=US, ST=Washington, L=Seattle, O=Scott Robinson, CN=mail.quadhome.com/emailAddress=webmaster@quadhome.com
#
# Cue "self-signed certificates are evil" moans here. http://xmpp.net/ offers
# free "real" signed certs. But, I found no way to renew mine after a year. YMMV.
#
#SSLCertificateFile $(pwd)/djabberd-cert.pem
#SSLCertificateKeyFile $(pwd)/djabberd-key.pem
PIDFile $(pwd)/djabberd.pid
<VHost jwz.org>
S2S enable
# RequireSSL yes
<Plugin DJabberd::Authen::HTDigest>
Realm djabberd
HtDigest $(pwd)/jwz.users
</Plugin>
<Plugin DJabberd::RosterStorage::SQLite>
Database $(pwd)/jwz.sqlite
</Plugin>
<Plugin DJabberd::Plugin::Ping />
</VHost>
END
# djabberd logging config
mkdir etc
cat > etc/log.conf << END
log4perl.logger.DJabberd = ERROR, LOGFILE
log4perl.logger.DJabberd.Hook = WARN
log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename=$(pwd)/djabberd.log
log4perl.appender.LOGFILE.mode=append
log4perl.appender.LOGFILE.layout=PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern=%d %-5p %-40c %m%n
END
# Run it?
cat > djabberd-service << END
#!/bin/sh -e
NAME=djabberd
DAEMON_DIR=$(pwd)
DAEMON=\$DAEMON_DIR/trunk/DJabberd/\$NAME
DAEMON_ARGS="--conffile djabberd-jwz.conf --daemon"
PIDFILE=\$DAEMON_DIR/\$NAME.pid
export PERL5LIB="\$(dirname \$DAEMON)/lib"
start-stop-daemon --start --quiet --chdir \$DAEMON_DIR --pidfile \$PIDFILE --exec \$DAEMON --test > /dev/null || return 1
start-stop-daemon --start --quiet --chdir \$DAEMON_DIR --pidfile \$PIDFILE --exec \$DAEMON -- \$DAEMON_ARGS || return 2
END
chmod +x ./djabberd-service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment