DenyHosts
利用DenyHosts防止暴力破解
DenyHosts由Phil Schwartz编写,其官方网站是http://denyhosts.sourceforge.net。
DenyHosts是使用Python开发的,它通过监控系统安全日志(例如,/var/log/secure)来分析是否存在对OpenSSH的暴力破解行为。如发现暴力破解,则其从该系统安全日志中分析出来源IP地址,然后通过在/etc/hosts.deny中加入相应的条目来使用TCP Wrappers禁止该IP地址的后续连接尝试。
DenyHosts的安装和启动脚本
wget https://nchc.dl.sourceforge.net/project/denyhosts/denyhosts/2.6/DenyHosts-2.6.tar.gz
# 官网下载包安装
[root@www ~]# tar zxvf DenyHosts-2.6.tar.gz
[root@www ~]# cd DenyHosts-2.6
[root@www DenyHosts-2.6]# apt install python -y
[root@www DenyHosts-2.6]# python setup.py install
[root@www DenyHosts-2.6]# cd /usr/share/denyhosts/
[root@www denyhosts]# cp denyhosts.cfg-dist denyhosts.cfg //配置文件
[root@www denyhosts]# cp daemon-control-dist daemon-control //启动文件
[root@www denyhosts]# chown root daemon-control
[root@www denyhosts]# chmod 700 daemon-control
[root@www denyhosts]# ln daemon-control /etc/init.d/ #创建硬链接
[root@www denyhosts]# /etc/init.d/daemon-control start #以Daemon形式启动DenyHosts
配置文件详细解读
相关命令
最后更新于
这有帮助吗?