Last active
September 15, 2019 23:28
-
-
Save mrjamiebowman/b139da2092409054452c4b1249c0f787 to your computer and use it in GitHub Desktop.
VPN Killswitch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo ufw reset | |
sudo ufw default deny incoming | |
sudo ufw default allow outgoing | |
sudo ufw allow 4444/tcp | |
sudo ufw enable | |
# restart network manager | |
sudo service network-manager restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./hack-off.sh | |
# connect to vpn | |
nordvpn c | |
# take all connections down as a precaution before resetting ufw | |
sudo ifconfig eth0 down | |
sudo ifconfig wlan0 down | |
# reset ufw settings | |
sudo ufw --force reset | |
# set default behaviour of and enable ufw | |
sudo ufw default deny incoming | |
sudo ufw default deny outgoing | |
sudo ufw enable | |
# allow local traffic | |
sudo ufw allow to 192.168.0.1/24 | |
sudo ufw allow in from 192.168.0.1/24 | |
# bring connections back up | |
sudo ifconfig eth0 up | |
sudo ifconfig wlan0 up | |
# allow vpn connection to be established | |
sudo ufw allow out 1194/udp | |
# allow vpn ip address | |
#sudo ufw allow in from $MY_IP to any | |
# allow all traffic over VPN interface | |
sudo ufw allow in on tun0 from any to any | |
sudo ufw allow out on tun0 from any to any | |
# restart network manager | |
sudo service network-manager restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment