After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778154 - openvpn import ignores key-direction 1 option when tls-auth is an external file
openvpn import ignores key-direction 1 option when tls-auth is an external file
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: VPN: openvpn
unspecified
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
: 792007 (view as bug list)
Depends on:
Blocks: nm-review
 
 
Reported: 2017-02-03 20:30 UTC by Forest
Modified: 2017-12-28 10:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example ovpn config w/ key-direction and external tls-auth file (759 bytes, text/plain)
2017-02-10 17:49 UTC, Forest
  Details
[PATCH] import: fix parsing of key direction (8.26 KB, patch)
2017-08-04 08:14 UTC, Beniamino Galvani
none Details | Review

Description Forest 2017-02-03 20:30:42 UTC
When importing an .ovpn config, the "key-direction 1" option is ignored if the tls-auth option points to an external file.  This causes VPN session setup to fail (after a timeout).

The "key-direction 1" import works if the .ovpn config is first rewritten to either use the inline <tls-auth> syntax or else use the "tls-auth filename 1" syntax.


NetworkManager 1.2.4
NetworkManager-openvpn 1.2.6 and 1.2.8 (same problem in both)

$ nmcli --version
nmcli tool, version 1.2.4

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.10
Release:	16.10
Codename:	yakkety

$ openvpn --version
OpenVPN 2.3.11 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Jun 22 2016
library versions: OpenSSL 1.0.2g  1 Mar 2016, LZO 2.08
Originally developed by James Yonan
Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
Compile time defines: enable_crypto=yes enable_crypto_ofb_cfb=yes enable_debug=yes enable_def_auth=yes enable_dependency_tracking=no enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown enable_fast_install=yes enable_fragment=yes enable_http_proxy=yes enable_iproute2=yes enable_libtool_lock=yes enable_lzo=yes enable_lzo_stub=no enable_maintainer_mode=no enable_management=yes enable_multi=yes enable_multihome=yes enable_pam_dlopen=no enable_password_save=yes enable_pedantic=no enable_pf=yes enable_pkcs11=yes enable_plugin_auth_pam=yes enable_plugin_down_root=yes enable_plugins=yes enable_port_share=yes enable_selinux=no enable_server=yes enable_shared=yes enable_shared_with_static_runtimes=no enable_silent_rules=no enable_small=no enable_socks=yes enable_ssl=yes enable_static=yes enable_strict=no enable_strict_options=no enable_systemd=yes enable_win32_dll=yes enable_x509_alt_username=yes with_aix_soname=aix with_crypto_library=openssl with_gnu_ld=yes with_mem_check=no with_plugindir='${prefix}/lib/openvpn' with_sysroot=no
Comment 1 Thomas Haller 2017-02-08 12:54:10 UTC
could you attach the .ovpn file here (after removing private data).

Thanks
Comment 2 Forest 2017-02-10 17:49:28 UTC
Created attachment 345470 [details]
Example ovpn config w/ key-direction and external tls-auth file
Comment 3 blkeller 2017-02-16 00:15:15 UTC
I noticed this same problem, except in my case it was with the inline configuration.

If "key-direction 1" appeared on the line *after* "</tls-auth>", it was ignored during import.  If I moved "key-direction 1" to the line *before* "<tls-auth>", it was properly recognized on import.  This is with network-manager-openvpn 1.2.8 on Debian testing.

I'm not sure if this is the same bug or different.  Looking at the attached config file, I notice that the key-direction line is also after the tls-auth line.

@Forest, does the problem go away for you if you move the key-direction line above the tls-auth line?
Comment 4 Forest 2017-02-16 19:00:31 UTC
> does the problem go away for you if you move the key-direction line above the tls-auth line?

Nope; moving the key-direction line above the tls-auth line does not fix it for me.

Tested with NetworkManager-openvpn 1.2.6. The 1.2.8 changelog doesn't mention any key-direction parsing changes, so I imagine it's the same there.
Comment 5 Forest 2017-02-16 19:02:33 UTC
P.S.
I tested both with a GUI import and an nmcli import.  The ta-direction line was not imported (as ta-dir) in either case.
Comment 6 Nazar Mokrynskyi 2017-05-22 17:28:11 UTC
Very annoying issue discovered here: https://github.com/kylemanna/docker-openvpn/issues/268
Comment 7 Beniamino Galvani 2017-08-04 08:14:41 UTC
Created attachment 356919 [details] [review]
[PATCH] import: fix parsing of key direction
Comment 8 Thomas Haller 2017-08-04 09:20:06 UTC
(In reply to Beniamino Galvani from comment #7)
> Created attachment 356919 [details] [review] [review]
> [PATCH] import: fix parsing of key direction

lgtm
Comment 10 Thomas Haller 2017-12-28 10:36:55 UTC
*** Bug 792007 has been marked as a duplicate of this bug. ***