Advertisement
Cyre

SSR Filtros

Feb 16th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.42 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. service iptables restart
  4. iptables -F
  5. iptables -P INPUT DROP
  6. iptables -P FORWARD DROP
  7. iptables -P OUTPUT DROP
  8.  
  9. # Activando estados
  10. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  11. iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
  12. iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  13.  
  14. # Pasarela
  15. iptables -A INPUT -i lo -m state --state NEW -j ACCEPT
  16. iptables -A INPUT -i eth1 -s 10.110.3.0/24 -p icmp -m state --state NEW -j ACCEPT
  17. iptables -A INPUT -p udp --dport 53 -m state --state NEW -j ACCEPT
  18. iptables -A INPUT -p tcp -m multiport --dport 80,443,8443 -m state --state NEW -j ACCEPT
  19. iptables -A INPUT -p tcp --dport 22 -d 10.110.3.1 -m state --state NEW -j ACCEPT
  20.  
  21. # Red Interna
  22. iptables -A FORWARD -p icmp -i eth1 -s 10.110.3.0/24 -m state --state NEW -j ACCEPT
  23. iptables -A FORWARD -p udp --dport 53 -m state --state NEW -j ACCEPT
  24. iptables -A FORWARD -p tcp -m multiport --dport 80,443,8443 -m state --state NEW -j ACCEPT
  25. iptables -A FORWARD -p tcp --dport 22 -d 10.110.1.24 -m state --state NEW -j ACCEPT
  26.  
  27. # Salida
  28. iptables -A OUTPUT -p icmp -m state --state NEW -j ACCEPT
  29. iptables -A OUTPUT -p udp --dport 53 -m state --state NEW -j ACCEPT
  30. iptables -A OUTPUT -p tcp -m multiport --dport 80,443,8443 -m state --state NEW -j ACCEPT
  31.  
  32.  
  33. # FALTA LOG
  34. iptables -A FORWARD -p tcp --dport 22 -m state --state NEW -j LOG --log-prefix "SSH_ATEMPTS"
  35. iptables-save
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement