rpms/denyhosts/devel denyhosts.sysconfig, NONE, 1.1 denyhosts.init, 1.2, 1.3 denyhosts.spec, 1.7, 1.8

Jason Tibbitts (tibbs) fedora-extras-commits at redhat.com
Mon Aug 15 16:21:13 UTC 2005


Author: tibbs

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

Modified Files:
	denyhosts.init denyhosts.spec 
Added Files:
	denyhosts.sysconfig 
Log Message:
* Sun Aug 14 2005 Jason L Tibbitts III <tibbs at math.uh.edu> - 0.9.9
- Framework for enabling daemon mode.



--- NEW FILE denyhosts.sysconfig ---
# Should DenyHosts run in daemon mode?
# If set to "no", you also need to edit /etc/cron.d/denyhosts and
#  uncomment the appropriate lines.
DAEMON=yes


Index: denyhosts.init
===================================================================
RCS file: /cvs/extras/rpms/denyhosts/devel/denyhosts.init,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- denyhosts.init	22 Jul 2005 16:27:04 -0000	1.2
+++ denyhosts.init	15 Aug 2005 16:21:11 -0000	1.3
@@ -7,7 +7,7 @@
 #
 # chkconfig:	- 50 01
 #
-# description:  Enable periodic execution of denyhosts, an SSH log watcher
+# description:  Enable execution of denyhosts, an SSH log watcher
 # processname	denyhosts
 # config:	/etc/denyhosts.cfg
 #
@@ -15,29 +15,65 @@
 # source function library
 . /etc/rc.d/init.d/functions
 
-lockfile=/var/lock/subsys/denyhosts.init
-
+CONFIG=/etc/denyhosts.cfg
+CONTROL=/usr/bin/denyhosts-control
+CRONLOCK=/var/lock/subsys/denyhosts.init
+LOCKFILE=/var/lock/subsys/denyhosts
 RETVAL=0
 
-start() {
+[ -f /etc/sysconfig/denyhosts ] && . /etc/sysconfig/denyhosts
+
+c_start() {
 	echo -n $"Enabling denyhosts: "
-	touch "$lockfile" && success || failure
+	touch "$CRONLOCK" && success || failure
 	RETVAL=$?
 	echo
 }
 
-stop() {
+c_stop() {
 	echo -n $"Disabling denyhosts: "
-	rm -f "$lockfile" && success || failure
+	rm -f "$CRONLOCK" && success || failure
 	RETVAL=$?
 	echo
 }
 
-restart() {
-	stop
-	start
+c_restart() {
+	c_stop
+	c_start
+}
+
+c_condrestart() {
+	[ -f "$CRONLOCK" ] && c_restart
+}
+
+c_status() {
+	if [ -f $CRONLOCK ]; then
+		echo $"Denyhosts is enabled."
+		RETVAL=0
+	else
+		echo $"Denyhosts is disabled."
+		RETVAL=3
+	fi
+}	
+
+d_start()   {$CONTROL start   --config=$CONFIG; RETVAL=$?}
+d_stop()    {$CONTROL stop    --config=$CONFIG; RETVAL=$?}
+d_restart() {$CONTROL restart --config=$CONFIG; RETVAL=$?}
+d_status()  {$CONTROL status  --config=$CONFIG; RETVAL=$?}
+
+d_condrestart() { 
+	# It's a layering violation to test the location of the
+	# lockfile, but the control script doesn't support condrestart
+	# yet
+	[ -f $LOCKFILE ] && d_restart
 }
 
+start()       {if [ $DAEMON = "yes" ]; then d_start;       else c_start;   fi}
+stop()        {if [ $DAEMON = "yes" ]; then d_stop;        else c_stop;    fi}
+restart()     {if [ $DAEMON = "yes" ]; then d_restart;     else c_restart; fi}
+condrestart() {if [ $DAEMON = "yes" ]; then d_condrestart; else c_restart; fi}
+status()      {if [ $DAEMON = "yes" ]; then d_status;      else c_status;  fi}
+
 case "$1" in
   start)
 	start
@@ -51,16 +87,10 @@
   reload)
 	;;
   condrestart)
-	[ -f "$lockfile" ] && restart
+	condrestart
 	;;
   status)
-	if [ -f $lockfile ]; then
-		echo $"Denyhosts is enabled."
-		RETVAL=0
-	else
-		echo $"Denyhosts is disabled."
-		RETVAL=3
-	fi
+	status
 	;;
   *)
 	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"


Index: denyhosts.spec
===================================================================
RCS file: /cvs/extras/rpms/denyhosts/devel/denyhosts.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- denyhosts.spec	13 Aug 2005 20:28:27 -0000	1.7
+++ denyhosts.spec	15 Aug 2005 16:21:11 -0000	1.8
@@ -1,6 +1,6 @@
 Name:           denyhosts
 Version:        0.9.9
-Release:	0%{?dist}
+Release:	1%{?dist}
 Summary:        A script to help thwart ssh server attacks
 
 Group:          Applications/System
@@ -10,7 +10,8 @@
 Source1:	denyhosts.cron
 Source2:	denyhosts.init
 Source3:	denyhosts-allowed-hosts
-Source4:	README.fedora
+Source4:	denyhosts.sysconfig
+Source5:	README.fedora
 Patch0:		denyhosts-0.8.0-config.patch
 Patch1:		denyhosts-0.9.8-setup.patch
 Patch2:		denyhosts-0.9.8-daemon-control.patch
@@ -35,7 +36,7 @@
 %patch1 -p0
 %patch2 -p0
 
-cp %{SOURCE4} .
+cp %{SOURCE5} .
 
 
 %build
@@ -46,6 +47,9 @@
 rm -rf $RPM_BUILD_ROOT
 python ./setup.py install --root=$RPM_BUILD_ROOT --record=%{name}.files
 
+install -d $RPM_BUILD_ROOT${_bindir}
+install -p -m 755 daemon-control-dist $RPM_BUILD_ROOT%{_bindir}/denyhosts-control
+
 install -d $RPM_BUILD_ROOT%{_initrddir}
 install -d $RPM_BUILD_ROOT%{_sysconfdir}/cron.d
 
@@ -99,9 +103,12 @@
 %dir %{_localstatedir}/lib/denyhosts
 
 %{_initrddir}/denyhosts
-
+%{_bindir}/denyhosts-control
 
 %changelog
+* Sun Aug 14 2005 Jason L Tibbitts III <tibbs at math.uh.edu> - 0.9.9
+- Framework for enabling daemon mode.
+
 * Sat Aug 13 2005 Jason L Tibbitts III <tibbs at math.uh.edu> - 0.9.9-0
 - Update to 0.9.9
 




More information about the scm-commits mailing list