早上起床就发现 服务器负载很高 平时基本上访问量不大 不可能负载超过 1的. 用的是 htop 命令.

htop-loadaverage
登陆 CloudFlare CDN 也证实了这种不寻常 可以看到 未被缓存的访问 很多很多. 虽然这样 网站还是打开很快 似乎不受任何影响.
cloudflare-uncached-requests
不过这种现状一直持续了有几个小时 我担心这么下去服务器不行 我设置了邮件警告 每几分钟都会检查一下系统负载 高于3的话就会发邮件.
system-email-high-load-average
登陆 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 登陆 所以果断 一起 屏蔽了.
block-ips
果然 效果很明显 CPU使用又恢复正常了.
normal-htop
CLOUDFLARE 也马上看出效果了.
cloudflare-fixed-traffic
我应该加一条 ‘合理使用’ 条例 在我提供的API使用说明里.
英文: https://helloacm.com/abuse-use-of-api-server-attacked-and-ip-blocked-case-study/
强烈推荐
- 英国代购-畅购英伦
- TopCashBack 返现 (英国购物必备, 积少成多, 我2年来一共得了3000多英镑)
- Quidco 返现 (也是很不错的英国返现网站, 返现率高)
- 注册就送10美元, 免费使用2个月的 DigitalOcean 云主机(性价比超高, 每月只需5美元)
- 注册就送10美元, 免费使用4个月的 Vultr 云主机(性价比超高, 每月只需2.5美元)
- 注册就送10美元, 免费使用2个月的 阿里 云主机(性价比超高, 每月只需4.5美元)
- 注册就送20美元, 免费使用4个月的 Linode 云主机(性价比超高, 每月只需5美元) (折扣码: PodCastInit2022)
- PlusNet 英国光纤(超快, 超划算! 用户名 doctorlai)
- 刷了美国运通信用卡一年得到的积分 换了 485英镑
- 注册就送50英镑 – 英国最便宜最划算的电气提供商
- 能把比特币莱特币变现的银行卡! 不需要手续费就可以把虚拟货币法币兑换
微信公众号: 小赖子的英国生活和资讯 JustYYUK