Bug 1403227

Summary: [RFE] support import/export of NetworkManager's keyfile format in nmcli
Product: [Fedora] Fedora Reporter: Stefan Assmann <sassmann>
Component: NetworkManagerAssignee: Lubomir Rintel <lkundrak>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: dcbw, fgiudici, lkundrak, thaller
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Stefan Assmann 2016-12-09 13:17:49 UTC
Description of problem:
Tried to import openvpn config file from NetworkManager itself and failed.

The file 'GRU2.ovpn' could not be read or does not contain recognized VPN connection information
Error: does not look like a Cisco Compatible VPN (vpnc) VPN connection (no Host).

Version-Release number of selected component (if applicable):
NetworkManager-pptp-gnome-1.2.4-1.fc25.x86_64
NetworkManager-glib-1.4.2-2.fc25.x86_64
NetworkManager-config-connectivity-fedora-1.4.2-2.fc25.x86_64
NetworkManager-openvpn-1.2.6-1.fc25.x86_64
NetworkManager-vpnc-1.2.4-1.fc25.x86_64
NetworkManager-adsl-1.4.2-2.fc25.x86_64
NetworkManager-openvpn-gnome-1.2.6-1.fc25.x86_64
NetworkManager-1.4.2-2.fc25.x86_64
NetworkManager-wwan-1.4.2-2.fc25.x86_64
NetworkManager-team-1.4.2-2.fc25.x86_64
NetworkManager-vpnc-gnome-1.2.4-1.fc25.x86_64
NetworkManager-bluetooth-1.4.2-2.fc25.x86_64
NetworkManager-pptp-1.2.4-1.fc25.x86_64
NetworkManager-libnm-1.4.2-2.fc25.x86_64
NetworkManager-wifi-1.4.2-2.fc25.x86_64
NetworkManager-openconnect-1.2.3-0.20160606git5009f9.fc25.x86_64

How reproducible:
always

Steps to Reproduce:
1. mv /etc/NetworkManager/system-connections/GRU2.ovpn /dev/shm/
2. systemctl restart NetworkManager
3. Goto: Gnome->Network Settings->"+"->Import from file
4. select /dev/shm/GRU2.ovpn

Actual results:
Error message as seen above.

Expected results:
Successful import of the OpenVPN settings.

If this is expected behaviour please make this BZ a RFE.

Comment 1 Thomas Haller 2016-12-10 19:23:13 UTC
NetworkManager does not handle ovpn files, except it supports to import/export them. Import/export means, to read/write a ovpn file and create a NetworkManager connection. The latter is stored in keyfile format (not ovpn!) in /etc/NetworkManager/system-connections.

If GRU2.ovpn is in keyfile format, it is expected that you cannot import it via VPM import functionality. 


Preferably, we would have an import function for keyfile format as well (for which there exists an RFE). For now, drop the file to /etc/NetworkManager/system-connection, 
  
  chmod 600 $FILE
  chown root:root $FILE
  nmcli connection load $FILE
or
  nmcli connection reload

Comment 2 Thomas Haller 2016-12-10 19:26:37 UTC
> 2. systemctl restart NetworkManager

Sidenote: restarting NetworkManager is almost always not the thing you want. What did you want to achieve?

Comment 3 Stefan Assmann 2016-12-11 01:40:57 UTC
Hi Thomas,
thanks for your post, can you share a link to the RFE? Or mark this bz as duplicate? I'd really like to see NM being able to handle (import/export) the format it actually uses for its own configs.
Moving around config files manually is not really user-friendly.

The reason for doing systemctl restart NetworkManager was to make NM aware that the GRU2.ovpn file is gone from /etc/NetworkManager/system-connections. There's probably a more elegant way to do that.

Comment 4 Thomas Haller 2016-12-11 22:17:16 UTC
ah, I see it's ~only~ upstream (note that all development is done upstream-first, so the upstream bug is almost just as good. OK: the downstream bug adds pressure to fix it, so it serves a purpose).


I change the subject to something specific:
  [RFE] support import/export of NetworkManager's keyfile format in nmcli


But there are really many aspects to this:

 - libnm internally already supports keyfile format. It should become public API
 - nmcli (using libnm) should implement this import/export.
     https://bugzilla.gnome.org/show_bug.cgi?id=744702
 - nmcli should allow offline-use, that is without NetworkManager. E.g. to
   directly write the keyfile. Or even better: just print it to stdout, and 
   allow the user to build on that using shell. E.g.
      nmcli connection export --stdout $CONN_NAME > \
          /etc/NetworkManager/system-connection/new 
   or
      nmcli connection add --stdout type ethernet ... > \
          /etc/NetworkManager/system-connection/new
      https://bugzilla.gnome.org/show_bug.cgi?id=744700
 - leverage import/export from nm-connection-editor.
 - In Gnome/KDE, associate a file extension (.nm-keyfile?) with nm-connection-
   editor to import the keyfile on double-click.

 - maybe: same for other file formats, most prominently ifcfg-rh.

Comment 5 Fedora End Of Life 2017-11-16 19:20:42 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 6 Stefan Assmann 2018-06-07 10:33:17 UTC
any update?