用于 ical 正则表达式的 fail2ban 过滤器

用于 ical 正则表达式的 fail2ban 过滤器

我尝试获取主机上 ical 服务的正则表达式,但没有成功。这是日志文件的一部分:

Tue Jul 23 13:55:23 2019: ical|T720] [info   ] Accepted connection from [::ffff:2.3.4.5]:56450
Tue Jul 23 13:55:23 2019: [net/[::ffff:5.6|T5234] [error  ] HrLogon server "http://localhost:123/" user "Admin": logon failed   
Tue Jul 23 13:55:23 2019: [net/[::ffff:5.6|T5234] [warning] Login failed (0x80040111 logon failed), resending authentication request   
Tue Jul 23 13:55:23 2019: [net/[::ffff:5.6|T5234] [notice ] [::ffff:5.61.48.194]:56450 - Admin [23/Jul/2019:13:55:23 +0200] "GET / HTTP/1.1" 401 0 "-" "Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"   
Tue Jul 23 13:55:23 2019: [net/[::ffff:5.6|T5234] [info   ] Connection closed

这是日志文件的一部分,我已经尝试了不同的方法来将其放入过滤器中。重要的部分是“登录失败”,下一行是 IP 部分。但我该如何让它工作呢?任何帮助都很好!!!

提前致谢

冰冷

实际配置如下:ical.conf:

[INCLUDES]
before = common.conf

[Definition]

failregex = ^*Login failed\n^.*\[notice \] \[::ffff:<HOST>\]$

ignoreregex =
[Init]
maxlines = 2

以及监狱会议:

[ical]

enabled = false
port = 8443
filter = kopano-ical
logpath = /var/log/ical.log
maxtetry = 3
bantime = 3600

答案1

^我认为您的正则表达式不正确。您在 之后、.*之前和之后的开头缺少点 (.),\n因为您使用了并且您需要放在之前的结尾$不是最后一个字符。.*$]

failregex = ^.*Login failed.*\n^.*\[notice \] \[::ffff:<HOST>\].*$

相关内容