bus1 / dbus-broker

Linux D-Bus Message Broker
https://github.com/bus1/dbus-broker/wiki
Apache License 2.0
675 stars 78 forks source link

Allow to signal only processes own by specific uid #265

Closed pbrezina closed 3 years ago

pbrezina commented 3 years ago

I have a daemon (sssd-kcm, Kerberos ccache backend) that runs as root. We would like to implement a notification mechanism to send a signal to a user when the user's ccache has changed, but we can not publish this information publicly to other users due to security reasons. We would like to use dbus signals for this, however it would be problematic and not clean to connect a root process to a user's session bus.

What we need is the ability to send signal only to names owned by specific uid over a system bus. Would this be possible? I can contribute a PR if you would accept this feature.

It can be implemented similar to unicast signals, but the destination would be a special token, e.g. uid:$uid

dvdhrm commented 3 years ago

Yeah, dbus broadcasts are not meant for that. What you can do is have clients subscribe to your signals via a normal method-call. You then remember which client is subscribed, and you sent signals as unicast-signal directly to them. You can then check yourself what UID each client is of.

Note that the correct place to ask for extensions to the D-Bus specification is the dbus-mailing-list, or the dbus reference-implementation.

dvdhrm commented 3 years ago

Lets move this discussion to the dbus development list:

https://lists.freedesktop.org/archives/dbus/2021-April/018027.html

Feel free to comment here again, in case you want to discuss this specifically in the scope of dbus-broker.