LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-16-2018, 07:55 PM   #1
PatD
Member
 
Registered: Dec 2016
Posts: 74

Rep: Reputation: Disabled
Geo-blocking upside down


Geo-blocking -excluding a user from your site based on the user's location.
Is that close enough? Good.
I want to do the opposite.
I want to know how a user can block websites FROM a specified location.
I know I can alter search engines to bring me info from only a specific country's sites.
I want to be able to access all sites EXCEPT those in a certain country. You follow?

Any thoughts?
 
Old 01-16-2018, 09:48 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,147

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
Add a set of iptables rules to drop traffic in the IP ranges for the country.
 
Old 01-16-2018, 10:15 PM   #3
PatD
Member
 
Registered: Dec 2016
Posts: 74

Original Poster
Rep: Reputation: Disabled
That actually sounds quite simple, though I suspect in the end that it won't be.
Where would I be most apt to find concise information about this. would you know by any chance?
 
Old 01-17-2018, 01:45 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
as most things asked on LQ, i think it starts with a good article/tutorial/documentation.
you mentioned geo-blocking, not sure that's a linux software, but there are libraries/lists/packages that translate locations to ip ranges for you.
on my system it's called geoip and geoip-database.
i'd start with those, reading all documentation both local and online.
 
Old 01-17-2018, 03:29 AM   #5
camp0
Member
 
Registered: Dec 2016
Location: Dublin
Distribution: Fedora
Posts: 70

Rep: Reputation: 4
Not sure if will help you but you can use pyaiengine for that. The only thing is that you will need to script in python what you want, but have netfilter support and you can drop/reject domains or protocols easily, I think
 
Old 01-17-2018, 05:36 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,476

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Couple of things spring to mind.

Make use of MaxMind's GeoIP services to get things like country details from the visitors IP address and then handle that through whatever application you're using for the site.

Make use of an IP allocation provider to get a hold of the IP blocks for the countries you want to allow and create IP tables entries for each of the blocks you wish to allow access.

I make use of both, the first to match forum registrations with countries and to mark posts from "problematic" countries for checking. I use the second to entirely block a few countries totally at firewall level. The same blocking script could probably be used "in reverse", creating a default "block all" rule and then adding the allowed countries above it.
 
  


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
LXer: Get started with Dr. Geo for geometry LXer Syndicated Linux News 0 08-30-2016 09:10 AM
LXer: Nginx Automated Geo Ban LXer Syndicated Linux News 0 08-24-2014 11:42 PM
Linux Firewall and Geo Ips sachinsud Linux - Security 3 11-29-2012 01:09 PM
Geo-Location munna_dude Programming 1 05-24-2007 01:37 PM
Geo::IPFree - Where do I find the database? Cronjob Linux - Software 0 01-20-2005 11:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:40 PM.

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