我正在尝试在wordpress网站上为fail2ban设置一个自定义filter。 我一直在关注这个教程,但是当我尝试testing我的自定义filter,我得到的错误:server.failregex.RegexException:没有'主机'组在'/ etc / … 我一直在研究这个问题,我发现filter应该按照文档包装(?P …) 所以我的文件看起来像这样: # Fail2Ban filter for WordPress # # WP brute force attacks filter [Definition] failregex = (?P<host> ^ .* "POST ) /wp-login.php ignoreregex = 我已经尝试了将(?P …)放在正则expression式的不同部分周围的不同排列,但是在环顾四周之后,我真的不确定正确的语法是什么。 有人可以向我解释语法,以便我可以启动和运行? 我不确定这些细节是否重要,但是,我的服务器正在运行Apache / PHP,并在其上运行了cloudflare。 提前致谢。
我有一个Fail2Ban监狱,监视失败的SASLauthentication到我的Postfix SMTP服务器。 发生这种情况时,/ /var/log/mail.log包含以下三行: postfix/smtpd[32591]: connect from unknown[xxxx] postfix/smtpd[32591]: warning: unknown[xxxx]: SASL LOGIN authentication failed: authentication failure postfix/smtpd[32591]: disconnect from unknown[xxxx] Fail2Ban过滤警告线:如果发现,IP被视为禁止。 最近,我改变了Postfix,使得AUTH仅通过TLS可用(使用选项smtpd_tls_auth_only )。 其结果是,当有人尝试不使用TLS进行身份validation时,警告行不再生成: postfix/smtpd[22469]: connect from unknown[xxxx] postfix/smtpd[22469]: disconnect from unknown[xxxx] 这意味着Fail2Ban不能够监视所有的SASLauthentication尝试了。 我怎样才能做到这一点? 我提出的一个解决scheme是使SMTP更加详细(在/etc/postfix/master.cf追加-v到smtpd )并parsing相应的行,但是我的问题是-v选项使得日志过于冗长: postfix/smtpd[23185]: connect from unknown[xxxx] postfix/smtpd[23185]: match_list_match: xxxx: no match postfix/smtpd[23185]: match_list_match: xxxx: no match postfix/smtpd[23185]: match_hostaddr: xxxx ~? […]
我刚刚在我的学校社区启动了一个网站,今天早上醒来,有人试图暴力破解我的服务器。 我跟着digitalocean上的一些指南来设置fail2ban和iptables ,并且仍然能够使用端口22 ssh进入服务器。 但是,我似乎无法通过SFTP与服务器交互。 我已经尝试winscp和filezilla都似乎超时 对于winscp我得到这个: Host is not communicating for more than 15 seconds. Authentication log (see session log for details): Using username "will". Authentication failed. 和filezilla我得到这个: Status: Resolving address of %website% Status: Connecting to %ip%:21… Error: Connection timed out after 20 seconds of inactivity Error: Could not connect to server Status: Waiting […]
我每天都在我的mail.log中获得数百行这样的代码: Apr 28 11:10:28 servername amavis[30077]: (30077-08) Blocked SPAM {DiscardedInbound,Quarantined}, [185.140.110.16] <[email protected]> -> <[email protected]>, quarantine: F/spam-FaGlty0PIZMS.gz, Message-ID: <[email protected]>, mail_id: FaGlty0PIZMS, Hits: 7.544, size: 5136, 7444 ms Apr 28 11:44:53 servername amavis[30074]: (30074-10) Blocked SPAM {DiscardedInbound,Quarantined}, [185.140.110.25] <[email protected]> -> <[email protected]>, quarantine: H/spam-H4sMG6EC6q-I.gz, Message-ID: <[email protected]>, mail_id: H4sMG6EC6q-I, Hits: 12.405, size: 5209, 3816 ms Apr 28 11:45:53 servername […]
我已经更新了我的sshd_config对机器人更严格。 即: 只有密钥是允许的,除了特定ips上的一些指定用户 MaxAuthTries = 1 没有rootlogin 这既好又坏。 虽然它locking更多的盒子,testing后,我注意到,即使使用VERBOSE日志logging,不允许的客户端将看到他们的尝试logging到/var/log/auth.log。 例如 ssh [email protected] 不会出现在日志文件中,因为客户端没有尝试authentication。 我想确保这些事件被logging,因为主机可以被认为是“邪恶的”。
在Fail2ban中,我已经将我的电子邮件设置设置为: # Destination email address used solely for the interpolations in # jail.{conf,local} configuration files. destemail = [email protected] # # Name of the sender for mta actions sendername = [email protected] # Email address of the sender sender = [email protected] 我已经在我的/etc/fail2ban/jail.local和/etc/fail2ban/jail.conf文件中设置了这个,但是当我查看我的Mailgun域日志时,我看到由于没有被RFC 5322。 当我查看Mailgun日志中的邮件标题时,可以看到: "message": { "headers": { "to": "root", "message-id": "[email protected]", "from": "Fail2Ban <fail2ban>", "subject": "[Fail2Ban] […]
我目前正在重新安装fail2ban以获得新版本,因为自从我第一次安装它以来,我已经修改了相当多的时间,并且我希望为其设置默认设置。 一旦安装,当我检查日志,看起来,监狱不能启动/修改,因为“数据库被locking”。 2016-05-24 19:09:41,012 fail2ban.transmitter [30865]: WARNING Command ['start', 'ssh-iptables'] has failed. Received OperationalError('database is locked',) 2016-05-24 19:09:46,178 fail2ban.transmitter [30865]: WARNING Command ['start', 'proftpd-iptables'] has failed. Received OperationalError('database is locked',) 我在CentOS 7 + Webmin上运行。 我已经四处看了一遍,但是我不能遇到一个单一的与fail2ban相关的错误“数据库被locking”的错误。 任何帮助是极大的赞赏。
我正在修复默认的php-url-fopenfilter,以允许我在我的系统中使用一些GET查询参数(它不是公开的,但我仍然想阻止不必要的请求)。 问题是,我得到了一个参数名称的工作正则expression式,但我不能得到两个参数的工作正则expression式,其中第二个opiton是从两个名称组合。 我正在使用fail2ban 0.8.11 – 这是工作(失败)正则expression式: ^<HOST> -.*"(GET|POST).*\?.*(?<!outer)\=http\:\/\/.* HTTP\/.*$ 这是不正常的正则expression式: ^<HOST> -.*"(GET|POST).*\?.*(?<!outer|type\=outer\&url)\=http\:\/\/.* HTTP\/.*$ 当我尝试使用非工作正则expression式启动fail2ban服务时,我收到以下消息: ERROR NOK: ('Unable to compile regular expression \'^(?:::f{4,6}:)?(?P<host>[\\w\\-.^_]*\\w) -.*"(GET|POST).*\\?.*(?<!outer|type\\=outer\\&url)\\=http\\:\\/\\/.* HTTP\\/.*$\'',) 任何帮助,将不胜感激。
我注意到,fail2bans iptables规则只适用于*新的连接意味着只要有人继续锤击login(基本身份validation或WordPress的等现有的连接继续允许它。 如果我暂停几秒钟,则cloudflare防火墙会阻止访问。 nginxlogging正确的IP,fail2ban报告他正确的ip被禁止,cloudflare也正确地添加了防火墙规则,显示ip地址。 我试过在ip上使用tcpkill,但是什么都不做。 我猜实际的连接是与cloudflare,这使得cloudflare和iptables在连接可以重用的地方是无用的。 build议? 大概一些应用程序层阻塞? nginx基本身份validation不会比较可怕。 因此,所有这一切都会阻止实际用户,而不采取任何措施防止暴力攻击。 希望我错过了一些东西。
我想阻止IP地址与fail2ban,如果在postfix邮件日志是行: SSL_accept error from unknown[xxx.xxx.xxx.xxx]: lost connection 我尝试使用下面的代码在filter.d中创buildfail2ban ssl_error.conf: failregex = ^%(__prefix_line)sSSL_accept error from \S+\s*\[<HOST>\]: lost connection$ 但没有运气:(