Elxis CMS Forum

Support => Security => Topic started by: perseas on July 13, 2021, 15:22:50

Title: Defender Excluded IPs - Network Address
Post 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.
Title: Re: Defender Excluded IPs - Network Address
Post by: datahell on July 18, 2021, 20:35:42
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.
Title: Re: Defender Excluded IPs - Network Address
Post by: perseas on July 18, 2021, 20:38:37
Do you have an example?
Title: Re: Defender Excluded IPs - Network Address
Post by: perseas on July 18, 2021, 20:46:58
ok Thanks. I understood
xxx.xxx.xxx.*
Title: Re: Defender Excluded IPs - Network Address
Post by: datahell on July 18, 2021, 20:54:17
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
Title: Re: Defender Excluded IPs - Network Address
Post by: perseas on July 18, 2021, 21:01:30
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.*)
Title: Re: Defender Excluded IPs - Network Address
Post by: datahell on July 18, 2021, 21:03:16
Read my answer again, I told you No. Ranges are supported only in blocking IPs.