How to restrict access to LAMP for certain IP ranges

I want to restrict all access (Apache, Postfix) to a certain geographical region, how can I do this?

If I want to do this, is it best to use iptables or should I do it per application? What are the pros and cons?



This is difficult and possible only with severe limitations. Geographical information of internet users is usually not available. The closest one gets is to look up their IP in a geo-ip database. Free such databases only give a coarse classification (country), everything else is possibly quite expensive.

What's more is that IP addresses can be spoofed, cell phone users are often "located" in regions very remote from their actual position, and VPNs and similar services allow users to hide their real IP address, fooling any IP-based location methods.

Long story short: Unless you have very good reasons to do so and know what you are doing, I'd advice against doing this.

If you must implement such a thing (don't!), iptables would be a good option. Just look for a basic tutorial or read the man page (focus on the -s option for matching).

Category: postfix Time: 2016-07-29 Views: 0
Tags: apache postfix

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.193 (s). 12 q(s)