首页 > 系统服务 > 详细

fail2ban-0.8.14 shell自动部署脚本

时间:2017-01-29 23:12:18      阅读:294      评论:0      收藏:0      [点我收藏+]
#!/bin/bash
#fail2ban-0.8.14.tar.gz
#python > 2.4V
#user:root

tar  -zxf fail2ban-0.8.14.tar.gz
cd /root/fail2ban-0.8.14/
python setup.py install 
cp /root/fail2ban-0.8.14/files/redhat-initd /etc/init.d/fail2ban
chkconfig --add fail2ban
sleep 1

rm -rf /root/fail2ban-0.8.14/
rm -rf /root/fail2ban-0.8.14.tar.gz

[ -f /etc/fail2ban/jail.bak ]
if [ $? -eq 0 ];then
	exit 0
else
	cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.bak
fi

sed -i ‘96c enable = true‘ /etc/fail2ban/jail.conf
sed -i ‘100c logpath  = /var/log/secure‘ /etc/fail2ban/jail.conf
sed -i ‘101c maxretry = 3‘ /etc/fail2ban/jail.conf
sed -i ‘101a\bantime = 3600‘ /etc/fail2ban/jail.conf
sed -i ‘101a\findtime = 300‘ /etc/fail2ban/jail.conf

sleep 1
[ -f /var/log/secure.bak ]
if [ $? -eq 0 ];then
	exit 0
else
	cp /var/log/secure /var/log/secure.bak
fi

> /var/log/secure
/etc/init.d/fail2ban start &>/dev/null


本文出自 “何阳光” 博客,请务必保留此出处http://heyangguang.blog.51cto.com/10930823/1894392

fail2ban-0.8.14 shell自动部署脚本

原文:http://heyangguang.blog.51cto.com/10930823/1894392

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!