Skip to content

Instantly share code, notes, and snippets.

@tmugford
Last active April 6, 2018 11:57
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 tmugford/7cf37e96a1bef006de351640bb8077f7 to your computer and use it in GitHub Desktop.
Save tmugford/7cf37e96a1bef006de351640bb8077f7 to your computer and use it in GitHub Desktop.
# Limit Login Attempts Reloaded (https://en-gb.wordpress.org/plugins/limit-login-attempts-reloaded/)
# doesn’t currently offer a way to quickly add logged IP addresses to the blacklist. The following
# one-liner uses WP-CLI and JQ (https://stedolan.github.io/jq/) to quickly merge the entire lockouts
# log with the blacklist, which is useful when the site is experiencing distributed brute force
# attempts on wp-login.php
cat <(wp option get limit_login_blacklist --format=json | jq -r '.[]') <(wp option get limit_login_logged --format=json | jq -r 'keys_unsorted | .[]') | jq -s -R 'split("\n") | .[0:-1] | unique' | wp option update limit_login_blacklist --format=json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment