大网数据广告活动
服务器运维问答

NGINX Brute Force Detection of devices hiding behind NAT. Block only specific device and not all devices sharing the same IP

· 52CE 我爱测

I have a AWS EC2 Ubuntu instance with NGINX server configured to listen on IP address 50.0.0.1 (Example) on port 80. I have a login page in index.php. I want to configure nginx for brute force detection and prevention (active blo…

问题原文

原帖链接 · Akshay Shah · CC BY-SA 3.0

I have a AWS EC2 Ubuntu instance with NGINX server configured to listen on IP address 50.0.0.1 (Example) on port 80.

I have a login page in index.php. I want to configure nginx for brute force detection and prevention (active blocking) for this page.

But if a client end node is hiding behind a NAT as shown in my architecture: Architecture, according to my simple script which blocks the IP addresses after 5 unsuccessful attempts, it blocks the IP 1.2.3.4 (Refer Architecture) so the other legitimate users sharing the IP 1.2.3.4 with the attacker also get blocked.

Is there any way I can block only the attacker's requests and not other legitimate requests? Some solutions come to mind are:

  • Blocking IP-SourcePort combination instead of only IP, but attacker can randomize source ports for each request.
  • Implementing a STUN server or TURN server

What can be the best solution to achieve this?

已采纳解答

原帖链接 · Tero Kilkanen · CC BY-SA 3.0

Unless there is some specific fingerprint for each attack request (which is unlikely since they want to hide themselves), you cannot do anything except rate limiting, which also affects all legitimate clients.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-11-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。