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

HAProxy logs are showing external IP addresses trying to access domains that are not hosted by my company

· 52CE 我爱测

So I was browsing my HAProxy logs earlier today and noticed some odd requests being made by external IP addresses to domains that we are not hosting. For example Jun 8 06:25:56 haproxy haproxy[6316]: 185.108.107.19:54243 [08/Jun/…

问题原文

原帖链接 · Richie086 · CC BY-SA 4.0

So I was browsing my HAProxy logs earlier today and noticed some odd requests being made by external IP addresses to domains that we are not hosting.

For example

Jun  8 06:25:56 haproxy haproxy[6316]: 185.108.107.19:54243 [08/Jun/2020:06:25:56.731] localhost localhost/<NOSRV> -1/-1/-1/-1/13 503 213 - - SC-- 2/2/0/0/0 0/0 "CONNECT chekfast.zennolab.com:443 HTTP/1.1
Jun  8 06:26:33 haproxy haproxy[6316]: 185.108.107.19:54598 [08/Jun/2020:06:26:33.855] localhost localhost/<NOSRV> -1/-1/-1/-1/3 400 188 - - PR-- 0/0/0/0/0 0/0 "<BADREQ>"
Jun  8 06:34:07 haproxy haproxy[6316]: 94.200.76.222:55958 [08/Jun/2020:06:34:07.906] localhost localhost/<NOSRV> -1/-1/-1/-1/0 503 213 - - SC-- 0/0/0/0/0 0/0 "POST /cgi-bin/mainfunction.cgi HTTP/1.1"
Jun  8 06:46:05 haproxy haproxy[6316]: 14.221.172.38:2184 [08/Jun/2020:06:46:05.845] localhost localhost/<NOSRV> -1/-1/-1/-1/11 503 213 - - SC-- 6/6/0/0/0 0/0 "GET http://api.gxout.com/proxy/check.aspx HTTP/1.1"
Jun  8 06:59:49 haproxy haproxy[6316]: 223.12.75.250:17883 [08/Jun/2020:06:59:49.392] localhost localhost/<NOSRV> -1/-1/-1/-1/0 503 213 - - SC-- 11/11/0/0/0 0/0 "HEAD http://123.125.114.144/ HTTP/1.1"

From what I can tell the person doing this (or script) is getting response codes like 503 (Service Unavailable) which I am hoping means that the request is not going through properly - but is there some way I can stop these sorts of requests from being made in the first place? We are running HAProxy version 1.6.3 on Ubuntu 16.04.4 LTS.

Thanks

已采纳解答

原帖链接 · Altimus Prime · CC BY-SA 4.0

You can't prevent people from making the request, but you can limit the number of times a given ip makes certain requests.

On the server-level I run fail2ban and define the jails and rules to my needs, so no single ip address can make more than your predefined number of bad requests and it drastically reduces the total number of requests to the server. For more information on how to use it and create specific rules and define log files to your need visit:

https://www.fail2ban.org/wiki/index.php/MANUAL_0_8

HAProxy has a tool built in that does something similar that you can see at:

https://haproxy.com/blog/bot-protection-with-haproxy

If I understand correctly, HAProxy only concerns itself with requests being routed to the ports it's responsible for. fail2ban can have rules for requests on any port, so if it's not already running and you look are your secure log, there are probably loads of people probing your ports 22, 3306 and others.

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

资料来源与适用范围

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

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

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