Skip to content

Instantly share code, notes, and snippets.

@whoamiTM
Last active October 3, 2018 02:06
Show Gist options
  • Save whoamiTM/928ac404f31edb08ffcf29be121c76c2 to your computer and use it in GitHub Desktop.
Save whoamiTM/928ac404f31edb08ffcf29be121c76c2 to your computer and use it in GitHub Desktop.
VPN Kill Switch | ChromeOS or Linux | .sh or command line syntax
#! /bin/bash
#########################################################################
##### VPN Kill Switch Linux
#########################################################################
#
# Set Varibles
vpn_ip=55.55.55.55
vpn_interface=tun0
#
sudo iptables -F
sudo iptables -P INPUT DROP
sudo iptables -P FORWARD DROP
sudo iptables -P OUTPUT DROP
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -s $vpn_ip -j ACCEPT
sudo iptables -A INPUT -i $vpn_interface -j ACCEPT
sudo iptables -A INPUT -j DROP
sudo iptables -A OUTPUT -o lo -j ACCEPT
sudo iptables -A OUTPUT -d $vpn_ip -j ACCEPT
sudo iptables -A OUTPUT -o $vpn_interface -j ACCEPT
sudo iptables -A OUTPUT -j DROP
sudo ip6tables -F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment