dsoares / roundcube-rcguard

Roundcube plugin to enforce reCAPTCHA for users who have too many failed logins.
24 stars 10 forks source link

Add support for IPv6 CIDR match #49

Open pbiering opened 1 year ago

pbiering commented 1 year ago

So far, IPv6 entries in $config['recaptcha_whitelist'] where not proper honored, this PR adds IPv6 support to the CIDR matching code using e.g. following config

$rcmail_config['recaptcha_whitelist'] = array('2001:db8::/32');

also add some log lines and fixes the somehow broken code mentioned in https://github.com/dsoares/roundcube-rcguard/pull/46.

BTW: reason for config option

// Block IPv6 client IP based on prefix length
// Use an integer between 16 and 128, 0 to disable
$config['rcguard_ipv6_prefix'] = 0;

is unclear, there was no code sniplet found which blocks something, with that PR it's at least proper masking (for whatever reason...)