Modernising the management interface
Hi,
I have for a long time pondered on how we can make the management API more suitable for more modern tools and tasks. So I am just giving an extremely early heads-up on on what I'm poking at ... and hopefully receive some feedbacks on what you think.
One of the things which have struck me is that D-Bus is adopted a lot of places, and its internal API have been considered stable for about 10 years or more. Even though there are areas where D-Bus seems a bit over-engineered, it has proved to be a very useful IPC mechanism for a lot of software.
Currently, each tool and application who wants to integrate with the management API today, needs to write their own TCP connect code and implement various methods to send, receive and parse the data to and from the management interface. And the management interface doesn't scale well if you want to add support for more advanced management.
Yes, the current interface solves most of today's challenges reasonably well. But I believe it can be improved so that it can be even more flexible and more easily integrable with various set of management tools.
* Why D-Bus?
It provides a standardised API with integrations to most programming and scripting languages. It is asynchronous and it you can both send messages but also have management tools act upon signals the application sends. The way messages are sent are standardised, and all the connectivity and data exchange is covered by the D-Bus libraries. Even data types are standardised and there is type safety on all data exchanged in a D-Bus message.
D-Bus is also pretty much installed by default on any modern Linux distribution today. And as far as I have seen, it exists on most POSIX based platforms. I am somewhat uncertain on the Windows and macOS side, though. More on that towards the end.
* How will a D-Bus improve OpenVPN?
With D-Bus we can provide a better integration towards GUIs as well as other management tools. OpenVPN can much more easy alert D-Bus listeners about things which requires attention. And we can more easily extend the management interface to also cover more areas of OpenVPN more easily, as D-Bus will describe the API through its built-in introspection.
This can also enable us to provide plug-ins to be managed via the management interface, where each plug-in can individually provide it's own API without requiring any changes to the OpenVPN core. The plug-in just needs to provide an init call which tells the OpenVPN server it has D-Bus support, and introspection takes care of providing the proper message passing from a management client down to the plug-in itself.
And it can enabled more modern and advanced management tools to be integrated more easily with OpenVPN. For example the Cockpit project[1] is a a web based management interface for Linux systems with systemd. Cockpit depends entirely on D-Bus to do the management.
Writing a new module in Cockpit requires only to write a module
covering the D-Bus methods defined in OpenVPN, the presentation and interaction is covered by the Cockpit framework. A demo how to implement setting the time zone as a Cockpit module can be seen here[2].
[1] <http://cockpit-project.org/>
[2] <https://www.youtube.com/watch?v=97l1qf2sZtk&feature=youtu.be&t=1754>
Other features where this can be useful is to provide D-Bus signals when users log in and out for audit purposes. It is possible to add methods where you can set thresholds on bytes sent/received or how long a session have been running, and then send a signal when those thresholds are reached; then a management tool can decide what to do when these signals happens. As a Cockpit feature, could be to list all connected VPN clients on a Cockpit enabled OpenVPN server, and have a button kick them out or otherwise manage these VPN clients.
Many of these things requires today a poll mechanism which doesn't scale too well as only one instance can be connected to the management API today. With D-Bus you can have many instances connected to the interfaces OpenVPN would provide at the same time - which again simplifies implementing new management tools for OpenVPN.
Similar D-Bus interfaces will also be added to the OpenVPN 3 codebase when that arrives, which should help migration between OpenVPN 2 and OpenVPN 3 setups as well.
* What comes next?
Right now I am digging into the whole feature set of the management interface and wrapping my head around how this could look like through a D-Bus interface.
The next thing I am will do is to provide some proof-of-concept code, which first will just connect to today's management API and be a broker between OpenVPN and D-Bus. This won't scale well, but it will at least give something we can play with.
Then comes the job of implementing D-Bus natively into OpenVPN and then start to provide more advanced features over D-Bus which today is be harder to achieve. This will be an iterative process.
But ... It would be very useful to get some input from especially macOS and Windows developers on how the state of D-Bus are on those platforms. AFAIK, D-Bus is available on most *BSD platforms, so that shouldn't be an issue.
It is not being planned to remove the management interface. If D-Bus works well for everyone on all platforms, then we can discuss what to do next. But as of now, I have no plans to remove this part of the code.
And of course ... plenty of discussions along the road :) But I chose to start this discussion in the public before actually starting to coding and submitting patches - just as a heads up and to get feedback before moving on further.
Signature · 4 lines
kind regards, David Sommerseth OpenVPN Technologies, Inc
I'd bet many people would like to see REST here
2016-08-31 23:55 GMT+05:00 David Sommerseth <
[email protected]...>:
Quoted 137 lines
Hi,
I have for a long time pondered on how we can make the management API more suitable for more modern tools and tasks. So I am just giving an extremely early heads-up on on what I'm poking at ... and hopefully receive some feedbacks on what you think.
One of the things which have struck me is that D-Bus is adopted a lot of places, and its internal API have been considered stable for about 10 years or more. Even though there are areas where D-Bus seems a bit over-engineered, it has proved to be a very useful IPC mechanism for a lot of software.
Currently, each tool and application who wants to integrate with the management API today, needs to write their own TCP connect code and implement various methods to send, receive and parse the data to and from the management interface. And the management interface doesn't scale well if you want to add support for more advanced management.
Yes, the current interface solves most of today's challenges reasonably well. But I believe it can be improved so that it can be even more flexible and more easily integrable with various set of management tools.
* Why D-Bus?
It provides a standardised API with integrations to most programming and scripting languages. It is asynchronous and it you can both send messages but also have management tools act upon signals the application sends. The way messages are sent are standardised, and all the connectivity and data exchange is covered by the D-Bus libraries. Even data types are standardised and there is type safety on all data exchanged in a D-Bus message.D-Bus is also pretty much installed by default on any modern Linux distribution today. And as far as I have seen, it exists on most POSIX based platforms. I am somewhat uncertain on the Windows and macOS side, though. More on that towards the end.
* How will a D-Bus improve OpenVPN?
With D-Bus we can provide a better integration towards GUIs as well as other management tools. OpenVPN can much more easy alert D-Bus listeners about things which requires attention. And we can more easily extend the management interface to also cover more areas of OpenVPN more easily, as D-Bus will describe the API through its built-in introspection.
This can also enable us to provide plug-ins to be managed via the management interface, where each plug-in can individually provide it's own API without requiring any changes to the OpenVPN core. The plug-in just needs to provide an init call which tells the OpenVPN server it has D-Bus support, and introspection takes care of providing the proper message passing from a management client down to the plug-in itself.
And it can enabled more modern and advanced management tools to be integrated more easily with OpenVPN. For example the Cockpit project[1] is a a web based management interface for Linux systems with systemd. Cockpit depends entirely on D-Bus to do the management.
Writing a new module in Cockpit requires only to write a module
covering the D-Bus methods defined in OpenVPN, the presentation and interaction is covered by the Cockpit framework. A demo how to implement setting the time zone as a Cockpit module can be seen here[2].[1] <http://cockpit-project.org/>
[2] <https://www.youtube.com/watch?v=97l1qf2sZtk&feature=youtu.be&t=1754>Other features where this can be useful is to provide D-Bus signals when users log in and out for audit purposes. It is possible to add methods where you can set thresholds on bytes sent/received or how long a session have been running, and then send a signal when those thresholds are reached; then a management tool can decide what to do when these signals happens. As a Cockpit feature, could be to list all connected VPN clients on a Cockpit enabled OpenVPN server, and have a button kick them out or otherwise manage these VPN clients.
Many of these things requires today a poll mechanism which doesn't scale too well as only one instance can be connected to the management API today. With D-Bus you can have many instances connected to the interfaces OpenVPN would provide at the same time - which again simplifies implementing new management tools for OpenVPN.
Similar D-Bus interfaces will also be added to the OpenVPN 3 codebase when that arrives, which should help migration between OpenVPN 2 and OpenVPN 3 setups as well.
* What comes next?
Right now I am digging into the whole feature set of the management interface and wrapping my head around how this could look like through a D-Bus interface.
The next thing I am will do is to provide some proof-of-concept code, which first will just connect to today's management API and be a broker between OpenVPN and D-Bus. This won't scale well, but it will at least give something we can play with.
Then comes the job of implementing D-Bus natively into OpenVPN and then start to provide more advanced features over D-Bus which today is be harder to achieve. This will be an iterative process.
But ... It would be very useful to get some input from especially macOS and Windows developers on how the state of D-Bus are on those platforms. AFAIK, D-Bus is available on most *BSD platforms, so that shouldn't be an issue.
It is not being planned to remove the management interface. If D-Bus works well for everyone on all platforms, then we can discuss what to do next. But as of now, I have no plans to remove this part of the code.
And of course ... plenty of discussions along the road :) But I chose to start this discussion in the public before actually starting to coding and submitting patches - just as a heads up and to get feedback before moving on further.
--
kind regards,David Sommerseth
OpenVPN Technologies, Inc------------------------------------------------------------
------------------_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 1 line · Илья Шипицин
I'd bet many people would like to see REST here
You might be right here. But that would actually be far more complicated to implement, as then OpenVPN needs to be a HTTP server - with all the complications that involves.
In addition you loose some features, such as asynchronous communication and the signalling (think "PUSH" instead of "POLL"). And the data types are loosely defined over a HTTP (unless you start pulling in XML, DTD, Schemas, relaxng, etc). Or to say it differently, REST is more like an interface than an API itself.
However, with a D-Bus interface it actually is much easier to write a REST-dbus bridge - as the D-Bus API is very well defined and offers
introspection to what is connected to the D-Bus. That gives the
bonus that such a bridge can tackle more than just OpenVPN too.
For a D-Bus example - this one is in C:
<https://leonardoce.wordpress.com/2015/04/01/dbus-tutorial-a-simple-serv
er/>
- --
kind regards,
David Sommerseth
OpenVPN Technologies, Inc
Quoted 72 lines
2016-08-31 23:55 GMT+05:00 David Sommerseth
<[email protected]...
<mailto:[email protected]...>>:Hi,
I have for a long time pondered on how we can make the management API more suitable for more modern tools and tasks. So I am just giving an extremely early heads-up on on what I'm poking at ... and hopefully receive some feedbacks on what you think.
One of the things which have struck me is that D-Bus is adopted a lot of places, and its internal API have been considered stable for about 10 years or more. Even though there are areas where D-Bus seems a bit over-engineered, it has proved to be a very useful IPC mechanism for a lot of software.
Currently, each tool and application who wants to integrate with the management API today, needs to write their own TCP connect code and implement various methods to send, receive and parse the data to and from the management interface. And the management interface doesn't scale well if you want to add support for more advanced management.
Yes, the current interface solves most of today's challenges reasonably well. But I believe it can be improved so that it can be even more flexible and more easily integrable with various set of management tools.
* Why D-Bus? It provides a standardised API with integrations to most programming and scripting languages. It is asynchronous and it you can both send messages but also have management tools act upon signals the application sends. The way messages are sent are standardised, and all the connectivity and data exchange is covered by the D-Bus libraries. Even data types are standardised and there is type safety on all data exchanged in a D-Bus message.
D-Bus is also pretty much installed by default on any modern Linux distribution today. And as far as I have seen, it exists on most POSIX based platforms. I am somewhat uncertain on the Windows and macOS side, though. More on that towards the end.
* How will a D-Bus improve OpenVPN?
With D-Bus we can provide a better integration towards GUIs as well as other management tools. OpenVPN can much more easy alert D-Bus listeners about things which requires attention. And we can more easily extend the management interface to also cover more areas of OpenVPN more easily, as D-Bus will describe the API through its built-in introspection.
This can also enable us to provide plug-ins to be managed via the management interface, where each plug-in can individually provide it's own API without requiring any changes to the OpenVPN core. The plug-in just needs to provide an init call which tells the OpenVPN server it has D-Bus support, and introspection takes care of providing the proper message passing from a management client down to the plug-in itself.
And it can enabled more modern and advanced management tools to be integrated more easily with OpenVPN. For example the Cockpit project[1] is a a web based management interface for Linux systems with systemd. Cockpit depends entirely on D-Bus to do the management. Writing a new module in Cockpit requires only to write a module covering the D-Bus methods defined in OpenVPN, the presentation and interaction is covered by the Cockpit framework. A demo how to implement setting the time zone as a Cockpit module can be seen here[2].
Quoted 4 lines
[1] <http://cockpit-project.org/> [2]
<https://www.youtube.com/watch?v=97l1qf2sZtk&feature=youtu.be&t=1754
<https://www.youtube.com/watch?v=97l1qf2sZtk&feature=youtu.be&t=1754>>
Quoted 54 lines
Other features where this can be useful is to provide D-Bus signals when users log in and out for audit purposes. It is possible to add methods where you can set thresholds on bytes sent/received or how long a session have been running, and then send a signal when those thresholds are reached; then a management tool can decide what to do when these signals happens. As a Cockpit feature, could be to list all connected VPN clients on a Cockpit enabled OpenVPN server, and have a button kick them out or otherwise manage these VPN clients.
Many of these things requires today a poll mechanism which doesn't scale too well as only one instance can be connected to the management API today. With D-Bus you can have many instances connected to the interfaces OpenVPN would provide at the same time
- which again simplifies implementing new management tools for OpenVPN.Similar D-Bus interfaces will also be added to the OpenVPN 3 codebase when that arrives, which should help migration between OpenVPN 2 and OpenVPN 3 setups as well.
* What comes next?
Right now I am digging into the whole feature set of the management interface and wrapping my head around how this could look like through a D-Bus interface.
The next thing I am will do is to provide some proof-of-concept code, which first will just connect to today's management API and be a broker between OpenVPN and D-Bus. This won't scale well, but it will at least give something we can play with.
Then comes the job of implementing D-Bus natively into OpenVPN and then start to provide more advanced features over D-Bus which today is be harder to achieve. This will be an iterative process.
But ... It would be very useful to get some input from especially macOS and Windows developers on how the state of D-Bus are on those platforms. AFAIK, D-Bus is available on most *BSD platforms, so that shouldn't be an issue.
It is not being planned to remove the management interface. If D-Bus works well for everyone on all platforms, then we can discuss what to do next. But as of now, I have no plans to remove this part of the code.
And of course ... plenty of discussions along the road :) But I chose to start this discussion in the public before actually starting to coding and submitting patches - just as a heads up and to get feedback before moving on further.
Quoted 3 lines
-- kind regards,
David Sommerseth OpenVPN Technologies, Inc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXxznlAAoJEIbPlEyWcf3yH5cP/i8yXnaiwC6yqyyfTaOtrfAR m1TKn7w+AJDQdpQXylaj9FD3O3bYqOZ3fTPQG6u3iGk9MdyWWLdFHdOO/G/Vxadf OH9WjFVYJOGj+IGb+wfH63qercregeALNz2AGlp0FJbvoPw3vNaviKg3OyIIiGPa TogjIu59WYvbzxzwK5o1Vppy0sZZcKRDgKIw8hGxy4TR7V//bb0J5C8a0xQIVUY7 WRcCeMvUhz5lNsjM3fYOZ8lf3U7u0ny92c2VOxQGbSiOU9JKN5njlY5OhbtdgVU4 GjGhNOfkF6qUcUuojNwoqS1Reoyy/Wx9h0LOVSKZFmvJ3PN1MvBB6bNM0E2cOIjP ZCL2YWV66iooBSBzuvN80DHB4FPxf0Nv0OgpsWTqEr3XScgAd4ybjfYyN3DpZJyF pjkrN+VeQsigqRuPM6XqPv0pru/BbEIb89Zn/KfAwRe4DhkjFvviPg3reRJqH+TS DEn6d11S5bTLFGmStCVrbxutFas5Lhwat9AipK/umIaJJ2qThDeuCpYAhPZp0tyR t4lPNhfiVCjg+sf/cjU7w+wOCGy1Ntg3OKbUZBny0PU581c4PRLeII9NxFPhxI9c GEBP0qAdAp90pUhfwwiEXteJTNAvvsM70TdhojB9W2P2LikHn+LCFyfKrNp+7t1Q ljOIVpmJtW7UDuXxs6mt
=0tPq
-----END PGP SIGNATURE-----
Hi,
Quoted 5 lines · David Sommerseth
Quoted 4 lines
It is not being planned to remove the management interface. If D-Bus works well for everyone on all platforms, then we can discuss what to do next. But as of now, I have no plans to remove this part of the code.
That's all what I wanted to hear -- as long as the management interface (MI) is not going anywhere, no need to panic, right? I like the simple design of the current MI that makes it so easy to debug over command line, support on virtually any platform without external libraries etc. Even with D-Bus one has to still send messages specific to the application and the UI developer has to learn a few new keywords. Not very different from the current state of affairs unless we have a use case that is not easy to support over the current MI. I have never used D-Bus so no idea of the status of Windows support -- I believe the reference implementation as a windows port, not sure how well maintained it is.
One limitation of the current setup is lack of a security layer which makes passing passwords, keys etc not very safe. I suppose D-Bus has security features?
Selva
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 8 lines · Selva Nair
Hi,
Quoted 2 lines · On Wed, Aug 31, 2016 at 4:11 PM, David Sommerseth <[email protected]...…
It is not being planned to remove the management interface. If D-Bus works well for everyone on all platforms, then we can disc
uss
Quoted 5 lines
Quoted 2 lines
what to do next. But as of now, I have no plans to remove this part of the code.
That's all what I wanted to hear -- as long as the management interfac
e
Quoted 3 lines
(MI) is not going anywhere, no need to panic, right? I like the simple design of the current MI that makes it so easy to debug over command line, support on virtually any platform without external libraries etc
.
Quoted 4 lines
Even with D-Bus one has to still send messages specific to the application and the UI developer has to learn a few new keywords. Not very different from the current state of affairs unless we have a use case that is not easy to support over the current MI. I have never use
d
Quoted 2 lines
D-Bus so no idea of the status of Windows support -- I believe the reference implementation as a windows port, not sure how well maintain
ed
Quoted 1 line
it is.
I noticed that the upstream D-Bus community have embraced the Windows port and included all fixes for Windows there. So it is probably somewhat better maintained nowadays. But I have not looked where to download things.
If I've understood some of the D-Bus docs correctly, it should also be possible to use D-Bus without a "master daemon" running too, but that needs to be investigated further.
No, no need to panic :) But I think that GUI's may also have some advantages of using D-Bus too, such as getting a more instant notifications when something goes wrong, or if a user needs to re-authenticate. But I am completely open to explore these areas and not set things to stone now.
I am also open to look at alternatives to D-Bus on Windows too, if there is something native which is worth looking into.
Actually, I also wonder how this would work on Android as well. Android have the binder interface, I believe, which is somewhat related but not the same. And if such an interface would be useful there.
I'm not too thrilled about needing to look at several implementations resolving what D-Bus does in OpenVPN (similar to the OpenSSL and mbedTLS modularity) ... but if that is considered a requirement, we will definitely look into that.
Quoted 3 lines
One limitation of the current setup is lack of a security layer which makes passing passwords, keys etc not very safe. I suppose D-Bus has security features?
Yes, it does. Again, I have no idea how this is resolved on Windows, but I know that on Linux this is coupled with polkit (formerly known as PolicyKit), where you can define policies on the different methods exposed over D-Bus. So also here it is possible to gain additional control without too much extra work. The policies being defined can include things such as:
- with or without password
- if the authentication can be "cached" (need to authenticate each time or only after some idle time)
- if it can be an "inactive user" (not having a session active on the local console, such as ssh) or if it must be an active session
- If the the authentication must be an admin user, or if the current user would suffice.
Plus polkit can do even more fine grained control as well, through the rule system.
I'll admit I don't have full overview of all you can control via these policies, but it should truly suffice for our need. A reasonably nice and easy introduction to polkit can be found here:
<http://www.admin-magazine.com/Articles/Assigning-Privileges-with-sudo-a
nd-PolicyKit>
- --
kind regards,
David Sommerseth
OpenVPN Technologies, Inc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXx2XsAAoJEIbPlEyWcf3y5IAQAMDqTGXXH/mUMNeK1GlBBaT5 mrmmz7ARybBT7zQCIkrcr/6DgVOZQ4n3JOQWaPSFhIyzw7BTwg0WqlTMRBpmCazG 2y3HuscaOfW3AUKtns+LyScLkQyeZwWKn2Y03Y03KEKVAXz26hrXSrIl02ZUYSqo 0rv9fk8D8iiK52vAUGFe4TQnmW0fcj5dQu6Q2UQFtPNHPuL/DYJcHTd65DgYX6Dw G5KkEF9o0Bwzx2rPBqMoyn1McfD+iOJFKmrVCczH62z16B/0f6VuE5ssdM8i9GD7 uYCY/kAqv3xmf/M42gWQpAh7nVWtUxd5ny49+X8ZiAbU3G22pWzFuz+DpxF/oL0s cQIuoxoWCgQsHqTwSKZsUvZ5iacbxY9KIJ1t1xAMwDr16pvIo7IX2tXVhe7DqQl2 dKTo9kGARdQK/fahdMg136JJFXHZm7zTJtGyAouYUf+tgTAjj76my6y0UfxDIZYM ua2MHSAm6xVH4OFEsoqzACY76V10VeU21WJ26KYW/GvdiXq/mIV2W57x+vb1fG52 DVdvfXtuHZQIhNEIRYZ+9Kob104ojegDMp3IaCa1FPxZr6vuKtIDSrCRUlD2qDlH 1f7ozDALLsYEDxcYULq8U4QLH6N9qR8Zz8R4Hgea3uONNa/xX9hVGxfGxwXjyRiF jlAkS3mF4yHhhJ/9WDG0
=myng
-----END PGP SIGNATURE-----
Quoted 42 lines · David Sommerseth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 8 lines · Selva Nair
Hi,
Quoted 2 lines · On Wed, Aug 31, 2016 at 4:11 PM, David Sommerseth <[email protected]...…
It is not being planned to remove the management interface. If D-Bus works well for everyone on all platforms, then we can disc
uss
Quoted 5 lines
Quoted 2 lines
what to do next. But as of now, I have no plans to remove this part of the code.
That's all what I wanted to hear -- as long as the management interfac
e
Quoted 3 lines
(MI) is not going anywhere, no need to panic, right? I like the simple design of the current MI that makes it so easy to debug over command line, support on virtually any platform without external libraries etc
.
Quoted 4 lines
Even with D-Bus one has to still send messages specific to the application and the UI developer has to learn a few new keywords. Not very different from the current state of affairs unless we have a use case that is not easy to support over the current MI. I have never use
d
Quoted 2 lines
D-Bus so no idea of the status of Windows support -- I believe the reference implementation as a windows port, not sure how well maintain
ed
Quoted 1 line
it is.
I noticed that the upstream D-Bus community have embraced the Windows port and included all fixes for Windows there. So it is probably somewhat better maintained nowadays. But I have not looked where to download things.
If I've understood some of the D-Bus docs correctly, it should also be possible to use D-Bus without a "master daemon" running too, but that needs to be investigated further.
Quoted 6 lines
No, no need to panic :) But I think that GUI's may also have some advantages of using D-Bus too, such as getting a more instant notifications when something goes wrong, or if a user needs to re-authenticate. But I am completely open to explore these areas and not set things to stone now.
My advice, just leave the management-interface alone, at least until a real need for a different framework arises . It "ain't broke", so why fix it?
The amount of communication we need/have between OpenVPN and UI's is so minimal that it shouldn't take more than an hour for a developer to "learn" the current management "protocol". Replacing or even augmenting it with D-Bus bringing in new dependency and a lot of bloat doesn't make much sense; nor does it look worth the time and effort to me..
Selva
Il 01/09/2016 07:33, Selva Nair ha scritto:
Quoted 61 lines
On Wed, Aug 31, 2016 at 7:19 PM, David Sommerseth
<[email protected]...
<mailto:[email protected]...>> wrote:-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 31/08/16 23:25, Selva Nair wrote:
> Hi,
>
> On Wed, Aug 31, 2016 at 4:11 PM, David Sommerseth
> <[email protected]...
<mailto:[email protected]...>
> <mailto:[email protected]...
<mailto:[email protected]...>>> wrote:
>
> > It is not being planned to remove the management interface. If
> > D-Bus works well for everyone on all platforms, then we can disc
uss
> > what to do next. But as of now, I have no plans to remove this
> > part of the code.
>
>
> That's all what I wanted to hear -- as long as the management interfac e
> (MI) is not going anywhere, no need to panic, right? I like the simple > design of the current MI that makes it so easy to debug over command > line, support on virtually any platform without external libraries etc .
> Even with D-Bus one has to still send messages specific to the > application and the UI developer has to learn a few new keywords. Not > very different from the current state of affairs unless we have a use > case that is not easy to support over the current MI. I have never use d
> D-Bus so no idea of the status of Windows support -- I believe the > reference implementation as a windows port, not sure how well maintain ed
> it is.I noticed that the upstream D-Bus community have embraced the Windows port and included all fixes for Windows there. So it is probably somewhat better maintained nowadays. But I have not looked where to download things.
If I've understood some of the D-Bus docs correctly, it should also be possible to use D-Bus without a "master daemon" running too, but that needs to be investigated further.
No, no need to panic :) But I think that GUI's may also have some advantages of using D-Bus too, such as getting a more instant notifications when something goes wrong, or if a user needs to re-authenticate. But I am completely open to explore these areas and not set things to stone now.
My advice, just leave the management-interface alone, at least until a real need for a different framework arises . It "ain't broke", so why fix it?
Quoted 5 lines
The amount of communication we need/have between OpenVPN and UI's is so minimal that it shouldn't take more than an hour for a developer to "learn" the current management "protocol". Replacing or even augmenting it with D-Bus bringing in new dependency and a lot of bloat doesn't make much sense; nor does it look worth the time and effort to me..
The main benefit seems to be easing the management of clients from the server-side. This could prove useful when managing VPN servers that have large numbers of clients, for example in the VPN service provider use-case. Is that the primary use-case you're thinking of, David?
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 66 lines · Samuli Seppänen
Il 01/09/2016 07:33, Selva Nair ha scritto:
Quoted 60 lines
On Wed, Aug 31, 2016 at 7:19 PM, David Sommerseth
<[email protected]...
<mailto:[email protected]...>> wrote:-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 31/08/16 23:25, Selva Nair wrote:
> Hi,
>
> On Wed, Aug 31, 2016 at 4:11 PM, David Sommerseth
> <[email protected]...
<mailto:[email protected]...>
> <mailto:[email protected]...
<mailto:[email protected]...>>> wrote:
>
> > It is not being planned to remove the management interface. If
> > D-Bus works well for everyone on all platforms, then we can disc
uss
> > what to do next. But as of now, I have no plans to remove this
> > part of the code.
>
>
> That's all what I wanted to hear -- as long as the management interfac e
> (MI) is not going anywhere, no need to panic, right? I like the simple > design of the current MI that makes it so easy to debug over command > line, support on virtually any platform without external libraries etc .
> Even with D-Bus one has to still send messages specific to the > application and the UI developer has to learn a few new keywords. Not > very different from the current state of affairs unless we have a use > case that is not easy to support over the current MI. I have never use d
> D-Bus so no idea of the status of Windows support -- I believe the > reference implementation as a windows port, not sure how well maintain ed
> it is.I noticed that the upstream D-Bus community have embraced the Windows port and included all fixes for Windows there. So it is probably somewhat better maintained nowadays. But I have not looked where to download things.
If I've understood some of the D-Bus docs correctly, it should also be possible to use D-Bus without a "master daemon" running too, but that needs to be investigated further.
No, no need to panic :) But I think that GUI's may also have some advantages of using D-Bus too, such as getting a more instant notifications when something goes wrong, or if a user needs to re-authenticate. But I am completely open to explore these areas and not set things to stone now.
My advice, just leave the management-interface alone, at least until a real need for a different framework arises . It "ain't broke", so why fix it?
Quoted 5 lines
The amount of communication we need/have between OpenVPN and UI's is so minimal that it shouldn't take more than an hour for a developer to "learn" the current management "protocol". Replacing or even augmenting it with D-Bus bringing in new dependency and a lot of bloat doesn't make much sense; nor does it look worth the time and effort to me..
Quoted 4 lines
The main benefit seems to be easing the management of clients from the server-side. This could prove useful when managing VPN servers that have large numbers of clients, for example in the VPN service provider use-case. Is that the primary use-case you're thinking of, David?
after reading this entire thread I tend to agree with Selva (mostly). Here's my recap/understanding:
- there is a desire to update the management interface , in order to more easily manage clients from the server side. Adding functionality using either D-Bus , REST or (god forbid) SOAP will cause extra libraries to be added - more bloat
- on the client side, the management interface is used (extensively) by the client GUI to interact with OpenVPN. The client needs to remain as small and light-weight as possible, with as few external dependencies as possible (can you spell 'pkcs11-helper' ?) Thus, here, we have the desire to keep things the way they are, or at the very least, a strong and understandable desire to NOT add any external libraries
So, the management interface suffers from schizophrenia: it must allow for full-blown interaction for large-scale server setups and it must be small and light-weight for the client. IMHO these requirements contradict each other. A possible solution would be to have a separate management interface (or at least management interface *protocol*) for client and server. A counter argument would then be to split the client and server code completely , so that all server support is removed from the OpenVPN client, in order to make the client software even more light weight - is that a route we want to take?
Therefore I tend to agree with Selva: this is a very messy problem, don't touch unless there's an absolute need to do so.
JM2CW,
JJK
Hi,
Quoted 1 line · ???????? ??????????????
I'd bet many people would like to see REST here
"if all you have a hammer, every problem looks like a nail" - which describes "let's add a REST interface to everyhing!" quite well.
(And please do not top-quote full mails on the openvpn-devel list)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Quoted 7 lines · David Sommerseth
One of the things which have struck me is that D-Bus is adopted a lot of places, and its internal API have been considered stable for about 10 years or more. Even though there are areas where D-Bus seems a bit over-engineered, it has proved to be a very useful IPC mechanism for a lot of software.
From what I can tell, the main advantage D- Bus would offer is that it would allow multiple processes to manage an OpenVPN process. I don't see a big benefit from that, but it might be nice, I suppose. D-Bus may also include some security protections, although I haven't seen anything specific about that.
However, for OpenVPN on OS X (now macOS), I see little advantage. Maybe I'm missing it, but I don't see any simple way to integrate D-Bus into an app such as Tunnelblick on OS X. In fact, a Google Search for "'OS X' "D-Bus'" resulted mostly in mentions of problems with D-Bus in specific programs and how to get around them, and one seven-year-old email offering an OS X version of the D-Bus library. I assume macports has it, but that didn't show up, nor did any official "D-Bus" repository. (Is there one?)
I also question the idea of relying on yet another big, complicated external library, which must be updated as issues arise (as they do with complex programs and libraries). On Linux, I gather it is part of the OS so I suppose that isn't a concern, but it would be on OS X (and Windows?).
So I am not enthusiastic about integrating a D-Bus interface to OpenVPN into Tunnelblick (I haven't even integrated of all of the current management interface into Tunnelblick, nor does there seem to be much demand for me to do so).
But maybe I'm just an old curmudgeon, or maybe it's just late and I'm tired. Any pointers (for example, to a reference implementation of integrating D-Bus into an OS X app) would be welcome, and could very well change my mind.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 7 lines · David Sommerseth
Hi,
I have for a long time pondered on how we can make the management API more suitable for more modern tools and tasks. So I am just giving an extremely early heads-up on on what I'm poking at ... and hopefully receive some feedbacks on what you think.
[...snip...] (I'll try to respond to all feedback in this single mail)
Thank you to all of you who raised your voice, this is very helpful!
First of all, I understand the scepticism. And I also do not want to bloat OpenVPN needlessly.
JJK have also made a very good point, that there is a contradiction between the need on the server and client. In regards to splitting client and server code, the OpenVPN 3 code base is actually far better separated in this regards - so we are moving towards that direction.
I also understand the argument "If it ain't broken, don't fix it". The problem is what and who defines what is broken or not. I see a great potential to make OpenVPN integrate better, both towards the OS level but also towards the user interfaces. From my point of view, OpenVPN is still stuck in how things were done in 90s, and to enable possibilities which is found in modern OS we need to adopt OpenVPN likewise. I still wouldn't call it broken, but seeing it more mature for a real update.
Samuli's comment regarding easing the client management on the server side, is quite spot-on. But it won't be that much extra work at all to add client side support in addition. Hence, I am daring to also consider client-side needs.
I understand that the client-side is quite happy with the situation as it is now. So I will therefore then focus these next steps on the server side primarily. If the client-side see some advantages later on, it shouldn't be too hard adding those features later on. And having both the old TCP based management interface and a newer D-Bus interface will therefore be the primary goal - with D-Bus enabling will happen both at compile time (to allow building without extra dependencies) and runtime (to not enforce D-Bus to be used). And I will not spend time adding new features to the TCP based management interface for the time being.
So just to provide a few more examples why I'm so persistent on providing D-Bus support ... I'll bring up both a few already mentioned use cases, for completeness, as well as some new ones.
* Better and easier integration with modern management tools (like Cockpit)
* Enables a simpler way to manage OpenVPN also from shell scripts, by using standard D-Bus clients such as gdbus or qdbus.
* Allow multiple management tools to interact with OpenVPN at the same time, even allowing differentiated access controls per management client (more on that in a bit)
* Enable management of OpenVPN plug-ins without needing to extend OpenVPN core code additionally per plug-in and allow plug-ins full control of the API it will provide (not restricted to the OpenVPN capabilities the core OpenVPN code is designed for - each plug-in can provide its own D-Bus interface independently of others)
* Allow for PUSH notifications (in D-Bus jargon: signals) instead of management tools need to constantly pull for information
* Enable possibility to add (set) triggers (which uses D-Bus signals)
* Provide possibility to do user/password authentication via D-Bus as an alternative to plug-ins or script hooks. Can also extend this to provide the TLS verification methods too. This allows for more powerful authentication modules where using script hooks easily gets complex and writing a C plug-in is a too big challenge.
* New tools can more easily manipulate firewalls on the fly using more fine grained information for connected sessions at once. Also considering that FirewallD is also D-Bus based can ease this integration too.
* Enable policy management of methods ("function calls") provided over D-Bus. This can allow non-admin users to have limited power while admin users can be allowed to do more. These policies can also be completely controlled by using user groups defined by the system. All user authentication is done by the OS via D-Bus (using polkit). This means, a non-root user can actually control much of an OpenVPN process if the policy allows it - including restarting OpenVPN. The OpenVPN process itself can run as a different user or even root.
* Enable possibility to have better understanding of the current network situation, as OpenVPN can through D-Bus query NetworkManager (or similar D-Bus interfaces for networks) for the general network situation. This is probably more useful on the client side than server side, though. (No need to try to reconnect every 5th second if the network state is "offline")
* Prepare the ground for seamless restart of the OpenVPN process without needing to do complete reconnect with all TLS key exchanges for all connected clients. This can be done such that the new OpenVPN process connects to the D-Bus, signals the already running process to pass over all client states. These client states can also include byte/packet counters as well, if that is used for accounting.
By adding an extra "link program", it can, in theory at least, also be made possible to sync client states across hosts.
This can probably be done today too, but would we enable such things over an unencrypted TCP link? As it is unencrypted, I'd say that the management password you can set is quite moot and useless. So to get the security right, the management today needs to be even further extended - as D-Bus provides the authentication and access control in the basic API.
These are just some of the possibilities I see D-Bus can more easily enable. As I said, OpenVPN ain't broke as it is, but it can be improved to be better integrated with more advanced use cases which is harder to achieve today.
As an example in the end, I'll consider up a question I've heard every now and then on the #openvpn IRC channel. "How can I add quotas to VPN clients?" Today, I would say, that can only be achieved by either writing a plug-in and/or some tools using the management interface to retrieve information and do the quota controls.
With D-Bus this can be done with a few simple scripts ... here as a very simple pseudo code. These scripts can be written in your favourite language as long as it has D-Bus libraries available.
* ConnectionSetup ... a script which prepares the triggers
=====================================================================
system_bus = dbus.connect(DBUS_SYSTEM)
while (1) {
# wait for a client to connect
res = system_bus.wait_for_signal(dest="net.openvpn.managment",
path="/net/openvpn/management/Triggers",
signal="sys_vpn_connect"); # Fetch client info and log
client = system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/ClientInfo/" + res, method="QueryClients");
# Retrieve quota and do some logging
quota = corp_function_get_quota(client.cn); printf("Client %s connected, used %i bytes of quota, " \
"setting quota to %i bytes\n", client.cn, quota.used, quota.max);
# Set the quota for this session, account for already used quota system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/Triggers/" + res, method="SetQuota"
quota=(quota.max - quota.used));
}
=====================================================================
* ConnectionDisconnected ... a script which logs used quota
=====================================================================
system_bus = dbus.connect(DBUS_SYSTEM)
while (1) {
# wait for a client to connect
res = system_bus.wait_for_signal(dest="net.openvpn.managment",
path="/net/openvpn/management/Triggers",
signal="sys_vpn_disconnect"); # Fetch session info
session = system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/Sessions/" + res, method="QuerySession");
# Log some statistics
printf("Client %s disconnects, used %i bytes in this session\n",
session.cn,
(session.bytes_received + session.bytes_sent));
# Update corp database with used quota corp_function_add_used_quota(session.cn,
(session.bytes_received + session.bytes_sent));
}
=====================================================================
* QuotaControl .... a script which kicks out clients exceeding quota
=====================================================================
system_bus = dbus.connect(DBUS_SYSTEM)
while (1) {
# wait for a client who exceeds the quota
res = system_bus.wait_for_signal(dest="net.openvpn.managment",
path="/net/openvpn/management/Triggers",
signal="quota_exceed"); # Fetch client info and log
client = system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/ClientInfo/" + res, method="QueryClients");
printf("Client %s exceeded quota, killing session\n",
client.cn);
# Kill the session system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/Sessions/" + res, method="KillClientSession");
}
=====================================================================
(I admit this over-simplifies the D-Bus calls, but this is in
essence of how these calls would work)
So three individual scripts, which can be added/modified/restarted at will outside of OpenVPN without influencing any established OpenVPN connections.
Doing a similar thing using the TCP based management interface is going to be considerably harder, as you need to manage everything through a single TCP connection and it is needed to do regular polls to the OpenVPN server as there are no push features. Plus you need to manage the TCP connection setup and all communication over the socket.
I'll let you all know when I have something more concrete to show; but I am still very much open for more feedback!
- --
kind regards,
David Sommerseth
OpenVPN Technologies, Inc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXyHu6AAoJEIbPlEyWcf3yYYIP/1ljl24r1b+uBiBOEl1op17t u2YFm4B0AsAhXvwLeoGEBt7Vx45Fnn6yHskLnsEuUXyZSLj7EXcKqtdY5Dpd6Qcx k+LtPdIG19TA17GUvrWhQbclLlsm7kRe7L9iYOtYVqkUW24TrXkiu7nZ7THwteZp Y1+afd6NRMWi2rMpn3KfOEdQepNwbpBaurC0D4ENmUtkIAPHdPjqCFReIh7++JKj 9ADp/rMMjorBNcUKlnPGg21C1FDCVCKCtHPmPb9uW/TFWMGUoO8tgFfzaaQudvQG K28hZKDmolhDwlSWsjC/QaacNcwwjknfg1CDrL65mNklNMJCut5HlPtEBQFOEH7p RFi6GHzWWInmAY1+mUvWKvO/DO4NJovdl6ygCbtvhNiEJacNLKYk7bpGkZQnyPxX 06DgzW/myyj+GipQCevvaGMr9cuBnneNCmeiMnDh7n2FHteoZYUf9xeIxjkM/KQI DuVNJeLVrhdFT0NtOcLBHahSp6rWVGkUA4aYAzmzkMyEjPFYXrxV0dttpSr11Qjb 2tSKHm72fiJ5kLoMcm8ugOaIoFiTreaukUl5rY271PjxOLLfJ7A2jzVEUefQvxwN FlEvjAJ+Nb5p57mN98IUR0QzVheLgUPENaW9oFpCizGJeQjiKk5j07YZNF1vIW2K 3EN1CDDg6Q9K1Xb5z+tu
=QczO
-----END PGP SIGNATURE-----
Quoted 229 lines · David Sommerseth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 6 lines · David Sommerseth
Hi,
I have for a long time pondered on how we can make the management API more suitable for more modern tools and tasks. So I am just giving an extremely early heads-up on on what I'm poking at ... and hopefully receive some feedbacks on what you think.
[...snip...] (I'll try to respond to all feedback in this single mail)
Thank you to all of you who raised your voice, this is very helpful!
First of all, I understand the scepticism. And I also do not want to bloat OpenVPN needlessly.
JJK have also made a very good point, that there is a contradiction between the need on the server and client. In regards to splitting client and server code, the OpenVPN 3 code base is actually far better separated in this regards - so we are moving towards that direction.
I also understand the argument "If it ain't broken, don't fix it". The problem is what and who defines what is broken or not. I see a great potential to make OpenVPN integrate better, both towards the OS level but also towards the user interfaces. From my point of view, OpenVPN is still stuck in how things were done in 90s, and to enable possibilities which is found in modern OS we need to adopt OpenVPN likewise. I still wouldn't call it broken, but seeing it more mature for a real update.
Samuli's comment regarding easing the client management on the server side, is quite spot-on. But it won't be that much extra work at all to add client side support in addition. Hence, I am daring to also consider client-side needs.
I understand that the client-side is quite happy with the situation as it is now. So I will therefore then focus these next steps on the server side primarily. If the client-side see some advantages later on, it shouldn't be too hard adding those features later on. And having both the old TCP based management interface and a newer D-Bus interface will therefore be the primary goal - with D-Bus enabling will happen both at compile time (to allow building without extra dependencies) and runtime (to not enforce D-Bus to be used). And I will not spend time adding new features to the TCP based management interface for the time being.
So just to provide a few more examples why I'm so persistent on providing D-Bus support ... I'll bring up both a few already mentioned use cases, for completeness, as well as some new ones.
* Better and easier integration with modern management tools (like Cockpit)
* Enables a simpler way to manage OpenVPN also from shell scripts, by using standard D-Bus clients such as gdbus or qdbus.
* Allow multiple management tools to interact with OpenVPN at the same time, even allowing differentiated access controls per management client (more on that in a bit)
* Enable management of OpenVPN plug-ins without needing to extend OpenVPN core code additionally per plug-in and allow plug-ins full control of the API it will provide (not restricted to the OpenVPN capabilities the core OpenVPN code is designed for - each plug-in can provide its own D-Bus interface independently of others)
* Allow for PUSH notifications (in D-Bus jargon: signals) instead of management tools need to constantly pull for information
* Enable possibility to add (set) triggers (which uses D-Bus signals)
* Provide possibility to do user/password authentication via D-Bus as an alternative to plug-ins or script hooks. Can also extend this to provide the TLS verification methods too. This allows for more powerful authentication modules where using script hooks easily gets complex and writing a C plug-in is a too big challenge.
* New tools can more easily manipulate firewalls on the fly using more fine grained information for connected sessions at once. Also considering that FirewallD is also D-Bus based can ease this integration too.
* Enable policy management of methods ("function calls") provided over D-Bus. This can allow non-admin users to have limited power while admin users can be allowed to do more. These policies can also be completely controlled by using user groups defined by the system. All user authentication is done by the OS via D-Bus (using polkit). This means, a non-root user can actually control much of an OpenVPN process if the policy allows it - including restarting OpenVPN. The OpenVPN process itself can run as a different user or even root.
* Enable possibility to have better understanding of the current network situation, as OpenVPN can through D-Bus query NetworkManager (or similar D-Bus interfaces for networks) for the general network situation. This is probably more useful on the client side than server side, though. (No need to try to reconnect every 5th second if the network state is "offline")
* Prepare the ground for seamless restart of the OpenVPN process without needing to do complete reconnect with all TLS key exchanges for all connected clients. This can be done such that the new OpenVPN process connects to the D-Bus, signals the already running process to pass over all client states. These client states can also include byte/packet counters as well, if that is used for accounting.
By adding an extra "link program", it can, in theory at least, also be made possible to sync client states across hosts.
This can probably be done today too, but would we enable such things over an unencrypted TCP link? As it is unencrypted, I'd say that the management password you can set is quite moot and useless. So to get the security right, the management today needs to be even further extended - as D-Bus provides the authentication and access control in the basic API.
These are just some of the possibilities I see D-Bus can more easily enable. As I said, OpenVPN ain't broke as it is, but it can be improved to be better integrated with more advanced use cases which is harder to achieve today.
As an example in the end, I'll consider up a question I've heard every now and then on the #openvpn IRC channel. "How can I add quotas to VPN clients?" Today, I would say, that can only be achieved by either writing a plug-in and/or some tools using the management interface to retrieve information and do the quota controls.
With D-Bus this can be done with a few simple scripts ... here as a very simple pseudo code. These scripts can be written in your favourite language as long as it has D-Bus libraries available.
* ConnectionSetup ... a script which prepares the triggers
=====================================================================
system_bus=dbus.connect(DBUS_SYSTEM)
while (1) {
# wait for a client to connect
res = system_bus.wait_for_signal(dest="net.openvpn.managment",
path="/net/openvpn/management/Triggers", signal="sys_vpn_connect");# Fetch client info and log
client = system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/ClientInfo/" + res,
method="QueryClients");# Retrieve quota and do some logging
quota =corp_function_get_quota(client.cn); printf("Client %s connected, used %i bytes of quota, " \
"setting quota to %i bytes\n",
client.cn, quota.used, quota.max);# Set the quota for this session, account for already used quota system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/Triggers/" + res,
method="SetQuota"
quota=(quota.max - quota.used));
}
=====================================================================* ConnectionDisconnected ... a script which logs used quota
=====================================================================
system_bus=dbus.connect(DBUS_SYSTEM)
while (1) {
# wait for a client to connect
res = system_bus.wait_for_signal(dest="net.openvpn.managment",
path="/net/openvpn/management/Triggers", signal="sys_vpn_disconnect");# Fetch session info
session = system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/Sessions/" + res,
method="QuerySession");# Log some statistics
printf("Client %s disconnects, used %i bytes in this session\n",
session.cn,
(session.bytes_received + session.bytes_sent));# Update corp database with used quota corp_function_add_used_quota(session.cn,
(session.bytes_received + session.bytes_sent));
}
=====================================================================* QuotaControl .... a script which kicks out clients exceeding quota
=====================================================================
system_bus=dbus.connect(DBUS_SYSTEM)
while (1) {
# wait for a client who exceeds the quota
res = system_bus.wait_for_signal(dest="net.openvpn.managment",
path="/net/openvpn/management/Triggers", signal="quota_exceed");# Fetch client info and log
client = system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/ClientInfo/" + res,
method="QueryClients");printf("Client %s exceeded quota, killing session\n",
client.cn);# Kill the session system_bus.call(dest="net.openvpn.management",
path="/net/openvpn/management/Sessions/" + res,
method="KillClientSession");
}
=====================================================================(I admit this over-simplifies the D-Bus calls, but this is in
essence of how these calls would work)So three individual scripts, which can be added/modified/restarted at will outside of OpenVPN without influencing any established OpenVPN connections.
Doing a similar thing using the TCP based management interface is going to be considerably harder, as you need to manage everything through a single TCP connection and it is needed to do regular polls to the OpenVPN server as there are no push features. Plus you need to manage the TCP connection setup and all communication over the socket.
I'll let you all know when I have something more concrete to show; but I am still very much open for more feedback!
Quoted 6 lines
- --
kind regards,David Sommerseth
OpenVPN Technologies, Inc
David, that all sounds fantastic but .. One note of caution:
* If it sounds too good to be true .. then it probably is.
If it is possible; a run time option eg. --dbus enabled|disabled or at least a compile time option --enable-dbus might be preferable.
For me personally, it sounds like a lot of openvpn 'control' is being handed over to another entity and I am not convinced that is ideal.
Regards
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 1 line · On 01/09/16 22:14, debbie10t wrote:
* If it sounds too good to be true .. then it probably is.
There's a good intro to D-Bus programming here, with focus on C:
<https://leonardoce.wordpress.com/2015/04/01/dbus-tutorial-a-simple-serv
er/>
Here's one I haven't looked too careful at, but related to Python:
<https://georgemuraruc.wordpress.com/2015/07/16/d-bus-tutorial-for-pytho
n/>
And for some good shell fun:
(this should work on most modern Linux distros)
$ gdbus call --system -d org.freedesktop.NetworkManager \
-o /org/freedesktop/NetworkManager \
-m org.freedesktop.NetworkManager.GetDevices
Returns on my laptop:([objectpath '/org/freedesktop/NetworkManager/Devices/0',
'/org/freedesktop/NetworkManager/Devices/1', '/org/freedesktop/NetworkManager/Devices/2'],)
To query everything about one of the devices, to see all methods, signals and properties available you do this:
$ gdbus introspect --system -d org.freedesktop.NetworkManager \
-o /org/freedesktop/NetworkManager/Devices/1Through gdbus, you can do a lot of fun stuff. If you are on a systemd based system, you can even start and stop services through D-Bus calls
- - if you have the right privileges.
D-Bus has been around for over a decade and is very stable and widely used, at least on the Linux side - but I believe it's a requirement if you use GNOME or KDE too, regardless if it is Linux or not.
Quoted 2 lines
If it is possible; a run time option eg. --dbus enabled|disabled or at least a compile time option --enable-dbus might be preferable.
Okay, there will be two ways to enable/disable. D-Bus will be disabled by default.
To enable D-Bus you must first compile it with D-Bus support, that
will be done via ./configure --enable-dbus
Then to enable the D-Bus API, where OpenVPN will connect and register to the D-Bus, you will need --management-dbus in your config. This option will only be available if built with --enable-dbus when running ./configure.
Quoted 3 lines
For me personally, it sounds like a lot of openvpn 'control' is being handed over to another entity and I am not convinced that is ideal.
It is completely optional. Without activating D-Bus, OpenVPN will work just as before. But there are use cases where the interfacing possibilities to managing OpenVPN are very limited - and if not limited, it is hard to accomplish. I want to lower this barrier, to allow simpler integration with tools and which is more agnostic to programming languages and scripts.
D-Bus is first of all an API for interprocess communication (IPC), but it has standardised how services are offered through that API so you don't need to re-invent the wheel each time you want to do anything new.
In regards to handing over 'control', this is not much more different than using the script hooks or enabling third-party plugins. The difference is that you can integrate using an API which is available through the most common programming and scripting languages (C/C++, Java, C#, golang, Python, Ruby, Perl, Haskel, Erlang, LUA, etc, etc).
And I emphasize again: D-Bus provides a much better control over whom can do what on services provided over the D-Bus. Every user or process accessing a service is authenticated and access control is managed through polkit policies. Thus you can actually improve the overall security by using D-Bus compared to using script hooks or even plug-ins - where they at least run with the same privileges as the openvpn process, if they haven't fork()ed out a root process (like the down-root plugin does).
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXyJYQAAoJEIbPlEyWcf3yfcEP/jjF4tjk2dTjhcJMVyZMCotH vM5uApgA6uGmV7DcR4MXTxzn29rqS1nppoqlRNtC+znqvraeXJjddhrCUFq5QRmr fowjbtRDMyXGTC5QZeDqfKO0CmqUzh6B+zqNrMeDU/vbaLVcL6NGHXP4yWTNyvmz 9lPGAuiwv195/vDf0mlKq5OM9m+peyTY3eGp+lEzDVaKdlb1CatXYEnVbSK7wCUl daZPEaxKTKEVdGDs7DQdSMLDU+ix76KZ/CZSTmKaXAPtjGB9aQ2WiRSFp5PWkRLB jkCmd9eyyEsGvsqgBlkVJ6rOXhpv+nQpHGYyTm3uQ+hSqcA8QKHK9S13j+5NYZbs OOG2H9PM9AoGNWYRBi9BaW3LYyAS7r6o+P3VSeBRhHvZXmKkuEZVYhVpn/OAjokX bUzVyYhc5PXCkRKAmviPm7aQBipP7KofM4T9+y4MBThw00PMm1UWrnkHm53qck6+ apcBx74mbF3ySW1xZIiRupTREBuca57UJ5Agh+cf2L6q5BWaXCbsnQkgKzgfx0Cf mQXJSmnYNoVQBmb9TSps1J1ShL9rBkS27TbIcVHYsihibDHjaG/5PpyEa9cTxkya o0alVbButYE6nqy5KCWEjxPFDImQM9MEOyC7LMzsZTuDzUNu+ADy+3xBFETqdqfV RVXpwSkxIPYWAWbUeU17
=Rmzu
-----END PGP SIGNATURE-----
Quoted 72 lines · David Sommerseth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 1 line · On 01/09/16 22:14, debbie10t wrote:
* If it sounds too good to be true .. then it probably is.
There's a good intro to D-Bus programming here, with focus on C:
<https://leonardoce.wordpress.com/2015/04/01/dbus-tutorial-a-simple-serv
er/>Here's one I haven't looked too careful at, but related to Python:
<https://georgemuraruc.wordpress.com/2015/07/16/d-bus-tutorial-for-pytho
n/>And for some good shell fun:
(this should work on most modern Linux distros)$ gdbus call --system -d org.freedesktop.NetworkManager \ -o /org/freedesktop/NetworkManager \ -m org.freedesktop.NetworkManager.GetDevices Returns on my laptop:([objectpath '/org/freedesktop/NetworkManager/Devices/0',
'/org/freedesktop/NetworkManager/Devices/1', '/org/freedesktop/NetworkManager/Devices/2'],)To query everything about one of the devices, to see all methods, signals and properties available you do this:
$ gdbus introspect --system -d org.freedesktop.NetworkManager \ -o /org/freedesktop/NetworkManager/Devices/1Through gdbus, you can do a lot of fun stuff. If you are on a systemd based system, you can even start and stop services through D-Bus calls
- - if you have the right privileges.D-Bus has been around for over a decade and is very stable and widely used, at least on the Linux side - but I believe it's a requirement if you use GNOME or KDE too, regardless if it is Linux or not.
Quoted 2 lines
If it is possible; a run time option eg. --dbus enabled|disabled or at least a compile time option --enable-dbus might be preferable.
Okay, there will be two ways to enable/disable. D-Bus will be disabled by default.
To enable D-Bus you must first compile it with D-Bus support, that
will be done via ./configure --enable-dbusThen to enable the D-Bus API, where OpenVPN will connect and register to the D-Bus, you will need --management-dbus in your config. This option will only be available if built with --enable-dbus when running ./configure.
Quoted 3 lines
For me personally, it sounds like a lot of openvpn 'control' is being handed over to another entity and I am not convinced that is ideal.
It is completely optional. Without activating D-Bus, OpenVPN will work just as before. But there are use cases where the interfacing possibilities to managing OpenVPN are very limited - and if not limited, it is hard to accomplish. I want to lower this barrier, to allow simpler integration with tools and which is more agnostic to programming languages and scripts.
D-Bus is first of all an API for interprocess communication (IPC), but it has standardised how services are offered through that API so you don't need to re-invent the wheel each time you want to do anything new.
In regards to handing over 'control', this is not much more different than using the script hooks or enabling third-party plugins. The difference is that you can integrate using an API which is available through the most common programming and scripting languages (C/C++, Java, C#, golang, Python, Ruby, Perl, Haskel, Erlang, LUA, etc, etc).
Quoted 10 lines
And I emphasize again: D-Bus provides a much better control over whom can do what on services provided over the D-Bus. Every user or process accessing a service is authenticated and access control is managed through polkit policies. Thus you can actually improve the overall security by using D-Bus compared to using script hooks or even plug-ins - where they at least run with the same privileges as the openvpn process, if they haven't fork()ed out a root process (like the down-root plugin does).
David,
consider me convinced; I cannot possibly argue against your incredibly well informed opinion and, in fact, I look forward to testing it for myself. No doubt there will be teething problems but, judging by your enthusiasm, I expect they will be easily weaned.
/me is reading a lot more about dbus now !
Regards
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 8 lines · David Sommerseth
Hi,
I have for a long time pondered on how we can make the management API more suitable for more modern tools and tasks. So I am just giving an extremely early heads-up on on what I'm poking at ... and hopefully receive some feedbacks on what you think.
Quoted 5 lines
One of the things which have struck me is that D-Bus is adopted a lot of places, and its internal API have been considered stable for about 10 years or more. Even though there are areas where D-Bus seems a bit over-engineered, it has proved to be a very useful IPC mechanism for a lot of software.
[...snip...]
Time for some proof-of-concept code!
<https://gitlab.com/dazo/openvpn-dbus-poc/tree/master>
This is just a plain and silly TCP management to D-Bus proxy. It does nothing fancy, but it is just a little introduction to how D-Bus can simplify getting an integration to a management interface in OpenVPN.
To do the more advanced features, such as signalling ("push" messages from server to listening D-Bus clients) is something which will require a lot more work and I have not considered doing this.
All information to get started should be fairly well documented in the source code. But if anyone have any questions, no question is too silly .
A few details.
- - *DO NOT RUN THIS IN PRODUCTION!* This is *Proof of Concept* code. It will be buggy, it is hacky and you cannot fully trust it.
- - A proper implementation will not use Python on the D-Bus server side, but will be included into the core OpenVPN C code.
- - A proper implementation will also use "properties". This is currently not possible to do via the dbus-python implementation, at least not without too much additional hackery. For a PoC, I did not consider this important. But a proper implementation in C will make use of object properties to provide read-only information.
- - The API provided via the D-Bus by this proxy WILL change.
- - Please do not start massive improvements to this code, unless it helps understanding better D-Bus features which can be worth investigating further.
Again: A proper D-Bus server implementation will happen inside the OpenVPN C code. This code is purely to help us getting further in this discussion.
- - And please do not judge the code harshly. I have prioritised getting something which works for a PoC. I have not added much styling or very describing comments. And yes, there will be bugs.
- --
kind regards,
David Sommerseth
OpenVPN Technologies, Inc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJX0E5MAAoJEIbPlEyWcf3yh4wP/i5hEjqzqHy6hnocA0ANT5ov VGfG1ZUF4QMUsyhjEbN2D1OM5sPQaPmH20CRcwbZGaZnuavDtjwBjc82IeopGaYC S4VmjQYNwGMawmrYTOH3/ITg/JzySQ60wKMv5AZBPK31zcqoFFKaYw8klsvTsj/N sO+ew/btlNdeosMKBGX/4+VjadgsvudX/o7GYfHVRonZX9E3B7tV7gE4EX5Z99xn UEnnwHzH6Olw6dhObNopPaFiFLte9Indt1iOLb3Fng0qZL5BDqw/ltr4h5klmD3R gJGFi75yarT41wW65ONZPm/530gzuwWEyaS2yPJ8YF7QLSiy8RZcMhdxjUP4a+dA 31dBfv/pWXHwM5lan668d9aIjAJ/q++9IMZmwIaqNI7MCudwemXjZ1opnwopz5rQ nDjtOCjMeUhYo7aJAPTcxfUF+ty4JnMSnkWMRt7PJg1hJG5E4VbRiWPPDIfsXW0h g8WRMPHPe/bG3dC/qH6zdzupi7GqHy9UyPeVBFrJ56TuWoGeuRKQ6NL4ahn67Vt1 th5rifBMEqsq/wxeQ+7EBYlgkNrO7A9ewo/5KNQVnYeRUv+kWAwrxeUAYzMWh7B8 Co0UX0mKV65IR/QH0hwag0mRgS7IxTX9Y5pV7WTfqmIzxaggWTrcJFVRby5Wr4Cq Na26b+buT6xGdEnotrqf
=bbcG
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 54 lines · David Sommerseth
Quoted 7 lines · David Sommerseth
Hi,
I have for a long time pondered on how we can make the management
API more suitable for more modern tools and tasks. So I am just giving an extremely early heads-up on on what I'm poking at ...
and hopefully receive some feedbacks on what you think.Quoted 5 lines
One of the things which have struck me is that D-Bus is adopted a
lot of places, and its internal API have been considered stable
for about 10 years or more. Even though there are areas where D-Bus seems a bit over-engineered, it has proved to be a very useful IPC mechanism for a lot of software.[...snip...]
Time for some proof-of-concept code!
<https://gitlab.com/dazo/openvpn-dbus-poc/tree/master>
This is just a plain and silly TCP management to D-Bus proxy. It does nothing fancy, but it is just a little introduction to how D-Bus can simplify getting an integration to a management interface in OpenVPN.
To do the more advanced features, such as signalling ("push" messages from server to listening D-Bus clients) is something which will require a lot more work and I have not considered doing this.
All information to get started should be fairly well documented in the source code. But if anyone have any questions, no question is too silly .
A few details.
- *DO NOT RUN THIS IN PRODUCTION!* This is *Proof of Concept* code. It will be buggy, it is hacky and you cannot fully trust it.
- A proper implementation will not use Python on the D-Bus server side, but will be included into the core OpenVPN C code.
- A proper implementation will also use "properties". This is currently not possible to do via the dbus-python implementation, at least not without too much additional hackery. For a PoC, I did not consider this important. But a proper implementation in C will make use of object properties to provide read-only information.
- The API provided via the D-Bus by this proxy WILL change.
- Please do not start massive improvements to this code, unless it helps understanding better D-Bus features which can be worth investigating further.
Quoted 7 lines
Again: A proper D-Bus server implementation will happen inside the OpenVPN C code. This code is purely to help us getting further in this discussion.
- And please do not judge the code harshly. I have prioritised getting something which works for a PoC. I have not added much styling or very describing comments. And yes, there will be bugs.
Just for reference (or "fun"), I did a very quick and dirty port of the Python client to Perl ... for all of the Perl fans out there. That code is horrible, as I've not done any Perl coding for almost 9 years (it seems I've recovered after all those years ;-)). But once you've installed the Net::DBus package it should work. It is located in the same git repository as the python code.
- --
kind regards,
David Sommerseth
OpenVPN Technologies, Inc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJX0GMDAAoJEIbPlEyWcf3yjX4P/jtFYvK1VIThayYcs9rtYMQc gLv7G/PgfltiWrSRItmDu6xahJGte8akghDni1VClmY9d6r5lsYtId6QnlqoijlR o+Z6W7b1IenB0LRj2q2w3gJcc7XL+2rDkwSOu7Nqw+dFSmDdrA85TFCk55l6gucX elvhP4svn5/BTUXWu1PvceVrGiqA74XwE4HB+C+4xL7/j4TeybBxrXR5MWJSAteC 9njH6yqzU2r89c0biRYwVLDiO1XBBDIGM6osYwupO24PDeG82Vbtjb/GI4bF+dIo t0DfcuPpKqZYlkiDFQeDcfmt+3H1XEmhkDzeV3UmMhK5TvY8oZVq9ZMHJLFUTbDY M0qnJf7wVykebBctoLujaEl6IhclQKinq4ywQ7LnVXDwQrIubF07VowoOH4qDGY7 MPfn5Oq0qb+dL1bfB4lJbuK5A20ezQAslh5UqjhktDej9RXQu0F8C1N1H0psJRjE +JPgtxTsQvh0RmzhJtQv30dqcO8XFgDLK5tJ3GPJTuM1+nh76OYYjnewonr+AfQI pSx4UsG1B2RI7BGVcgr/1dfmkaxc4fvAVaBdtlXddnD2RgCPYjN6iBnPojQ56JNp zzLAtGPCPrr4Gb6L5Ulg1xZPPvhMZLaFx/SeKFETj/3Vf1llNqiMSCARJ30966tW DHetuWrI08j0Pi8JG7r9
=llV3
-----END PGP SIGNATURE-----