10

I need to access VPN from my Ubuntu 12.04.

I see that there is VPN connections > Configure VPN in network manager, but it asks for username and password.

All I have is some .crt, .csr, .key, .ovpn files, which are suited for some windows client.

I'm really newbie with VPN.

I also found this blog post. Is that a way to go?

BuZZ-dEE
  • 14,533
umpirsky
  • 3,852

3 Answers3

14

This is the procedure I followed to get it working. There's a bug in network manager where it doesn't do ovpn import properly - since 2010 (!)

https://bugs.launchpad.net/ubuntu/+source/network-manager-openvpn/+bug/606365

Until that's fixed, I found this site

http://howto.praqma.net/ubuntu/vpn/openvpn-access-server-client-on-ubuntu

PROCEDURE

Create a new folder in your home dir - I called mine vpn.config
Copy your downloaded client.ovpn file into the new folder

Open client.opvn in an editor

Open a new file
Cut the lines between <ca> tags in client.ovpn
Paste into new file, save this file as ca.crt
Remove both <ca> tags from client.ovpn

Open a new file
Cut the lines between <cert> tags in client.ovpn
Paste into new file, save this file as client.crt
Remove both <cert> tags from client.ovpn

Open a new file
Cut the lines between <key> tags in client.ovpn
Paste into new file, save this file as client.key
Remove both <key> tags from client.ovpn

Open a new file - this is the last one :-)
Cut the lines between <tls-auth> tags in client.ovpn
Paste into new file, save this file as ta.key
Remove both <tls-auth> tags from client.ovpn

And remove this line:
key-direction 1


Now position the cursor in client.ovpn, right above the line # -----BEGIN RSA SIGNATURE-----

Insert the following lines

ca ca.crt
cert client.crt
key client.key
tls-auth ta.key 1

Save and close all the files.

Goto Network Manager -> Edit Connections ->VPN
click Import, browse to the modified client.ovpn in the folder you recently created - and where your certificates are, and import that file
Enter vpn username and password if prompted
On the VPN page, select Advanced
On the General Tab, uncheck the first option, "Use custom gateway"

Save

Use...
Eliah Kagan
  • 119,640
tehowe
  • 156
13

Install network-manager-openvpn-gnome from Ubuntu Software Center (usually this is hidden from search results when searching for openvpn unless you click "Show XX technical items" at the bottom of the window).

Or can use terminal (Ctrl+Alt+T):

sudo aptitude install network-manager-openvpn-gnome

After this the option to connect to an openvpn VPN will appear under the

network manager -> vpn connections -> configure vpn

BuZZ-dEE
  • 14,533
Simon B
  • 1,296
0

Solutions to some problems you may have:

No connection/disconnecting WiFi

  • Select configure VPN from the menu.
  • Select the VPN you are having trouble with.
  • Click edit.
  • Click the IPv4 tab.
  • Click Routes
  • Check the box that says "Use this Connection only for resources on its network."

source

Cannot connect to hosts in VPN - Firewall configuration

In this file:

sudo gedit /etc/firestarter/user-pre

add those rules:

iptables -A INPUT -j ACCEPT -s xxx.xxx.xxx.xxx -p esp
iptables -A INPUT -j ACCEPT -s xxx.xxx.xxx.xxx -p udp -m multiport -sports isakmp,10000
iptables -A INPUT -j ACCEPT -i tun+
iptables -A OUTPUT -j ACCEPT -d xxx.xxx.xxx.xxx -p esp
iptables -A OUTPUT -j ACCEPT -d xxx.xxx.xxx.xxx -p udp -m multiport -dports isakmp,10000
iptables -A OUTPUT -j ACCEPT -o tun+

Replace xxx.xxx.xxx.xxx with IP address of your VPN Gateway.

source