After reading the following CMSMS Security page on Banning IP addresses via UDT
http://docs.cmsmadesimple.org/general-i ... ring-cmsms
...is there an enhancement I can place to this code to detect...
{if the user has these first 9 values in their IP address}
..then block that IP address?
{/if}
How to band range of IP addresses
Re: How to band range of IP addresses
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: How to band range of IP addresses
If you wanted to extend that UDT to ban a particular ip range from the front end of your site you could just match a substring . So something like:
If you're planning on doing more than a few simple rules though then this is probably something your firewall should be handling at a sever level.
Code: Select all
$ipaddress = cms_utils::get_real_ip();
if (in_array($ipaddress, $banned))
die ("You are banned from this website!");
if( substr($ipaddress,0,11)=='111.222.333' ){
die ("You and all your friends are banned from this website!");
}
Re: How to band range of IP addresses
My first thought on this is that blocking by a UDT or in general cmsms/php is generaly not best practice.
Well, it depends on the reason why you want to block those. But I don't think it adds extra security.
I think blocking by firewall or .htaccess or ...(?) is more secure as you don't allow those ip to get to any of the web/php processing.
Well, it depends on the reason why you want to block those. But I don't think it adds extra security.
I think blocking by firewall or .htaccess or ...(?) is more secure as you don't allow those ip to get to any of the web/php processing.
Re: How to band range of IP addresses
I agree velden,
I am just trying to learn if there is a better way that typing in each IP address one by one, which totally sucks. I need the ability to set a range...
Thanks for that thought
I am just trying to learn if there is a better way that typing in each IP address one by one, which totally sucks. I need the ability to set a range...
Thanks for that thought