![iptables TCP 規則](https://rvso.com/image/770089/iptables%20TCP%20%E8%A6%8F%E5%89%87.png)
iptables -t raw -F
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Mozil" --algo kmp --to 65535 -m tcp --dport 1000 # You can change the port here
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Saf" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Edge" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Oper" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Chrom" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Gecko" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Andr" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "exch" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Fire" --algo kmp --to 65535 -m tcp --dport 1000
iptables -t raw -I PREROUTING -j DROP -p tcp -m string --string "Wind" --algo kmp --to 65535 -m tcp --dport 1000
如果我嘗試訪問http://127.0.0.1:1000/它拒絕連接,但如果我嘗試https://127.0.0.1:1000我可以訪問,為什麼?順便說一句,謝謝!
這是一個應用程式伺服器在第 7 層受到 DDoS 攻擊。如果我使用相同的規則阻止連接埠 443 會怎麼樣?
答案1
因為HTTP是明文的,而HTTPS是加密的。
除此之外,我強烈建議不要使用此方法來阻止特定的用戶代理 - 它應該在 Web 伺服器本身內完成。