Update: some instructions were missing.
The client side of an OpenVPN setup is dead-easy now with the n-m in feisty. Simply sudo apt-get install network-manager-openvpn and fill in the forms. The server side of a forward-everything-over-the-VPN setup is slightly more difficult, but this should do the trick:
sudo -i
apt-get install openvpn dnsmasq openssl
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
Add this last line to /etc/rc.local before exit 0, uncomment the ipv4 forwarding line in /etc/sysctl.conf and grab my openvpn config from kaarsemaker.net (save it as /etc/openvpn/home.conf). This config is pretty standard except for the following
- It expects all traffic to be routed through the VPN, I use this because I mainly use the VPN for safe remote working over unprotected wifi
- It uses a tcp connection instead of udp because the vpn server is behind nat and I want to test it from behind the same nat (yes, the test setup does 3 nat steps before traffic goes out to the internet!)
- It uses a local DNS server on the VPN host (that’s why dnsmasq was being installed earlier)
Read the config and if you use 10.8.0.0/24 in your network, change the IP addresses. Then place it in /etc/openvpn and edit /etc/default/openvpn so the “home” VPN is started automatically.
With the config in place, you only have to generate the PKI for the VPN. Fortunately openvpn makes this all very easy for you with the easy-rsa scripts. First you edit /etc/openvpn/easy-rsa/vars and then you can simply run a few of the easy-rsa scripts:
cp -r /usr/share/doc/openvpn/examples/easy-rsa /etc/openvpn
cd /etc/openvpn/easy-rsa
source ./vars
./clean-all
./build-ca
./build-key-server server
./build-dh
./build-key client1
If you want to support more than one client, repeat the last command with different names. Now copy the keys/certificates to the appropriate places:
cp /etc/openvpn/easy-rsa/keys/{ca.crt,server.crt,server.key,dh1024.pem} /etc/openvpn
Make sure that each client gets its .key and .crt file and the ca.crt file. Now restart openvpn and you’re ready to connect to it!
To connect to your freshly created openvpn server from another machine which uses network-manager, simply rightclick on the n-m icon, select “VPN Connections” and “Configure VPN”. The following screenshots are my setup, which works with the example OpenVPN setup and the freshly generated keys:


And now I can safely use unprotected wifi, with 2 mouseclicks n-m can switch the VPN connection on and off. Yes, OpenVPN and network-manager rock!