早上起床就发现 服务器负载很高 平时基本上访问量不大 不可能负载超过 1的. 用的是 htop 命令.
登陆 CloudFlare CDN 也证实了这种不寻常 可以看到 未被缓存的访问 很多很多. 虽然这样 网站还是打开很快 似乎不受任何影响.
不过这种现状一直持续了有几个小时 我担心这么下去服务器不行 我设置了邮件警告 每几分钟都会检查一下系统负载 高于3的话就会发邮件.
登陆 SSH后访问 LOG记录 /var/log/apache2/access.log 发现 有大量的API访问记录.
3 100.1.241.126 - - [12/Aug/2015:12:55:27 +0000] "GET /api/fortune/ HTTP/1.1 " 200 545 "-" "Totems.us fortune teller player interact" 4 100.1.241.126 - - [12/Aug/2015:12:55:27 +0000] "GET /api/fortune/ HTTP/1.1 " 200 6867 "-" "Totems.us fortune teller player interact" 5 100.1.241.126 - - [12/Aug/2015:12:55:27 +0000] "GET /api/fortune/ HTTP/1.1 " 200 542 "-" "Totems.us fortune teller player interact" 6 100.1.241.126 - - [12/Aug/2015:12:55:27 +0000] "GET /api/fortune/ HTTP/1.1 " 200 663 "-" "Totems.us fortune teller player interact" 7 100.1.241.126 - - [12/Aug/2015:12:55:27 +0000] "GET /api/fortune/ HTTP/1.1 " 200 580 "-" "Totems.us fortune teller player interact" 8 100.1.241.126 - - [12/Aug/2015:12:55:27 +0000] "GET /api/fortune/ HTTP/1.1 " 200 527 "-" "Totems.us fortune teller player interact" 9 100.1.241.126 - - [12/Aug/2015:12:55:28 +0000] "GET /api/fortune/ HTTP/1.1 " 200 6764 "-" "Totems.us fortune teller player interact" 10 100.1.241.126 - - [12/Aug/2015:12:55:28 +0000] "GET /api/fortune/ HTTP/1.1 " 200 556 "-" "Totems.us fortune teller player interact"
显然 是来自这个IP频繁持久的调用 我提供的免费 API. 我从其它记录里发现了 尝试 root 帐号 远程 登陆 SSH的 但我已经设置不能用 root 登陆 所以果断 一起 屏蔽了.
果然 效果很明显 CPU使用又恢复正常了.
CLOUDFLARE 也马上看出效果了.
我应该加一条 ‘合理使用’ 条例 在我提供的API使用说明里.
英文: https://helloacm.com/abuse-use-of-api-server-attacked-and-ip-blocked-case-study/
GD Star Rating
loading...
本文一共 275 个汉字, 你数一下对不对.loading...
上一篇: 一年的信用卡消费 换来 180英镑点卷
下一篇: FACEBOOK 爬虫使用 IPv6 地址
扫描二维码,分享本文到微信朋友圈
你这API的事情是炫技,麻烦迟早的事.
不怕麻烦 有麻烦才有学习 才能进步