Skip to content

Instantly share code, notes, and snippets.

@kbhaines
Created February 11, 2017 15:30
Show Gist options
  • Save kbhaines/5274bd781a47eb16bafcf1f6fa4719de to your computer and use it in GitHub Desktop.
Save kbhaines/5274bd781a47eb16bafcf1f6fa4719de to your computer and use it in GitHub Desktop.
NordVpn connection starter
# Assumes you've installed the nordvpn zip file into /etc/openvpn
#
# To use:
# 1) create a file /etc/openvpn/nordvpn with username on line 1, password on line 2
# 2) source this into your shell
# 3) Run:
# vpn # defaults to a random VPN in the UK
# vpn nl # connects to random VPN in Netherlands
# vpn uk1 # connects to random VPN starting with 'uk1'
vpn() {
VPN=/etc/openvpn
prefix=${1:-uk}
target=`ls $VPN/$prefix*nordvpn*udp*|shuf -n 1`
echo "Connecting to $target"
sudo openvpn --config $target --auth-user-pass $VPN/nordvpn --script-security 2 --up $VPN/update-resolv-conf
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment