also sprach martin f krafft <[EMAIL PROTECTED]> [2007.08.14.1216 +0200]: > While upstream is still working on this, I have now augmented the > init.d script and default settings to allow for a second spamd > instance to be started out of the box to handle virtual > configurations. I would appreciate if you'd apply the attached > patch.
My previous patch would not properly track the PID of the virtual spamd instance. Please find an updated patch against the 3.2.1-1 package attached. -- .''`. martin f. krafft <[EMAIL PROTECTED]> : :' : proud Debian developer, author, administrator, and user `. `'` http://people.debian.org/~madduck - http://debiansystem.info `- Debian - when you have better things to do than fixing systems
diff -u spamassassin-3.2.1/debian/spamassassin.init spamassassin-3.2.1/debian/spamassassin.init
--- spamassassin-3.2.1/debian/spamassassin.init
+++ spamassassin-3.2.1/debian/spamassassin.init
@@ -3,6 +3,7 @@
# Spamd init script
# June 2002
# Duncan Findlay
+# Virtual configuration by martin f. krafft
# Based on skeleton by Miquel van Smoorenburg and Ian Murdock
@@ -22,10 +23,24 @@
OPTIONS=""
NICE=
+VNAME=$NAME-virtual
+VDESC="$DESC (virtual instance)"
+VINSTANCE=0
+VPORT=784
+VUSER=""
+VCONFIGDIR=""
+VOPTIONS=""
+VPIDFILE=/var/run/$VNAME.pid
+VNICE=
+
test -f /etc/default/spamassassin && . /etc/default/spamassassin
DOPTIONS="-d --pidfile=$PIDFILE"
+VOPTIONS="$VOPTIONS --virtual-config-dir=$VCONFIGDIR --nouser-config"
+VOPTIONS="$VOPTIONS --username $VUSER --port $VPORT"
+VDOPTIONS="-d --pidfile=$VPIDFILE"
+
if [ "$ENABLED" = "0" ]; then
echo "$DESC: disabled, see /etc/default/spamassassin"
exit 0
@@ -33,6 +48,16 @@
test -f $DAEMON || exit 0
+if [ "$VINSTANCE" = "1" ]; then
+ if [ -z "$VCONFIGDIR" ]; then
+ echo "$VDESC: no virtual-config-dir specified, disabling..."
+ VINSTANCE=0
+ elif [ -z "$VUSER" ]; then
+ echo "$VDESC: no virtual user specified, disabling..."
+ VINSTANCE=0
+ fi
+fi
+
set -e
case "$1" in
@@ -41,18 +66,34 @@
start-stop-daemon --start --pidfile $PIDFILE --exec $XNAME \
$NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS
echo "$NAME."
+ if [ "$VINSTANCE" = 1 ]; then
+ echo -n "Starting $VDESC: "
+ start-stop-daemon --start --pidfile $VPIDFILE --exec $XNAME \
+ $VNICE --oknodo --startas $DAEMON -- $VOPTIONS $VDOPTIONS
+ echo "$VNAME."
+ fi
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --pidfile $PIDFILE --exec $XNAME --oknodo
echo "$NAME."
+ if [ "$VINSTANCE" = 1 ]; then
+ echo -n "Stopping $VDESC: "
+ start-stop-daemon --stop --pidfile $VPIDFILE --exec $XNAME --oknodo
+ echo "$VNAME."
+ fi
;;
reload|force-reload)
echo -n "Reloading $DESC: "
start-stop-daemon --stop --pidfile $PIDFILE --signal HUP --exec $XNAME
echo "$NAME."
+ if [ "$VINSTANCE" = 1 ]; then
+ echo -n "Reloading $VDESC: "
+ start-stop-daemon --stop --pidfile $VPIDFILE --signal HUP --exec $XNAME
+ echo "$VNAME."
+ fi
;;
restart)
@@ -63,6 +104,14 @@
$NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS
echo "$NAME."
+ if [ "$VINSTANCE" = 1 ]; then
+ echo -n "Restarting $VDESC: "
+ start-stop-daemon --stop --pidfile $VPIDFILE --exec $XNAME \
+ --retry 5 --oknodo
+ start-stop-daemon --start --pidfile $VPIDFILE --exec $XNAME \
+ $VNICE --oknodo --startas $DAEMON -- $VOPTIONS $VDOPTIONS
+ echo "$VNAME."
+ fi
;;
*)
diff -u spamassassin-3.2.1/debian/changelog spamassassin-3.2.1/debian/changelog
--- spamassassin-3.2.1/debian/changelog
+++ spamassassin-3.2.1/debian/changelog
@@ -1,3 +1,16 @@
+spamassassin (3.2.1-1.2) unstable; urgency=low
+
+ * Fix init.d script to properly track PID of virtual instance.
+
+ -- martin f. krafft <[EMAIL PROTECTED]> Fri, 17 Aug 2007 09:33:38 +0200
+
+spamassassin (3.2.1-1.1) unstable; urgency=low
+
+ * Added infrastructure to spawn a second spamd instance for virtual
+ configurations (closes: #387878).
+
+ -- martin f. krafft <[EMAIL PROTECTED]> Tue, 14 Aug 2007 11:02:42 +0200
+
spamassassin (3.2.1-1) unstable; urgency=low
* New upstream release
diff -u spamassassin-3.2.1/debian/spamassassin.README.Debian spamassassin-3.2.1/debian/spamassassin.README.Debian
--- spamassassin-3.2.1/debian/spamassassin.README.Debian
+++ spamassassin-3.2.1/debian/spamassassin.README.Debian
@@ -139,2 +139,9 @@
+Virtual mail setups
+-------------------
+
+Debian's spamassassin can now support virtual and non-virtual mail setups out
+of the box by spawning two separate spamd instances. You can enable and
+configure the second instance in /etc/default/spamassassin.
+
-- Duncan Findlay <[EMAIL PROTECTED]>, Mon, 21 May 2007 23:53:57 -0400
diff -u spamassassin-3.2.1/debian/spamassassin.default spamassassin-3.2.1/debian/spamassassin.default
--- spamassassin-3.2.1/debian/spamassassin.default
+++ spamassassin-3.2.1/debian/spamassassin.default
@@ -1,5 +1,5 @@
# /etc/default/spamassassin
-# Duncan Findlay
+# Duncan Findlay and martin f. krafft
# WARNING: please read README.spamd before using.
# There may be security risks.
@@ -31,0 +32,51 @@
+
+
+
+### VIRTUAL CONFIGURATION
+# Debian's spamassassin package can spawn a second spamd instance and thus
+# handle virtual and non-virtual mail configurations out of the box.
+#
+# To enable the virtual instance, set VINSTANCE to 1 and configure at least
+# VUSER and VCONFIGDIR below.
+#VINSTANCE=1
+
+# Port
+# The virtual instance must listen on a different port than the main instance.
+# The default is 784.
+#VPORT=784
+
+# User
+# The virtual instance must be run by a non-root user. Ideally, this will be
+# the same user as responsible for delivering mail to your virtual mail
+# directory hierarchy. There is no default.
+#VUSER=vmail
+
+# Directory layout
+# How is your virtual directory hierarchy organised? Where can spamd find
+# per-vuser configuration. Specify the complete path to the directory to hold
+# the user_prefs and bayes_* files for each vuser. You can use the following
+# escapes:
+# %u -- replaced with the full name of the current user, as sent by spamc.
+# %l -- replaced with the ’local part’ of the current username. In other
+# words, if the username is an email address, this is the part before
+# the "@" sign.
+# %d -- replaced with the ’domain’ of the current username. In other words,
+# if the user‐ name is an email address, this is the part after the
+# "@" sign.
+# %% -- replaced with a single percent sign (%).
+# There is no default.
+#VCONFIGDIR=/srv/vmail/%d/%l/.spamassassin
+
+# spamd options
+# Specify the options to pass to the virtual spamd instance. Note that these
+# are separate from the OPTIONS further up. However, the same notes apply, so
+# make sure not to increase --max-children without knowing what you're doing.
+# I suggest not to use --helper-home-dir
+VOPTIONS="--create-prefs --max-children 5"
+
+# Set nice level of virtual spamd
+#NICE="--nicelevel 15"
+#
+# Pid file
+# the location of the file to hold the virtual instance's PID
+#VPIDFILE=/var/run/spamd-virtual.pid
digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

