Denyhosts简介
DenyHosts是Python语言写的一个程序,它会分析sshd的日志文件(/var/log/secure),当发现重 复的攻击时就会记录IP到/etc/hosts.deny文件,从而达到自动屏IP的功能。
Denyhosts官网
https://sourceforge.net/projects/denyhosts
https://github.com/denyhosts/denyhosts。Github项目
下载Denyhosts
解压
- tar -zxvf DenyHosts-2.6.tar.gz
进入目录后进行安装
- cd /usr/share/denyhosts/ # 进入安装目录
- cp denyhosts.cfg-dist denyhosts.cfg # 创建配置文件
- cp daemon-control-dist daemon-control # 启动文件副本
- ln -s /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts # 创建软连接
- chkconfig --add denyhosts # 添加denyhosts服务
- chkconfig denyhosts on # 设置denyhosts在各等级为开启状态
- chkconfig --list denyhosts # 查询是否设置成功
- systemctl start denyhosts # 启动denyhosts服务
- systemctl status denyhosts # 查询denyhosts服务状态
- cat /usr/share/denyhosts/denyhosts.cfg # denyhosts的配置文件
- cat /etc/hosts.allow # 白名单列表
- cat /etc/hosts.deny # 黑名单列表
展开内容