If anyone else comes across this, it was amazingly simple. First I backed up my current good iptables configuration like this:
Code:
sudo iptables-save > ~/iptables/working.iptables.rules
Then I took the sample iptables file that I linked above (putting it below in case it disappears in the future) and saved it as ~/iptables/vpn.iptables.rules
Code:
# Begin Here
*filter
:OUTPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
# Comment
## Wireless Rules
# DHCP and DNS
-I INPUT -i wlan0 -p udp --dport 67:68 --sport 67:68 -j ACCEPT
-A INPUT -i wlan0 -p udp --sport 53 -j ACCEPT
-A OUTPUT -o wlan0 -p udp --dport 53 -j ACCEPT
# PPTP and GRE for outbound VPN connections
-I OUTPUT -o wlan0 -p tcp --dport 1723 -j ACCEPT
-I OUTPUT -o wlan0 --proto gre -j ACCEPT
# Allow comms with home network
-I OUTPUT -o wlan0 -d 192.168.99.0/24 -j ACCEPT
## VPN Firewall Rules
# Allow anything outbound
-I OUTPUT -o ppp0 -j ACCEPT
## Loopback Firewall Rules
# Allow anything
-I INPUT -i lo -j ACCEPT
-I OUTPUT -o lo -j ACCEPT
COMMIT
I then restored iptables using that file like this:
Code:
sudo iptables-restore < ~/iptables/vpn.iptables.rules
And that's it. When I drop my VPN, I can no longer hit any remote resource. When I bring it back up, all is well!
Bookmarks