-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skiff/core: bridge dbus to host system for some services like NetworkManager #211
Comments
This is currently not possible with xdg-dbus-proxy or otherwise. In the issue above:
Response:
[...]
ConclusionThe approach I'll try to implement here is as suggested above: creating a program which pretends to be NetworkManager and forwards those requests to the parent system bus. We can still use xdg-dbus-proxy in skiff core to run a filtered version of the host system bus which prevents the container from accessing anything but NetworkManager. This is not the best, because there are other services that would be good to forward too - like the host systemd (for poweroff / sleep). But it'd be a start. |
Forwarding method calls seems to be very straight forward. The "bridge" connects to both "outside" and "inside" D-Bus. After that it acquires Bridging signals seems more difficult but I think you can mirror the match rules created on the "inside" and recreate the same rules on the "outside" that captures the NetworkManager signals. This all is assuming you bridge service on the "outside" to "inside". Bridging from "inside" to "outside" is probably way more difficult. I am developing my own D-Bus Python library so I have some understanding of the D-Bus. |
Actually you can just subscribe to all signals emitted by NetworkManager on the "outside" using wildcard match rules and then just emit them back on the "inside". This is less efficient but saves you the trouble of monitoring the match rules. |
@igo95862 I looked at doing this in the past and the dbus codebase is so confusing I had a hard time making it happen. Will have another look but let me know if you start a repo somewhere with a prototype and I'll test it out. |
D-Bus is a protocol and there are many implementations. I am most familiar with the sd-bus from systemd.
I might try putting together a prototype this weekend. Not sure what to implement it in. My Python library is not well suited for the low level work. I might do some C Glib, C++ or Zig. |
@paralin I created an prototype here: https://github.com/igo95862/dbus-forwarding-proxy It can forward a service between different D-Bus instances. To build you only need meson, libsystemd and glib. For example, forwarding NetworkManager from system bus to session bus: ./build/src/dbus-forwarding-proxy --from-dbus-address "unix:path=/run/dbus/system_bus_socket" --service org.freedesktop.NetworkManager --to-dbus-address "$DBUS_SESSION_BUS_ADDRESS" I tested it a bit with D-Feet and it seems to work. There is also a Only method calls are supported at the moment but I think signals will be easy to implement. |
@igo95862 awesome, thanks! I'll give it a try. |
https://github.com/igo95862/dbus-forwarding-proxy
Use the proxy to forward NetworkManager and other resources from the SkiffOS host system into the dbus in systemd/dbus-enabled Skiff Core containers.
We will need to add a buildroot package for dbus-forwarding-proxy
The text was updated successfully, but these errors were encountered: