Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer

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

share|improve this answer
    
Password with Cert would be my guess. – Ian H 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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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