我想知道其他人是否和我有同样的问题,或者是否有人知道如何调试它:
我目前正在寻找如何禁止那些试图连接到我的GLPI的人,以保护它免受野蛮人的伤害。这就是为什么我安装了"Fail2ban“:
nano /etc/fail2ban/jail.conf
[glpi]
enabled = true
filter = glpi
port = http, https
logpath = /var/www/glpi/files/_log/event.log
maxretry = 3
nano /etc/fail2ban/filter.d/glpi.conf
[INCLUDES]
before = common.conf
[Definition]
failregex = Connexion échouée de \w+ depuis l\’IP <HOST>
ignoreregex =
/etc/init.d/fail2ban restart但是,当我试图查看哪些行与regex与以下命令匹配时:
fail2ban-regex /var/www/glpi/files/_log/event.log /etc/fail2ban/filter.d/glpi.conf /etc/fail2ban/filter.d/glpi.conf我没有结果(0行匹配)。
然后,我决定尝试将这个regex作为忽略的regex:
nano /etc/fail2ban/filter.d/glpi.conf
[INCLUDES]
before = common.conf
[Definition]
failregex =
ignoreregex = Connexion échouée de \w+ depuis l\’IP <HOST>我创建与上面的(fail2ban-regex).相同的命令我有20行“忽略”的国际海事组织,这证明我的准则是好的。
再见,curumo29。
P.S : The tag <HOST> is the same as (?:::f{4,6}:)?(?P<host>\S+) which permits to get and block the IP address of the bruteforcer with iptables [this tag is mandatory by fail2ban]发布于 2018-06-04 12:54:17
实际上我试着在Debian 9上做同样的事情(当我在Debian 8上的时候),它起了作用.如果有人知道为什么不能在Debian 8上使用atm,那就太好了。
发布于 2020-06-30 16:22:23
错误在于:
failregex = Connexion échouée de \w+ depuis l\’IP <HOST>您必须使用
failregex = Connexion échouée de \w+ depuis l\'IP <HOST>(使用'而不是’)
您可以使用它来调试regex:
fail2ban-regex -D /var/www/glpi/files/_log/event.log /etc/fail2ban/filter.d/glpi.conf /etc/fail2ban/filter.d/glpi.conf --print-all-missedhttps://stackoverflow.com/questions/50578786
复制相似问题