{"id":7430,"date":"2015-10-21T02:08:53","date_gmt":"2015-10-21T09:08:53","guid":{"rendered":"http:\/\/blog.networkpresence.co\/?p=7430"},"modified":"2015-10-21T02:08:53","modified_gmt":"2015-10-21T09:08:53","slug":"use-fail2ban-to-block-wordpress-login-botnets","status":"publish","type":"post","link":"http:\/\/blog.networkpresence.co\/?p=7430","title":{"rendered":"Use Fail2Ban to block WordPress login botnets"},"content":{"rendered":"<p>Fail2Ban is great at being able to parse logfiles and generate IP Filter Firewall rules (usually &#8220;DROP&#8221;) against patterns that are unwanted.<\/p>\n<p>The common use of Fail2Ban is to firewall SSH login dictionary scans, but here&#8217;s how you add to just 2 files in your Fail2Ban config to block > 3 wp-login.php attempts from an IP Address.<\/p>\n<p>Please note this is for GNU\/Linux (Debian\/Ubuntu etc) and please feel free to contact us for RHEL based equivalent commands\/setup.<\/p>\n<p>Add the following lines to \/etc\/fail2ban\/jail.local<\/p>\n<p>[wp-auth]<br \/>\nenabled = true<br \/>\nfilter = wp-auth<br \/>\naction = iptables-multiport[name=NoAuthFailures, port=&#8221;http,https&#8221;]<br \/>\nmaxretry = 3<br \/>\nlogpath = \/var\/log\/apache2\/access.log<\/p>\n<p>Add the following lines to \/etc\/fail2ban\/filter.d\/wp-auth.conf<br \/>\n[Definition]<br \/>\nfailregex = ^<HOST> .* &#8220;POST \/wp-login.php<br \/>\nignoreregex =<\/p>\n<p>Then run as the root user:<\/p>\n<p>service fail2ban reload<\/p>\n<p>FYI,<br \/>\nRichard.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fail2Ban is great at being able to parse logfiles and generate IP Filter Firewall rules (usually &#8220;DROP&#8221;) against patterns that are unwanted. The common use of Fail2Ban is to firewall SSH login dictionary scans, but here&#8217;s how you add to &hellip; <a href=\"http:\/\/blog.networkpresence.co\/?p=7430\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[78],"class_list":["post-7430","post","type-post","status-publish","format-standard","hentry","category-network-presence","tag-sysadmin"],"_links":{"self":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/7430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7430"}],"version-history":[{"count":5,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/7430\/revisions"}],"predecessor-version":[{"id":7435,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/7430\/revisions\/7435"}],"wp:attachment":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7430"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}