rpms/denyhosts/devel denyhosts-2.6-defconffile.patch, NONE, 1.1 denyhosts.init, 1.8, 1.9 denyhosts.spec, 1.47, 1.48 denyhosts.sysconfig, 1.2, 1.3

Jason ティビツ (tibbs) fedora-extras-commits at redhat.com
Wed Jul 2 02:44:57 UTC 2008


Author: tibbs

Update of /cvs/extras/rpms/denyhosts/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8277

Modified Files:
	denyhosts.init denyhosts.spec denyhosts.sysconfig 
Added Files:
	denyhosts-2.6-defconffile.patch 
Log Message:
* Tue Jul 01 2008 Jason L Tibbitts III <tibbs at math.uh.edu> - 2.6-10
- Fix initscript lockfile handling:
   Stop creating the lockfile in the initscript.
   Clean up stray lockfiles automatically.
   Don't attempt to start the daemon if its already running.
- Various initscript cleanups.
- Set default configuration file location to match what we use.
- Make it easier to add extra options like --debug from the sysconfig file.


denyhosts-2.6-defconffile.patch:

--- NEW FILE denyhosts-2.6-defconffile.patch ---
diff -up ./DenyHosts/constants.py.defconffile ./DenyHosts/constants.py
--- ./DenyHosts/constants.py.defconffile	2008-07-01 18:12:34.000000000 -0500
+++ ./DenyHosts/constants.py	2008-07-01 18:12:43.000000000 -0500
@@ -36,7 +36,7 @@ PURGE_HISTORY = "purge-history"
 #                           Miscellaneous constants                             #
 #################################################################################
 
-CONFIG_FILE = "denyhosts.cfg"  # default can be overridden on cmd line
+CONFIG_FILE = "/etc/denyhosts.conf"  # default can be overridden on cmd line
 
 DENY_DELIMITER = "# DenyHosts:"
 ENTRY_DELIMITER = " | "


Index: denyhosts.init
===================================================================
RCS file: /cvs/extras/rpms/denyhosts/devel/denyhosts.init,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- denyhosts.init	3 Jan 2008 19:32:36 -0000	1.8
+++ denyhosts.init	2 Jul 2008 02:43:51 -0000	1.9
@@ -5,13 +5,13 @@
 #               /etc/sysconfig/denyhosts
 #
 # Author:       Seth Vidal <skvidal at phy.duke.edu> (original script)
-#		Jason Tibbitts <tibbs at math.uh.edu> (denyhost changes)
+#               Jason Tibbitts <tibbs at math.uh.edu> (denyhost changes)
 #
-# chkconfig:	- 50 01
+# chkconfig:    - 50 01
 #
 # description:  Enable execution of denyhosts, an SSH log watcher
-# processname	denyhosts
-# config:	/etc/denyhosts.cfg
+# processname:  denyhosts
+# config:       /etc/denyhosts.cfg
 #
 ### BEGIN INIT INFO
 # Provides:          denyhosts
@@ -74,42 +74,51 @@
 
 c_status() {
     if [ -f $CRONLOCK ]; then
-	echo $"denyhosts cron service is enabled."
-	RETVAL=0
+        echo $"denyhosts cron service is enabled."
+        RETVAL=0
     else
-	echo $"denyhosts cron service is disabled."
-	RETVAL=3
+        echo $"denyhosts cron service is disabled."
+        RETVAL=3
     fi
 }
 
 # daemon service functions
 d_start() { 
     echo -n $"Starting denyhosts: "
-    daemon $DHOSTS $DOPTS 
-    RETVAL=$?
+
+    # There may be a stray lockfile; clean it up.
+    status -p $LOCKFILE $DHOSTS &> /dev/null
+    STATUS=$?
+    if [ $STATUS -eq 0 ]; then
+        echo -n $"Denyhosts already running."
+        failure
+        RETVAL=0
+    else
+        if [ $STATUS -eq 1 ]; then
+            echo -n $"Stray lockfile present; removing it."
+            rm -f $LOCKFILE
+        fi
+        daemon $DHOSTS $DOPTS $EXTRA_OPTIONS
+        RETVAL=$?
+    fi
     echo
-    [ $RETVAL -eq 0 ] && touch $LOCKFILE
 }
 
 d_stop() {
     echo -n $"Stopping denyhosts: "
 
-    # Some magic here since older versions stored the PID in the lockfile
-    # instead of using a separate PID file
-    # So if the lockfile has nonzero length, we use it as the PID file
-    if [ -n $LOCKFILE ]; then
+    if [ -f $LOCKFILE ]; then
         killproc -p $LOCKFILE $DHOSTS
         RETVAL=$?
-    else
-        killproc $DHOSTS
-        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
     fi
-    echo
-    [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
 }
 
+# Upstream's control script sleeps here; copy that behavior just in case.
 d_restart() {
     d_stop
+    sleep 1;
     d_start
 }
 
@@ -118,7 +127,7 @@
 }
 
 d_status() {
-    status $DHOSTS
+    status -p $LOCKFILE $DHOSTS
     RETVAL=$?
 }
 


Index: denyhosts.spec
===================================================================
RCS file: /cvs/extras/rpms/denyhosts/devel/denyhosts.spec,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- denyhosts.spec	4 Jan 2008 17:54:14 -0000	1.47
+++ denyhosts.spec	2 Jul 2008 02:43:51 -0000	1.48
@@ -1,6 +1,6 @@
 Name:       denyhosts
 Version:    2.6
-Release:    9%{?dist}
+Release:    10%{?dist}
 Summary:    A script to help thwart ssh server attacks
 
 Group:      Applications/System
@@ -16,6 +16,7 @@
 Patch0:     denyhosts-2.6-config.patch
 Patch1:     denyhosts-2.4-setup.patch
 Patch2:     denyhosts-2.2-daemon-control.patch
+Patch3:     denyhosts-2.6-defconffile.patch
 # Patch10 is a security fix
 Patch10:    denyhosts-2.6-regex.patch
 BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -42,6 +43,7 @@
 %patch0 -p0 -b .config
 %patch1 -p0 -b .setup
 %patch2 -p0 -b .daemon-control
+%patch3 -p0 -b .defconffile
 %patch10 -p1 -b .regex
 
 cp %{SOURCE6} .
@@ -156,6 +158,15 @@
 
 
 %changelog
+* Tue Jul 01 2008 Jason L Tibbitts III <tibbs at math.uh.edu> - 2.6-10
+- Fix initscript lockfile handling:
+   Stop creating the lockfile in the initscript.
+   Clean up stray lockfiles automatically.
+   Don't attempt to start the daemon if its already running.
+- Various initscript cleanups.
+- Set default configuration file location to match what we use.
+- Make it easier to add extra options like --debug from the sysconfig file.
+
 * Fri Jan 04 2008 Jason L Tibbitts III <tibbs at math.uh.edu> - 2.6-9
 - Properly escape percent symbols in the changelog entries.
 


Index: denyhosts.sysconfig
===================================================================
RCS file: /cvs/extras/rpms/denyhosts/devel/denyhosts.sysconfig,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- denyhosts.sysconfig	16 Aug 2005 03:30:56 -0000	1.2
+++ denyhosts.sysconfig	2 Jul 2008 02:43:51 -0000	1.3
@@ -2,3 +2,8 @@
 # If not set to "yes", you also need to edit /etc/cron.d/denyhosts
 # and uncomment the appropriate lines.
 DAEMON=yes
+
+# Set EXTRA_OPTIONS to pass additional settings to denyhosts when run in daemon
+# mode.
+# For example, uncomment the following line to enable additional debugging.
+#EXTRA_OPTIONS="--debug"




More information about the fedora-extras-commits mailing list