Skip to content

Instantly share code, notes, and snippets.

View tmugford's full-sized avatar

Tristan Mugford tmugford

View GitHub Profile
@tmugford
tmugford / autoload.php
Created September 14, 2018 11:44
Kirby custom SMTP email driver using PHPMailer (assumes SMTP authentication is required)
<?php
require kirby()->roots()->index() . DS . 'vendor' . DS . 'autoload.php';
# 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