Re: How to import .ovpn file



On Mon, Feb 24, 2020 at 8:00 AM Thomas Haller <thaller redhat com> wrote:
On Mon, 2020-02-24 at 06:59 -0600, Greg Oliver via networkmanager-list
wrote:
> On Mon, Feb 24, 2020 at 1:40 AM Thomas Haller <thaller redhat com>
> wrote:
> > On Sun, 2020-02-23 at 18:14 -0600, Greg Oliver via networkmanager-
> > list
> > wrote:
> > > While the gui has the import option, I find it has always told me
> > > "unknown option" on every profile I have ever tried to import.
> > That
> > > said, nmcli always imports them just fine.
> > >
> > > nmcli connection import type openvpn file openvpnProfile.ovpn
> >
> > hi,
> >
> > which GUI? nm-connection-editor and gnome-control-center use the
> > same
> > import code as nmcli (by loading the library specified in
> > "/usr/lib/NetworkManager/VPN/nm-openvpn-service.name").
>
> Both - this is nm-connection-editor's output (nothing into the
> journal though).
> """
> Could Not Create New Connection
> The VPN plugin failed to import the VPN connection correctly. Key
> file contains line "client" which is not a key-value pair, group or
> comment.
> """
>
> If I hand edit the ovpn file, and remove the line, it just starts
> complaining about more lines :)

Hi,

The import code of a NetworkManager VPN plugin might just not support
an option and fail. In that case, it's a missing feature, and should be
fixed. The import code for VPN is here [1].

[1] https://gitlab.gnome.org/GNOME/NetworkManager-openvpn/-/blob/8cde95234832f10acd8f6a7c375354e948ee53c1/properties/import-export.c#L777


If you click "import" in nm-connection-editor, then nm-c-e asks all
installed VPN plugins to import the file. Since they all fail, nm-c-e
doesn't know which plugin was intended to be used, so it picks one
error message arbitrarily. The problem is, that the error message might
not be the error message from the openvpn plugin. That should be
improved by letting the user specify which VPN type this is.


Try instead `nmcli connection import type openvpn file "$FILENAME"`.
That should give you a better error message and a better idea what's
wrong.

That was my point to the OP - that *is* how I get the profile imported :)
nmcli pulls it in perfectly while both nm-connection-editor and gnome both fail on it's import.  I am not worried about it, but there is definitely (and always has been for me) something askew if the libraries are supposedly the same and the methods are the same behind the scenes.  I have never successfully imported an OVPN profile with a GUI and have used Linux since way before NetworkManager was even a thought.

 

best,
Thomas

>
> [greg@dellxps ~]$ sudo rpm -qa |grep NetworkManager|sort
> NetworkManager-1.20.10-1.fc31.x86_64
> NetworkManager-adsl-1.20.10-1.fc31.x86_64
> NetworkManager-bluetooth-1.20.10-1.fc31.x86_64
> NetworkManager-config-connectivity-fedora-1.20.10-1.fc31.noarch
> NetworkManager-libnm-1.20.10-1.fc31.x86_64
> NetworkManager-openconnect-1.2.6-2.fc31.x86_64
> NetworkManager-openconnect-gnome-1.2.6-2.fc31.x86_64
> NetworkManager-openvpn-1.8.10-1.fc31.1.x86_64
> NetworkManager-openvpn-gnome-1.8.10-1.fc31.1.x86_64
> NetworkManager-ppp-1.20.10-1.fc31.x86_64
> NetworkManager-pptp-1.2.8-1.fc31.2.x86_64
> NetworkManager-pptp-gnome-1.2.8-1.fc31.2.x86_64
> NetworkManager-ssh-1.2.10-2.fc31.x86_64
> NetworkManager-ssh-gnome-1.2.10-2.fc31.x86_64
> NetworkManager-team-1.20.10-1.fc31.x86_64
> NetworkManager-vpnc-1.2.6-3.fc31.x86_64
> NetworkManager-vpnc-gnome-1.2.6-3.fc31.x86_64
> NetworkManager-wifi-1.20.10-1.fc31.x86_64
> NetworkManager-wwan-1.20.10-1.fc31.x86_64
>
> [greg@dellxps ~]$ ll /usr/lib/NetworkManager/VPN/
> total 20,480
> drwxr-xr-x. 2 root root 155 Jan 14 03:08 .
> drwxr-xr-x. 6 root root  77 Jan 14 03:08 ..
> -rw-r--r--. 1 root root 313 Sep 25 09:49 nm-openconnect-service.name
> -rw-r--r--. 1 root root 340 Jul 24  2019 nm-openvpn-service.name
> -rw-r--r--. 1 root root 302 Jul 24  2019 nm-pptp-service.name
> -rw-r--r--. 1 root root 265 Jul 24  2019 nm-ssh-service.name
> -rw-r--r--. 1 root root 322 Jul 24  2019 nm-vpnc-service.name
> Like I said - nmcli pulls it in straight away though.  I'm not trying
> to hijack this thread, just trying to help the OP.  I could care less
> if the GUI works for this really.  Thanks though.

> > But yes, nmcli's import should do pretty much the same as nm-c-e/g-
> > c-c.
> >
> > plasma-nm implements the import differently. So, maybe that's the
> > difference.
> >
> >
> > best,
> > Thomas
>
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]