1

I released an app almost a year ago that worked by requesting data from some php scripts on my server. That app no longer does this and the php files have been removed. Yet several people still have the app running and my server gets several hundred megabytes worth of bandwidth of 404 errors a day. I have the IP addresses of the people running the app. Is there any way I can block them so that they won't be wasting my bandwidth?

I know I can block them with apache, but will that stop them from wasting bandwidth?

Thanks for any help!

1
  • 1
    Best bet is to ask your ISP to block them; or better yet, contact those people and get them to upgrade. Also, lesson for the future, add a KoD feature, if the app gets a 404 (or some custom code/data) it never tried the request again (should probably also add a reset button in the app settings too).
    – Chris S
    May 20, 2011 at 13:59

1 Answer 1

3

I am assuming you are running Apache on a Linux machine, you can use iptables to block the IPs.

Here is the command to block the selected IP.

iptables -A INPUT -s <IP ADDRESS> -j DROP

And here is the little bash script that will read the IP list from the txt file and will block all the IPs.

#!/bin/bash

while read IPADDR; do
    iptables -A INPUT -s $IPADDR -j DROP
done

save the above script in any file and then run it as following.

./scriptfile < /path/to/ip_address_list.txt

HTH.

5
  • This still wont block the incoming traffic; so he'll still be wasting about 1/3 to 1/2 of that traffic.
    – Chris S
    May 20, 2011 at 13:54
  • I'll use this as a last resort. I'll try what Chris suggested. The server is hosted on a VPS, so I'll ask the host if they can block the IPs at a higher level. Thanks for the replies!
    – edc1591
    May 20, 2011 at 15:54
  • Well, according to my hosting company I won't be losing any bandwidth if I block them with iptables. I'll try that out now and let you know if it works.
    – edc1591
    May 20, 2011 at 16:02
  • Also, will running this script stick on a reboot, or will I have to run it again?
    – edc1591
    May 20, 2011 at 16:04
  • You can add it to your /etc/rc.local, then it will run on every reboot. May 20, 2011 at 16:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .