[Mimedefang] updates for redhat/mimedefang-init.in
James Ralston
qralston+ml.mimedefang at andrew.cmu.edu
Wed Dec 15 18:07:19 EST 2010
David,
I've attached several patches that we apply to
redhat/mimedefang-init.in. Except for possibly the Razo2 stuff, these
should be appropriate for everyone.
If no one else objects, could you apply these patches?
Thanks.
-------------- next part --------------
Bring the "status" function of the init.d script into LSB compliance.
Specifically, we must not return a RETVAL of 0 if the mimedefang status check
fails but the mimedefang-multiplexor status check succeeds, because that would
mask the fact that the mimedefang service has failed from automated checks.
Instead, the overall return value of the init.d script's "status" function will
depend on the return value of the mimedefang status check: if it is nonzero,
its status result will be returned; otherwise, the overall return value will be
the return value of the mimedefang-multiplexor status check.
diff -up mimedefang-2.71/redhat/mimedefang-init.in.initd-status mimedefang-2.71/redhat/mimedefang-init.in
--- mimedefang-2.71/redhat/mimedefang-init.in.initd-status 2010-12-15 16:33:33.961903096 -0500
+++ mimedefang-2.71/redhat/mimedefang-init.in 2010-12-15 16:37:10.012708588 -0500
@@ -283,8 +283,9 @@ case "$1" in
;;
status)
status $prog
- status $prog-multiplexor
RETVAL=$?
+ status $prog-multiplexor
+ [ $RETVAL -eq 0 ] && RETVAL=$?
if [ $RETVAL = 0 -a -x $PROGDIR/md-mx-ctrl ] ; then
$PROGDIR/md-mx-ctrl -s $MX_SOCKET barstatus
fi
-------------- next part --------------
Bring the init.d script into LSB compliance.
Specifically, when the MIMEDefang package is installed, it should not default
to running at system boot; it should have to be explicitly enabled (e.g., via
chkconfig) before it will run at system boot.
Also, add the LSB header.
diff -up mimedefang-2.71/redhat/mimedefang-init.in.lsb-initd mimedefang-2.71/redhat/mimedefang-init.in
--- mimedefang-2.71/redhat/mimedefang-init.in.lsb-initd 2010-10-28 12:35:04.499826935 -0400
+++ mimedefang-2.71/redhat/mimedefang-init.in 2010-10-28 12:35:04.502826876 -0400
@@ -26,13 +26,25 @@
# These comments are used by chkconfig and supporting programs
#
-# chkconfig: 2345 79 31
+# chkconfig: - 79 31
# description: mimedefang is a sendmail milter designed to perform virus \
# scans on incoming mail messages.
# processname: mimedefang
# config: @CONFDIR_EVAL@/mimedefang-filter
# pidfile: @SPOOLDIR@/mimedefang.pid
+### BEGIN INIT INFO
+# Provides: mimedefang
+# Required-Start: $local_fs $network $named $remote_fs $syslog $time
+# Required-Stop: $local_fs $network $named $remote_fs $syslog $time
+# Default-Start:
+# Default-Stop:
+# Short-Description: Start and stop mimedefang.
+# Description: MIMEDefang is a framework for filtering e-mail. It uses
+# Sendmail's "Milter" API, some C glue code, and some Perl code to let you
+# write high-performance mail filters in Perl.
+### END INIT INFO
+
# Source function library.
. /etc/rc.d/init.d/functions
-------------- next part --------------
Ensure that /var/spool/mdspool has proper ownership and SELinux context. This
could be incorrect if (e.g.) /var/spool/mdspool is a tmpfs filesystem.
"Disable" any potential Razor2 log by symlinking it to /dev/null.
diff -up mimedefang-2.71/redhat/mimedefang-init.in.tmpfs-init mimedefang-2.71/redhat/mimedefang-init.in
--- mimedefang-2.71/redhat/mimedefang-init.in.tmpfs-init 2010-10-28 12:33:48.189764923 -0400
+++ mimedefang-2.71/redhat/mimedefang-init.in 2010-10-28 12:33:48.195764991 -0400
@@ -90,6 +90,23 @@ start() {
return $RETVAL
fi
+ # Since /var/spool/mdspool might be tmpfs, ensure that it is properly
+ # initialized.
+ chown defang:defang /var/spool/mdspool
+ restorecon -R /var/spool/mdspool &>/dev/null
+ if [ ! -d /var/spool/mdspool/.razor ]; then
+ mkdir /var/spool/mdspool/.razor
+ chown defang:defang /var/spool/mdspool/.razor
+ chmod 0750 /var/spool/mdspool/.razor
+ fi
+ if [ ! -L /var/spool/mdspool/.razor/razor-agent.log ]; then
+ # The Razor2 log is mostly useless, and we can't change its location.
+ # In order to prevent it from filling up the spool, we just link it to
+ # /dev/null.
+ ln -sf /dev/null /var/spool/mdspool/.razor/razor-agent.log
+ chown -h defang:defang /var/spool/mdspool/.razor/razor-agent.log
+ fi
+
echo -n "Starting $prog-multiplexor: "
[ -e $MX_SOCKET ] && rm -f $MX_SOCKET
# Tricky stuff below... "echo -E" won't work, hence the two-step.
More information about the MIMEDefang
mailing list