Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. #!/bin/bash
  2. #@Guilherme2041
  3.  
  4. #Apaga todas as regras
  5. iptables -F
  6. iptables -X
  7. iptables -t nat -F
  8. iptables -t nat -X
  9. iptables -t mangle -F
  10. iptables -t mangle -X
  11.  
  12. #Bloquear tudo
  13. iptables -P INPUT DROP
  14. iptables -P OUTPUT DROP
  15. iptables -P FORWARD DROP
  16.  
  17. #Permitir conexões pre-estabelecidas
  18. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  19. iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  20. iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
  21. iptables -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  22.  
  23. #Permitir DNS
  24. iptables -A OUTPUT -p udp --dport 53 -m state --state NEW -j ACCEPT
  25. iptables -A INPUT -p udp --dport 53 -m state --state NEW -j ACCEPT
  26.  
  27. #Permitir SSH
  28. iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  29. iptables -A OUTPUT -p tcp --dport 22 -j ACCEPT
  30.  
  31. #Permitir HTTP/HTTPS
  32. iptables -A INPUT -p tcp --dport 443 -j ACCEPT
  33. iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT
  34. iptables -A INPUT -p tcp --dport 80 -j ACCEPT
  35. iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
  36.  
  37. #Bloquear PING
  38. iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
  39.  
  40. echo Aplicado.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement