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:
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityvpnbook.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:
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.
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:
.ovpn
files!
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:
I created this repository as an example implementation of that logic to grab all ovpn files and create certificates
In Gnome you can just click the + to add VPN:
And then select OpenVPN here:
Then you can open the .ovpn
file.
Unfortunately it doesn't provide a way to load a new .opvn
into an existing VPN config, so the easiest way if you want to change an existing VPN is to delete it and make a new one.