News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

ban all IP addresses except for a 200 mile radius.

Started by dafydd, September 17, 2011, 04:00:03 PM

Previous topic - Next topic

dafydd

I am currently getting account request in excess of 100  per day. I would like to ban all those IP addresses from outside the continental United States. ( Actually a radius of 200 miles of Houston TX.

A site that wants to sell maternity clothes in Russian or a spider crawling my site with an IP address in China, has no business or interest in fly fishing the Texas Gulf Coast.

Looks like I might be able to do that with code simular to this .htaccess example.

order allow,deny
deny from 192.168.
deny from 10.0.0.
allow from all

Where do I find a list/map/chart of how the world is divide into IP address areas?

Thanks for any information you can contribute to this problem.
Dave

Illori

the world or countries/states is not really divided like you want by ip address and because we have dynamic ip addresses it would be too easy to accidentally block a valid user just because they got another ip that was from another area.

sawz

try using this site, not sure if it will help but what the heck, we try to please.

http://ipinfodb.com/ip_country_block.php
keep smiling, they'll always wonder what your up too.....

a10

Although risky, have resorted to blocking countries (cn, ru, pl, ua etc) with htaccess, became a large file, approx 400k & 16000 ranges. Keeps vast amounts of vermin away, with seemingly no problems with existing members and new (wanted) registrations, & no speed problem.

Getting the htaccess to work on a local range must be very difficult, but as a start maybe try deny all + allow us ip's. Many sites with lists, am using http://ipinfodb.com/ (generates readymade htaccess, choose with 'Select the output type')

& this may be of interest http://ipinfodb.com/ip_country_block_htaccess.php
2.0.19, php 8.0.30, MariaDB 10.6.18. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.
Stand with 🇺🇦

MrPhil

#4
Quote from: a10gf on September 17, 2011, 06:35:12 PM
Although risky, have resorted to blocking countries (cn, ru, pl, ua etc) with htaccess, became a large file, approx 400k & 16000 ranges.
Heh, heh. I wonder what the problem is going to be like when ipv6 becomes commonly used... billions more ranges?

Banning by IP address doesn't work very well, but is better than nothing. If you want to narrow your signups to not only a specific geographic area, but also an area of interest, try to find a mod to let you ask questions upon registration (SMF 2 has this built-in).

  • What was the name of the football team that abandoned Houston?
  • What is the large body of water east of San Padre Island?
  • What does the phrase 'MSC' stand for?
etc.

Regarding banning by location, what if there is a Montana fly fisherman who wants to come down during the winter (I hear it gets quite cold there!) and do a little salt water angling (or at least, East Texas angling... I would guess that fly fishing is fresh water only). What if there's a Russian billionaire who wants to fly in and drop a half million rubles or so on a vacation?

If you're still interesting in locating someone by IP address, you might want to follow this topic: http://www.simplemachines.org/community/index.php?topic=447801.msg3142928

a10

Tried removing the htaccess for a day, immediately the rats were all over the place trying to register, requesting password reminder, logging in (to some non-existent account), nothing or nothing you can see, unknown action etc. What an ipv6 future will bring, no idea, ftm the country ban does a fine job.
2.0.19, php 8.0.30, MariaDB 10.6.18. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.
Stand with 🇺🇦

dafydd

Quote from: sawz on September 17, 2011, 06:33:11 PM
try using this site, not sure if it will help but what the heck, we try to please.

http://ipinfodb.com/ip_country_block.php
The site says it can generate a list of IP address for a country. If I generated a list for the United States, which would look like this example,

COUNTRY_BLOCK_START
<Limit GET HEAD POST>
order allow,deny
deny from 58.147.128.0/19
deny from 67.212.160.0/24
deny from 80.247.139.0/24
deny from 82.205.190.0/21
[...]
allow from all
</Limit>
#COUNTRY_BLOCK_END


Could I hand edit it to look like this example:

COUNTRY_BLOCK_START
<Limit GET HEAD POST>
order deny,allow
allow from 58.147.128.0/19
allow from 67.212.160.0/24
allow from 80.247.139.0/24
allow from 82.205.190.0/21
[...]
deny from all
</Limit>
#COUNTRY_BLOCK_END


And block everything outside the US?

dafydd

Let give a better description of my website/group. We are a 200 member group with an interest in one thing. Fly Fishing.

I live probably the farthermost from town, 60 miles. A 200 mile radius would be more than enough to cover our area of influence.

I am more concerned with spiders from around the world harvesting information than banning legitimate users. I only want Google, Yahoo, Bing, and other US search engines indexing my website. Our club members are very concerned about anonymity and privacy.

Illori

then really your best option would be using a robots.txt file and keeping guests from being able to see your forum

dafydd

Quote from: Illori on September 18, 2011, 04:37:19 PM
then really your best option would be using a robots.txt file and keeping guests from being able to see your forum
That puts me between a rock and a hard place. I want guest to SEE the website. We are registered with the State of Texas and the IRS as a non-profit educational orginazation.

It is our goal to TEACH. That is done with a hands on local experience. I need the local public to see  what we  have to offer.

Angelina Belle

You can try mods such as httpbl and stopspam, which use spammer databases to stop the spammers.
If you want guests to see the website, you want to be listed in a google search as well, don't you?

That and the verification questions should really help.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Advertisement: