Hugo博客公告弹窗

屏蔽拦截风险、爬虫、恶意IP扫描

屏蔽 Censys 的 IP 段

sudo ufw insert 1 deny from 162.142.125.0/24 to any
sudo ufw insert 1 deny from 167.94.138.0/24 to any
sudo ufw insert 1 deny from 167.94.145.0/24 to any
sudo ufw insert 1 deny from 167.94.146.0/24 to any
sudo ufw insert 1 deny from 167.248.133.0/24 to any
sudo ufw insert 1 deny from 199.45.154.0/24 to any
sudo ufw insert 1 deny from 199.45.155.0/24 to any
sudo ufw insert 1 deny from 206.168.34.0/24 to any

v6单独添加,首先查看编号

sudo ufw status numbered

再把以下插入到v6最上方,假设最上方的v6编号是20

sudo ufw insert 20 deny from 2602:80d:1000:b0cc:e::/80
sudo ufw insert 21 deny from 2620:96:e000:b0cc:e::/80
sudo ufw insert 22 deny from 2602:80d:1003::/112
sudo ufw insert 23 deny from 2602:80d:1004::/112

屏蔽单独的风险IP地址

sudo ufw insert 1 deny from 94.154.33.153 to any
sudo ufw insert 1 deny from 185.220.101.29 to any
sudo ufw insert 1 deny from 138.197.191.87 to any
sudo ufw insert 1 deny from 152.42.217.201 to any
sudo ufw insert 1 deny from 149.88.106.138 to any
sudo ufw insert 1 deny from 179.43.191.19 to any
sudo ufw insert 1 deny from 146.190.111.4 to any
sudo ufw insert 1 deny from 185.220.101.190 to any
sudo ufw insert 1 deny from 192.42.116.178 to any

屏蔽IP范围

包含一些垃圾IDC疯狂扫描的情况

sudo ufw insert 1 deny from 20.171.206.0/24 to any
sudo ufw insert 1 deny from 52.230.152.0/24 to any
sudo ufw insert 1 deny from 52.233.106.0/24 to any
sudo ufw insert 1 deny from 152.32.128.0/17 to any
sudo ufw insert 1 deny from 103.218.243.0/24 to any

重新加载UFW生效

sudo ufw reload

清空所有屏蔽

curl -sS -O https://raw.githubusercontent.com/woniu336/open_shell/main/clear_ufw_rules.sh && chmod +x clear_ufw_rules.sh && ./clear_ufw_rules.sh
CC BY-NC-SA 4.0 转载请注明
最后更新于 2024-11-23 15:12
clarity统计