OpenVPN / openvpn3-indicator

Simple GTK indicator GUI for OpenVPN 3 Linux
https://github.com/OpenVPN/openvpn3-indicator
GNU Affero General Public License v3.0
24 stars 2 forks source link

Code comment - "#TODO: What can you do with Network Change Events?" #1

Closed dsommers closed 4 months ago

dsommers commented 5 months ago

First .... It's awesome to see this project, and that it is one of the few ones actually making use of the D-Bus interface in OpenVPN 3 Linux. I'm the maintainer of OpenVPN 3 Linux, and I hope to see lots of cool stuff integrating with it. I'm very thankful for you putting efforts into providing this as a "stop gap" before we get NM integration in place.

I saw in the comments that you raised the question what you could do with NetworkChange events. I can provide some details here.

Currently, these are signals only available for the openvpn user/group currently. This is used to do certain operations when VPN sessions start/stop and you want specific actions to happen when the network configuration changes. One example (where we already put this into use) is the openvpn3-service-aws. This is used to modify the AWS VPC setups to account for network routes being pushed to a VPN client. If you have an OpenVPN 3 Linux client running on an AWS EC2 host, you can enable this feature (it requires quite a config file, though) and it will propagate all added and removed network routes to the designated AWS VPC. Other EC2 hosts in that VPC can then access networks made available via the VPN connection.

There are four "main groups" of network information available: Device, VPN IP address, routes and DNS. Then there are sub-groups, like "device created", "device removed", "IP address added", "IP address removed", and so on.

I see you listen for Session Manager events. For an tray-icon tool, that should normally be sufficient. The NetworkChange events is generally out-of-scope for that kind of tool. NetworkChange is more a system-level notification. For example if you want certain services to start if a specific IP address is assigned, or to run a specific program when a certain network route and DNS server is configured - or like the AWS VPC integration, and such things. NetworkChange is not something end-users will need to care much about.

I would suggest to just ignore this feature for this appindicator project.

grzegorz-gutowski commented 5 months ago

TL;DR: No point using Network Change Events in a simple end-user GUI app.

Thank you for an extensive clarification! I'll just leave it here for others to use.

By the way, is there any natural way to get notified when some other app adds/removes configs. I didn't find it in ConfigurationManager. I have decided to refresh config list every 30 seconds in my app.

dsommers commented 5 months ago

By the way, is there any natural way to get notified when some other app adds/removes configs

That's a darn good question! No, currently we don't emit any signals on new configuration objects. But we should have that!

I'll see what I can manage to do for the coming v22_dev release (not happening too soon, unfortunately); I don't want to squeeze much new things into that release (it will have a brand new D-Bus glib2 integration, see GH issue 171 for details). When I start migrating the config manager, I'll have that in my mind to see if we can easily introduce such signalling.

An implementation here would need to send a signal each time the current user imports/removes a configuration profile + if another user grants/revokes access to a configuration profile (via openvpn3 config-acl).

Feel free to send fixes to openvpn3-linux (including the Python stuff), whenever something strikes you as odd or wrong. Or just have a good idea implementing a missing feature. I'm most easily available on e-mail if there are questions.

grzegorz-gutowski commented 4 months ago

I'll ask for config list change signals later in openvpn3-linux project.