欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CentOS VPS入手后的基本優(yōu)化和安全配置

  發(fā)布時間:2014-12-30 14:44:06   作者:佚名   我要評論
這篇文章主要介紹了CentOS VPS入手后的基本優(yōu)化和安全配置,本文涉及升級防火墻策略、刪除不用的應用、清理不需要的用戶和用戶組、更改時區(qū)等方面,需要的朋友可以參考下

適用環(huán)境和條件:安裝CentOS5或6的任意VPS

升級系統(tǒng)


復制代碼
代碼如下:

yum update

升級防火墻策略


復制代碼
代碼如下:

#清除現(xiàn)有防火墻規(guī)則
iptables -F
iptables -X
iptables -Z
#允許本機訪問本機
iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
# 允許已建立的或相關連的通行
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</p> <p>
#允許有限的ping功能,每秒10次
iptables -A INPUT -p icmp -m limit --limit 10/sec -j ACCEPT</p> <p>
#允許所有本機向外的訪問
iptables -A OUTPUT -j ACCEPT</p> <p>
# 允許訪問22端口,默認的SSH端口,請先保留,等修改sshd_conf后再進行修改
iptables -A INPUT -p tcp --dport 22 -j ACCEPT</p> <p>
#允許訪問80端口
iptables -A INPUT -p tcp --dport 80 -j ACCEPT</p> <p>
#允許其他端口只需要修改端口號即可</p> <p>
#禁止其他未允許的規(guī)則訪問
iptables -A INPUT -j REJECT (注意:如果22端口未加入允許規(guī)則,SSH鏈接會直接斷開。)
iptables -A FORWARD -j REJECT</p> <p>#保持防火墻規(guī)則
service iptables save
#如果保持失敗,是因為缺少policycoreutils,請先安裝
yum -y install policycoreutils
#之后再進行保存
#將iptables加入隨機啟動
chkconfig --level 345 iptables on

刪除不用的應用


復制代碼
代碼如下:

yum remove Deployment_Guide-en-US cups-libs cups
bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utils
nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools
syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools
ypbind
#刪除不安全的服務
yum remove telnet rsh ftp rcp
#安裝postfix替代sendmail
yum install postfix
#刪除sendmail
yum remove sendmail
#禁用和刪除xinetd服務
/sbin/service xinetd stop; /sbin/chkconfig xinetd off
rm -rf /etc/xinetd.d


清理不需要的用戶和用戶組


復制代碼
代碼如下:

#復制備份一份passwd和group
cp /etc/passwd /etc/passwd.sav
cp /etc/group /etc/group.sav
#刪除沒用的用戶和用戶組
for a in adm lp sync news uucp operator games gopher mailnull nscd rpc;
do /usr/sbin/userdel $a -f; done
for a in lp news uucp games gopher users floopy nscd rpc rpcuser nfsnobody;
do /usr/sbin/groupdel $a -f; done


更新為香港時區(qū)


復制代碼
代碼如下:

ln -sf /usr/share/zoneinfo/Hongkong /etc/localtime


支持zip和unzip


復制代碼
代碼如下:

yum install zip unzip

相關文章

最新評論