Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit restructures the debian packaging. First it splits off the modules from the djabberd package which allows installing all required libraries w/o getting another deamon (e.g. as build dependency for building other modules or custom jabberds). Second it adds the missing wiring to the djabberd to get an jabber server which is easy to set up. Including propper logging and an ssl certificate.
- Loading branch information
1 parent
d13d175
commit c0f64df
Showing
11 changed files
with
291 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
tmp/ | ||
djabberd/ | ||
libdjabberd-perl/ | ||
*.debhelper | ||
*.substvars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/djabberd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/sh | ||
|
||
### BEGIN INIT INFO | ||
# Provides: djabberd | ||
# Required-Start: $local_fs $remote_fs | ||
# Required-Stop: $local_fs $remote_fs | ||
# Should-Start: $all | ||
# Should-Stop: $all | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Start/stop djabberd | ||
# Description: Start/stop djabberd | ||
### END INIT INFO | ||
|
||
# Original Version from http://graveyard.martinjansen.com/2006/08/06/djabberd.html | ||
# Modified by Dominik Schulz <dominik.schulz@gauner.org> | ||
|
||
set -e | ||
|
||
test $DEBIAN_SCRIPT_DEBUG && set -v -x | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
DESC="DJabberd" | ||
NAME="djabberd" | ||
CONFIG_DIR=/etc/djabberd | ||
HOME_DIR=/var/lib/djabberd | ||
DAEMON=/usr/bin/djabberd | ||
PIDFILE=/var/run/djabberd/djabberd.pid | ||
SCRIPTNAME=/etc/init.d/djabberd | ||
OPTS="--conf=$CONFIG_DIR/djabberd.conf" | ||
|
||
test -x $DAEMON || exit 0 | ||
text -d $CONFIG_DIR || exit 0 | ||
|
||
d_start() { | ||
start-stop-daemon --start --quiet --pidfile $PIDFILE -m \ | ||
-d $HOME_DIR \ | ||
--chuid djabberd \ | ||
--background \ | ||
--exec $DAEMON -- $OPTS | ||
} | ||
|
||
d_stop() { | ||
start-stop-daemon --stop --quiet --pidfile $PIDFILE \ | ||
-d $HOME_DIR \ | ||
--name $NAME -- $OPTS | ||
} | ||
|
||
d_reload() { | ||
start-stop-daemon --stop --quiet --pidfile $PIDFILE \ | ||
--name $NAME --signal 1 | ||
} | ||
|
||
case "$1" in | ||
start) | ||
echo -n "Starting $DESC: $NAME" | ||
d_start | ||
echo "." | ||
;; | ||
stop) | ||
echo -n "Stopping $DESC: $NAME" | ||
d_stop | ||
echo "." | ||
;; | ||
reload) | ||
echo -n "Reloading $DESC: $NAME" | ||
d_reload | ||
echo "." | ||
;; | ||
restart|force-reload) | ||
echo -n "Restarting $DESC: $NAME" | ||
d_stop | ||
sleep 1 | ||
d_start | ||
echo "." | ||
;; | ||
*) | ||
echo "Usage: $SCRIPTNAME {start|stop|reload|restart|force-reload}" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 | ||
|
||
# vim: set ai sts=2 sw=2 tw=0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
debian/tmp/usr / | ||
debian/tmp/usr/bin / | ||
/etc/djabberd.conf /etc/djabberd/ | ||
/etc/log.conf /etc/djabberd/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/var/log/djabberd/djabberd.log { | ||
daily | ||
missingok | ||
copytruncate | ||
rotate 90 | ||
compress | ||
notifempty | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/sh -e | ||
|
||
# DJabberd Common postinst | ||
# Dominik Schulz <dominik.schulz@gauner.org> | ||
|
||
makedir() { | ||
if [ ! -d $1 ]; then | ||
mkdir $1 | ||
fi | ||
chown $2 $1 && chmod $3 $1 | ||
} | ||
|
||
umask 022 | ||
|
||
# postinst processing | ||
|
||
case "$1" in | ||
configure) | ||
OLDVERSION="$2" | ||
# see below | ||
;; | ||
abort-upgrade) | ||
exit 0 | ||
;; | ||
abort-remove|abort-deconfigure) | ||
exit 0 | ||
;; | ||
*) | ||
echo "postinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# make sure that the user exists. the simplest portable way to check that | ||
# is to chown something. | ||
makedir /tmp/djabberd root:root 700 | ||
chgrp djabberd /tmp/djabberd 2>/dev/null || | ||
addgroup --system djabberd | ||
chown djabberd /tmp/djabberd 2>/dev/null || | ||
adduser --system --home /var/lib/djabberd --no-create-home --ingroup djabberd --disabled-password djabberd | ||
# create missing directories and/or make sure the permissions fit | ||
makedir /var/lib/djabberd djabberd:djabberd 755 | ||
makedir /var/log/djabberd djabberd:djabberd 755 | ||
makedir /var/run/djabberd djabberd:djabberd 755 | ||
makedir /etc/djabberd djabberd:djabberd 750 | ||
|
||
# generate a snakeoil keypair so that SSL works OOTB | ||
SERVERKEY="/etc/djabberd/snakeoil-server-key.pem" | ||
SERVERCRT="/etc/djabberd/snakeoil-server-crt.pem" | ||
if [ ! -f $SERVERKEY -a ! -f $SERVERCRT ]; then | ||
openssl req -x509 -batch -newkey rsa:1024 -keyout $SERVERKEY -out $SERVERCRT -days 3650 -nodes | ||
fi | ||
|
||
# remove the temporary directory | ||
rm -r /tmp/djabberd | ||
|
||
# functionality generated by debhelper (e.g. invoking start/stop scripts) will be added here | ||
#DEBHELPER# | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh -e | ||
|
||
# DJabberd Common postrm | ||
# Dominik Schulz <dominik.schulz@gauner.org> | ||
|
||
case "$1" in | ||
remove) | ||
;; | ||
upgrade) | ||
;; | ||
purge) | ||
rm -rf /etc/djabberd | ||
rm -rf /var/lib/djabberd | ||
rm -rf /var/log/djabberd | ||
rm -rf /var/run/djabberd | ||
userdel djabberd >/dev/null 2>&1 || true | ||
groupdel djabberd >/dev/null 2>&1 || true | ||
;; | ||
failed-upgrade|abort-install|abort-upgrade|disappear) | ||
;; | ||
*) | ||
echo "postrm called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
#DEBHELPER# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
debian/tmp/usr/share / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
OldSSL enable | ||
|
||
# health checks from this IP (directive can be repeated) won't log and | ||
# won't allocate a connection id | ||
DeclareMonitor 127.0.0.1 | ||
AdminPort 5200 | ||
|
||
# defaults: | ||
ClientPort 5222 | ||
ServerPort 5269 | ||
|
||
SSLCertificateFile /etc/djabberd/snakeoil-server-crt.pem | ||
SSLCertificateKeyFile /etc/djabberd/snakeoil-server-key.pem | ||
|
||
PidFile /var/run/djabberd/djabberd.pid | ||
|
||
<VHost jabber.localhost.localdomain> | ||
S2S enable | ||
RequireSSL yes | ||
|
||
<Plugin DJabberd::SASL::AuthenSASL> | ||
Optional no | ||
Mechanisms PLAIN LOGIN | ||
</Plugin> | ||
|
||
<Plugin DJabberd::RosterStorage::SQLite> | ||
Database /var/lib/djabberd/roster.sqlite | ||
</Plugin> | ||
|
||
<Plugin DJabberd::Authen::HTDigest> | ||
Realm djabberd | ||
HtDigest /var/lib/djabberd/djabberd.htdigest | ||
</Plugin> | ||
|
||
<Plugin DJabberd::Plugin::VCard::SQLite> | ||
Storage /var/lib/djabberd/vcards.sqlite | ||
</Plugin> | ||
|
||
# This needs the package libdjabberd-authen-userlimit-perl | ||
# <Plugin DJabberd::Authen::UserLimit> | ||
# UserLimit 150 | ||
# </Plugin> | ||
|
||
# This needs the package libdjabberd-entitytime-perl | ||
# <Plugin DJabberd::Plugin::EntityTime /> | ||
|
||
# This needs the package libdjabberd-plugin-balancer-perl | ||
# <Plugin DJabberd::Plugin::Balancer /> | ||
|
||
# This needs the package libdjabberd-plugin-jabberiqversion-perl | ||
# <Plugin DJabberd::Plugin::JabberIqVersion> | ||
# OS Debian GNU/Linux | ||
# Name A poorly maintained Jabber Server | ||
# Version Beta | ||
# </Plugin> | ||
|
||
# This needs the package libdjabberd-plugin-ping-perl | ||
# <Plugin DJabberd::Plugin::Ping /> | ||
|
||
<Plugin DJabberd::PresenceChecker::Local /> | ||
<Plugin DJabberd::Delivery::Local /> | ||
<Plugin DJabberd::Delivery::S2S /> | ||
|
||
# This needs the package libdjabberd-delivery-offlinestorage-perl | ||
# IMPORTANT: This plugin MUST be loaded last! | ||
# <Plugin DJabberd::Delivery::OfflineStorage::SQLite> | ||
# Database /var/lib/djabberd/offline.sqlite | ||
# Types Message | ||
# </Plugin> | ||
</VHost> | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
log4perl.logger.DJabberd = ERROR, LOGFILE | ||
log4perl.logger.DJabberd.Hook = WARN | ||
|
||
log4perl.appender.LOGFILE=Log::Log4perl::Appender::File | ||
log4perl.appender.LOGFILE.filename=/var/log/djabberd/djabberd.log | ||
log4perl.appender.LOGFILE.mode=append | ||
|
||
log4perl.appender.LOGFILE.layout=Log::Log4perl::Layout::PatternLayout | ||
log4perl.appender.LOGFILE.layout.ConversionPattern=%-5p %-40c %m %n |