Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # RESET RULES
- iptables -t filter -F
- iptables -t filter -X
- # ALLOW LOOPBACK
- iptables -t filter -A INPUT -i lo -j ACCEPT
- iptables -t filter -A FORWARD -i lo -j ACCEPT
- iptables -t filter -A OUTPUT -o lo -j ACCEPT
- # Autorisation des ports
- iptables -A INPUT -p tcp --dport 22 -j ACCEPT
- iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
- # Activation du forward
- iptables -t nat -A POSTROUTING -j MASQUERADE
- # REDIRECTION
- iptables -t nat -A PREROUTING -p tcp ! -s 192.168.20.187 --dport 8080 -j DNAT --to-destination 192.168.20.187:443
- iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
- iptables -A FORWARD -p tcp --dport 443 -j ACCEPT
- # SETUP IPV4 DEFAULT POLICY
- iptables -t filter -P INPUT DROP
- iptables -t filter -P FORWARD DROP
- iptables -t filter -P OUTPUT DROP
- # SETUP IPV6 DEFAULT POLICY
- ip6tables -t filter -P INPUT DROP
- ip6tables -t filter -P FORWARD DROP
- ip6tables -t filter -P OUTPUT DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement