ACL Block List contains multiple IPs and some are not blocked
-
Hi Gregory,
first of all thanks for this great plugin and your work!I came upon sth annoying related to sth. that has beed discussed various times here.
Different IPs in the ACL and like half of them have ip_long_begin + ip_long_end set to zero. For those, the ACL rule is not working at all:
https://www.ads-software.com/support/topic/acl-database-errors/And
ACL Access list does not recognize some IPs:
https://www.ads-software.com/support/topic/access-list-does-not-recognize-some-ips/And I myself have multiple Entries in the ACL.
All of this seems to be related to a 32-Bit Server Problem…
I have multiple Cerber Installations and they are working great.
But I have an obviously 32-Bit Server Hosting environment, where my Cerbers are not working as expected due to failing IP recognizations:You rely on ip2long to check an IP and determine duplicatons and so on.
But ip2long “fails” for “large” IPs in a 32-Bit Environment due to an integer Overflow and returns a signed int-value:
https://www.php.net/manual/de/function.ip2long.phpI succeeded by replacing the ip2long func to an “unsinged int” version that i added to the main wp-cerber.php:
function ip2long64( $ip ) { return sprintf("%u", ip2long($ip)); }
and then I replaced all occurrences of the ip2long with ip2long64. (Especially in cerber-load.php, dashboard.php and cerber-lab.php)
This way now cerber_acl_fixer also works again. The “Repair Database”/”Repair Cerber’s Tables” Function is not able to working properly with ip2long and the ip_long_begin and _ip_long_end keep staying at zero…. But with ip2long64 also these Entries get repaired and everything works again as expected.
In the CIDR2range Function where long2ip appears it seems to work as expected.
you might try to take sth from here:
https://www.php.net/manual/de/function.long2ip.phpBut then again the Ranges seem not to be saveable to the database within dashboard.php // cerber_acl_add
because in the “$wpdb->insert( CERBER_ACL_TABLE …” the Range again has the integer format in the format-array (%d). And therefore it becomes 2147483647 that resolves to 127.255.255.255…
…so just pass the values e.g. by string and it works….$result = $wpdb->insert( CERBER_ACL_TABLE, array( 'ip' => $ip, 'ip_long_begin' => $begin, 'ip_long_end' => $end, 'tag' => $tag, 'comments' => $comment, 'acl_slice' => $acl_slice, 'v6range' => $v6range, 'ver6' => $ver6, ), array( '%s', /* >> */ '%s', '%s' /* << INSTEAD OF %d, %d */, '%s', '%s', '%d', '%s', '%d' ) );
…that’s how it worked for me. ; )
I hope you could include sth like this in the next version because my 32-Bit Server won’t change. And i don’t want to change my firewall : ))
Greetigns!
- The topic ‘ACL Block List contains multiple IPs and some are not blocked’ is closed to new replies.