From b35df9b95cb5a1858747e64e82fb2d0b2622b921 Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Mon, 31 Jan 2011 22:25:59 -0500 Subject: Removing windows formatting. Attempt number two. --- config/countryblock/countryblock.sh | 170 ++++++++++++++++++------------------ config/countryblock/execute.sh | 170 ++++++++++++++++++------------------ 2 files changed, 170 insertions(+), 170 deletions(-) mode change 100644 => 100755 config/countryblock/countryblock.sh mode change 100644 => 100755 config/countryblock/execute.sh (limited to 'config/countryblock') diff --git a/config/countryblock/countryblock.sh b/config/countryblock/countryblock.sh old mode 100644 new mode 100755 index 2de62848..ce3e3c04 --- a/config/countryblock/countryblock.sh +++ b/config/countryblock/countryblock.sh @@ -1,85 +1,85 @@ -#!/bin/sh - -#version 2.0 -#check if countryblock running -export resultr=`pfctl -s rules | grep -c countryblock` -#echo $resultr -if [ "$resultr" -gt "0" ]; then - echo running - exit 1 -else - echo not running - /usr/bin/logger -s "Countryblock was found not running" - echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php -fi - -pfctl -t countryblock -T kill -sed -i -e '/countryblock/d' /tmp/rules.debug - -#Now edit /tmp/rules.debug - -#find my line for table -export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` -export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` - -i=$(($i+'1')) -t=$(($t+'1')) -#i = line where is -#t is where 'User Aliases' is -echo $i -echo $t - -rm /tmp/rules.debug.tmp - -#Insert table-entry limit -sed -i -e '/900000/d' /tmp/rules.debug -while read line - do a=$(($a+1)); - #echo $a; - if [ "$a" = "$t" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 - -rm /tmp/rules.debug.tmp - -#Insert countryblock rules -a="0" -echo $a -while read line - do a=$(($a+1)); - echo $a; - if [ "$a" = "$i" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "#countryblock" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp - - for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do - echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - if [ -f logging ]; then - echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - else - echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - fi - if [ -f OUTBOUND ]; then - echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - fi - done - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -rm errorOUT.txt -pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 +#!/bin/sh + +#version 2.0 +#check if countryblock running +export resultr=`pfctl -s rules | grep -c countryblock` +#echo $resultr +if [ "$resultr" -gt "0" ]; then + echo running + exit 1 +else + echo not running + /usr/bin/logger -s "Countryblock was found not running" + echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php +fi + +pfctl -t countryblock -T kill +sed -i -e '/countryblock/d' /tmp/rules.debug + +#Now edit /tmp/rules.debug + +#find my line for table +export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` +export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` + +i=$(($i+'1')) +t=$(($t+'1')) +#i = line where is +#t is where 'User Aliases' is +echo $i +echo $t + +rm /tmp/rules.debug.tmp + +#Insert table-entry limit +sed -i -e '/900000/d' /tmp/rules.debug +while read line + do a=$(($a+1)); + #echo $a; + if [ "$a" = "$t" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 + +rm /tmp/rules.debug.tmp + +#Insert countryblock rules +a="0" +echo $a +while read line + do a=$(($a+1)); + echo $a; + if [ "$a" = "$i" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "#countryblock" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp + + for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do + echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + if [ -f logging ]; then + echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + else + echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + fi + if [ -f OUTBOUND ]; then + echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + fi + done + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +rm errorOUT.txt +pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 \ No newline at end of file diff --git a/config/countryblock/execute.sh b/config/countryblock/execute.sh old mode 100644 new mode 100755 index 5d33345e..d79c37b7 --- a/config/countryblock/execute.sh +++ b/config/countryblock/execute.sh @@ -1,85 +1,85 @@ -#!/bin/sh - -#version 2.0 -#is countryblock running -#export resultr=`pfctl -s rules | grep -c countryblock` -#echo $resultr -#if [ "$resultr" -gt "0" ]; then -# echo running -# exit 1 -#else -# echo not running -# /usr/bin/logger -s "Countryblock was found not running" -# echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php -#fi - -pfctl -t countryblock -T kill -sed -i -e '/countryblock/d' /tmp/rules.debug - -#Now edit /tmp/rules.debug - -#find my line for table -export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` -export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` - -i=$(($i+'1')) -t=$(($t+'1')) -#i = line where is -#t is where 'User Aliases' is -echo $i -echo $t - -rm /tmp/rules.debug.tmp - -#Insert table-entry limit -sed -i -e '/900000/d' /tmp/rules.debug -while read line - do a=$(($a+1)); - #echo $a; - if [ "$a" = "$t" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 - -rm /tmp/rules.debug.tmp - -#Insert countryblock rules -a="0" -echo $a -while read line - do a=$(($a+1)); - echo $a; - if [ "$a" = "$i" ]; then - echo "" >> /tmp/rules.debug.tmp - echo "#countryblock" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp - echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp - - for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do - echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - if [ -f logging ]; then - echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - else - echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp - fi - if [ -f OUTBOUND ]; then - echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp - fi - done - fi - echo $line >> /tmp/rules.debug.tmp -done < "/tmp/rules.debug" - -mv /tmp/rules.debug /tmp/rules.debug.old -mv /tmp/rules.debug.tmp /tmp/rules.debug - -rm errorOUT.txt -pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 +#!/bin/sh + +#version 2.0 +#is countryblock running +#export resultr=`pfctl -s rules | grep -c countryblock` +#echo $resultr +#if [ "$resultr" -gt "0" ]; then +# echo running +# exit 1 +#else +# echo not running +# /usr/bin/logger -s "Countryblock was found not running" +# echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php +#fi + +pfctl -t countryblock -T kill +sed -i -e '/countryblock/d' /tmp/rules.debug + +#Now edit /tmp/rules.debug + +#find my line for table +export i=`grep -n 'block quick from any to ' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'` +export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'` + +i=$(($i+'1')) +t=$(($t+'1')) +#i = line where is +#t is where 'User Aliases' is +echo $i +echo $t + +rm /tmp/rules.debug.tmp + +#Insert table-entry limit +sed -i -e '/900000/d' /tmp/rules.debug +while read line + do a=$(($a+1)); + #echo $a; + if [ "$a" = "$t" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1 + +rm /tmp/rules.debug.tmp + +#Insert countryblock rules +a="0" +echo $a +while read line + do a=$(($a+1)); + echo $a; + if [ "$a" = "$i" ]; then + echo "" >> /tmp/rules.debug.tmp + echo "#countryblock" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp + echo "table persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp + + for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do + echo "pass quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + echo "pass quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + if [ -f logging ]; then + echo "block log quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + else + echo "block quick from to $i label 'countryblock'" >> /tmp/rules.debug.tmp + fi + if [ -f OUTBOUND ]; then + echo "block quick from $i to label 'countryblock'" >> /tmp/rules.debug.tmp + fi + done + fi + echo $line >> /tmp/rules.debug.tmp +done < "/tmp/rules.debug" + +mv /tmp/rules.debug /tmp/rules.debug.old +mv /tmp/rules.debug.tmp /tmp/rules.debug + +rm errorOUT.txt +pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1 \ No newline at end of file -- cgit v1.2.3