diff --git a/rebuild-hosts.allow.sh b/rebuild-hosts.allow.sh new file mode 100755 index 0000000..6f2cc55 --- /dev/null +++ b/rebuild-hosts.allow.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# rebuild-hosts.allow.sh +# Rebuild /etc/hosts.allow From Standard And User-Requested Entries +# Part Of The 'tperimeter' Package +# +# Copyright (c) 2006 TundraWare Inc., Des Plaines, IL USA +# All Rights Reserved +# $Id: rebuild-hosts.allow.sh,v 1.100 2006/04/28 23:04:53 tundra Exp $ + +BASE="/usr/local/etc/tperimeter" +EPILOGUE=${BASE}/epilogue +PROLOGUE=${BASE}/prologue +STANDARD=${BASE}/allow +USERREQUESTS="/www/cgi-bin/perimeter/requests" + +##### +# Function To Scan A Directory Structure To Build +# "Allow" Entries In Proper /etc/hosts.allow Format +##### + +BuildAllowEntries() +{ + if [ -d $1 ] # Only attempt this if the target directory exists + then + cd $1 + for x in * + do + echo -n $x": " + cd $x + for y in * + do + echo -n $y" " + done + echo " :ALLOW" + cd .. + done + fi +} +# End Of 'BuildAllowEntries()' + +##### +# Rebuild /etc/hosts-allow +##### + +# Timestamp it + +echo "# Built On: `date`" +echo "" + +# First, the standard prologue + +cat ${PROLOGUE} + + +# Add any user-requested temporary additions + +echo "# Access Requested Via The 'tperimeter' Interface" +echo "" + +BuildAllowEntries ${USERREQUESTS} + + +# Delete the user requests + +rm -rf ${USERREQUESTS} + + +# Now include the standard set of access definitions + +echo "" +echo "# Standard 'Allow' Entries" +echo "" + +BuildAllowEntries ${STANDARD} + +# Finally, add the epilogue + +cat ${EPILOGUE} \ No newline at end of file