CentOS6.5安全系统加固及性能优化.doc

上传人:scccc 文档编号:13587685 上传时间:2022-01-19 格式:DOC 页数:17 大小:213KB
返回 下载 相关 举报
CentOS6.5安全系统加固及性能优化.doc_第1页
第1页 / 共17页
CentOS6.5安全系统加固及性能优化.doc_第2页
第2页 / 共17页
CentOS6.5安全系统加固及性能优化.doc_第3页
第3页 / 共17页
亲,该文档总共17页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《CentOS6.5安全系统加固及性能优化.doc》由会员分享,可在线阅读,更多相关《CentOS6.5安全系统加固及性能优化.doc(17页珍藏版)》请在三一文库上搜索。

1、CentOS 6.5安全加固及性能优化通过修改CentOS 6.5 的系统默认设置,对系统进行安全加固,进行系统的性能优化。环境:系统硬件:vmware vsphere (CPU : 2*4 核,内存 2G)系统版本:Cen tos-6.5-x86_64(最小化安装)步骤:1.关闭 SELinuxrootce ntos # vim /etc/seli nux/config打开文件,修改并保存SELINUX=disabled # 禁止如果需要生效,需要设置为EnforcingSELINUX=E nforcing# 生效rootce ntos # gete nforce#查看selinux 状态2

2、.清空防火墙并设置规则2.1清除及查看#清空前,先允许所有连接rootce ntos #/sbi n/iptables -P INPUT ACCEPTDROP该为INPUT,防止悲剧发生,没法远程连接#清空所有规则前把policy#清空规则rootce ntos #/sb in/iptables -F#清空所有规则rootce ntos #/sb in/iptables -X#清空所有规则rootce ntos #/etc/i ni t.d/iptables status# 查看防火墙信息22设置规则,根据需求开启相应端口rootce ntos # iptables -A INPUT -i l

3、o -j ACCEPT# 允许来自于lo接口的数据包,如果没有此规则,你将不能通过 访问本地服务rootcentos# iptables -A INPUT -p tcp -dport 22 -j ACCEPT#TCP 22=远程登录协议端口rootce ntos # iptables -A INPUT -p tcp -dport 80 -j ACCEPT#TCP 80=超文本服务器(Http),Executor,RingZero端口ACCEPT#接受所有来自内网IP, 的TCP请求rootce ntos # iptables -A INPUT -p icmp -m icmp -icmp-typ

4、e 8 -j ACCEPT#接受pi ng#确保正常和外部通信#其它规则,根据需求设定rootcentos#iptables-A INPUT-p tcp -dport53 -j ACCEPT#TCP53=DNS,B on k (DOS Exploit)端口rootcentos#iptables-A INPUT-p udp -dport53 -j ACCEPT#TCP53=DNS,B on k (DOS Exploit)端口rootce ntos # iptables -A INPUT -p udp -dport 123 -j ACCEPT #UDP 123=网络时间协议(NTP),Net Co

5、ntroller端口rootce ntos # iptables -A INPUT -p icmp -j ACCEPT#屏蔽rootce ntos # iptables -P INPUT DROP# 屏蔽上述规则以为的所有请求2.3保存设置rootSlocalhost _* cattc/iysrk postfix 滋回 U血4|Wo:off 0 : off 0 :off0:oFF 0:01 0:off0ff 1 I JDf f Oifrf f l;off :Xf.off off off off off onS器slcfonsscn4n4n4n54rl4nJj jBonfjsimonananss

6、: *911-ill- + : S-t *+t4v It 5455-55555556r&666G6-_&-root3QCA I host ;rootiiocAirio5tjootlociilficr rootalocalhfisrLroor*J local teT: rrond ntwQrit postf1K 斜o o D-og g g g g g of f f f f f f JI i i kl t f f fl f f 磐篦T2密 c c c c f- c 矇hkhichk矇c c c c c c cf f f HUF f fflf*!* 律0oa 00f of1 - t 2 dk V u

7、l pw abilIfDn6.删除不必要的系统用户rootlocalhost J# awk -F root bindaemon admTphalt mailuucp operator games33 3cnsononf f f f f ofcfofofcf-1*/etc paswdynd nutdwnno vcsa saslauih postfix sshd nep ?rootlocalnost Tootlocalho5t rootl ocal host rooWlocalhost rootl ocal host rooxlocalhost rootffilocalhostuserdel us

8、erdel userdel us er del userdel useful us er delUUCP operator games#注释掉#设置开机自动生7. 关闭重启ctl-alt-delete 组合键rootcentos # vim /etc/init/control-alt-delete.conf#exec /sbin /shutdow n -r now Con trol-Alt-Deletepressed8. 调整文件描述符大小rootcentos # ulimit-n # 默认是 10241024rootce ntos # echo ulimit -SHn 102400 /etc

9、/rc.local效9. 去除系统相关信息rootcentos # echo Welcome to Server /etc/issuerootcentos # echo Welcome to Server /etc/redhat-release10. 修改history 记录rootcentos # vim /etc/profile# 修改记录 10 个HISTSIZE=1011. 同步系统时间#设置rootcentos# cp /usr/share/zoneinfo/Asia/Shanghai/etc/localtimeShan ghai 时区硬件时间rootce ntos # cro nt

10、ab-e#设置任务计划每天零点同步一次0 * * * * /usr/sb in/n tpdate cn. pool. ntp.org ; hwclock -w12.内核参数优化rootce ntos # vim /etc/sysctl.c onf#末尾添加如下参数n et.ipv4.tcp_s yn cookies= 1#1是开启SYN Cookies,当出现SYN等待队列溢出时,启用 Cookies来处,理,可防范少量SYN攻击,默认是0关闭n et.ipv4.tcp_tw_reuse = 1用于新的TCP连接,默认是0关闭#1是开启重用,允许讲 TIME_AIT sockets 重新n e

11、t.ipv4.tcp_tw_recycle = 1#TCP失败重传次数,默认是 15,减少次数可释放内核资源#应用程序可使用的端口范围= 5000#系统同时保持TIME_WAIT套接字的最大数量,如果超出这个数字,TIME_WATI套接字将立刻被清除并打印警告信息,默认1800001024n et.core .n etdev_max_backlog默认300为单位)4096#进入SYN宝的最大请求队列,默认是10240#允许送到队列的数据包最大设备队列,#liste n挂起请求的最大数量,默认128#发送缓存区大小的缺省值#接受套接字缓冲区大小的缺省值(以字节#最大接收缓冲区大小的最大值#发送

12、缓冲区大小的最大值#SYN-ACK握手状态重试次数,默认 5#向外SYN握手重试次数,默认 4n et.ipv4.tcp_tw_recycle = 1#开启TCP连接中TIME WAIT sockets 的快速回收,默认是0关闭n et.ipv4.tcp_max_orpha ns = 3276800#系统中最多有多少个 TCP套接字不被关联到任何一个用户文件句柄上,如果超出这个数字,孤儿连接将立即复位并打印警告信息= 94500000 915000000 927000000低于此值,TCP没有内存压力;在此值下,进入内存压力阶段;高于此值,TCP拒绝分配socket。内存单位是页,可根据物理内存大小进行调整,如果内存足够大的话,可适当往上调。上述内存单位是页,而不是字节。至此CentOS 6.5_x64 最小化安装系统基本优化调整完毕,需要重启下系统。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1