我有一个在菲律宾没有用户的 Web 应用程序,但它不断受到垃圾邮件发送者、测试卡的卡片者和来自那里的其他不良活动的轰炸。我可以在日志中看到他们在菲律宾拥有 IP,并且最初是通过 google.ph 或其他.ph网站找到我的网站。
我有很好的过滤器和安全检查,所以它们不会造成太大的损害,但尽管如此,我真的厌倦了。他们用尽带宽,填满我的数据库,滥用日志和安全日志,浪费我的时间来命名帐户等。
虽然绝大多数菲律宾公民不是垃圾邮件发送者,而且我不能只是阻止让我烦恼的每个国家,但在这一点上,我认为解决方案只是阻止从菲律宾到我的 web 应用程序的所有流量。(我知道封锁整个国家的 IP 封锁不是一个好习惯,而且有很多问题,但对于这个国家,我想破例。)
(我知道他们可以欺骗他们的 IP 地址,但至少我可以让他们为它工作一点。)
我知道那里有一些 geoip 服务。有谁知道任何免费或便宜的服务?或者有什么其他方法可以过滤来自特定国家/地区的流量?
如果重要的话,我在 Apache 2 上运行 PHP。
我有一个需要根据 IP 地址阻止特定国家/地区的网站。我非常清楚基于 IP 的阻止并不是阻止访问者的万无一失的方法,但它是朝着正确方向迈出的必要步骤。
由于我使用的是 PHP,我会做的是使用 GeoIP 数据库,如geoplugin.net。但是,我很想知道是否有更好的方法来做到这一点。
该网站位于共享网络服务器上(我没有 root 访问权限)并且它在 centOS 上运行 Apache。我想我的问题是“可以将 .htaccess 文件配置为使用外部源来阻止 IP 地址来查找 IP 地址。”
我正在尝试将 geoip 编译到 nginx 中。这样做时,./configure --with-http_geoip_module我收到以下错误。
./configure: error: the GeoIP module requires the GeoIP library.
You can either do not enable the module or install the library.
Run Code Online (Sandbox Code Playgroud)
我已经尝试了任何组合来尝试使用 apt-get 为 nginx 找到 geoip 模块,但我没有运气。如果有人能指出我正确的方向。
在 CentOS 6 上,即使许多网站描述使用以下命令安装 GeoIP,我也无法安装 GeoIP:
yum install GeoIP GeoIP-devel GeoIP-data
Run Code Online (Sandbox Code Playgroud)
我得到 No package GeoIP available.
我的 CentOS 7 上有一个 nginx/1.10.1 通过 nginx repo 安装。我只安装了 geoip 模块
[root@www nginx]# nginx -V
nginx version: nginx/1.10.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic **--with-http_geoip_module=dynamic** --with-http_perl_module=dynamic --add-dynamic-module=njs-1c50334fbea6/nginx --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio …Run Code Online (Sandbox Code Playgroud) 是否有任何防火墙(首选一些免费的 :) )可以阻止来自所有 IP 地址的所有通信,除了来自特定位置的某些 IP...
我基本上想阻止对我的服务器的 DDOS 攻击,它受到来自我国家/地区以外的某些 IP 的攻击
编辑:我正在使用 1 台 windows 机器和 1 台 linux 机器
编辑 2:我听说在印度有一些组织可以帮助我们做这件事,所以我认为这是可能的。他们只过滤来自印度地区的 IP,并阻止其余的 IP。
除了白名单国家和局域网之外,我想使用 geoip 阻止 IP。第一部分完美无缺,第二部分没有。Somwehere 搜索互联网我找到了代码 LH(本地主机)和 LN(本地网络),但它们都不起作用。
我正在使用标准的 howto 代码进行阻塞。
nginx.conf 中相关的 http {} 部分:
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $allowed_country {
default no;
US yes;
}
Run Code Online (Sandbox Code Playgroud)
站点可用/默认中的相关服务器 {} 部分:
block countries
if ($allowed_country = no) {
return 444;
}
Run Code Online (Sandbox Code Playgroud)
我们欢迎所有的建议!
更新:
$geoip_country_code 变量在 LAN IP 访问时返回“-”,但添加“- yes;” 到 geoip_county 块也不起作用。