Skip to content

Instantly share code, notes, and snippets.

@olimortimer
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olimortimer/48d1efbe776e1484e236 to your computer and use it in GitHub Desktop.
Save olimortimer/48d1efbe776e1484e236 to your computer and use it in GitHub Desktop.
Shell: Fail2Ban WordPress Logins
# Ban IP via Cloudflare API: /etc/fail2ban/action.d/cloudflare-api.local
[Definition]
actionban = curl https://www.cloudflare.com/api_json.html -d 'a=ban' -d 'tkn=1234567890' -d 'email=cloudflare@email.com' -d 'key=<ip>'
actionunban = curl https://www.cloudflare.com/api_json.html -d 'a=nul' -d 'tkn=1234567890' -d 'email=cloudflare@email.com' -d 'key=<ip>'
[wp-auth]
enabled = true
filter = wp-auth
action = iptables-multiport[name=wp-auth, port="http,https"]
cloudflare-api
logpath = /var/log/ispconfig/httpd/*/access.log
maxretry = 3
# WordPress brute force auth filter: /etc/fail2ban/filter.d/wp-auth.conf
#
# Block IPs trying to auth wp wordpress
#
# Matches e.g.
# 94.75.208.136 - - [25/Nov/2014:17:41:07 +0000] "POST /wp-login.php HTTP/1.0" 302 381 "-" "-"
#
[Definition]
failregex = ^<HOST> .* "POST /wp-login.php
ignoreregex =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment