denyhosts是Python语言程序,借用tcp_wrapper程序来进行主机防护。作用:防止暴力破解服务器用户密码。
1、下载denyhosts
wget -c http://sourceforge.net/projects/denyhosts/files/denyhosts/2.6/DenyHosts-2.6.tar.gz
2、解压
tar -zxvf DenyHosts-2.6.tar.gz
3、安装
cd DenyHosts-2.6
python setup.py install
4、相关配置
进入目录:
cd /usr/share/denyhosts/
复制重命名一份配置文件
cp daemon-control-dist daemon-control
cp denyhosts.cfg-dist denyhosts.cfg
根据具体配置daemon-control
vi daemon-control
将:
SECURE_LOG=/var/log/secure
改为:
SECURE_LOG=/var/log/denyhosts
设置启动脚本
chown root daemon-control
chmod 700 daemon-control
./daemon-control start
ln -s /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts
chkconfig --add denyhosts
chkconfig --list denyhosts
chkconfig denyhosts on
设置开机启动
vi /etc/rc.local
添加:
/usr/share/denyhosts/daemon-control start
启动服务:
service denyhosts start