Articles of fail2ban

Fail2Ban Regex – Joomla / PHP5-FPM

我无法获得fail2ban的正则expression式。 我想匹配以下内容: [Tue Jun 24 10:22:14.528987 2014] [fcgid:warn] [pid 22526:tid 139757615011584] [client IP:PORT] mod_fcgid: stderr: user admin joomla authentication failure, referer: http://www.mydomain.com/administrator/index.php?option=com_login 我试过了: ^\[.*\s*.*]* \[client <HOST>\] mod_fcgid: stderr: user .* joomla authentication failure, referer: .* 任何帮助将非常感激。

fail2ban不工作在Apache Ubuntu

即使它在日志中检测到也没有任何反应。 它不会阻止IP。 它适用于VSFTP,但不适用于Apache。 请帮忙。 你可以看到下面的configuration和日志。 jail.localconfiguration文件: [apache] enabled = true port = 80,443 filter = apache-auth logpath = /var/log/apache*/*error.log maxretry = 2 # default action is now multiport, so apache-multiport jail was left # for compatibility with previous (<0.7.6-2) releases [apache-multiport] enabled = true port = http,https filter = apache-auth logpath = /var/log/apache*/*error.log maxretry = […]

从fail2ban运行Expect脚本的SELinux问题

我有一个Expect脚本工作正常,如果我手动运行,但失败时,作为从Fail2ban行动运行。 错误消息如下所示: spawn /usr/bin/telnet 192.168.242.1 The system has no more ptys. Ask your system administrator to create more. while executing "spawn /usr/bin/telnet $hostname" 在audit.log中有相应的消息: type=AVC msg=audit(1407894085.867:54862): avc: denied { read write } for pid=14748 comm="ciscoacl.exp" name="ptmx" dev=devtmpfs ino=5288 scontext=unconfined_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:ptmx_t:s0 tclass=chr_file 脚本以root身份运行(通过从脚本运行whoami确认),所以我预计不会有任何问题。 如果有的话,我能做些什么来解决这个问题? (不,我不想禁用SELinux!) 我不认为脚本本身在这里有所作为,但如果需要,我可以发布它。

fail2ban阻止端口规则iptable

我刚刚安装了Ubuntu Server 14.04,并没有太多的IPtables的经验。 我试图得到一个基本的设置,我只接受端口22和2222上的SSH连接。实际上我使用fail2ban ssh没有问题。 然后,我想阻止除423和4242之外的其他所有端口,但是删除所有未列出的连接的方法似乎都不起作用,并且阻止了我的一切。 以下是工作的设置: -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -N fail2ban-ssh -A INPUT -p tcp -m multiport –dports 22,2222 -j fail2ban-ssh -A fail2ban-ssh -j RETURN 我试图改变它: -P INPUT DROP -P FORWARD ACCEPT -P OUTPUT ACCEPT -N fail2ban-ssh -A INPUT -p tcp -m multiport –dports 22,2222 -j fail2ban-ssh -A […]

logging403重写暴力攻击

正如Wordpress编解码器中所解释的,我想通过RewritetRule来防止对wp-login.php的暴力攻击。 http://codex.wordpress.org/Brute_Force_Attacks#Deny_Access_to_No_Referrer_Requests 我想重写为403 Forbidden状态,而不是Codex的301状态码,并将其logging为“ 客户端被服务器configuration拒绝 ”,以便Fail2Ban可以处理日志并阻止IP。 我正在使用下面的代码。 # Stop spam attack logins and comments <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .(wp-comments-post|wp-login)\.php* RewriteCond %{HTTP_REFERER} !.*example.com.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule (.*) – [R=403,L] </ifModule> 它禁止POST攻击作为403状态码,但是我没有看到有关error_log发生的任何日志。 我如何使RewriteRulelogging正常的发生率403loginerror_log? 而且是Rewrite + Fail2Banconfiguration来处理有效的服务器pipe理的蛮力攻击还是不行?

Fail2Ban – Iptables – Set不存在

fail2ban / iptables有一个很奇怪的问题。 有些事情是不正确的,但我不能想象出什么。 我已经添加了这个conf&和过滤fail2ban: [wordpress-register] enabled = true port = http,https filter = wordpress-register logpath = /var/log/nginx/access.log [Definition] failregex = ^<HOST> .* "GET /wp-login.php\?action=register HTTP/.*" .*$ Fail2ban启动,但在错误日志中有这个: 2014-09-22 15:14:35,794 fail2ban.server.action [5275]:错误ipset create fail2ban-wordpress-register hash:ip timeout 600 firewall-cmd –direct –add-rule ipv4 filter INPUT 0 -p tcp -m multiport –dport http,https -m set –match-set fail2ban-wordpress-register src […]

不能理解这个例子fail2ban规则

我试图确保我的pipe理员和用户login页面免受暴力攻击。 我已经安装了iptables和我能find的最接近的东西是这样的: 监狱档案: [nginx-login] enabled = true filter = nginx-login action = iptables-multiport[name=NoLoginFailures, port="http,https"] logpath = /var/log/nginx*/*access*.log bantime = 600 # 10 minutes maxretry = 6 /etc/fail2ban/filter.d/nginx-login.conf # Blocks IPs that fail to authenticate using web application's log in page. # Scan access log for HTTP 200 + POST /sessions => failed log in. [Definition] […]

无法通过SSH,SFTP连接到Ubuntu VPS

当我尝试使用SSH和SFTPlogin到我的VPS时,它没有连接到服务器。 然后,我通过VPS提供商控制面板(数字海洋)closuresVPS电源。 一旦启动,几秒钟后,我可以访问服务器,几分钟后,我不能。 这是一个Ubuntu 14.04.2 + Nginx1.6.2服务器。 我使用CSF,Fail2ban。 这件事的原因是什么? 我的/var/log/auth.log。 Apr 13 22:49:23 my-Server sshd[1569]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key Apr 13 22:49:20 my-Server sshd[1071]: Server listening on 0.0.0.0 port 2200. Apr 13 22:49:20 my-Server sshd[1071]: Server listening on :: port 2200. Apr 13 22:49:22 my-Server su[1477]: Successful su for newrelic by root […]

fail2ban不断尝试再次禁止

我有一个问题得到fail2ban做我想要的。 我使用禁止CLoudFlare IP的行为,这意味着仍然有很多请求会通过,直到Cloudflare的所有内容都被更新(因此用户不再能够访问该站点)。 在此之前,fail2ban试图一次又一次地禁止IP,导致它发送数千(在ddos的情况下)请求cloudflare,这需要很长的时间,因此不会禁止任何其他攻击者,直到完成以前(已经被禁止)的。 那么,有没有办法阻止fail2ban试图再次禁止它们,而忽略它们呢? #!/bin/bash # Make sure that the ip-blacklist file exists # otherwise we go ahead and create it if [ ! -e "/etc/fail2ban/ip.blacklist" ] ; then touch "/etc/fail2ban/ip.blacklist" fi if [[ $1 = ban ]]; then if ! grep -q "$2" /etc/fail2ban/ip.blacklist; then # Store the IP as we need it […]

如何防止Web应用程序中的密码暴力?

我有PHP的Web应用程序(Nginx的+ PHP的FFP)。 有人试图强制密码。 他有很多IP。 而且这些暴力破解的工作,如DDOS,因为每次Web应用程序启动,并尝试处理请求。 fail2ban将在maxretry时间后禁止ip。 但是我有几千个请求,每个请求都是由不同的IP发送的。 如何防止第一次POST请求login行动没有启动Web应用程序? 因为通常的用户不能先发送他的请求作为POST请求。