/** * Check IPs on authentication to see if they've been banned * @static * @param string $user * @param string $username * @param string $password * @return WP_User */ public static function block_login_attempts($user, $username, $password) { if (!empty($username)) { require_once SYNTHESIS_CHILD_PLUGIN_INCLUDES_DIR . 'synthesis-blacklist.php'; // If the incoming IP is blacklisted, block the login. if (Synthesis_Blacklist::is_blacklisted_ip()) { $user = null; } Synthesis_Blacklist::increment_logins_since_last_check(); } return $user; }
/** * @param string $username The username used in the invalid login attempt * @return string The response from Loggly */ public static function log_authentication_failure($username) { require_once SYNTHESIS_CHILD_PLUGIN_INCLUDES_DIR . 'synthesis-blacklist.php'; $blog_url = get_bloginfo('url'); $domain = str_replace('http://', '', str_replace('https://', '', untrailingslashit($blog_url))); $bad_ip = Synthesis_Blacklist::get_client_ip(); $args = array('body' => json_encode(array('domain' => $domain, 'username' => $username, 'ip' => $bad_ip)), 'headers' => array('Content-Type' => 'text/plain')); if (get_option('sng_level')) { return wp_remote_post('https://logs-01.loggly.com/inputs/d0f18a89-c6de-4bf7-8104-0924d4bc98b3/tag/rmkr-wp-login/', $args); } return wp_remote_post('https://logs-01.loggly.com/inputs/e944274e-7924-4aa3-93d2-bdf3d6fc96b2/tag/wp-login/', $args); }