linux 安装 DenyHosts 防止密码被暴力破解

DenyHosts

    DenyHosts是Python语言写的一个程序,它会分析sshd的日志文件(/var/log/secure),当发现重 复的攻击时就会记录IP到/etc/hosts.deny文件,从而达到自动屏IP的功能。

安装和配置

  

    wget http://soft.vpser.net/security/denyhosts/DenyHosts-2.6.tar.gz
    
    tar -zxvf DenyHosts-2.6.tar.gz

    cd DenyHosts-2.6

   python setup.py install (注意python的版本不能大于3.0)
  
   cp /usr/share/denyhosts/denyhosts.cfg-dist  /usr/share/denyhosts/denyhosts.cfg

   更改 配置文件 denyhosts.cfg 根据实际情况更改

   cp /usr/share/denyhosts/daemon-control-dist  /usr/share/denyhosts/daemon-control

   chown root /usr/share/denyhosts/daemon-control

   启动 denyhosts

  /usr/share/denyhosts/daemon-control  start

  设置开机启动  将命令 /usr/share/denyhosts/daemon-control  start
  写入到 /etc/rc.local
  
  安装成功以后 过几个小时查看 /etc/hosts.deny  是否有被禁止的IP写入 

  

原文地址:https://www.cnblogs.com/jackspider/p/6712942.html