CentOS iptables配置笔记
2011-01-14 at 09:55 下午 宽宽针对网站近期被入侵的现状,对iptables做以下设置,提升服务器安全性能
(1)屏蔽所有端口
(2)把SSH的缺省端口设置为56565
(3)把56565、80、3306端口打开
(4)把3306端口设置为只允许本机访问
如果没有安装iptables的话,运行命令yum install iptables完成iptables安装
初始化安装以后,显示为以下信息:
- [root@tp ~]# iptables -L -n
- Chain INPUT (policy ACCEPT)
- target prot opt source destination
- Chain FORWARD (policy ACCEPT)
- target prot opt source destination
- Chain OUTPUT (policy ACCEPT)
- target prot opt source destination
(1)屏蔽所有端口
- [root@tp ~]# iptables -F
- [root@tp ~]# iptables -X
- [root@tp ~]# iptables -P INPUT DROP
- [root@tp ~]# iptables -P OUTPUT DROP
- [root@tp ~]# iptables -P FORWARD DROP
当超出了IPTABLES里filter表里的两个链规则 (INPUT,FORWARD)时,不在这两个规则里的数据包怎么处理呢,那就是DROP(放弃),有同学喜欢配置OUTPUT为accpet,因为如果被入侵,对方可以使用服务器做为中转,发起攻击,也会产生大量的数据包,所以这里配置为DROP
(2)把SSH的缺省端口设置为56565
在修改ssh端口时,应先把要修改的端口号56565加入白名单
- [root@tp ~]# iptables -A INPUT -p tcp --dport 56565 -j ACCEPT
- [root@tp ~]# iptables -A OUTPUT -p tcp --sport 56565 -j ACCEPT
- [root@tp ~]# /etc/rc.d/init.d/iptables save
- [root@tp ~]# service iptables restart
再修改端口号
- [root@linux ~]# vi /etc/ssh/sshd_config
将"#Port 22"修改为"Port 56565"
重启ssh服务
- [root@linux ~]# /etc/init.d/sshd restart
- Stopping sshd: [ OK ]
- Starting sshd: [ OK ]
如果想看看sshd端口号是否修改成功的话,可以使用 netstat -an 命令查看一下或退出ssh使用新端口号登陆尝试。
(3)把80端口打开
- [root@tp ~]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
- [root@tp ~]# iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT
- [root@tp ~]# /etc/rc.d/init.d/iptables save
- [root@tp ~]# service iptables restart
(4)把3306端口设置为只允许本机访问
- [root@tp ~]#/sbin/iptables -A INPUT -p tcp -s 127.0.0.1 --dport 3306 -j ACCEPT
- [root@tp ~]#/sbin/iptables -A OUTPUT -p tcp -s 127.0.0.1 --dport 3306 -j ACCEPT
至此,完成CentOS iptables配置,此配置可提升服务器安全性能,过滤掉一些常见的linux攻击,对于少量爆超管系统权限的linux 0day攻击,也只能算走运了。
buy@generic.VIAGRA” rel=”nofollow”>……
Need cheap generic VIAGRA?…
Order@Coral.Calcium.Online” rel=”nofollow”>..…
Buygeneric pills…
Cheap@Abilify.Online” rel=”nofollow”>..…
Buygeneric meds…
Cheap@Generic.Abilify” rel=”nofollow”>..…
Buygeneric drugs…
Cheap@Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>..…
Buygeneric pills…
Buy@Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>..…
Buyno prescription…
Purchase@Cheap.Acai” rel=”nofollow”>……
Buygeneric drugs…
Cheap@Acai.Online” rel=”nofollow”>……
Buynow…
Purchase@Acai.Without.Prescription” rel=”nofollow”>..…
Buynow it…
Buy@Acai.500mg” rel=”nofollow”>.…
Buynow it…
Buy@Discount.Coral.Calcium” rel=”nofollow”>..…
Buygeneric meds…
Buy@Generic.Abilify” rel=”nofollow”>……
Buywithout prescription…
Order@Cheap.Coral.Calcium” rel=”nofollow”>.…
Buygeneric drugs…
Buy@Cheap.Acai” rel=”nofollow”>……
Buygeneric drugs…
Buy@Cheap.Acai” rel=”nofollow”>……
Buygeneric drugs…
Order@Acai.Online” rel=”nofollow”>……
Buyit now…
Purchase@Generic.Acai” rel=”nofollow”>..…
Buygeneric drugs…
Purchase@Acai.Without.Prescription” rel=”nofollow”>..…
Buyno prescription…
Order@Discount.Energy.Boost” rel=”nofollow”>.…
Buynow it…
Buy@Discount.Accupril” rel=”nofollow”>.…
Buyno prescription…
Order@Cheap.Accupril” rel=”nofollow”>.…
Buygeneric drugs…
Order@Cheap.Accutane” rel=”nofollow”>.…
Buygeneric drugs…
Cheap@Aciphex.Without.Prescription” rel=”nofollow”>.…
Buynow it…
Cheap@Aciphex.20mg” rel=”nofollow”>.…
Buygeneric meds…
Buy@Cheap.Acomplia” rel=”nofollow”>.…
Buygeneric pills…
Actonel@35mg.Without.Prescription” rel=”nofollow”>.…
Buygeneric drugs zfk…
Get@Actoplus.Met.Online” rel=”nofollow”>..…
Buygeneric pills zdg…
Buy@Actos.Without.Prescription” rel=”nofollow”>.…
Buyno prescription luw…
Order@Discount.Adalat” rel=”nofollow”>.…
Buygeneric meds unm…
Order@Discount.Abana” rel=”nofollow”>..…
Buynow it vhx…
Buy@Abilify.Online” rel=”nofollow”>..…
Buywithout prescription dyo…
Order@Cheap.Acai” rel=”nofollow”>..…
Buyno prescription gdt…
Purchase@Acai.Without.Prescription” rel=”nofollow”>.…
Buyit now ojb…
Generic@Acai.500mg.Without.Prescription” rel=”nofollow”>..…
Buyno prescription wkp…
Buy@Cheap.Energy.Boost” rel=”nofollow”>……
Buygeneric meds svb…
Order@Cheap.Accupril” rel=”nofollow”>.…
Buynow it fnp…
Order@Accutane.Online” rel=”nofollow”>……
Buyit now sge…
Order@Discount.Accutane” rel=”nofollow”>.…
Buygeneric drugs mby…
Purchase@Cheap.Accutane” rel=”nofollow”>……
Buywithout prescription ccw…
Buy@Aciphex.Online” rel=”nofollow”>.…
Buygeneric drugs itj…
Cheap@Generic.Aciphex” rel=”nofollow”>..…
Buyno prescription lka…
Order@Acomplia.Online” rel=”nofollow”>.…
Buygeneric drugs axm…
Purchase@Acomplia.Online” rel=”nofollow”>..…
Buyno prescription jui…
Purchase@Discount.Acomplia” rel=”nofollow”>..…
Buynow it sgk…
Order@Actonel.Without.Prescription” rel=”nofollow”>……
Buydrugs without prescription jlg…
Order@Advair.Online” rel=”nofollow”>..…
Buyit now irl…
< a href=”http://trig.com/advair5771/biography/?ml=Advair-25mcg/50mcg-25mcg/125mcg-25mcg/250mcg-50mcg/500mcg-50mcg/100mcg-50mcg/250mcg-Without-Prescription Advair@25mcg50mcg.25mcg125mcg.25mcg250mcg.50mcg500mcg.50mcg100mcg.50mcg250mcg.Without.Pr…
Buydrugs without prescription ygy…
Buy@Aggrenox.Online” rel=”nofollow”>..…
Buygeneric drugs ajd…
Purchase@Discount.Aggrenox” rel=”nofollow”>.…
Buynow it lmg…
buy@acai.berry.juice” rel=”nofollow”>..…
Buygeneric drugs…
accutane@krupnick.class.action” rel=”nofollow”>..…
Buynow…
advair@copd.advertising.campaign” rel=”nofollow”>..…
Buynow…
buy@amoxicillin.500mg” rel=”nofollow”>.…
Buynow it…
abilify@company.buy” rel=”nofollow”>.…
Buywithout prescription…
blue@sky.energy.solar.boost.3048” rel=”nofollow”>……
Buynow it…
amoxicillin@online.buy” rel=”nofollow”>.…
Buygeneric drugs…
arimidex@or.nolvadex.steriods” rel=”nofollow”>..…
Buywithout prescription…
artane@bending.over” rel=”nofollow”>.…
Buynow…
herpes kelly dating kansas…
Buy_no prescription…
strong insulin…
Buy_generic meds…
erectile dysfunction herbal treatment…
Buy_drugs without prescription…
brown algae good for slow thyroid…
Buy_generic drugs…
steroids abuse sexual dysfunction…
Buy_it now…
hiv aids in california in 1997…
Buy_generic pills…
impact rating journal of clinical psychology…
Buy_now it…
novo 50 allergy medicine…
Buy_now it…
viagra in the uk…
Buy_no prescription…
arimidex and marathon…
Buy_generic drugs…
lithium alcohol…
Buy_generic drugs…
good and bad drugs…
Buy_without prescription…
is hepatitis b contagious…
Buy_generic pills…
drug rehab center british columbia…
Buy_generic drugs…
embed video webpage…
Buy_generic drugs…
what is plavix…
Buy_drugs without prescription…
postpartum remeron…
Buy_no prescription…
medication errors 2nd ed…
Buy_no prescription…
terbutaline autism claim…
Buy_no prescription…
iv zofran…
Buy_drugs without prescription…
oral cancer hospital…
Buy_generic meds…
joke male birth control…
Buy_generic meds…
prozac daily strength…
Buy_generic pills…
chf vs pulmonary edema…
Buy_generic drugs…
acne in cats…
Buy_it now…
weight loss tricks for 40 somethings…
Buy_drugs without prescription…
nursing times alzheimer mavis ford…
Buy_it now…
diseaeses contracted from sand fleas…
Buy_now it…
pet ct scan results accuracy cancer…
Buy_drugs without prescription…
pictures of herpes blisters…
Buy_generic pills…
hypertension police ma…
Buy_drugs without prescription…
reversing alcohol induced neuropathy…
Buy_generic meds…
psychostimulant treatment of depression…
Buy_drugs without prescription…
natural cures for premature ejaculation…
Buy_generic drugs…
copd lung sounds…
Buy_it now…
images of tongue cancer…
Buy_generic meds…
canadian paediatric diabetes association…
Buy_now…
discovery of zinc in human health…
Buy_now…
emotions surviveing uterine cancer…
Buy_generic meds…
azithromycin doxycycline over the counter…
Buy_generic pills…
forensic drug test swab…
Buy_no prescription…
clinical studies of clonidine…
Buy_no prescription…
diet generator reviews…
Buy_it now…
psychiatric care model…
Buy_generic meds…
most successful diet ever…
Buy_generic pills…
dr loss phil ultimate weight…
Buy_no prescription…
sleep apnea side effect of lexapro…
Buy_generic pills…
indomethacin opthalmic drops…
Buy_generic pills…
hormone shot for prostate cancer…
Buy_generic drugs…
acute angle-closure glaucoma…
Buy_drugs without prescription…
tobacco alternatives herbal…
Buy_generic drugs…
regulations for dementia units…
Buy_drugs without prescription…
black molley slang drug name…
Buy_generic drugs…
depo@provera.bone.loss” rel=”nofollow”>……
Buygeneric drugs…
benadryl dogs…
Buy_generic drugs…