JianShu_failban2实现动态屏蔽的功能

一,首先是服务安装

#vim /etc/yum.repos.d/Centos-Base.repo


在最新新增

[atrpms]
name=Red Hat Enterprise Linux $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1 


然后再yum装即可.

#yum -y install fail2ban


安装完的目录

#/etc/fail2ban

1.       安装

2.      

#yum install fail2ban logwatch gamin

3.       相关文件说明

a)         安装完成后配置文件在目录/etc/fail2ban/中:

b)        /etc/fail2ban/fail2ban.conf  #fail2ban的配置文件

c)         /etc/fail2ban/jail.conf #阻挡设定文件

d)        /etc/fail2ban/filter.d/ #具体过滤规则文件目录

e)         /etc/fail2ban/action.d/ #具体过滤规则检测到后采取相对应措施的目录

4.       根据需要的目的.在jail.conf文件中追回相关的内容

5.       


6.      

action = iptables[name=nginx, port=http, protocal=tcp] ;

7.       然后再创建/etc/fail2ban/filter.d/nginx.conf 文件.并添加相关的内容.这个内容可以复制之前的规则.

8.    /etc/init.d/fail2ban restart 重启下相关的程序

9.    jail.conf的规则这个就不说了.按上面的抄就可以了.说明也在上面了.

10.但是nginx.conf怎么写.这个用正则来写就可以了.相关的规则这个就不多说了.

11.比如下面,我添加的一个dovecot.conf的规则文件.

12.   


13.  

localhost dovecot: auth-worker(.*): dict((.*),<HOST>): Password mismatch

http://rpmfind.net/linux/rpm2html/search.php?query=python-inotify

http://dl.fedoraproject.org/pub/epel/6/i386/

原文地址:https://www.cnblogs.com/drgcaosheng/p/4579930.html