31

Gnome network manager can't import any openvpn config file (.ovpn) after upgrading ubuntu to 16.04 version;

I get the following error message when I try to import openvpn config file:

The file 'file-x.ovpn' could not be read or does not contain recognized VPN connection information Error: the plugin does not support import capability
  • This has been resolved and answered here: askubuntu.com/questions/760664/ubuntu-16-04-openvpn?lq=1 – Kestrell Apr 26 '16 at 5:14
  • 1
    Hi Kestrell ...Thank you for your answer************* I already installed required packages and successfully setup openvpn manually: **********but my problem is that i can't import openvpn config files using network manager – ahooee Apr 30 '16 at 11:12
  • 2
    Did you ever get this working? – Seth May 16 '16 at 2:14
  • before reading any more, check that network-manager-openvpn is installed. – FlipMcF Mar 5 at 21:26
19

My setup

I also had the same issue, trying to import on an Ubuntu 16.04 client a .ovpn file produced by a home pritunl server.

The .ovpn file contained comment lines (#) as well as inline certificates (<ca>, <tls-auth>, <cert>, <key>). And there was no apparent reason to remove comments or keys. This same .ovpn had already been successfully imported into the Kubuntu 16.04 network manager, with only a warning about reneg-sec being too high; A clue to import issues on Ubuntu 16.04.

Solving the OP's errors

  1. The reneg-sec value is too high and encounters known import bug:

    reneg-sec 2592000
    

    Comment it out or use default value 3600.

    #reneg-sec 2592000
    

    This value can be re-set from Advanced settings in VPN config tab under:

    reneg-sec

  2. The config had two remote definitions:

    remote hostname.org 14195 udp6
    remote hostname.org 14195 udp
    remote-random
    

    Try with only one:

    #remote hostname.org 14195 udp6
    remote hostname.org 14195 udp
    #remote-random
    

After these two modifications, there were no import errors.

Further issue with remote configuration

Although there was no import error any more, the remote was not imported properly, i.e. the port and protocol were not properly parsed, so I had to further break the remote directive down in the .ovpn file as follows

    remote hostname.org
    port 14195
    proto udp

Summary

My .ovpn file contained comments as well as inline certificates, etc.. After reading some other posts, I thought the problem lied in the inline files or the comments, so I split the inline certificates and keys into separate files and removed all comments.

So in the end, after applying the above fixes, the .ovpn file with the inline keys and comments was imported.

  • 2
    Thanks the reneg-sec value is the reason I could not import my .ovpn file. There is a network-manager bug report: bugs.launchpad.net/ubuntu/+source/network-manager-openvpn/+bug/… – Cas Jul 6 '17 at 10:00
  • 1
    Thanks, I also had to check "Use LZO data compression" in the advanced options of Network Manager (I use OpenVPN Access Server). And be careful of DNS leaks! Without firewall rule to block DNS queries on the Ethernet / WiFi interface, there was a DNS leak, even when using my own DNS server IP and with "block-outside-dns" rule for OpenVPN 2.3.10 (via Network Manager). You can check for DNS leaks on the website dnsleaktest.com and double check with a tool like Wireshark. – baptx Jan 18 '18 at 19:47
  • Splitting the certificates in other files allowed me to import successfully. I also had to use tls-remote instead of verify-x509-name for it to work – Pierre de LESPINAY May 12 '18 at 12:55
  • Googling, it seems there are MANY MANY reasons why the file could not be parsed. Isn't a way to get a more verbose message on what caused the parsing error trying to import the .ovpn file ? – Antonello May 9 at 14:46
14

The issue for me was the following line in my .ovpn file:

route remote_host 255.255.255.255 net_gateway

Commenting out this line allowed me to import the connection.

  • 3
    Ubuntu 18.04 and still had this issue. Commenting this line out (from Sophos XG config) fixed it. – Jasin Jun 3 '18 at 2:32
  • ubuntu 19.04 same issue, commenting out this line fixed error – stetoc Aug 5 at 8:36
10

I also have Ubuntu 16.04, and the same problem occurs. The solution is not a very good solution, because you need another computer already connected with the VPN.

Check that you have already installed openvpn and network-manager, from the terminal:

$ sudo apt install openvpn network-manager-openvpn network-manager-openvpn-gnome
$ sudo systemctl restart network-manager

In general, this should work, but in very few cases (and i don't know why - i suppose that's probably a bug) a .ovpn can't be imported.

So, follow theses steps:

  1. On the computer that already have a created connection with the VPN, select the vpn connection

  2. make empty the password

  3. click on export button

At this point, you'd have a ".conf" file.

  1. open the ".conf" file and edit any parts that reference files on your computer if exists

  2. In your computer, create a new connection with the ".conf" file.

  • that happened to me as well. Luckily I had a laptop already configured and could use that trick to configure my new computer. Quick note though: I had to configure username, password, key file and advanced TLS key file again. – igorsantos07 Aug 2 '16 at 18:15
2

In my case it was necessary to remove all the comments (starting with #) from the *.ovpn. Some people found also that the line containing "remote SERVER NNNN" should be split into "remote SERVER" and "port NNNN".

  • 1
    I can confirm that removing the comments from the .ovpn file resolved my issue. – George D Oct 31 '16 at 10:22
1
$ sudo openvpn --config file.ovpn

worked for me - I can tunnel, however I need to remember local IPs since I have no local DNS configured.

0

Edit *.ovpn file

Probably this is caused by settings in the .opvn file that can't be parsed.

First make sure you have the needed packages installed:

sudo apt update && sudo apt install network-manager-openvpn-gnome network-manager-openvpn openvpn

If it still fails, edit the *.ovpn file in a text editor and strip out the following lines that break the import.

<he> tag

If there is a <he> tag in the client ovpn config files, delete those lines. It's not needed:

<he>
...
</he>

Multiple connection details

If there is something like:

<connection>
remote <ip> 443 tcp-client
</connection
<connection>
remote <ip> 1194 udp
</connection>

Replace that section with this:

remote <ip> 1194 udp

The import stumbles upon multiple connections and doesn't support the <connection> tag. At least not in 16.04-17.04.

That's all, IMHO you can keep comments, they make no difference.

After you deleted the tag and edited the connection part, try to import the modified *.ovpn file. Solution from this blog post.

0

For me, I had to change the following in the .ovpn file:

remote ***.org 443 tcp-client

To:

proto tcp
remote ***.org 443

And also, as pointed by @Kostas Filios I had to change this part to a comment:

#reneg-sec 2592000
0

I had this problem while importing the .ovpn file with the network manager. I fixed it by changing my remote line from

remote vpn.example.com 1190 udp4

to

remote vpn.example.com 1190 udp

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.