7

When I try to import the VPN settings from an OVPN file, I get the following error.

The file "test.ovpn" could not be read or does not contain recognized VPN connection information. Error: Key file contains line "client" which is not a key-value pair, group, or comment

I am quite sure that the line "client" should not be a problem, since I have it in other .ovpn files as well.

What is wrong with this?

PS: This is the beginning of the ovpn file (with fake data)

client
dev tun
proto tcp
remote xxxxx.yyyyyyyyy.de 443
verify-x509-name "C=de, L=Somewhere, O=mycompanyname AG, CN=xxxxx.yyyyyyyy.de, emailAddress=admins@yyyyyyyyy.de"
route remote_host 255.255.255.255 net_gateway
resolv-retry infinite
nobind
persist-key
persist-tun
auth-user-pass
cipher AES-256-CBC
auth MD5
comp-lzo no
route-delay 4
verb 3
reneg-sec 0
  • can you share with us the .ovpn file, I assume that we might find the problematic line there – Yaron Jan 25 '18 at 9:36
  • Not sure I am allowed to show you that... I will try to put some lines with dummy data – Enrique Moreno Tent Jan 25 '18 at 9:37
  • I have updated with some (hopefully) relevant info – Enrique Moreno Tent Jan 25 '18 at 10:21
4

There is a known bug in NetworkManager : configuration files with inline certificates can't be imported.

There are several workarounds which can be taken:

  1. Use the this python script which extract the embedded certificates and rewrite the ovpn config to use separate key and cert files. (reference)

  2. Execute the ovpn config using command line:

    sudo openvpn your-ovpn-config-filename.ovpn
    
  3. separate lines which contains port into several lines:

    remote xxxxx.yyyyyyyyy.de 443
    

    To be:

    remote xxxxx.yyyyyyyyy.de 
    port 443
    
| improve this answer | |
  • 1
    This isn't working for me. I extracted the certificates via that script and now I get Error: Key file contains line "ca ca.crt" which is not a key-value pair, group, or comment.. Why is NM so bloody incompetent at importing OVPN files? – Doktor J Aug 26 '19 at 17:57
2

Could be because of mssfix 0 option. Per NM's opinion it's wrong. How to check which option is not acceptable? Try from terminal:

# nmcli connection import type openvpn file client1_udp.ovpn
[sudo] password for ipeacocks: 
Error: failed to import 'client1_udp.ovpn': configuration error: invalid 1th argument to “mssfix” where number expected (line 136).

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

| improve this answer | |

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.