unable to import config with inlined ca, cert, key or tls-auth

Bug #606365 reported by Till Klampaeckel
766
This bug affects 164 people
Affects Status Importance Assigned to Milestone
NetworkManager-OpenVPN
Fix Released
Medium
plasma-nm
Fix Released
High
network-manager-openvpn (Ubuntu)
Fix Released
Medium
Unassigned
plasma-nm (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: network-manager-openvpn-gnome

So a client of mine runs an OpenVPN setup. It exported a client.ovpn file but it fails to completely import this file using the network-manager (gnome) on Ubuntu 10.04.

When I import the file, it gives me the name ("client") and gateway ("vpn.example.org") on the initial screen. No other fields are populated even though the client.ovpn file also includes a user certificate, server certifikate and a private key.

When I go to advanced, some (most) of the settings obviously seem to import correct, others not at all. E.g. none of the TLS settings (key and key direction) are imported.

From what I understand I should be able to use this without any additional settings.

The following software is installed through aptitude:

 * openvpn (2.1.0)
 * openvpn-blacklist
 * network-manager-openvpn
 * network-manager-openvpn-gnome

Tags: xenial
Revision history for this message
Till Klampaeckel (till-php) wrote :

I wanted to share the configuration (dummy):

remote vpn.example.org
client
proto tcp
port 443
dev tun
ns-cert-type server
auth-user-pass
auth-retry interact
comp-lzo
verb 3

<ca>
-----BEGIN CERTIFICATE-----
FOO
-----END CERTIFICATE-----
</ca>

<cert>
-----BEGIN CERTIFICATE-----
FOO
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN RSA PRIVATE KEY-----
FOO
-----END RSA PRIVATE KEY-----
</key>

key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key (Server Agent)
#
-----BEGIN OpenVPN Static key V1-----
FOO
-----END OpenVPN Static key V1-----
</tls-auth>

So the quickfix here is that you can dissect the file and import it all once you figured out the corresponding dropdown/whatever in the network manager. So for example in the example above I needed to select "Passwords with certificates (TLS)" and enter another user/pass along with it, no password for the key and also the TLS key and direction in advanced.

One more note - the following settings seemed to get imported:
proto, port, comp-lzo, remote

The rest was ignored.

I hope this helps.

Revision history for this message
emilio (emiliomaggio) wrote :

I have the same problem in importing the ovpn file provided by my company system administrators

emilio (emiliomaggio)
Changed in network-manager-openvpn (Ubuntu):
status: New → Confirmed
Revision history for this message
AlexConrad (aconrad-tlv) wrote :

Same problem for me under Ubuntu 10.04.

Running "sudo openvpn --config client.ovpn" works though.

Revision history for this message
Mitch Goldenberg (kgolden) wrote :

Same problem in Ubuntu 10.10.

Again, "sudo openvpn --config client.ovpn" works properly.

Revision history for this message
Till Klampaeckel (till-php) wrote :

Thanks for posting the workaround, it's definitively a small bug in network-manager-openvpn.

Revision history for this message
kapetr (kapetr) wrote :

I can confirm that in Ubuntu 10.10:

Specially: statements auth-user-pass and route are ignored.

So most config are not possible to import.
To set auth-user-pass manually in applet is trivial, but add e.g. 20 route statements via this interface is quite impossible.

See for example attached config for popular USA IP service with man routes.

BTW - in this example - OpenVPN do not addd route to host (--remote) via the old GW. I'm not sure, if it is not also a bug, but the config fails. It is necessary to add also this route statement:

route remote_host net_gateway

--kapetr

Revision history for this message
kapetr (kapetr) wrote :
Revision history for this message
Till Klampaeckel (till-php) wrote :

To add to this - the export feature is broken too.

I tried to rescue a couple profiles which I had done on another workstation for backup purposes, but it didn't work at all in 10.04.1.

Revision history for this message
lordbinky (lordbink) wrote :

I have the same issue in Ubuntu 11.04 where importing a .ovpn file isn't completely imported.

Revision history for this message
Justin (justin-wzy) wrote :

same issue in Oneiric

Revision history for this message
Stephan Fabel (sfabel) wrote :

This problem still exists in Precise.

Revision history for this message
Todd Howe (tehowe) wrote :

Can't hook up to my ISP's VPN. IT'S 2012

Revision history for this message
Todd Howe (tehowe) wrote :

Found a way to do this that works under GUI network-manager

http://howto.praqma.net/ubuntu/vpn/openvpn-access-server-client-on-ubuntu

Revision history for this message
lenzai (lenzai) wrote :

paqma.net website is down but the work around i still published at
http://askubuntu.com/questions/134918/setting-vpn-client

almost 2 years .... maybe we should write a bash to break down the ovpn into certificate files if this bug can't be fixed ?

Revision history for this message
exactt (giesbert) wrote :

2013... Ubuntu 12.10... still not working...

Revision history for this message
Claus Lensbøl (cmol) wrote :

Used the workaround from #14 and got it working, but without the fix I'm having the same issues.

Revision history for this message
kingtiger01 (mnovick1988) wrote :

Come on, were Weeks away from Raring(13.04) Quit Dropping the ball on things like this Ubuntu Team!

Revision history for this message
Parasit (parasit-go2) wrote :

2013... Ubuntu 13.04... still not working...
Eg. certs configuration are imported (#14 method) but still not connecting from GUI.

Revision history for this message
bagl0312 (bagl0312) wrote :

I confirm the same problem.
ovpn conf files produced by the openvpn/privatetunnel site:

https://www.privatetunnel.com/

are not imported correctly by the network-manager on ubuntu 13.04.
They instead work giving the command

openvpn --config xxx.ovpn

Revision history for this message
Carla Sella (carla-sella) wrote :

I am having the same problem importing a file for Watchguard on Saucy with all updates using network manager (today is July 20th 2013).
The "sudo openvpn --config client.ovpn" works properly.

Revision history for this message
Jakob (johnthedon) wrote :

same problem, ubuntu 13.10 here

Revision history for this message
bagl0312 (bagl0312) wrote :

Confirmed, same problem in 13.10
This bug is around since more than two years now :(

Revision history for this message
Bachi (m-bachmann) wrote :

Proud to be the first posting 2014. Wow. C'mon folks...

Revision history for this message
Giovanni Panozzo (giox069) wrote :

This is the more related upstream bug:

https://bugzilla.gnome.org/show_bug.cgi?id=633337

Please add your comments there explaining all problems importing .ovpn files (certs not imported, invalid TLS selection and other badly imported parameters).
Maybe someone will notice it one day... :(

Revision history for this message
Monty Cantsin (open-pop-star) wrote :

same in Trusy Tahr 14.04

Revision history for this message
Martin (getmartin) wrote :

Confirmed, same bug in 14.04.
Well, the workaround "sudo openvpn --config client.ovpn" is still working.

Revision history for this message
Carlos Tavares Jr (carlosmtavaresjr) wrote :

I am having issues with 14.04 lts openvpn client for gnome as well. I get the same freezing and not loading the config file issues. I had to revert back to 12.04 lts as this feature is needed in my line of work. Any fix available?

Simon Déziel (sdeziel)
summary: - client.ovpn file is not completely imported
+ unable to import config with inlined ca, cert, key or tls-auth
Changed in network-manager-openvpn:
importance: Undecided → Unknown
status: New → Unknown
Changed in network-manager-openvpn:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Tomislav (hefest) wrote :

Same as #25 and #26.

Revision history for this message
Tomislav (hefest) wrote :

Actually, I'm not having luck with the workaround: it seems that DNS settings have not been updated to find recources in the VPN.

Revision history for this message
Solitaire (bill-s0l) wrote :

This bug affects me as well.

Anyone got a script working to automate the creation of the separate certificates and keys from inside the .ovpm file?
Would be a great workaround till this gets fixed

Revision history for this message
Frol (frolvlad) wrote :

2015... Nothing was done yet. Let's make some movements.

Here is the import function:
http://bazaar.launchpad.net/~network-manager/network-manager-openvpn/trunk/view/head:/properties/import-export.c#L268

and here are the lines of ca/cert/key tags parsing:
http://bazaar.launchpad.net/~network-manager/network-manager-openvpn/trunk/view/head:/properties/import-export.c#L563

My suggestion is to save inline ca/cert/key inside of a Network Manager configurations file encoded into base64 (again) with "inline:" prefix, e.g.:
[connection]
id=MyVPN
uuid=ac9d354e-03ef-4063-8c96-4a40bd17bea6
type=vpn

[vpn]
service-type=org.freedesktop.NetworkManager.openvpn
connection-type=tls
remote=myvpnhost.com
cert-pass-flags=0
tap-dev=no
proto-tcp=no
mssfix=no
ca=inline:<base64 coded>
cert=inline:<base64 coded>
key=inline:<base64 coded>

Another approach would be to parse as much information from *.ovpn file as we can, remove parsed parts, encode rest of the file into a base64 string, and save it into a Network Manager connection config file. This may help to deal with extra options like inline certificates, but may also cause unexpected configuration conflicts.

Revision history for this message
Ryan Hendry (ryanhendry123) wrote :

I am experiencing the same problem.

Revision history for this message
Mahdi Fattahi (mfat) wrote :

Can somebody please fix this?

Revision history for this message
Lars (stecklars-r) wrote :

Would be really nice if somebody could take a look at this and work on it. Thanks :)

Revision history for this message
seebk (seebk) wrote :

I have created a small python script to extract the embedded certificates and to rewrite the ovpn config to use separate key and cert files.

https://gist.github.com/seebk/bb94a7fd70d4cc454aaa

Maybe it helps to simplify the error prone manual setup until this bug is fixed.

Revision history for this message
In , Psychonaut (psychonaut) wrote :

The Connection Editor of the NetworkManager plasma applet is unable to import OpenVPN configuration files which contain inline certificates and keys.

Reproducible: Always

Steps to Reproduce:
1. Open the Connection Editor.
2. File -> Import VPN…
3. Select and open an OpenVPN configuration file (.ovpn) which contains inline certificates and/or keys. That is, the file specifies "[inline]" as the value of the ca, cert, key, and/or tls-auth fields, and then provides ASCII-armoured certificates and/or keys in <ca>, <cert>, <key>, and <tls-auth> elements at the end of the file.

Actual Results:
4. For every inline certificate/key in the configuration file, an error dialog appears indicating that the certificate/key could not be copied because the file [inline] could not be opened. For example:

Error copying file to /home/miller/.kde4/share/apps/networkmanagement/certificates/ukp-vpn_[inline]: Cannot open /tmp/[inline] for input

Expected Results:
4. The Connection Editor should recognize that "[inline]" is not a filename but rather a special value indicating that the certificate/key is contained within the OpenVPN configuration file itself. It should then read in and process that certificate/key.

Revision history for this message
In , Jgrulich (jgrulich) wrote :

Do you really use plasma-nm in version 0.9.3.4? I thought this has been fixed already. Any chance you can try at least 0.9.3.5 version where I did one more fix regarding OpenVPN import.

Revision history for this message
In , Psychonaut (psychonaut) wrote :

Yes, I'm running plasma-nm 0.9.3.4. I can't test 0.9.3.5 at the moment but can do so as soon as it's packaged for openSUSE 13.2.

Revision history for this message
In , Lamarque (lamarque) wrote :

That is not the syntax our import code expects. The import code expects no ca, cert, key or ts-auth tags with '[inline]' as value when certificates are embedded. It expects only <ca>, <cert> <key> and <tls-auth> tags in that case. Besides, using '[inline]' as value is redundant in this case.

Revision history for this message
In , Psychonaut (psychonaut) wrote :

It may not be the syntax the plasma-nm import code expects, but it's one that the OpenVPN command-line client supports. I've come across a few .ovpn files which use this syntax, and I've seen it recommended by OpenVPN experts such as Jan Just Keijser (see for example <http://openvpn-users.narkive.com/ZwzahkCv/embedding-key-cert-ca-into-client-config>).

It looks like this [inline] directive was never documented in the OpenVPN man pages. However, given that it's in use, it might still be a good idea for plasma-nm to handle this syntax.

Revision history for this message
In , Lamarque (lamarque) wrote :

Git commit 599afdacd744a2d7785274687438a23f21617c34 by Lamarque V. Souza.
Committed on 28/06/2015 at 23:26.
Pushed by lvsouza into branch 'master'.

Add support to import .ovpn files with syntax described in
http://openvpn-users.narkive.com/ZwzahkCv/embedding-key-cert-ca-into-client-config
FIXED-IN: 0.9.3.7

M +22 -5 vpn/openvpn/openvpn.cpp

http://commits.kde.org/plasma-nm/599afdacd744a2d7785274687438a23f21617c34

Revision history for this message
In , Lamarque (lamarque) wrote :

Git commit c6f0b9df0e1a78c4d54058136580104b5e5b22a7 by Lamarque V. Souza.
Committed on 29/06/2015 at 00:21.
Pushed by lvsouza into branch '0.9.3'.

Add support to import .ovpn files with syntax described in
http://openvpn-users.narkive.com/ZwzahkCv/embedding-key-cert-ca-into-client-config
FIXED-IN: 0.9.3.7

M +22 -5 vpn/openvpn/openvpn.cpp

http://commits.kde.org/plasma-nm/c6f0b9df0e1a78c4d54058136580104b5e5b22a7

Revision history for this message
zao (zao-d) wrote :

Hope this bug will be addressed - five years without a fix - is far too long...
:(

Revision history for this message
Nyr (nyr7) wrote :

Come on, many of the latest OpenVPN implementations use in-line certificates by default... how can this bug be still there five years later?

Revision history for this message
reliable-robin-22 (nicolasdiogo) wrote :

Happy Birthday to this Bug !!!

Sarcasm apart - it is amazing that such an important piece of software is not been supported properly - particularly with the corporate market requesting it.

if the suggestion here:
https://bugzilla.gnome.org/show_bug.cgi?id=633337

is correct - that it is not possible to handle inline certificates & it will be necessary to manually edit the ovpn file.

could we have an article/wiki explaining the steps to do so?

or a small utility that could do this work?

Thanks,

Revision history for this message
reliable-robin-22 (nicolasdiogo) wrote :
Revision history for this message
Frol (frolvlad) wrote :

@Nicolas It is not the answer for *inlined* certificates. You can extract inline certificates into separate files, but it is not what people requested here.

Revision history for this message
Markus Majer (mpathy) wrote :

I thought I have another look, and wow, the bug is still existant.. Wow! Years!
Even though it is so easy to fix it, and there are already solutions present, it just have to get upstream.
Can somebody state what the problem is?
Its a quite enterprisey thing that doesnt work for years now, no wonder they still use RHEL everywhere.. :/

Revision history for this message
Markus Majer (mpathy) wrote :

Btw for those people who looking here for bugfixes, which they dont get, look at this:

Yes, there is:
http://howto.praqma.net/ubuntu/vpn/openvpn-access-server-client-on-ubuntu

And even a little python script who breaks it apart:
https://gist.github.com/seebk/bb94a7fd70d4cc454aaa

So, as you see, its would be so damn easy for the Network Manager to read these kind of files, which are very very common for OpenVPN, because you only have to provide ONE file.

Revision history for this message
Spayder26 (spayder26) wrote :

I just hit this bug. And this is how Ubuntu will never get enterprise acceptance.

Revision history for this message
Yavvsy (yavanna-spring) wrote :

Confirmed for 15.04: Still an issue for in-line *.ovpn files
still works with sudo openvpn --config client.ovpn

Off to do this manually, but... this IS an issue for larger deployments.

Revision history for this message
Frol (frolvlad) wrote :

Just FYI, this feature is already implemented in KDE (plasma-nm) - https://bugs.kde.org/show_bug.cgi?id=349282

Revision history for this message
Tanguy Herrmann (dolanor) wrote :

It seems we have a hero!
http://bazaar.launchpad.net/~network-manager/network-manager-openvpn/trunk/revision/559

For my use case (.ovpn file created by https://hub.docker.com/r/kylemanna/openvpn/ ), I guess I will still lack the TLS-AUTH file blob.
Maybe I'll add it myself if I have time.

But meanwhile I also created a tool for that at: https://github.com/dolanor/ovpnsplit
It is in go, and if you want binaries directly, here they are: https://github.com/dolanor/ovpnsplit/releases

Revision history for this message
Diego (gran-diego) wrote :

Will this ever be addressed?

Changed in network-manager-openvpn:
status: Confirmed → Fix Released
Revision history for this message
Andres G. Aragoneses (knocte) wrote :

> Changed in network-manager-openvpn:
> status: Confirmed → Fix Released

Great! Will 16.04 have this fix?

Revision history for this message
urusha (urusha) wrote :

16.04 now includes upstream fixed version. So it doesn't affect xenial anymore.

Revision history for this message
Bogdan Grosu (groenator) wrote :

I am using Ubuntu GNOME 16.4 beta 2, and the fix is not there. The file still cannot be imported....

Revision history for this message
Simon Déziel (sdeziel) wrote :

Bogdan, please make sure to have all the updates applied. Network-Manager and the OpenVPN plugin were refreshed post beta 2 so maybe this got implemented.

Revision history for this message
bagl0312 (bagl0312) wrote :

Confirmed: I cannot (yet) import a VPN configuration file on 16.04 (current release)

Revision history for this message
Marcos Alano (mhalano) wrote : Re: [Bug 606365] Re: unable to import config with inlined ca, cert, key or tls-auth

I need to get the packages from proposed repository to make things work.

Em qui, 14 de abr de 2016 às 11:11, bagl0312 <email address hidden>
escreveu:

> Confirmed: I cannot (yet) import a VPN configuration file on 16.04
> (current release)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/606365
>
> Title:
> unable to import config with inlined ca, cert, key or tls-auth
>
> Status in NetworkManager-OpenVPN:
> Fix Released
> Status in network-manager-openvpn package in Ubuntu:
> Confirmed
>
> Bug description:
> Binary package hint: network-manager-openvpn-gnome
>
> So a client of mine runs an OpenVPN setup. It exported a client.ovpn
> file but it fails to completely import this file using the network-
> manager (gnome) on Ubuntu 10.04.
>
> When I import the file, it gives me the name ("client") and gateway
> ("vpn.example.org") on the initial screen. No other fields are
> populated even though the client.ovpn file also includes a user
> certificate, server certifikate and a private key.
>
> When I go to advanced, some (most) of the settings obviously seem to
> import correct, others not at all. E.g. none of the TLS settings (key
> and key direction) are imported.
>
> From what I understand I should be able to use this without any
> additional settings.
>
> The following software is installed through aptitude:
>
> * openvpn (2.1.0)
> * openvpn-blacklist
> * network-manager-openvpn
> * network-manager-openvpn-gnome
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/network-manager-openvpn/+bug/606365/+subscriptions
>
--

Sent from my Android

Revision history for this message
Bogdan Grosu (groenator) wrote :

I'll try another update, maybe I miss something...

Revision history for this message
Patrick (patrick-w) wrote :

I'm running 16.04 release. This bug is still present. I tried updating all packages, still no joy. Where can I get this alleged fix? I've been tracking this bug for 6 years and I'm ready to throw my monitor out of the window.

Revision history for this message
Patrick (patrick-w) wrote :

Further to the above, here is the error message I receive. . .

The file 'client.ovpn' could not be read or does not contain recognised VPN connection information
Error: the plugin does not support import capability.

Revision history for this message
Kestrell (spam-spamburger) wrote :

Agree with Patrick.

Revision history for this message
5a54a (5a54a) wrote :

Had no problem importing pfSense ovpn file (with separate p12 and key files) in 15.10. Now in 16.04 LTS cannot import the same files anymore:

"Cannot import VPN connnection
The file 'pfsense-udp-1194-xxxx-xxxx-xx.ovpn' could not be read or does not contain recognized VPN connection information. Error: unknown error."

Revision history for this message
Mauro Gaspari (ilvipero) wrote :

I just want to confirm this issue, exactly the same 5a54a wrote. This is confirmed on ubuntu-mate 16.04 64bit.
Interesting enough, Kubuntu 16.05 64bit does not have this issue. There is some problem at times importing profiles in Kubuntu, but trying again a second time works well.

I also noticed a few more issues, confirmed on multiple OpenVPN profiles:

TCP Ports
if the port in the profile is selected to be TCP, network-manager does not recognize that, and it is needed to manually go in network manager and select TCP port. However same profiles work fine on windows OpenVPN GUI, also starting OpenVPN from command line on linux works fine.
remote xxxxxxxx tcp-client - This line in the configuration is relevant. network-manager-openvpn cannot interpret that (but works fine on anything else including cli). If I manually change the profile and split 2 lines, it works on network-manger-openvpn. something like this:
remote xxxxxxxx
tcp-client

SPLIT TUNNEL
if the profile is a split-tunnel configuration, network manager setting "use only for resources on this connection" in "ipv4 - routes" is not ticked. The connection tries to go full tunnel, and internet stops working. Also confirmed that on windows OpenVPN GUI this problem does not exist, and also starting OpenVPN from command line on linux works fine.

If separate bugs are requested, please let me know and I will do that.

sample of an OpenVPN profile (exported by PFSense appliance):
dev tun
persist-tun
persist-key
cipher BF-CBC
auth SHA1
tls-client
client
resolv-retry infinite
remote xxxxxxxx tcp-client
lport 0
auth-user-pass
ca xxxxxxxx-ca.crt
tls-auth xxxxxxxx-tls.key 1
ns-cert-type server
comp-lzo
passtos

Best Regards
Mauro

Revision history for this message
Patrick (patrick-w) wrote :

Importing .ovpn files also worked as expected on Kubuntu 14.04

Revision history for this message
EAB (adair-boder) wrote :

Ubuntu 16.04 here with the same issue. "Error: the plugin does not support import capability."

This worked in 14.04!

Revision history for this message
Patrick (patrick-w) wrote :

How did you have it working in Ubuntu 14.04??? This bug has been present for generations of Ubuntu.

Revision history for this message
Giovanni Panozzo (giox069) wrote :

In ubuntu 16.04 I'm able to import almost all my 6 .ovpn profiles with all inline certs.

But one profile fails.

The non-importable .ovpn profile works very well if used via commandline (sudo openvpn profile_001.ovpn) or in other vpn clients for OS X and windows.

The error I get on ubuntu mate for raspberry Pi 2 is:
-----
Cannot import VPN connection
The file 'profile_001.ovpn' could not be read or does not contain recognized VPN connection information

Error: the plugin does not support import capability.
------

The error I get on my core i5 desktop
---
Cannot import VPN connection
The file 'profile_001.ovpn' could not be read or does not contain recognized VPN connection information

Error: Key files contains line 'dev tun' which is not a key-value pair, group, or comment.
-----

I have found another user reporting the same issue here:
http://askubuntu.com/questions/760345/cannot-import-saved-openvpn-configuration-file-in-ubuntu-16-04-lts

Revision history for this message
Giovanni Panozzo (giox069) wrote :

A workaround for the problem of my previous post is to remove the line

float 1

from the .ovpn profile. It gets correctly imported on both ubuntu mate for RPi and Ubuntu 64 bit.

Another problem is the default route setup: routing should be decided by the VPN server and/or the .ovpn profile. But for some reason, the network manager subsystem by default puts the system default gateway to the tunnel interface.
You must manually check "Use this connection only for resources on its network" on the profile after importing the .ovpn profile. An extra manual configuration step which should not be done, because the configuration is already complete in .ovpn or from pushed server routes.
Also please consider that all other openvpn clients don't add this default route by default.

Revision history for this message
cudiaco (bigmakvoodoo) wrote :

Also running into this problem on 16.04

My unified profile looks like this:

client
remote x.x.x.x 8757
dev tun
proto udp
cipher AES-256-CBC
auth SHA256
resolv-retry infinite
nobind
persist-key
persist-tun
ns-cert-type server
tls-version-min 1.2
comp-lzo
key-direction 1
verb 3
route x.x.x.0 255.255.255.255 net_gateway
<ca>
-----BEGIN CERTIFICATE-----
xxxxx
-----END CERTIFICATE-----
</ca>

<cert>
-----BEGIN CERTIFICATE-----
xxxxx
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN RSA PRIVATE KEY-----
xxxxxx
-----END RSA PRIVATE KEY-----
</key>

<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
xxxx
-----END OpenVPN Static key V1-----
</tls-auth>

Ubuntu should come with more VPN protocols installed by default, at the very least OpenVPN,

Revision history for this message
Torsten Harenberg (harenberg) wrote :

Running Ubuntu 16.04 Mate:

I was able to import a "old-style" config file (certificates NOT inline, but in seperate files) ONLY after removing all "#" remarks. Seems they are not recognized, neither at the beginning on a line nor somewhere in the middle, so resulting in parsing errors.

The same file imported nicely under Ubuntu 14.04. Only after upgrading the change was needed.

Revision history for this message
Torsten Harenberg (harenberg) wrote :

Update to #66: importing an "inline" .ovpn file worked now as well (after removing any # remarks). Empty lines did not give any trouble.

Revision history for this message
cudiaco (bigmakvoodoo) wrote :

I got it to import after removing the following line from the config:

route x.x.x.0 255.255.255.255 net_gateway

However it's a legitimate OpenVPN argument.

Revision history for this message
Kestrell (spam-spamburger) wrote :

I tried #66 & #68, I made sure there were no '#' in the .ovpn file and I don't have this line in the config:
route x.x.x.0 255.255.255.255 net_gateway

I still get the same error:
The file 'vpn.ovpn' could not be read or does not contain recognized VPN connection information

Error: the plugin does not support import capability.

Revision history for this message
cudiaco (bigmakvoodoo) wrote :

Kestrell,

Can you post your config file?

Revision history for this message
Kestrell (spam-spamburger) wrote :

Private Parts removed:

remote x.x.x.x x udp
remote x.x.x.x x udp
remote x.x.x.x x udp
key-direction 1
cipher AES-128-CBC
client
dev tun
resolv-retry infinite
nobind
persist-key
persist-tun
;http-proxy-retry
;http-proxy x.x.x.x x
verb 4
reneg-sec 86400
echo vpnx ovpn0x
tun-mtu 1500
route-method exe
route-delay 2
redirect-gateway def1
comp-lzo no
explicit-exit-notify 2
fragment 1390
mssfix 1390
hand-window 30
<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</ca>
<key>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</key>
<cert>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</cert>
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
-----END OpenVPN Static key V1-----
</tls-auth>

Mathew Hodson (mhodson)
Changed in network-manager-openvpn (Ubuntu):
importance: Undecided → Medium
importance: Medium → High
Revision history for this message
Denilson Sá (denilsonsa) wrote :

I tried grabbing the [proxpn.ovpn][1] file ([from this URL][2]) and importing it into network-manager-openvpn. Unfortunately, the "Save" button stays disabled with this message:

"Invalid setting IPv4 Settings: ipv4.routes: 1. route cannot be a default route"

Manually adding the VPN following the instructions from [this URL][3] works. But I expected to be able to quickly import the .opvn file instead.

[1]: http://www.proxpn.com/chromeos/proxpn.ovpn
[2]: https://support.proxpn.com/customer/en/portal/articles/2276335-proxpn-on-chromebook-chromium-os-
[3]: https://support.proxpn.com/customer/portal/articles/2120656-linux-install-instructions

Revision history for this message
Marcos Alano (mhalano) wrote :

@denilsonsa

The problem remains on proXPN file. You need to import and delete the routes (under 'IPv4 Settings' tab) after that open advanced settings and close to update and show the button.

Or you could comment all lines with 'route' and then import.

Revision history for this message
dasti (dasti) wrote :
Download full text (3.2 KiB)

Same error message as above I got the same message a
Error: Key files contains line 'dev tun' which is not a key-value pair, group, or comment.

- running Ubuntu mate 16.04.1 up to date
- configuration files are coming from pfsense (up to date) using the "archive" export that produce a .ovpn file (without keys) plus a .key and .p12 file as this network manager can not handle configurations files with inline keys and certificates

-------------------------
content of the .ovpn file
-------------------------
dev tun
persist-tun
persist-key
cipher AES-128-CBC
auth SHA1
tls-client
client
resolv-retry infinite
remote xxx.xxx.xxx.xxx 1194 udp
lport 0
verify-x509-name "NAMEOFTHEOPENVPNSERVERHERE" name
auth-user-pass
pkcs12 P12FILENAMEHERE.p12
tls-auth KEYFILENAMEHERE.key 1
ns-cert-type server
comp-lzo adaptive
--------------------------------
end of content of the .ovpn file
--------------------------------

1/
I tried commenting the problematic line but the error then pointed to the 2nd line and then the 3rd....

2/
This .ovpn file can be imported on Mint 17.3 but not in Ubuntu mate 16.04.1 nor Linux Mint 18

I imported it in Mint 17.3 and then exported a .conf file from the network manager.
I edited the .conf file so the correct path to the files.

----------------------------------------
content of the .conf file from Mint 17.3
----------------------------------------
client
remote XXX.XXX.XXX.XXX 1194
pkcs12 /PATH/TO/P12/FILE/P12FILENAME.p12
auth-user-pass
cipher AES-128-CBC
comp-lzo yes
dev tun
proto udp
tls-auth /PATH/TO/KEY/FILE/KEYFILENAME.key 1
nobind
auth-nocache
script-security 2
persist-key
persist-tun
user nobody
group nogroup
-----------------------------------------------
end of content of the .conf file from Mint 17.3
-----------------------------------------------

NOTE: informations seems to be the same as the .ovpn files but not in the same order

3/
The .conf file successfully imported into ubuntu mate 16.04.1 but the vpn wasn' t working.

4/
I compared visually the configuration of the the network manager in the 2 OS and changed what was different or missing in Mate (without looking at more explanations)
- username
- user password
- private key password
- advanced/security : HMAC authentication to 'sha1'

5/
tried it and it works

6/
here the conf file from ubuntu mate

--------------------------------------------------
content of the .conf file from Ubuntu mate 16.04.1
--------------------------------------------------
 client
 remote XXX.XXX.XXX.XXX 1194
 pkcs12 /PATH/TO/THE/P12/FILE/P12FILENAME.p12
 auth-user-pass
 cipher AES-128-CBC
 comp-lzo yes
 dev tun
 proto udp
 tls-auth /PATH/TO/THE/KEY/FILE/KEYFILENAME.key 1
 nobind
 auth-nocache
 script-security /home/david-stievenard/Desktop/testopenvpnDS/fw-qinhe-1-udp-1194-david.stievenard/forlaunchpad/fw-qinhe-1-udp-1194-david.stievenard-tls.key2
 persist-key
 persist-tun
 user nobody
 group nogroup
--------------------------------------------------
content of the .conf file from Ubuntu mate 16.04.1
--------------------------------------------------

NOTE: the only difference is that there is one space character in front of every line

NOTE2: Importing .ovpn files work...

Read more...

Revision history for this message
Simon Déziel (sdeziel) wrote :

@datsi, I noticed that the importer has trouble with "comp-lzo something". Using "comp-lzo" alone worked for me but I didn't test with inline cert nor PKCS12.

Revision history for this message
Simon Déziel (sdeziel) wrote :

I just tested with inlined ca, cert, key and tls-auth on Ubuntu Xenial. All of them are properly imported, the only problem is how to specify the tls-auth key direction if any.

With inlined style, <tls-auth> requires specifying the key direction with the "key-direction" parameter. The problem is the importer just ignores the "key-direction" parameter.

Revision history for this message
Micah Mangione (randomlogic314) wrote :

For what it's worth, an out-of-the-box OpenVPN 2.1.3 Access Server user-locked configuration file only needs 1 parameter changed to import with the "network-manager-openvpn-gnome" tool.

The line that says:
reneg-sec 604800

Comment that out.
# reneg-sec 604800

Imports without issue now.

Revision history for this message
Sodki (henrique-rodrigues) wrote :

With Ubuntu 16.04, solution provided by #77 worked. Thanks, Micah.

Revision history for this message
Patrick (patrick-w) wrote :

Holy cow! Micah you cracked it for me too! Finally after all these years I can use OpenVPN without cli. Kudos to you.

Revision history for this message
Samuel Ausman (sgausman) wrote :

Can also confirm that solution specified in comment #77 worked for me on Ubuntu 16.04.1. Thank you Micah!

Revision history for this message
Peter Passchier (peter-passchier) wrote :

I've found that removing the #comments in the TA key helped.

Revision history for this message
D (360-dennis) wrote :

I'm sorry, but im a newbie, but how does this fix get into the ubuntu versions? Do we have to wait until network-manager-openvpn (Ubuntu) gets assigned?

Revision history for this message
Jeremy LaCroix (j-jlacroix) wrote :

This is working for me now. When I import into Network Manager, it literally tells me which line is the problem now, and whatever line that is, I comment it out and it works. Before, it would just tell me that there was an issue importing but it wasn't specific. But at least now, Network Manager helps me figure out the issue. I recently switched to Ubuntu GNOME, so I'm not sure if there's something specific with the GNOME implementation that displays specific errors, or if Network Manager has changed. At least it's working for me now, albeit with manual intervention being required.

In my opinion, the real issue at this point is that even though commenting out some lines helps, each line is valid and should be accepted. If I export an .ovpn file and use it via the command line, it works without issue (even without commenting out anything). In my view, if the config file is valid enough for OpenVPN itself, it should surely be valid for Network Manager. Perhaps the OpenVPN spec has updated and Network Manager hasn't been updated to match?

Revision history for this message
BloodyIron (bloodyiron) wrote :

I'm on ubuntu 16.10,

I have pfsense running my openVPN service, and I exported the client config to an ovpn file (inline).

When I get network-manager to import, I STILL get "the plugin does not support import capability".

This bug has been open for OVER 6 YEARS now. How about we get this conclusively fixed already??? I have to switch to Windows to VPN in, I can't get network-manager to use any of my VPN info, even if I manually enter it.

It's mind-blowing this still exists as a problem.

Revision history for this message
Martin Zbořil (buntubugzilla) wrote :

funnily enough, the bug is actually fixed, all what is needed is actually network-manager-openvpn-gnome (I tested it on version 1.1.93-1ubuntu1.1 in 16.04.2) installed and then the network settings configuration gui restarted so the new VPN shows up as openvpn, after that importing the configuration from ovpn file works..

Revision history for this message
D (360-dennis) wrote :

im on 16.04.2 too, but i still see the bug. the workaround #77 didnt help for me too..

Revision history for this message
BloodyIron (bloodyiron) wrote :

I was able to import my config after making the adjustment outlined here : https://askubuntu.com/a/816140

However now I am having issues with systemd and my tap device, I'm not sure it's correctly creating it as I'm doing bridging not tunneling on the server end :( (probably unrelated here though)

Also, please note that the above method for the import did not correctly import my key direction, I had to change that after importing, which is weird.

Revision history for this message
James D. Hasselman (james.d.hasselman) wrote :

The error I get is:

"The file 'file.ovpn' could not be read or does not contain recognized VPN connection information

Error: Key file contains line 'dev tun' which is not a key-value pair, group, or comment."

If I edit the file and remove the line "comp-lzo adaptive" from the end of the file the import is successful.

Mathew Hodson (mhodson)
tags: added: xenial
removed: network-manager openvpn
Mathew Hodson (mhodson)
affects: network-manager-openvpn (Fedora) → plasma-nm
Changed in plasma-nm:
importance: Undecided → Unknown
status: New → Unknown
Revision history for this message
Robie Basak (racb) wrote :

The original bug as reported was a failure to import certain configuration files using network-mangaer-openvpn. This turned out to be due to the use of inlined key material (comment 24). network-manager-openvpn did not support this as a feature at the time, so was unable to parse this type of configuration file.

Support was since added (comment 46). This has been confirmed to work (comments 49, 63, 67, 68 etc). Therefore, this bug as reported has been fixed, so I'm setting it to Fix Released.

It may well be that this doesn't solve configuration imports for all users, as is clear from subsequent comments. But we track one issue per bug, since otherwise statements like "this bug is fixed" and "this bug is not fixed" become meaningless, developers cannot track what they are being asked to do, and users end up with wildly varying expectations that can never be met.

Note that a failure to import a configuration can be an entire class of bugs, not just one single bug. This bug's original reporter's problem turned out to be "doesn't work with inlined key material". Clearly that's not the only thing wrong here, as adding inlined key material support solved the problem for some, but not others. Of the remaining users here who still have import problems, there may yet be *multiple* underlying bugs. So please don't all pile on to a different bug thinking you're still all affected by the same issue.

If you'd like to see your problem fixed, and you'd like to help, then first please read "How to Report Bugs Effectively" (https://www.chiark.greenend.org.uk/~sgtatham/bugs.html) carefully. Take some time to work out exact steps to reproduce your problem, make sure that they really do reproduce, and then paste exact and detailed instructions on how to reproduce your problem into a new bug report. Don't assume that someone else's import failure problem is due to the same underlying bug as your import failure problem. Do link to bugs that you think may be related (such as this one). Don't worry about filing duplicates; in this kind of case it takes far more effort to untangle reports that turn out to have different root causes then it does to mark duplicate bugs if this becomes clear to developers later.

I hope this helps. I can't guarantee what will come next, but by filing actionable reports at least you'll be one step closer to real progress.

Changed in network-manager-openvpn (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Mathew Hodson (mhodson) wrote :

network-manager-openvpn was fixed in Xenial with https://launchpad.net/ubuntu/+source/network-manager-openvpn/1.1.93-1

Revision history for this message
Mathew Hodson (mhodson) wrote :
Changed in plasma-nm (Ubuntu):
importance: Undecided → Medium
Changed in network-manager-openvpn (Ubuntu):
importance: High → Medium
Changed in plasma-nm (Ubuntu):
status: New → Fix Released
Revision history for this message
In , Psychonaut (psychonaut) wrote :

Still reproducible for me with plsma-nm 5.10.4. I get the following error dialog when importing configuration files with inline certificates and agreeing with the prompt to copy the certificates to ~/.local:

Error copying certificate to /home/psy/.local/share/networkmanagement/certificates/ukp-vpn_[inline]: Cannot open /home/psy/vpn/UKP/[inline] for input

Revision history for this message
In , Psychonaut (psychonaut) wrote :

I should add that despite the error message, plasma-nm successfully extracted the certificates and copied them to ~.local/share/networkmanagement/certificates. So maybe the error message is spurious.

Revision history for this message
In , Lamarque (lamarque) wrote :

Hi. Hmmm QFile was not able to open the source file (/home/psy/vpn/UKP/[inline]). Does your user has permission to open that file for reading? That error message is shown only if QFile::copy returns false [1]

If the destination file already exists then QFile::copy returns false. That can be the problem too. In that case QFile::copy does not override the destination file. Probably we should ask the user if he/she wants to override it or keep the old one.

[1] http://doc.qt.io/qt-5/qfile.html#copy

OBS: since Plasma NM was not able to copy the file what it does is registering the source file's path (/home/psy/vpn/UKP/[inline]) in NetworkManager. Since NetworkManager run as root it probably has permission to read that file.

OBS2: Plasma NM run as normal user.

Revision history for this message
In , Psychonaut (psychonaut) wrote :

(In reply to Lamarque V. Souza from comment #9)
> Hi. Hmmm QFile was not able to open the source file
> (/home/psy/vpn/UKP/[inline]). Does your user has permission to open that
> file for reading? That error message is shown only if QFile::copy returns
> false [1]

That's because the file doesn't exist. As I already mentioned in the original report, plasma-nm is misinterpreting the [infile] header in the .ovpn file as a filename. It should not be trying to open any new files; the certificates should be read from the .ovpn file it already has open.

Revision history for this message
In , Lamarque (lamarque) wrote :

Does your file name has any space in it? If it does then you must use quotation mark in the .ovpn to delimitate the file name.

Revision history for this message
In , Psychonaut (psychonaut) wrote :

(In reply to Lamarque V. Souza from comment #11)
> Does your file name has any space in it? If it does then you must use
> quotation mark in the .ovpn to delimitate the file name.

I'm telling you for the third time, there is no filename in the .ovpn file. This bug report is about plasma-nm's failure to process .ovpn files which use the special identifier "[inline]" to indicate that the certificates and/or keys are included directly in the .ovpn file.

Changed in plasma-nm:
importance: Unknown → High
status: Unknown → New
Revision history for this message
Andreas (andreas-8) wrote :

Just experienced this issue in Ubuntu 17.04. Manually configuring the key-direction as stated in #76 fixed it.

Revision history for this message
Mustafa (finchie) wrote :

My ubuntu 16.04 has affected but #77 fixed it.

Revision history for this message
Feraali Sanger (amp-gold) wrote :

I was able to solve my problems on Ubuntu Mate 18.04 by using the command line (rather than the network manager gui) to import the .ovpn as follows:

User@Node-99:~/Downloads$ sudo nmcli connection import type openvpn file Miami.ovpn

Error: failed to import 'Miami.ovpn': configuration error: invalid 1th argument to “mssfix” where number expected (line 6).

What is good about the command line is that it is more verbose and will help you find which line in your .ovpn file is causing the error.

In my case I used a text editor to open the file Miami.ovpn and I commented out the offending line (It was line 6)

So I placed a # in front of the line and a space.

After doing that:

User@Node-99:~/Downloads$ sudo nmcli connection import type openvpn file Miami.ovpn
Connection 'Miami' (cb4d9379-9f35-4b03-b53d-3af05781e5aa) successfully added.

Problem solved. VPN able to connect now and it shows up as a choice inside of the Network manager.

Revision history for this message
In , Psychonaut (psychonaut) wrote :

Still reproducible as discussed in Comment 7 and Comment 8 with plasma-nm 5.12.6. That is, importing an OpenVPN configuration file with inline certificates and keys throws up a spurious error dialog about being unable to open the nonexistent file named "[inline]". However, the certificates and keys get successfully copied anyway.

Revision history for this message
In , Dennis Schridde (devurandom) wrote :

Does the import work when using nmcli (`nmcli connection import type openvpn file $FILENAME`)?

If nmcli works, I would think this is mostly caused by Plasma NM not using the NetworkManager OpenVPN code to import configuration files (bug #396530), but implements an own buggy version.

Revision history for this message
In , Psychonaut (psychonaut) wrote :

(In reply to Dennis Schridde from comment #14)
> Does the import work when using nmcli (`nmcli connection import type openvpn
> file $FILENAME`)?
>
> If nmcli works, I would think this is mostly caused by Plasma NM not using
> the NetworkManager OpenVPN code to import configuration files (bug #396530),
> but implements an own buggy version.

I'm now using plasma-nm 5.12.8. This version has the same behaviour as described for plasma-nm 5.12.6 in Comment 13: attempting to import an .ovpn file with inline certificates and keys results in a spurious error dialog, but the keys and certificates get successfully copied anyway.

I also tried using nmcli. This seems to work without any problems:

$ nmcli connection import type openvpn file ~/vpn/ukp-vpn.ovpn
Connection 'ukp-vpn' (c6cbabfe-f117-4af9-aca5-be9e8c88595c) successfully added.

When I open the NetworkManager plasma applet after doing this, I see the VPN connection listed there, with the keys and certificates copied into separate files under ~/.cert/nm-openvpn.

Revision history for this message
Kerstin Maur (kerstinmaur) wrote :

I am having the same issue on Ubuntu 18.04 LTS.

sudo nmcli connection import type openvpn file config.ovpn
gives the following error
Error: failed to import 'config.ovpn': configuration error: unsupported 3th argument net_gateway to “route” (line 12).

Running
sudo openvpn config.ovpn
works

Revision history for this message
ThomasG (thomas-gratier) wrote :

Made a script to split a single OpenVPN file to multiple to avoid the issue due to XML chunks within the single file breaking network-manager-openvpn when importing
https://gist.github.com/ThomasG77/5c09eead1244f9d1d2bd7fa70b26fead

Revision history for this message
In , Nicolas-fella (nicolas-fella) wrote :

In Plasma 5.27 we changed the VPN import to match what nmcli is doing, so this should be fixed

See https://invent.kde.org/plasma/plasma-nm/-/commit/9b22aa548f02ef43f7275ab2f9ffa48bde8a1ba8

Changed in plasma-nm:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.