LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-09-2011, 02:12 PM   #1
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Rep: Reputation: 22
Allow only certain countries


I've seen on certain websites that they won't let me view it cos I'm not in the "correct" country, how do they do this?
Is there away to add this into my iptables script somehow? or maybe an addon of some sort?

I've been googling a lot for this but never found a real solution for it, just some
that MIGHT be working correctly.
 
Old 12-09-2011, 02:25 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Basher52 View Post
I've seen on certain websites that they won't let me view it cos I'm not in the "correct" country, how do they do this? Is there away to add this into my iptables script somehow? or maybe an addon of some sort?

I've been googling a lot for this but never found a real solution for it, just some that MIGHT be working correctly.
It's called GeoIP:
http://en.wikipedia.org/wiki/Geolocation_software

There are several services and API's you can use to do this. I've used this before:
http://www.geoplugin.com/
http://www.geoplugin.com/examples

...with good results. There may be others, though...I've only had need to do this twice, and using this free solution was all I needed. If I had to write code to do it, I'd build a blacklist of countries I didn't want to be able to access the site, do the geoip lookup, and compare the country to the blacklist. If found, display the "not allowed" page.

Be aware, though, that such things as TOR will spoof an address, and you'll appear to be from a different location...and this is easily done. If you want REAL security, you'll have to go a different route.
 
1 members found this post helpful.
Old 12-09-2011, 02:35 PM   #3
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Original Poster
Rep: Reputation: 22
I'll have a look at that
Thanks a million
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to block countries from server? payjoe Linux - Security 10 10-10-2007 10:04 AM
My website is not accessible from particular countries gubak Linux - Networking 10 11-02-2006 02:34 AM
Blacklist all, whitelist two countries daiver Linux - Security 4 04-30-2006 10:41 PM
Ban IP's of certain countries ~=gr3p=~ Linux - Security 11 01-24-2006 02:28 PM
Exporting Linux to other countries from US elzmaddy Linux - General 7 05-25-2003 11:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration