DenyHosts官网:http://denyhosts.sourceforge.net/
DenyHosts GitHub页面:https://github.com/denyhosts/denyhosts
#!/bin/bash
wget https://github.com/denyhosts/denyhosts/archive/v2.10.tar.gz
tar -xf v2.10.tar.gz
mv denyhosts-2.10/ /usr/local/denyhosts
cd /usr/local/denyhosts/
python setup.py install
#我是自己保存了一个更改好的配置所以直接下载
wget http://XXXXXXXXX:8090/denyhosts.conf -O denyhosts.conf
\cp -f denyhosts.conf /etc/
cd /usr/bin/
cp daemon-control-dist denyhosts
chmod 700 denyhosts
sed -i 's/\/usr\/sbin\/denyhosts/\/usr\/bin\/denyhosts.py/g' denyhosts
denyhosts start
denyhosts.conf内容(具体参数意义可百度)
SECURE_LOG = /var/log/secure
HOSTS_DENY = /etc/hosts.deny
PURGE_DENY = 5h
#如果只需要防止sshd,all修改为sshd
BLOCK_SERVICE = ALL
DENY_THRESHOLD_INVALID = 10
DENY_THRESHOLD_VALID = 10
DENY_THRESHOLD_ROOT = 10
DENY_THRESHOLD_RESTRICTED = 1
WORK_DIR = /usr/local/denyhosts/data
SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES
HOSTNAME_LOOKUP=YES
LOCK_FILE = /var/lock/subsys/denyhosts
AGE_RESET_VALID=5d
AGE_RESET_ROOT=25d
AGE_RESET_RESTRICTED=25d
AGE_RESET_INVALID=10d
DAEMON_LOG = /var/log/denyhosts
DAEMON_SLEEP = 30s
DAEMON_PURGE = 1h
ps:部署完后denyhosts start正常,但是denyhosts stop/status却未生效。后续排查,欢迎大佬直接指点