Playing with the brute_kill_login-hook
-
Hi,
2014 is indeed a challenging year in terms of web security. Thanks for implementing this service. ?? I use BruteProtect as cloud-enabled replacement for Limit Login Attempts which served my purposes for many years but doesn’t seem to be quite enough anymore…
In my current setup I log all bad requests caught by BruteProtect to get an overview of the numbers and signatures of these attacks. Unfortunately, the provided hook brute_kill_login fires too early to capture all occurrences.
if ( isset( $pagenow ) && $pagenow == 'wp-login.php' ) { $bruteProtect->brute_check_loginability(); } else { // This is in case the wp-login.php pagenow variable fails*/ add_action( 'login_head', array( &$bruteProtect, 'brute_check_loginability' ) ); }
My current solution is to comment out the if-part and leave only the add_action call in the else, which works just fine. – Would it be possible to move this part of the code to the init-hook, so plugins can rely on brute_kill_login?
Regarding the hook, I’d like to ask for a feature. – Could you include the seconds_remaining or the expiry-time as additional parameters in the action? Currently I use the following snippet, though copying the code and messing with BruteProtect’s internals seems like a bad idea where the mileage may vary:
$headers=$bruteProtect->brute_get_headers(); $header_hash=md5(json_encode($headers)); $transient_name='brute_loginable_'.$header_hash; $transient_value=get_site_transient($transient_name); $expire=(!empty($transient_value) && array_key_exists('seconds_remaining', $transient_value) && intval($transient_value['seconds_remaining'])>60 && intval($transient_value['seconds_remaining'])<14400) ? intval($transient_value['seconds_remaining']) : 600;
Cheers,
Berny
- The topic ‘Playing with the brute_kill_login-hook’ is closed to new replies.