Re: [PATCH] vpn-manager: respect NM_VPN_PLUGIN_DIR

2019-07-18 Thread Jelle Licht
Thomas Haller  writes:

> [snip]
> if you have
>
>   /gnu/store/123verylonghash-networkmanager-1.18.2/
>   /gnu/store/234verylonghash-networkmanager-1.20.0/
>
> and
>
>   /gnu/store/345verylonghash-networkmanager-openvpn-1.2.8/
>
> then the plugin should work with both versions of NetworkManager. How
> would you solve that if you don't have a well known path where VPN
> plugins announce their existance (by putting their .name file there).

We solve this by setting NM_VPN_PLUGIN_DIR to
`/gnu/store/345verylonghash-networkmanager-openvpn-1.2.8/' for both
service configurations.

Mind you, since `network-manager' is an input for each nm vpn plugin we
have packaged, each distinct nm version leads to distinct build
artifacts for each nm vpn plugin.
>
>
>> > At that point, can you not patch NetworkManager source to look at
>> > the
>> > right place? Possibly we could add a configure option to make that
>> > easier.
>> 
>> To summarize and directly address your point; there is indeed *one*
>> location where we put all of our vpn plugins, but this location is
>> only
>> known after building each of nm and the selected vpn plugins.
>
> When switching NetworkManager you have to rebuild all plugins? That
> seems unnecessary and diamentral. At most you need to run a script to
> put the .name files in the new location.
>
> Also, if you anyway rebuild everything, why do you need an environment
> variable? If you can set the environment variable, can you not set the
> build-option? 
>
>
> I guess, if you switch between NetworkManager versions, you would
> change the environment variable. But that is not enough. The VPN
> plugins need to copy their name files to the new location. And at that
> point, what does the environment variable help?
>

The plugin directory will change depending on which plugins are
included, so in order to avoid recompiling NM every time you change the
set of plugins, you need to be able to pass the plugin directory to the
daemon at runtime.

Thanks,
Jelle
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] vpn-manager: respect NM_VPN_PLUGIN_DIR

2019-07-18 Thread Thomas Haller via networkmanager-list
On Thu, 2019-07-18 at 15:53 +0200, Jelle Licht wrote:
> Thomas Haller  writes:
> 
> > On Thu, 2019-07-18 at 13:27 +0200, Jelle Licht wrote:
> > > Thomas Haller  writes:
> > > 
> > > > On Wed, 2019-07-17 at 11:46 +0200, Jelle Licht wrote:
> > > > [snip]
> > > > But the daemon runs as root, so setting NM_VPN_PLUGIN_DIR
> > > > requires
> > > > you
> > > > to become root, to restart the daemon, and to set the
> > > > environment
> > > > variable (in the systemd service file). At that point, you
> > > > could
> > > > just
> > > > as well copy the .name file to /usr/lib/NetworkManager/VPN. Why
> > > > is
> > > > that
> > > > not sufficient?
> > > 
> > > As you say, we do set NM_VPN_PLUGIN_DIR for our networkmanager
> > > daemon.
> > > I was trying to have networkmanager vpn plugins simply work for
> > > Guix
> > > System, which does not follow FHS. As such, there is no
> > > `/usr/lib` to
> > > speak of, or any of the other default locations networkmanager
> > > looks
> > > in.
> > > 
> > > Put another way, do you know of a way to pass vpn plugin
> > > locations to
> > > NM
> > > at runtime?
> > 
> > Hi,
> > 
> > Hm. /usr/lib/NetworkManager/VPN is relevant to all the VPN plugins
> > in
> > your system.
> > 
> > So, even if you don't use /usr/lib, then all plugins still need to
> > agree on one location where to place their .name files? Or how is
> > this
> > supposed to work on Guix?
> 
> The simplified story is that guix builds and installs software in an
> immutable store, with unfriendly looking paths such as
> `/gnu/store/123verylonghash-networkmanager-4.3.1/`. These are then
> symlinked into a so-called profile, which can be activated which
> means
> that the right environment variables are set so systems can actually
> use
> softare installed in the store. NM and each nm vpn plugin has their
> very
> own 'unfriendly' store path as well.
> 
> We have services in guix that are akin to a daemon along with its
> configuration. It is at this point we decide which vpn plugins to
> enable, and only at this point where we know which paths should be
> visible to nm in order to properly 'see' the vpn plugins. 

if you have

  /gnu/store/123verylonghash-networkmanager-1.18.2/
  /gnu/store/234verylonghash-networkmanager-1.20.0/

and

  /gnu/store/345verylonghash-networkmanager-openvpn-1.2.8/

then the plugin should work with both versions of NetworkManager. How
would you solve that if you don't have a well known path where VPN
plugins announce their existance (by putting their .name file there).


> > At that point, can you not patch NetworkManager source to look at
> > the
> > right place? Possibly we could add a configure option to make that
> > easier.
> 
> To summarize and directly address your point; there is indeed *one*
> location where we put all of our vpn plugins, but this location is
> only
> known after building each of nm and the selected vpn plugins.

When switching NetworkManager you have to rebuild all plugins? That
seems unnecessary and diamentral. At most you need to run a script to
put the .name files in the new location.

Also, if you anyway rebuild everything, why do you need an environment
variable? If you can set the environment variable, can you not set the
build-option?


I guess, if you switch between NetworkManager versions, you would
change the environment variable. But that is not enough. The VPN
plugins need to copy their name files to the new location. And at that
point, what does the environment variable help?



> This is a
> consequence of the Guix software model. As such, directly patching
> the
> source or having a configure option would not help us here.
> 
> 
> NB, we could hardcode a location such as
> `/usr/lib/NetworkManager/VPN`
> as well, but this would require a hack that would not be acceptable
> for
> inclusion in `Guix proper'.
> 
> > Thomas
> 
> Thanks,
> Jelle


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] vpn-manager: respect NM_VPN_PLUGIN_DIR

2019-07-18 Thread Jelle Licht
Thomas Haller  writes:

> On Thu, 2019-07-18 at 13:27 +0200, Jelle Licht wrote:
>> Thomas Haller  writes:
>> 
>> > On Wed, 2019-07-17 at 11:46 +0200, Jelle Licht wrote:
>> > [snip]
>> > But the daemon runs as root, so setting NM_VPN_PLUGIN_DIR requires
>> > you
>> > to become root, to restart the daemon, and to set the environment
>> > variable (in the systemd service file). At that point, you could
>> > just
>> > as well copy the .name file to /usr/lib/NetworkManager/VPN. Why is
>> > that
>> > not sufficient?
>> 
>> As you say, we do set NM_VPN_PLUGIN_DIR for our networkmanager
>> daemon.
>> I was trying to have networkmanager vpn plugins simply work for Guix
>> System, which does not follow FHS. As such, there is no `/usr/lib` to
>> speak of, or any of the other default locations networkmanager looks
>> in.
>> 
>> Put another way, do you know of a way to pass vpn plugin locations to
>> NM
>> at runtime?
>
> Hi,
>
> Hm. /usr/lib/NetworkManager/VPN is relevant to all the VPN plugins in
> your system.
>
> So, even if you don't use /usr/lib, then all plugins still need to
> agree on one location where to place their .name files? Or how is this
> supposed to work on Guix?

The simplified story is that guix builds and installs software in an
immutable store, with unfriendly looking paths such as
`/gnu/store/123verylonghash-networkmanager-4.3.1/`. These are then
symlinked into a so-called profile, which can be activated which means
that the right environment variables are set so systems can actually use
softare installed in the store. NM and each nm vpn plugin has their very
own 'unfriendly' store path as well.

We have services in guix that are akin to a daemon along with its
configuration. It is at this point we decide which vpn plugins to
enable, and only at this point where we know which paths should be
visible to nm in order to properly 'see' the vpn plugins. 

>
> At that point, can you not patch NetworkManager source to look at the
> right place? Possibly we could add a configure option to make that
> easier.

To summarize and directly address your point; there is indeed *one*
location where we put all of our vpn plugins, but this location is only
known after building each of nm and the selected vpn plugins. This is a
consequence of the Guix software model. As such, directly patching the
source or having a configure option would not help us here.


NB, we could hardcode a location such as `/usr/lib/NetworkManager/VPN`
as well, but this would require a hack that would not be acceptable for
inclusion in `Guix proper'.

>
> Thomas

Thanks,
Jelle
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] vpn-manager: respect NM_VPN_PLUGIN_DIR

2019-07-18 Thread Thomas Haller via networkmanager-list
On Thu, 2019-07-18 at 13:27 +0200, Jelle Licht wrote:
> Thomas Haller  writes:
> 
> > On Wed, 2019-07-17 at 11:46 +0200, Jelle Licht wrote:
> > [snip]
> > But the daemon runs as root, so setting NM_VPN_PLUGIN_DIR requires
> > you
> > to become root, to restart the daemon, and to set the environment
> > variable (in the systemd service file). At that point, you could
> > just
> > as well copy the .name file to /usr/lib/NetworkManager/VPN. Why is
> > that
> > not sufficient?
> 
> As you say, we do set NM_VPN_PLUGIN_DIR for our networkmanager
> daemon.
> I was trying to have networkmanager vpn plugins simply work for Guix
> System, which does not follow FHS. As such, there is no `/usr/lib` to
> speak of, or any of the other default locations networkmanager looks
> in.
> 
> Put another way, do you know of a way to pass vpn plugin locations to
> NM
> at runtime?

Hi,

Hm. /usr/lib/NetworkManager/VPN is relevant to all the VPN plugins in
your system.

So, even if you don't use /usr/lib, then all plugins still need to
agree on one location where to place their .name files? Or how is this
supposed to work on Guix?

At that point, can you not patch NetworkManager source to look at the
right place? Possibly we could add a configure option to make that
easier.

Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] vpn-manager: respect NM_VPN_PLUGIN_DIR

2019-07-18 Thread Jelle Licht
Thomas Haller  writes:

> On Wed, 2019-07-17 at 11:46 +0200, Jelle Licht wrote:
> [snip]
> But the daemon runs as root, so setting NM_VPN_PLUGIN_DIR requires you
> to become root, to restart the daemon, and to set the environment
> variable (in the systemd service file). At that point, you could just
> as well copy the .name file to /usr/lib/NetworkManager/VPN. Why is that
> not sufficient?

As you say, we do set NM_VPN_PLUGIN_DIR for our networkmanager daemon.
I was trying to have networkmanager vpn plugins simply work for Guix
System, which does not follow FHS. As such, there is no `/usr/lib` to
speak of, or any of the other default locations networkmanager looks in.

Put another way, do you know of a way to pass vpn plugin locations to NM
at runtime?

>> +file = g_file_new_for_path (conf_dir_user);
>> +priv->monitor_etc = g_file_monitor_directory (file,
>> G_FILE_MONITOR_NONE, NULL, NULL);
>> +g_object_unref (file);
>> +if (priv->monitor_etc) {
>
> btw, you cannot overwrite the existing monitor_etc and monitor_id_etc
> fields. It would require new ones...
Thanks for explaining this.

- Jelle
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list