CC防御
一、连接服务器,使用iftop;
sudo apt update #更新 |
二、iftop查看异常流量的IP,然后使用防火墙禁止;
使用安全组规则将异常流量直接隔离,有些厂商不能设置拒绝的策略,那么只能等待流量到达服务器中,然后在处理;
具体方法:
iptables -I INPUT -s IP -j DROP |
或者直接禁止这个IP段访问
iptables -I INPUT -s 121.1.1.0/24 -j DROP |
iptables命令
查看规则:
iptables -L
: 列出当前防火墙规则。默认会列出filter
表的规则。iptables -t <table> -L
: 列出特定表的规则,其中<table>
可以是filter
、nat
、或mangle
。添加规则:
iptables -A <chain> -i <interface> -p <protocol> --dport <port> -j <target>
: 添加规则到指定链。例如,允许SSH流量:
iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
防火墙规则
添加防火墙规则表达式
第一
(cf.threat_score ge 5 and not cf.client.bot) or (not http.request.version in {“HTTP/1.2” “HTTP/2” “HTTP/3” “SPDY/3.1”}) or (not http.user_agent contains “Mozilla/“)
第二
(cf.client.bot) or (http.user_agent contains “duckduckgo”) or (http.user_agent contains “facebookexternalhit”) or (http.user_agent contains “Feedfetcher-Google”) or (http.user_agent contains “LinkedInBot”) or (http.user_agent contains “Mediapartners-Google”) or (http.user_agent contains “msnbot”) or (http.user_agent contains “Slackbot”) or (http.user_agent contains “TwitterBot”) or (http.user_agent contains “ia_archive”) or (http.user_agent contains “yahoo”)