Tunnel your traffic through AWS with OpenVPN and Juju in 5 minutes

November 15, 2013

# (If you don't already have juju configured and bootstrapped):
sudo apt-get install juju
juju generate-config
 # Edit .juju/environments.yaml to set access-key and secret-key
juju bootstrap --constraints "cpu-power=0 mem=512M" # Override defaults to create a micro instance (default is small)

# (Once you have juju bootstrapped):
OPENVPN_PASSWORD=password # Change this!
juju deploy --to 0 openvpn-as # Reuses bootstrap node for OpenVPN AS
juju set openvpn-as password=$OPENVPN_PASSWORD
juju expose openvpn-as
 # Go to https://instance-dns/ (use juju status to see it), login and accept the EULA (the following commands will fail if EULA has not been accepted)
juju ssh 0 mkdir openvpn_client
juju ssh 0 sudo /usr/local/openvpn_as/scripts/sacli -a openvpn -o openvpn_client/ --cn openvpn get5
juju ssh 0 sudo tar -czf openvpn_client.tgz openvpn_client/
juju ssh 0 rm -rf openvpn_client
juju scp 0:~/openvpn_client.tgz .
juju ssh 0 rm openvpn_client.tgz
tar -xzf openvpn_client.tgz
# On Ubuntu: Use NetworkManager to import openvpn_client/client.ovpn
# On Android: Install https://play.google.com/store/apps/details?id=net.openvpn.openvpn
# Optional: Log into the OpenVPN AS web GUI and enable client to client comms if you want your laptop and phone to talk (useful for e.g. ADB over TCP).