vpnkillswitch-on 491 Bytes
Newer Older
Jay Ta'ala's avatar
Jay Ta'ala committed
1
2
3
#!/bin/bash

# Default policies
4
5
sudo /usr/bin/ufw default deny incoming
sudo /usr/bin/ufw default deny outgoing
Jay Ta'ala's avatar
Jay Ta'ala committed
6
7

# Openvpn interface (adjust interface accordingly to your configuration)
8
sudo /usr/bin/ufw allow out on tun0
Jay Ta'ala's avatar
Jay Ta'ala committed
9
10

# Openvpn (adjust port accordingly to your vpn setup)
11
sudo /usr/bin/ufw allow out to any port 1194
Jay Ta'ala's avatar
Jay Ta'ala committed
12
13
14
15
16
17

# process arguments
while getopts "t:" opt; do
	case ${opt} in
		t)	
			echo "allow outgoing traffic to $OPTARG"
18
			sudo /usr/bin/ufw allow out to $OPTARG;;
Jay Ta'ala's avatar
Jay Ta'ala committed
19
20
	esac
done