Forked from cc32d9/EOSIO_public_node_DOS_protectrion.sh
Last active
October 6, 2022 09:45
-
-
Save ankh2054/79002404e2c1fd6c0f23ac40894a56fa to your computer and use it in GitHub Desktop.
EOSIO public node DOS protectrion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
case $1 in | |
start) | |
iptables -N eosio-api | |
iptables -N eosio-apisyn | |
iptables -N eosio-p2p | |
iptables -A eosio-api -m hashlimit --hashlimit-above 200/sec --hashlimit-mode srcip --hashlimit-burst 20 --hashlimit-name api_hash -j DROP | |
iptables -A eosio-apisyn -m hashlimit --hashlimit-above 10/sec --hashlimit-mode srcip --hashlimit-burst 20 --hashlimit-name apisyn_hash -j DROP | |
iptables -A eosio-p2p -m hashlimit --hashlimit-above 10/min --hashlimit-mode srcip --hashlimit-burst 5 --hashlimit-name p2p_hash -j DROP | |
iptables -A INPUT -p tcp -m tcp --dport 9000:9999 --tcp-flags FIN,SYN,RST,ACK SYN -j eosio-p2p | |
iptables -A INPUT -s 77.68.122.201/32 -j ACCEPT | |
iptables -A INPUT -p tcp -m tcp --dport 80 --tcp-flags FIN,SYN,RST,ACK SYN -j eosio-apisyn | |
iptables -A INPUT -p tcp -m tcp --dport 443 --tcp-flags FIN,SYN,RST,ACK SYN -j eosio-apisyn | |
iptables -A INPUT -p tcp -m tcp --dport 80 -j eosio-api | |
iptables -A INPUT -p tcp -m tcp --dport 443 -j eosio-api | |
;; | |
stop|flush) | |
iptables -D INPUT -p tcp -m tcp --dport 80 --tcp-flags FIN,SYN,RST,ACK SYN -j eosio-apisyn | |
iptables -D INPUT -p tcp -m tcp --dport 443 --tcp-flags FIN,SYN,RST,ACK SYN -j eosio-apisyn | |
iptables -D INPUT -p tcp -m tcp --dport 80 -j eosio-api | |
iptables -D INPUT -p tcp -m tcp --dport 443 -j eosio-api | |
iptables -D INPUT -s 77.68.122.201/32 -j ACCEPT | |
iptables -D INPUT -p tcp -m tcp --dport 9000:9999 --tcp-flags FIN,SYN,RST,ACK SYN -j eosio-p2p | |
iptables -F eosio-api | |
iptables -F eosio-apisyn | |
iptables -F eosio-p2p | |
;; | |
save) | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment