• Resolved kendawes

    (@kendawes)


    Hi,
    I use an .htninja file to whitelist IP addresses… Works great!
    If I want to whitelist an IPv6 range, can I just add the IPv6 CIDR to the array?
    If not, what would be the proper way to do it?

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author nintechnet

    (@nintechnet)

    Hi,

    You cannot add CIDR notation to the array. You would need to add some bit of code.
    For instance, this code could be perfect for what you want to do. To use it with the .htninja simply add the ‘ALLOW’ directive and of course, replace the $first_in_range and $last_in_range variable:

    
    $first_in_range = inet_pton('2001:db8::');
    $last_in_range = inet_pton('2001:db8::ffff:ffff:ffff:ffff');
    
    $address = inet_pton($_SERVER['REMOTE_ADDR']);
    
    if ((strlen($address) == strlen($first_in_range))
    &&  ($address >= $first_in_range && $address <= $last_in_range)) {
        return 'ALLOW'; // NinjaFirewall's whitelist
    }
    
Viewing 1 replies (of 1 total)

The topic ‘.htninja whitelisting IPv6 range’ is closed to new replies.