配色: 字号:
KLOXOLxadmin安装CSF防火墙应对DDOS攻击
2012-06-14 | 阅:  转:  |  分享 
  
KLOXO/Lxadmin安装CSF防火墙应对DDOS攻击

一,下载与安装

?

1

2

3

4

5

?cd/usr/local/src

wgethttp://www.configserver.com/free/csf.tgz

tar-zxvfcsf.tgz

cdcsf

./install.sh?

?

二,CSF的配置

要HypeVm和lxadmin的正常使用,需添加777,888和5558端口的支持

1,配置端口(/etc/csf/csf.conf)

增加TCP端口支持(HypeVm和Lxadmin需要):7776,7777,7778,7779,8886,8887,8888,8889,5558

?

1

2

3

4

5

?#AllowincomingTCPports

TCP_IN="20,21,22,25,53,80,110,143,443,465,587,993,995,7776,7777,7778,7779,8886,8887,8888,8889,5558"

?

#AllowoutgoingTCPports

TCP_OUT="20,21,22,25,53,80,110,113,443,7776,7777,7778,7779,8886,8887,8888,8889,5558"?

?

2,打开MONOLITHIC_KERNEL支持(/etc/csf/csf.conf)

?

1

2

3

4

5

6

7

8

9

?#Oneexampleisiftheip_conntrackandip_conntrack_ftpiptableskernel

#modulesarenotavailable.Ifthishappens,FTPpassivemode(PASV)won''t

#work.Insuchcircumstancesyouwillhavetoopenaholeinyourfirewalland

#configuretheFTPdaemontousethatsamehole.Forexample,withpure-ftpd

#youcouldaddtheportrange30000:35000toTCP_INandaddthefollowingline

#to/etc/pure-ftpd.conf(withouttheleading#):

#PassivePortRange???3000035000

#Thenrestartpure-ftpdandcsfandpassiveFTPshouldthenwork

MONOLITHIC_KERNEL="1"?

?

3,如果你要能ping同你的HyperVm服务器,需设置(/etc/csf/csf.conf):

?

1

2

?#AllowincomingPING

ICMP_IN="1"?

?

4,如果你使用的是OpenVz虚拟化技术,你需要添加以下语句到您的/etc/csf/csfpre.sh文件:

?

1

2

3

4

?iptables-AINPUT-ivenet0-jACCEPT

iptables-AOUTPUT-ovenet0-jACCEPT

iptables-AFORWARD-jACCEPT-pall-s0/0-ivenet0

iptables-AFORWARD-jACCEPT-pall-s0/0-ovenet0?

?

注意1:/etc/csf/csfpre.sh可能不存在,你需要新建它。CSF每次运行的时候都会执行这个文件的。

?

三,测试CSF

?

1

?servicecsfstart?

?

如果可以了的话,请关闭测试功能(配置/etc/csf/csf.conf)

?

1

2

3

4

5

6

?#Testingflag-enablesaCRONjobthatclearsiptablesincaseof

#configurationproblemswhenyoustartcsf.Thisshouldbeenableduntilyou

#aresurethatthefirewallworks-i.e.incaseyougetlockedoutofyour

#server!Thendoremembertosetitto0andrestartcsfwhenyou''resure

#everythingisOK.Stoppingcsfwillremovethelinefrom/etc/crontab

TESTING="0"?

?

四、重启CSF

?

1

?servicecsfrestart?

?

五、高级配置(配置/etc/csf/csf.conf)

你可以关闭进程和用户进程跟踪。

?

1

2

3

?PT_USERTIME="0"

PT_LIMIT="0"

PT_USERPROC="0"?



献花(0)
+1
(本文系红人会首藏)