1, without root login management system, and as a normal user login, through sudo authorization management.
2, change the default remote connection SSH server port, prohibit the root user to connect remotely, or even change the SSH service only listen to the intranet IP.
3, scheduled automatic Update server time, so that its secret Internet time synchronization.
4, configure the Yum update source, download the installation package from the domestic update source.
5, close Selinx and iptables
Sed-i ' s/selinux=enforcing/selinux=disabled '/etc/selinux/config
6, adjust the number of file descriptors, process and file opening will consume the number of file descriptors.
View Ulimit-n
Method 1,
vim/etc/security/limits.conf*-Nofile 65535
Once the configuration is complete, you can log on again to take effect.
Method 2,
Cat >>/ETC/RC.LOCAL<<EOFULIMIT-HSN 65535ulimit-s 65535EOF
7, scheduled automatic cleanup mail temporary directory garbage, to prevent the number of disk innodes by small files full (CENTOS5 and CENTOS6 to clear the directory is different)
Method of manual cleanup:
Find/var/spool/clientmqueue-type F |xargs rm-f (centos5 sendmail) find/var/spool/postfix/maildrop/-type F |xargs RM -F (CentOS 6 postfix)
Method of timed cleanup:
echo "find/var/spool/postfix/maildrop/-type F |xargs rm-f" >>/server/scripts/del_file.shecho "xx * * */bin/sh /server/scripts/del_file.sh>dev/null 2&1 ">>/var/spool/cron/rootcrontab-ldf-i
8, streamline and maintain the necessary power-on automatic services (such as: Crond, sshd, Network, Rsyslog, Sysstat).
9, the Linux kernel parameter optimization/etc/sysctl.conf, the execution sysctl-p takes effect.
10. Change the character set to "ZH_CN". UTF-8 "so that it supports Chinese.
11, lock the key system files, such as/etc/passwd,/etc/group,/etc/inittab, processing the above content after the chattr, Isattr renamed Yenokia and transferred.
Chattr +i/etc/passwd/etc/shadow/etc/group/etc/inttab[[email protected] ~]# lsattr/etc/passwd----i--------e-/etc/ Passwdchattr-i/etc/passwd/etc/shadow/etc/group/etc/inttabmv/usr/bin/chattr Usr/bin/yenokiayenokia +i/etc/passwd/ Etc/shadow/etc/group/etc/inttab
12, empty/etc/issue,/etc/issue.net, remove the system and the kernel version of the screen before the login display.
Cat/etc/issue
Cat/etc/issue.net
>/etc/issue>/etc/issue.net
13, clear the redundant system virtual user account.
14. Add Password for grub boot menu.
[[email protected] ~]# /sbin/grub-md5-cryptpassword: retype password: $1$tzk2t/$ O0ulszkpyaunn6yx6nskr/[[email protected] ~] #vim /etc/grub.conf# grub.conf generated by anaconda## note that you do not have to rerun grub after making changes to this file# notice: you do not have a /boot partition. This means that# all kernel and initrd paths are relative to /, eg.# root (hd0,1) # kernel /boot/vmlinuz-version ro root=/dev /xvda2# initrd /boot/initrd-[generic-] Version.img#boot=/dev/xvdadefAult=0timeout=5splashimage= (hd0,1)/boot/grub/splash.xpm.gzhiddenmenupassword --md5 $1$tzk2t/$ o0ulszkpyaunn6yx6nskr# Note that:password should be added between splashimage and title, otherwise it may not be effective title centos ( 2.6.32-642.3.1.el6.x86_64) root (hd0,1) kernel /boot/vmlinuz-2.6.32-642.3.1.el6.x86_64 ro root=uuid= 1a1ce4de-e56a-4e1f-864d-31b7d9dfb547 rd_no_luks rd_no_lvm lang=en_us. utf-8 rd_no_md sysfont=latarcyrheb-sun16 crashkernel=auto keyboardtype=pc keytable=us rd_no_dm rhgb quiet initrd / boot/initramfs-2.6.32-642.3.1.el6.x86_64.imgtitle centos (2.6.32-431.el6.x86_64) root (hd0,1) kernel / boot/vmlinuz-2.6.32-431.el6.x86_64 ro root=uuid=1a1ce4de-e56a-4e1f-864d-31b7d9dfb547 rd_no_luks rd_no_lvm lang=en_us. utf-8 rd_no_md sysfont=latarcyrheb-sun16 crashkernel=auto keyboardtype=pc keytable=us rd_no_dm rhgb quiet initrd / Boot/initramfs-2.6.32-431.el6.x86_64.img
15. Prohibit Ping
In the default Dorp scenario, the 10.0.0.0/24 network segment is allowed to ping.
Iptables-t filter-i input-p ICMP--icmp-type 8-i eth0-s 10.0.0.0/24-j ACCEPT
16. Upgrade the software version with the typical vulnerability.
View the version number of the software
Rpm-qa openssh OpenSSL Bash
Upgrade
Yum Install OpenSSH OpenSSL bash-y
This article is from the "Yenokia" blog, make sure to keep this source http://yenokia.blog.51cto.com/1899385/1959038
Linux Basic optimization and security summary