Elxis CMS Forum
Support => Security => Topic started by: perseas on July 13, 2021, 15:22:50
-
Can we set a Network Address in
Control panel>Settings>Security>Excluded IPs
like
xxx . xxx . xxx .0/24
or
xxx . xxx . xxx.0-255
or
xxx . xxx . xxx.0 - xxx . xxx . xxx.255
Thanks in advance.
-
No, the whitelist IPs should be set as single IP addresses. It is easy to change it but at this moment the check is performed on single IPs. On the other hand, you can use wildcards on block IP addresses.
-
Do you have an example?
-
ok Thanks. I understood
xxx.xxx.xxx.*
-
I found a nice function to check if an IP is within a CIDR network range.
https://gist.github.com/tott/7684443 (https://gist.github.com/tott/7684443)
An other way is to provide the 2 lower and higher ips, convert them into long integers (with ip2long) and then check if the user's IP is within this range.
Attention: Both methods work only with IPv4 IPs.
Tip: You dont need to modify Elxis or the defender to add this special functionality. You can add your custom code in your template ;-)
Edit: This one (https://github.com/cloudflarearchive/Cloudflare-Tools/blob/master/cloudflare/ip_in_range.php) supports both IPv4 and v6 IPs
-
Wildcards are not accepted from elxis.
(17.121.112.*,17.121.113.*,17.121.114.*,17.121.115.*,173.252.111.*,173.252.127.*,173.252.83.*,173.252.95.*)
-
Read my answer again, I told you No. Ranges are supported only in blocking IPs.