Zen Cart Logo
Forums / General Questions / Blocking specific IP addresses

Blocking specific IP addresses

Views: 8,439

Results 1 to 15 of 15
17 Jul 2009, 10:18 PM
#1
exquisitebag avatar

exquisitebag

New Zenner

Join Date:
Jul 2009
Posts:
1
Plugin Contributions:
0

Blocking specific IP addresses

Hi there, I have version v1.3.8a

I have someone using our "add link" section to keep posting links to their sites. They keep posting pictures that contain viruses - and while I have it set up that I'm required to approve all links prior to them being posted online, it still shows the image to me when I'm on my zen cart. I'm trying to block a specific IP that is a repeat offender of this but do not know how.

Is there another solution to this though? Like a way so that posting pictures as part of your link is not an option?

17 Jul 2009, 11:23 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Blocking specific IP addresses

The following is from javascriptkit.com

Is there a pesky person perpetrating pain upon you? Stalking your site from the vastness of the electron void? Blockem! In your htaccess file, add the following code--changing the IPs to suit your needs--each command on one line each:

order allow,deny
deny from 123.45.6.7
deny from 012.34.5.
allow from all

You can deny access based upon IP address or an IP block. The above blocks access to the site from 123.45.6.7, and from any sub domain under the IP block 012.34.5. (012.34.5.1, 012.34.5.2, 012.34.5.3, etc.) I have yet to find a useful application of this, maybe if there is a site scraping your content you can block them, who knows.

There is usually a IP blocker in the C-Panel at your host admin. Does the same as the above...

4 Dec 2009, 4:31 PM
#3
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Blocking specific IP addresses

schoolboy:

The following is from javascriptkit.com

There is usually a IP blocker in the C-Panel at your host admin. Does the same as the above...

I recently DLed the module for IP Blocking to play with on my test cart.

http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_41&products_id=1413

I was missing a file (my own error!), and it didn't work, but by the time I realized that I had missed uploading one of the files, I deleted the module because I read the above message on this board that a simple addition to the htaccess file in each fold will accomplish the same task.

Which would be fastest? Doesn't the IP Blocker mod slow down the cart just a little, whereas the other two methods mentioned will not affect cart performance??

15 Dec 2009, 6:59 PM
#4
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Blocking specific IP addresses

Donn:

Which would be fastest? Doesn't the IP Blocker mod slow down the cart just a little, whereas the other two methods mentioned will not affect cart performance??

Update to anyone reading this....

I decided to avoid installing the module.

I instead am now relying on the above .htaccess modification, as that will cause the least slowdown, according to what I've read.

Apparently, solutions can be implemented at many levels for this issue.

I think keeping it at the server level is most efficient, however.

:blink::blink::blink:

20 Mar 2010, 12:38 AM
#5
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Blocking specific IP addresses

i have just had 2 attempts at very large and unusual orders from a particular ip address under 2 different accounts. then when i went to check google analytics after blocking the ip addresses i found that i had 2 visits from 69.175.10.98/referral strange thing is this is actually a site but has a test page for an apacheserver so i have banned this ip address too. any ideas if i am being targeted here??

20 Mar 2010, 1:10 AM
#6
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Blocking specific IP addresses

Xbox Memberships:

... any ideas if i am being targeted here??

not unlikely at all

blocking one IP address is a temporary measure, does not stop a potential attacker to try again from a different computer with different IP address

Important to follow these links:
http://www.zen-cart.com/wiki/index.php/Recovering_From_Hacks
http://www.zen-cart.com/forum/forumdisplay.php?f=134

I just had a full audit done on one of my stores, can give you the name / url of the person who did that for me - just PM me

Frank

20 Mar 2010, 1:17 AM
#7
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Blocking specific IP addresses

i wasn't hacked though... they simply tried to place an order. twice with one lot of card details then made a new account with a new address and made a second order. they ordered 2 instan delivery xbox codes. luckily there is a flaw in my module for delivering them so it only sent one. so far as it was a microsoft points code and if the ip address is true to form it is useless to them as they are located in the us and the code will only work for european union consoles/accounts.

I am going to get in touch with my payment service provider tomorow to find out why it allowed the card transaction in the first place though as it shows in the payment managment screen as passed by the cv2 being correct but the address was not even checked??

talk about stringent fraud prevention tools eh??

fingers crossed the code hasnt been redeemed and i can sell it quick via ebay tomorow at a reduced price to recover my funds before doing a full refund to the unfortunate owner of the card that has been billed!

i think an audit may be a worth while step to take as well so if you could pm his details and a rough guide price and see if i can afford it:wink:

20 Mar 2010, 1:46 AM
#8
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Blocking specific IP addresses

PM in your Inbox
Frank

28 Jan 2011, 4:11 PM
#9
bshrc avatar

bshrc

New Zenner

Join Date:
Sep 2010
Posts:
30
Plugin Contributions:
0

Re: Blocking specific IP addresses

Every time I add an .htaccess file to the root of my cart it gives me http 500 errors all over. My IP is not on the block list but I think I am doing something wrong.

My htaccess file contains the following code IPs replaced by Xs

<Files *>
order allow, deny
deny from xx.xxx.xxx
deny from xx.xxx.xxx
deny from xx.xxx.xxx.xxx
allow from all
</Files>

I've tried with and without the <Files *></Files>

2 Feb 2011, 7:56 AM
#10
louis avatar

louis

Zen Follower

Join Date:
Jul 2006
Location:
Johannesburg
Posts:
408
Plugin Contributions:
0

Re: Blocking specific IP addresses

You can always add this to the top of your index.php file to block certain IP's from gaining access to your site.

$banned = array('129.168.1.1');
if(in_array($_SERVER['REMOTE_ADDR'], $banned))
{
    die();
}
23 Feb 2011, 6:23 AM
#11
wifeandmomof4 avatar

wifeandmomof4

New Zenner

Join Date:
Nov 2010
Location:
Ohio
Posts:
13
Plugin Contributions:
0

Re: Blocking specific IP addresses

Louis:

You can always add this to the top of your index.php file to block certain IP's from gaining access to your site.

$banned = array('129.168.1.1');
if(in_array($_SERVER['REMOTE_ADDR'], $banned))
{
die();
}


What if you have more than one that you want to ban?
How do I do that? :unsure:
23 Feb 2011, 8:10 AM
#12
cadyman avatar

cadyman

New Zenner

Join Date:
Oct 2010
Posts:
27
Plugin Contributions:
0

Re: Blocking specific IP addresses

wifeandmomof4:

What if you have more than one that you want to ban?
How do I do that? :unsure:

Because Array is a table you can add more IP-s like
array('1.2.3.4','1.2.3.5','1.2.3.6',.....,'XXX.XXX.XXX.XXX');

23 Feb 2011, 8:48 AM
#13
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Blocking specific IP addresses

Have you tried just using:

deny from ???

All you need is that one line with the IP address.

Or, with one line you can block 256 IPs if you so choose.

deny from xxx.xxx.xxx

Leaving off the period and last 3 digits will block everything from 0 - 255

Note: the above is to be used in an .htaccess file on a Linux Server. I don't work with MS Servers so can't say what would happen.

23 Feb 2011, 12:37 PM
#14
wifeandmomof4 avatar

wifeandmomof4

New Zenner

Join Date:
Nov 2010
Location:
Ohio
Posts:
13
Plugin Contributions:
0

Re: Blocking specific IP addresses

How would I go about limiting registration to 1 per IP Address? Is that possible?

What happened is that I created a gift certificate to be sent upon account creation from Admin. I had one individual register 9 "people" from the same IP Address. She got 9 unique gift certificate codes. Then, she emailed/transferred them all to one account and applied them all to one order which then didn't cost her a thing. :ohmy:

The original Admin gift certificate was limited to one per order. I'd like to know how I could limit registration to maybe 1-2 from each IP address to avoid this happening in the future. Thanks for your help.

23 Feb 2011, 12:38 PM
#15
wifeandmomof4 avatar

wifeandmomof4

New Zenner

Join Date:
Nov 2010
Location:
Ohio
Posts:
13
Plugin Contributions:
0

Re: Blocking specific IP addresses

CaDyMaN:

Because Array is a table you can add more IP-s like
array('1.2.3.4','1.2.3.5','1.2.3.6',.....,'XXX.XXX.XXX.XXX');

Thank you!:smile: