DenyHosts之前写过一篇:使用DenyHosts防止SSH暴力破解,接下来补一篇centos 8手动安装的方法,主要基于github上的安装介绍。
首先下载安装包:
$ wget https://github.com/denyhosts/denyhosts/releases/download/v3.1/DenyHosts-3.1.2.tar.gz
$ tar zxvf DenyHosts-3.1.2.tar.gz
$ mv DenyHosts-3.1.2 DenyHosts
使用root用户安装,机器只有python3环境:
# wget https://raw.githubusercontent.com/denyhosts/denyhosts/master/python3Conversion.sh
# wget https://raw.githubusercontent.com/denyhosts/denyhosts/master/requirements.txt
# sh python3Conversion.sh
# cd DenyHosts
# python setup.py install
配置启动服务:
# cp denyhosts.conf /etc
# vim /usr/local/bin/daemon-control-dist
# 修改这行配置:
DENYHOSTS_BIN = "/usr/bin/denyhosts.py" -> DENYHOSTS_BIN = "/usr/local/bin/denyhosts.py"
# cd /etc/init.d
# ln -s /usr/local/bin/daemon-control-dist denyhosts
# chkconfig --add denyhosts
# systemctl daemon-reload
# systemctl restart denyhosts.servic
# systemctl enable denyhosts.service
# systemctl status denyhosts.service
# echo "systemctl restart denyhosts.service" >> /etc/rc.d/rc.local