Linux服务器上适用的防火墙分析

2009-05-13 01:08:17来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折


#!/bin/bash
echo-e"\t\t\033[1;31mRainLowfirewall\033[mserverversion1.0rc1--09/24/2004\n"
echo-e"############################################"
echo-e"Thissoftwaremaybeusedanddistributedaccordingto"
echo-e"thetermsoftheGNUGeneralPublicLicense(GPL)provided"
echo-e"creditisgiventotheoriginalauthor."
echo-e"\t\t\t\033[1;31mCopyright(c)2004rainlow\033[m\n"
echo-e"\t\t\t\tAllrightsreserved\n\n\n"
echo-e"#######################################"

#nowbeginsthefirewall
echo-e"\n\t\t\tWelcometo\033[3;31mRainlowFirewall\033[0m\n\n"
echo-e"\t\t\t\t\033[1;32mhttp://www.rainlow.com\033[m\n"


PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
./etc/init.d/functions

exit_failure()
{
echo-en"\t\033[3;031m[FAILED]\033[0m\n"
echo-en"\033[3;031m->FATAL:$FAILURE\033[0m\n"
echo-en"\033[3;031m->**ABORTED**.\033[0m\n"
exit1
}

check_root()
{
ROOT_ID=0
echo"Checkingifyouareroot...."
if["$UID"="$ROOT_ID"]
then
echo-e"\n\tOK!continue....\n"
echo-e"\a"
else
echo-e"Sorry,youarenotrootandnotpermittedtodothisoption...\n"
echo-e"\a"
FAILURE="youcannotrunthiscommand,youmustberoottodothis"
exit_failure

fi
}

check_enviroment()
{
echo-e"\t\t\033[1;31mNowCheckingsoftwareenvrioment\033[m\n"

OS=`uname-s`
_OS=$OS
if["$_OS"!="Linux"];then
FAILURE="Sorrythisversioncanonlyworkunderlinux"
exit_failure
else
echo-en"\t\t\033[1;32mPASS\033[m\n"
fi

KERNELMAJ=`uname-r|sed-e's,\..*,,'`
KERNELMIN=`uname-r|sed-e's,[^\.]*\.,,'-e's,\..*,,'`

if["$KERNELMAJ"-lt2];then
FAILURE="Sorryyoukernelistooold,pleaseupgradeitfirst!"
exit_failure
fi
if["$KERNELMAJ"-eq2-a"$KERNELMIN"-lt4];then
FAILURE="onlykernelgreaterthan2.4issupported"
exit_failure
fi

if((`iptables-V2>&1|grep-c"Commandnotfound"`));then

FAILURE="cannotfindiptablescommandyoumustinstalliptablesfirst"
exit_failure
fi

if!((`whichmodprobe2>&1|grep-c"which:nomodprobein"`))&&
        ([-a/proc/modules]||![-a/proc/version]);then
if((`lsmod|grep-c"ipchains"`));then
rmmodipchains>/dev/null2>&1
fi
fi

}

wait()
{
echo|awk'{printf"||",$1}'
forxin`seq110`;
do
sleep1
echo"#"|awk'{printf"%s",$1}'
done

echo-en"\n"
}

iptables()
{
/sbin/iptables"$@"

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:LinuxCVS服务器与WinCVS的配置与使用

下一篇:NIX下远程连接XServer几个方法