Articles of fail2ban

编写一个fail2ban多行正则expression式

我有一些麻烦的主机用我运行的SSH服务器尝试它,我试图用fail2ban来禁止它们。 问题是,我没有用正则expression式做很多工作,用Python正则expression式更less。 下面是我的auth.log中的麻烦的一行: Nov 19 18:58:17 myhost sshd[48272]: Connection from xxx.xxx.xxx.xxx port 3284 on my.host.ip.address port 22 Nov 19 18:58:21 myhost sshd[48272]: fatal: Read from socket failed: Connection reset by peer [preauth] 我想抓住正则expression式中的两条线,在其他文章中我已经看到了如何做多行的东西,但目前我甚至不能把它匹配到第一行! 这是我的* .conf文件的一个片段: [INCLUDES] # Read common prefixes. If any customizations available — read them from # common.local before = common.conf [Init] maxlines […]

Fail2ban不禁止IP

运行新安装的OpenSuse 13.2(运行rsyslog) 我的jail.conf文件包含: [ssh-iptables] enabled = true filter = sshd action = iptables[name=SSH, port=ssh, protocol=tcp] sendmail-whois[name=SSH, [email protected], [email protected], sendername="Fail2Ban"] logpath = /var/log/messages maxretry = 5 在/ var / log / messages中: 2014-11-21T16:16:17.167566-05:00 suse sshd[31000]: error: PAM: Authentication failure for root from 62-210-172-145.rev.poneytelecom.eu 2014-11-21T16:16:17.232040-05:00 suse sshd[31000]: Received disconnect from 62.210.172.145: 11: [preauth] 2014-11-21T16:16:17.863395-05:00 suse sshd[31007]: pam_unix(sshd:auth): […]

fail2ban表示禁止,但仍然可以login

在Python 2.6.6的CentOS 6.5上运行fail2ban 0.8.14,fail2ban把我的IP放在禁止列表中,但是实际上并没有阻止我login。 下面是/var/log/fail2ban.log中一个失败禁令的例子(我想?): ERROR iptables -D fail2ban-SSH -s xxx.xxx.xxx.xxx -j REJECT –reject-with icmp-port-unreachable returned 100 有趣的是,我在另外两台机器上工作,其中一台是CentOS 6.6,另一台是CentOS 6.5,jail.conf和jail.local文件在两台机器上都是相同的。 我重新启动了fail2ban多次,添加Port = <my number>指令到[ssh-iptables]下的jail.local文件,但仍然没有运气。 同样,在运行fail2ban-client status ssh-iptables ,IP显示在被禁止的IP列表中,但是我仍然可以login。 任何想法可能会导致这个问题? 更新:它似乎间歇性地工作。 等了大约20分钟后,终于阻止了我的login。 所以我想这只是一个巨大的延迟?

如何更改邮件“从”名称为Fail2Ban电子邮件通知?

我有Fail2Ban给我发送来自各种服务器的电子邮件,但是我不能一眼就看出哪个服务器,因为电子邮件“从”名称始终只是“Fail2Ban”。 我设法为每个服务器设置不同的“发件人”地址,但是我仍然需要打开邮件才能看到这个值。 如果我可以更改每个服务器的Fail2Ban安装的“from”名称,那么我更喜欢它,这样我就可以一目了然地知道它来自哪个服务器。 编辑 – 要更清楚。 目前我得到这个: Fail2ban<[email protected]> 我要这个: Fail2ban.myserver<[email protected]>

fail2ban多个logpath指令

我为fail2ban创build了自己的自定义filter,操作等。 只是有一个关于日志path的问题。 logpath = /path/to/my/file1.log /path/to/my/file2.log /path/to/my/file3.log /path/to/my/file4.log maxretry = 3 如果我的监狱像上面那样设置,会失败2ban在任何日志文件中查找3失败? 或者3在任何文件中失败? 我希望它是在每个日志的基础上,但不要成千上万的监狱。 干杯!

postfix / submission / smtpd :警告:主机名<**>无法parsing为地址<IP>:名称或服务未知

我在VPS(Ubuntu)上安装了iRedMail。 Fail2Ban禁止我的家庭IP地址。 在/var/log/mail.log我看到如下消息: postfix/submission/smtpd[32149]: warning: hostname unallocated.sta.lan.ua does not resolve to address 31.43.102.*: Name or service not known unallocated.sta.lan.ua据我所知是我的家庭互联网提供商的主机名。 31.43.102.*是我的家庭IP。 哪里有问题? 它是互联网提供商的问题或我的错误,我的服务器\ iRedMailconfiguration不正确(如果是这样,如何解决)?

fail2ban:停止pop3login尝试?

我如何设置fail2ban以便所有讨厌的pop3login尝试都被照顾? 我使用的是Ubuntu 9.04,这里是从Log3发送的邮件中看到的pop3日志的摘录: LOGIN FAILED, user=Administrador, ip=[::ffff:208.115.212.106]: 8 Time(s) LOGIN FAILED, user=Alfredo, ip=[::ffff:208.115.212.106]: 8 Time(s) LOGIN FAILED, user=Antonio, ip=[::ffff:208.115.212.106]: 6 Time(s) LOGIN FAILED, user=Carmelo, ip=[::ffff:208.115.212.106]: 8 Time(s) LOGIN FAILED, user=access, ip=[::ffff:208.115.212.106]: 7 Time(s) LOGIN FAILED, user=account, ip=[::ffff:208.115.212.106]: 7 Time(s) LOGIN FAILED, user=admin, ip=[::ffff:208.115.212.106]: 5 Time(s) LOGIN FAILED, user=angel, ip=[::ffff:208.115.212.106]: 9 Time(s) 编辑:我认为解决scheme是通过启用快递相关的监狱改变/etc/fail2ban/jail.conf中的设置。 有人可以validation这个?

fail2ban正则expression式使用较less的CPU?

使用fail2ban,我想禁止那些发送垃圾邮件地址的垃圾邮件发送者: Oct 27 09:04:22 si68 postfix/smtpd[3240]: NOQUEUE: reject: RCPT from unknown[117.197.114.222]: 550 5.7.1 <[email protected]>: Recipient address rejected: Mail appeared to be SPAM or forged. Ask your Mail/DNS-Administrator to correct HELO and DNS MX settings or to get removed from DNSBLs; MTA helo: odwsgs.com, MTA hostname: unknown[117.197.114.222] (helo/hostname mismatch); from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<odwsgs.com> Oct 27 09:08:51 […]

Fail2ban不能在Ubuntu上运行

我注意到一大堆的请求来到我的Ubuntu 12.04服务器,所以我安装了fail2ban。 我按照这些说明设置了Fail2ban对w00tw00t的请求。 我确保正确命名这些文件,并在更改configuration后重新启动fail2ban。 我通过在URL中input各种w00tw00t参数来进行testing,就像攻击者一样,但是没有人会禁止我。 我没有将我的IP添加到忽略列表。 我甚至试过从我的手机上,仍然没有禁令。 在jail.conf中我有以下位于/etc/fail2ban/jail.conf [w00tw00t-scans] enabled = true action = iptables-allports sendmail-whois[name=SSH, dest=ubuntu, [email protected]] filter = w00tw00t logpath = /var/log/apache2/access.log maxretry = 1 bantime = 120 #testing so that I can verify and not be banned for a day! 这里是位于/etc/fail2ban/filter.d/w00tw00t.conf中的w00tw00tfilter #block w00tw00t scans of all variations [Definition] failregex = ^<HOST> .*”GET […]

fail2ban规则不会生效

我在Ubuntu 14.04的股票安装上安装了Apache Web服务器,我试图使用fail2ban来阻止检查漏洞的请求。 我把/etc/fail2ban/jail.local放在了下面: [apache-vulnerability-scan] enabled = true port = http,https filter = apache-vulnerability-scan logpath = /var/log/apache*/*access.log maxretry = 1 规则的定义在/etc/fail2ban/filter.d/apache-vulnerability-scan.conf : [Definition] failregex = ^<HOST> -.*"\(\)\s*\{[^;"]+[^}"]+}\s*;.*$ ignoreregex = 对于那些可能不熟悉Ubuntu的fail2ban默认规则的人来说,一些主要规则如下所示: ignoreip = 127.0.0.1/8 bantime = 600 findtime = 600 maxretry = 3 backend = auto usedns = warn protocol = tcp chain = INPUT 但是,即使maxretry设置为1 […]