5

vpnbook.com offers a free openVPN service. This is one of their files: http://paste.ubuntu.com/7231382/ with the name vpnbook-uk1-tcp80.ovpn.

I want to convert it to 3 files to be usable in network-manager-openvpn:

enter image description here

4

I created a script here to automate fetching password & zip files from vpn websites such as vpnbook.com, extracting the ca, cert, and key data from the ovpn files, and updating the opvn files so the certs should just import for you.

4

Copy the text between <ca> and </ca>, paste it in a text editor and save it as ca.crt. The text between <cert> and </cert> should be saved as client.crt and the text between <key> and </key> should be saved as client.key.


You must set some advanced options in accordance to the configuration file. I couldn't connect to servers using port 80, but port 443 works for me. This is what I did:

enter image description here enter image description here enter image description here

  • Password with Cert would be my guess. – Ian Hyzy Apr 11 '14 at 20:03
  • @onrea answer updated. – Eric Carvalho Apr 11 '14 at 20:23
  • @Eric, Thanks, Worked charming, However, it's odd why network manager does not support .ovpn files! – mini Apr 12 '14 at 5:09
0

since all ovpn files are all simple plain text files, you can create a python scripts with the following logic:

(1) read the contents of ovpn text file;

(2) grab relevant text between tags using regular expression;

def grabBetweenTag(tagName, fileContents):

    betweentag = re.findall('<'+tagName+'>.*\n(^.*$.*\n[\S\n]+.*$\n)</'+tagName+'>', fileContents, re.MULTILINE)

    return betweentag[0]

grabBetweenTag('ca', fileContents)
grabBetweenTag('cert', fileContents)
grabBetweenTag('key', fileContents)

(3) copy that text into a new text file;

(4) the mapping between tags and new-text-file to create looks like this:

  • All text between '<ca>' and '</ca>'will be used to create '**ca.crt';
  • All text between '<cert>' and '</cert>' will be used to create '**client.crt';
  • All text between '<key>' and '</key>' will be used to create '**client.key'.

I created this repository as an example implementation of that logic to grab all ovpn files and create certificates

*.ovpn --> *-ca.crt, *-client.crt, *-client.key

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.