Skip to content

a small script to fire up openvpn and visit the world

Notifications You must be signed in to change notification settings

zenfish/bash-vpn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

A teleportation script to travel to other countries (well, via OpenVPN)

(Probably Mac/Linux only, unles you have bash, openvpn, and various prayers pre-installed....)

A script that tries to create a VPN to a country you specify, and route all your system's traffic through that country.

I ran across autovpn, which I thought a nifty idea, but after it died silently I thought I'd just rewrite it as a shell script... because... if there's anything that Go shouldn't be used for it's to execute shell commands... IMHO, at least :)

That said, Autovpn probably works better and people seem to like it, so by all means use that over this. Mine is untested, mostly done for fun, so... don't trust your life with it or anything. There's probably a better script elsewhere else, but... scriptum, ergo sum.

Usage:

vpn.sh country-code

Country codes are two digit codes, like "US", "JP", and the like.

If you want to see the output of OpenVPN doing its job, tack on "DEBUG" after the country-code, like:

vpn.sh US DEBUG

Finally, a special "list" argument may be used to get a list of all the countries currently running VPNs - e.g.

vpn.sh list

The program stashes a cached copy of the VPN db in your home directory - in $HOME/.vpnlist. This is done to try and prevent hammering the VPN Gate project server. It'll fetch a new copy if that file doesn't exist or if it's over an hour old.

Output

If things go well, looks something like this... Control-C should kill it off:

$ ./vpn.sh FR
cache found, checking age...
cache is still minty fresh
looking for country FR in server list
Starting up VPN, you should be magically transported to FR if this all works....


my current ip: 91.121.90.212

trying to get my current location...

Country ... FR

^C

$

Details

The script -

  • fetches a list of servers and VPN configuration files from the awesome VPN Gate project

  • tries to match the specified country code from the list, bailing if it can't

  • fires up OpenVPN with the appropriate configuration gotten from VPN Gate

  • if the connection appears to have worked, tries to tell you what your new IP and country are.

Hopefully Control-C will kill off the script. If things are wonky, you can try to spot the openvpn process and kill it off, like (in the terminal) -

$ ps axuww|grep openv
zen              54194   0.0  0.0  4268792    860 s006  S+    4:15PM   0:00.00 grep -d skip openv
root             54082   0.0  0.0  4310768   3160 s004  S+    4:15PM   0:00.01 openvpn --script-security 2 --config /var/folders/1w/8x8dq8z96h5821syhxgz6hkm0000gn/T/tmp.DEPdm2Uj
root             54080   0.0  0.0  4316560   5284 s004  S+    4:15PM   0:00.03 sudo openvpn --script-security 2 --config /var/folders/1w/8x8dq8z96h5821syhxgz6hkm0000gn/T/tmp.DEPdm2Uj
$ sudo killall openvpn

Good luck, you'll probably need it.

About

a small script to fire up openvpn and visit the world

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages