Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #clear iptables
- iptables -F
- iptables -X
- #accept everything no matter port on localhost
- iptables -A INPUT -i lo -j ACCEPT
- #allow established connections
- iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- #allow traffic going to specific outbound ports
- iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
- iptables -A INPUT -p tcp --sport 80 -j ACCEPT
- iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT
- iptables -A INPUT -p tcp --sport 443 -j ACCEPT
- iptables -A OUTPUT -p tcp --dport 5938 -j ACCEPT
- iptables -A INPUT -p tcp --sport 5938 -j ACCEPT
- iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
- iptables -A INPUT -p tcp --sport 53 -j ACCEPT
- iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
- iptables -A INPUT -p udp --sport 53 -j ACCEPT
- #drop anything that doesn't match the rules above
- iptables -A INPUT -j DROP
- iptables -A OUTPUT -j DROP
- iptables -A FORWARD -j DROP
- #!/bin/bash
- #--------------------------------------
- #Clear iptables
- iptables -F -t nat
- iptables -X -t nat
- iptables -F -t filter
- iptables -X -t filter
- #allow forward
- echo '1' > /proc/sys/net/ipv4/ip_forward
- #default policy
- iptables -P INPUT DROP
- iptables -P FORWARD DROP
- iptables -P OUTPUT DROP
- #accept related and established connection
- iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- # DNS
- iptables -A INPUT -p tcp -m tcp --sport 53 -j ACCEPT
- iptables -A INPUT -p udp -m udp --sport 53 -j ACCEPT
- iptables -A OUTPUT -p tcp -m tcp --dport 53 -j ACCEPT
- iptables -A OUTPUT -p udp -m udp --dport 53 -j ACCEPT
- # interfejs LO
- iptables -A INPUT -i lo -s 127.0.0.1 -j ACCEPT
- iptables -A OUTPUT -o lo -d 127.0.0.1 -j ACCEPT
- #WWW
- iptables -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
- iptables -A OUTPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
- #TEAMVIEWER
- iptables -A OUTPUT -o eth0 -p tcp --dport 5938 -m state --state NEW -j ACCEPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement