yaren 大佬有话说 : 2020-1-8 10:54:53
求助:cloudflare真实ip分析
本帖最后由 yaren 于 2020-1-8 23:35 编辑
最近用了CF发现有个VPS上的几个站点,都遭受一个不明的采集或者bot:
我nginx上日志格式是 ( nginx with http_realip_module ):
log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ’
‘$status $body_bytes_sent “$http_referer” ’ request_time: ‘"$request_time" ’ upstream_response_time ‘"$upstream_response_time" ’
‘"$http_user_agent" http_x_forwarded_for: “$http_x_forwarded_for” ’ host: ‘"$host" ’ http_cf_connecting_ip: ‘"$http_cf_connecting_ip" ’ ;
然后发现大量请求日志如:
172.69.33.99 – – “GET /xx/ HTTP/1.1” 200 13962 “http://cc.com/xx/” request_time:“0.002” upstream_response_time"0.002" “WordPress/5.3.2; http://cc.com” http_x_forwarded_for: “200.200.200.200” host:“cc.com” http_cf_connecting_ip:“200.200.200.200”
奇怪的问题有两个:
1http_x_forwarded_for and http_cf_connecting_ip 记录的ip (200.200.200.200 ) 为什么是本鸡的ip,网卡上绑定了的。那这两个header难道是伪装的?从cf过来的还是伪装从CF来的? 关于这个设置,我用本机chrome打开查看日志中ip都是准确的。
终于定位出来了。
原来是WP Super Cache的问题。。这个插件无意我开了个preload模式,一旦触发了,会自动遍历所有post url,以期生成缓存。 蛋疼的插件
2类似ip “172.69.33.99” 是来自cloudflare套套吗? 但是在官方ip列表 https://www.cloudflare.com/ips/没找到,那是否是伪装的ip?
—–这个已经解决,借助楼下几位分析是在CF IP列表中
看看有没有CF大神一起看看。
也在CF官方询问了,可以围观:https://community.cloudflare.com/t/help-is-this-ip-is-a-fake-cloudflare-ip/140975
落叶随风 大佬有话说 : 2020-1-8 10:58:15
反代套cf?
这个ip像是cf的回源ip
冻猫 大佬有话说 : 2020-1-8 10:59:05
172.69开头的是CF回源服务器IP
affyun.org 大佬有话说 : 2020-1-8 10:59:26
172.64.0.0/13
你为何这么白
mobisww 大佬有话说 : 2020-1-8 11:02:18
yaren 大佬有话说 : 2020-1-8 11:04:28
affyun.org 大佬有话说 : 2020-1-8 10:59
172.64.0.0/13
你为何这么白
哈哈,ip段没仔细研究过yc010t
羞涩 大佬有话说 : 2020-1-8 11:05:40
了解一下IPV4 IP段格式算法
shiro 大佬有话说 : 2020-1-8 11:09:13
http://nginx.org/en/docs/http/ngx_http_realip_module.html
应该搭配这个指令 set_real_ip_from
放到nginx配置文件http块里
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
…
real_ip_header X-Forwarded-For;
real_ip_recursive on;
yaren 大佬有话说 : 2020-1-8 11:17:46
shiro 大佬有话说 : 2020-1-8 11:09
http://nginx.org/en/docs/http/ngx_http_realip_module.html
应该搭配这个指令 set_real_ip_from
这个我有配置过
配置之后,remote_addr就也变成了本机ip (200.200.200.200)了。
所以非常奇怪的是,为啥从cf过来的http_cf_connecting_ip也是本机Ip
yaren 大佬有话说 : 2020-1-8 11:38:07
顶一下,关键是,为什么cf过来的客户地址会是 我vps的ip啊?有没有人遇到过?
难道是openvz的vps有bug吗?或者是母鸡上的请求吗?这个vps还能用吗?