Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # RESET RULES
  4. iptables -t filter -F
  5. iptables -t filter -X
  6.  
  7. # ALLOW LOOPBACK
  8. iptables -t filter -A INPUT -i lo -j ACCEPT
  9. iptables -t filter -A FORWARD -i lo -j ACCEPT
  10. iptables -t filter -A OUTPUT -o lo -j ACCEPT
  11.  
  12. # Autorisation des ports
  13. iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  14. iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
  15.  
  16. # Activation du forward
  17. iptables -t nat -A POSTROUTING -j MASQUERADE
  18. # REDIRECTION
  19. iptables -t nat -A PREROUTING -p tcp ! -s 192.168.20.187 --dport 8080 -j DNAT --to-destination 192.168.20.187:443
  20.  
  21. iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
  22. iptables -A FORWARD -p tcp --dport 443 -j ACCEPT
  23.  
  24. # SETUP IPV4 DEFAULT POLICY
  25. iptables -t filter -P INPUT DROP
  26. iptables -t filter -P FORWARD DROP
  27. iptables -t filter -P OUTPUT DROP
  28.  
  29. # SETUP IPV6 DEFAULT POLICY
  30. ip6tables -t filter -P INPUT DROP
  31. ip6tables -t filter -P FORWARD DROP
  32. ip6tables -t filter -P OUTPUT DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement