SHARE
TWEET

Untitled

iNotLazo Nov 16th, 2019 140 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  #!/bin/bash
  2.  
  3. ALLOWED="21 22 80 48596 25565 26600 6379 45700 8087 443 27017 433 8080 3389 58963 8192 8193 8194 8195"
  4.  
  5. iptables -P INPUT ACCEPT
  6. iptables -F
  7. iptables -X
  8. iptables -Z
  9.  
  10. iptables -A INPUT -i lo -j ACCEPT
  11. iptables -A OUTPUT -o lo -j ACCEPT
  12.  
  13. for port in $ALLOWED; do
  14. echo "Aceptando el puerto TCP $port..."
  15. iptables -A INPUT -p tcp --dport $port -j ACCEPT
  16. done
  17.  
  18. for port in $ALLOWED; do
  19. echo "Aceptando el puerto UDP $port..."
  20. iptables -A INPUT -p udp --dport $port -j ACCEPT
  21. done
  22.  
  23. iptables -A INPUT -s 18.209.80.3 -j ACCEPT
  24. iptables -A INPUT -s 54.87.231.232 -j ACCEPT
  25. iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  26.  
  27. iptables -A INPUT -p udp -j DROP
  28. iptables -A INPUT -p tcp --syn -j DROP
  29. iptables -N syn_flood
  30. iptables -A INPUT -p tcp --syn -j syn_flood
  31. iptables -A syn_flood -m limit --limit 3/s --limit-burst 9 -j RETURN
  32. iptables -A syn_flood -j DROP
  33. iptables -A INPUT -p icmp -m limit --limit  1/s --limit-burst 1 -j ACCEPT
  34. iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j LOG
  35. iptables -A INPUT -p tcp --syn --dport 25565 -m connlimit --connlimit-above 3 -j REJECT
  36. iptables -A INPUT -p tcp --syn --dport 26600 -m connlimit --connlimit-above 3 -j REJECT
  37. iptables -A INPUT -p tcp --syn --dport 48596 -m connlimit --connlimit-above 3 -j REJECT
  38. iptables -A INPUT -p tcp --syn --dport 58963 -m connlimit --connlimit-above 3 -j REJECT
  39.  
  40. ufw allow 8087
  41. ufw allow 6379
  42. ufw allow 45700
  43. ufw allow 27017
  44. ufw allow 433
  45. ufw allow 3389
  46. ufw allow 8192
  47. ufw allow 8193
  48. ufw allow 8194
  49. ufw allow 8195
  50. ufw allow 20
  51. ufw allow 21
  52. ufw allow 22
  53. ufw allow 80
  54. ufw allow 25565
  55. ufw allow 26600
  56. ufw allow 48596
  57. ufw allow 58963
  58. ufw allow 8080
  59. ufw enable
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top