linux服务器安全加固shell脚本
来源:互联网 发布:淘宝创建时间 编辑:程序博客网 时间:2024/05/21 15:03
#!/bin/sh # desc: setup linux system security# author:coralzd# powered by www.xiaohuai.com# version 0.1.2 written by 2011.05.03#account setup passwd -l xfspasswd -l newspasswd -l nscdpasswd -l dbuspasswd -l vcsapasswd -l gamespasswd -l nobodypasswd -l avahipasswd -l haldaemonpasswd -l gopherpasswd -l ftppasswd -l mailnullpasswd -l pcappasswd -l mailpasswd -l shutdownpasswd -l haltpasswd -l uucppasswd -l operatorpasswd -l syncpasswd -l admpasswd -l lp # chattr /etc/passwd /etc/shadowchattr +i /etc/passwdchattr +i /etc/shadowchattr +i /etc/groupchattr +i /etc/gshadow# add continue input failure 3 ,passwd unlock time 5 minitesed -i 's#auth required pam_env.so#auth required pam_env.so\nauth required pam_tally.so onerr=fail deny=3 unlock_time=300\nauth required /lib/security/$ISA/pam_tally.so onerr=fail deny=3 unlock_time=300#' /etc/pam.d/system-auth# system timeout 5 minite auto logoutecho "TMOUT=300" >>/etc/profile # will system save history command list to 10sed -i "s/HISTSIZE=1000/HISTSIZE=10/" /etc/profile # enable /etc/profile go!source /etc/profile # add syncookie enable /etc/sysctl.confecho "net.ipv4.tcp_syncookies=1" >> /etc/sysctl.conf sysctl -p # exec sysctl.conf enable# optimizer sshd_config sed -i "s/#MaxAuthTries 6/MaxAuthTries 6/" /etc/ssh/sshd_configsed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config # limit chmod important commandschmod 700 /bin/pingchmod 700 /usr/bin/fingerchmod 700 /usr/bin/whochmod 700 /usr/bin/wchmod 700 /usr/bin/locatechmod 700 /usr/bin/whereischmod 700 /sbin/ifconfigchmod 700 /usr/bin/picochmod 700 /bin/vichmod 700 /usr/bin/whichchmod 700 /usr/bin/gccchmod 700 /usr/bin/makechmod 700 /bin/rpm # history security chattr +a /root/.bash_historychattr +i /root/.bash_history # write important command md5cat > list << "EOF" &&/bin/ping/bin/finger/usr/bin/who/usr/bin/w/usr/bin/locate/usr/bin/whereis/sbin/ifconfig/bin/pico/bin/vi/usr/bin/vim/usr/bin/which/usr/bin/gcc/usr/bin/make/bin/rpmEOF for i in `cat list`do if [ ! -x $i ];then echo "$i not found,no md5sum!" else md5sum $i >> /var/log/`hostname`.log fidonerm -f list
此shell脚本已经大量应用在某大型媒体网站体系中,关于脚本实现的加固内容,大家一看脚本就基本上能明白了,如果还不明白的话,那就GOOGLE+BAIDU吧! 如果还不知道的话,就问此脚本的作者吧!!哈哈
\
- linux服务器安全加固shell脚本
- Linux 服务器安全加固
- Linux服务器安全加固
- Linux服务器安全加固(一)
- Linux服务器安全初始化Shell脚本
- Linux服务器(redhat)的安全加固
- Linux服务器风险检测与安全加固
- 实战Linux服务器安全加固培训
- 实战Linux服务器安全加固培训
- Linux服务器风险检测与安全加固
- 生产安全加固脚本
- SQL服务器安全加固
- sql服务器安全加固
- 服务器安全加固BAT
- LINUX安全加固
- LINUX主机安全加固
- linux 安全加固
- linux安全加固
- PID 在机器人self balance中应用
- 一句话经典总结红黑树插入
- 小流涓涓成江海,拙技点点构平台——多线程开发
- 英文面试自我介绍
- 在 php 中通过 CURL 上传文件
- linux服务器安全加固shell脚本
- Java is Pass-by-Value, Dammit!
- java 关于操作oracle的clob类型
- 有关 C 指针的个人另类概念(1)
- C#实现限制软件的使用次数
- 白首方恨读书迟
- Combination Sum
- 线程并发库<二>_线程池
- JavaScript<四>_DOM