Package: stunnel4
Version: 3:4.53-1.1
Severity: serious
Tags: upstream patch
Justification: Policy 9.3


The stunnel4 init script is missing 'status' support. This makes it impossible 
to
programatically tell whether stunnel4 is properly running. This makes stunnel4
unusable in high-availability environments running heartbeat/corosync, which 
rely
on init script status output to determine whether a service is running. 

The 'status' target is also required by LSB, and Debian uses LSB init scripts.
There is an open issue to modify the Policy Manual to require 'status' target
support. See:

https://wiki.debian.org/LSBInitScripts
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291148
https://wiki.debian.org/LSBInitScripts/StatusSupport

The following patch adds status target support to the init script. It returns 0 
if 
all tunnels defined in /etc/stunnel/*.conf are running, and 3 if any of them 
are not:


--- ../../stunnel4-4.35/tools/stunnel.init.in   2011-10-26 02:47:44.000000000 
+0000
+++ stunnel.init.in     2011-10-26 15:56:01.068060682 +0000
@@ -91,6 +91,26 @@
         killdaemons
         echo "$NAME."
         ;;
+  status) 
+        FILECOUNT=0
+        RUNCOUNT=0
+        for file in $FILES; do
+          FILECOUNT=$((FILECOUNT+1))
+          PID=`get_pids $file`
+          if [ -n "$PID" ]; then
+            ps aux | awk '{print $2}' | grep -q $PID && 
RUNCOUNT=$((RUNCOUNT+1)) && echo " + $file: running"
+          else
+            echo " + $file: not running"
+          fi
+        done
+        if [ "$FILECOUNT" -gt 0 ] && [ "$RUNCOUNT" -eq "$FILECOUNT" ]; then
+          echo "stunnel4 is running"
+          exit 0
+        else
+          echo "stunnel4 is not running"
+          exit 3
+        fi
+             ;;
   reopen-logs)
         echo -n "Reopening log files $DESC: "
         killdaemons USR1
@@ -110,7 +130,7 @@
         ;;
   *)
         N=/etc/init.d/$NAME
-        echo "Usage: $N {start|stop|reload|reopen-logs|restart}" >&2
+        echo "Usage: $N {start|stop|status|reload|reopen-logs|restart}" >&2
         exit 1
         ;;
 esac



-- System Information:
Debian Release: 7.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to