WP fail2ban - Version 2.3.0

Version Description

  • Bugfix in experimental WP_FAIL2BAN_PROXIES code (thanks to KyleCartmell).
Download this release

Release Info

Developer invisnet
Plugin Icon 128x128 WP fail2ban
Version 2.3.0
Comparing to
See all releases

Code changes from version 2.2.1 to 2.3.0

Files changed (2) hide show
  1. readme.txt +8 -2
  2. wp-fail2ban.php +3 -3
readme.txt CHANGED
@@ -4,8 +4,8 @@ Author URI: https://charles.lecklider.org/
4
  Plugin URI: https://charles.lecklider.org/wordpress/wp-fail2ban/
5
  Tags: fail2ban, security, syslog, login
6
  Requires at least: 3.4.0
7
- Tested up to: 3.9
8
- Stable tag: 2.2.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -106,6 +106,9 @@ to the `[wordpress]` section in `jail.local`.
106
 
107
  == Changelog ==
108
 
 
 
 
109
  = 2.2.1 =
110
  * Fix stupid mistake with WP_FAIL2BAN_BLOCKED_USERS.
111
 
@@ -142,6 +145,9 @@ to the `[wordpress]` section in `jail.local`.
142
 
143
  == Upgrade Notice ==
144
 
 
 
 
145
  = 2.2.1 =
146
  Bugfix.
147
 
4
  Plugin URI: https://charles.lecklider.org/wordpress/wp-fail2ban/
5
  Tags: fail2ban, security, syslog, login
6
  Requires at least: 3.4.0
7
+ Tested up to: 4.0
8
+ Stable tag: 2.3.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
106
 
107
  == Changelog ==
108
 
109
+ = 2.3.0 =
110
+ * Bugfix in *experimental* `WP_FAIL2BAN_PROXIES` code (thanks to KyleCartmell).
111
+
112
  = 2.2.1 =
113
  * Fix stupid mistake with WP_FAIL2BAN_BLOCKED_USERS.
114
 
145
 
146
  == Upgrade Notice ==
147
 
148
+ = 2.3.0 =
149
+ Fix for WP_FAIL2BAN_PROXIES; if you're not using it you can safely skip this release.
150
+
151
  = 2.2.1 =
152
  Bugfix.
153
 
wp-fail2ban.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP fail2ban
4
  Plugin URI: https://charles.lecklider.org/wordpress/wp-fail2ban/
5
  Description: Write all login attempts to syslog for integration with fail2ban.
6
- Version: 2.2.1
7
  Author: Charles Lecklider
8
  Author URI: https://charles.lecklider.org/
9
  License: GPL2
@@ -50,12 +50,12 @@ function remote_addr()
50
  foreach(explode(',',WP_FAIL2BAN_PROXIES) as $proxy) {
51
  if (2 == count($cidr = explode('/',$proxy))) {
52
  $net = ip2long($cidr[0]);
53
- $mask = ~ ( (2 ^ (32 - $cidr[1])) - 1 );
54
  } else {
55
  $net = ip2long($proxy);
56
  $mask = -1;
57
  }
58
- if ($net == $ip & $mask) {
59
  return (false===($len = strpos($_SERVER['HTTP_X_FORWARDED_FOR'],',')))
60
  ? $_SERVER['HTTP_X_FORWARDED_FOR']
61
  : substr($_SERVER['HTTP_X_FORWARDED_FOR'],0,$len);
3
  Plugin Name: WP fail2ban
4
  Plugin URI: https://charles.lecklider.org/wordpress/wp-fail2ban/
5
  Description: Write all login attempts to syslog for integration with fail2ban.
6
+ Version: 2.3.0
7
  Author: Charles Lecklider
8
  Author URI: https://charles.lecklider.org/
9
  License: GPL2
50
  foreach(explode(',',WP_FAIL2BAN_PROXIES) as $proxy) {
51
  if (2 == count($cidr = explode('/',$proxy))) {
52
  $net = ip2long($cidr[0]);
53
+ $mask = ~ ( pow(2, (32 - $cidr[1])) - 1 );
54
  } else {
55
  $net = ip2long($proxy);
56
  $mask = -1;
57
  }
58
+ if ($net == ($ip & $mask)) {
59
  return (false===($len = strpos($_SERVER['HTTP_X_FORWARDED_FOR'],',')))
60
  ? $_SERVER['HTTP_X_FORWARDED_FOR']
61
  : substr($_SERVER['HTTP_X_FORWARDED_FOR'],0,$len);