-
Notifications
You must be signed in to change notification settings - Fork 84
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
RFE: API to acquire a connection fd from dbus-broker with pre-applied bus names and policies #259
Comments
(one more idea: maybe generate SOCK_SEQPACKET sockets this way, so that half-queued datagrams can't remain) |
Previous discussions on the systemd bug tracker: and dbus-daemon: |
ah, nice, forgot where this was discussed before... Anyway, maybe we can agree on something in dbus-broker, and then later standardize this and add it to the spec or so, after figuring out how and if things work. i certainly would be willing to provide the .busname side in pid 1, and the sd-bus client side to take over the connections. |
/cc @smcv |
Few comments:
|
if you get EMSGSIZE on sendmsg() allocate memfd, and send empty dgram with only a memfd in SCM_RIGHTS. |
This would mean, basically all are credited to PID 1. Which isn't much better, is it? |
It would mean the caller controls what they are credited to. I mean, I don't mind much if systemd ignores that matter and just creates the sockets as root user. But at least the API allows us to improve on this in the future. If we wouldn't pass the socket it, we would be locked to the current behavior. Is there any downside to passing the socket in, rather than passing it out?
Ah, like the journal-API you mean. Right, that would work. You still run into the same |
hmm so linux AF_UNIX will actually send a new SCM_CREDENTIALS message whenever the sender on an AF_UNIX/SOCK_STREAM socket changes. We use that in the journal for attributing output on an stdout/stderr stream that is written to by multiple processes (e.g. shell script with its subprocesses) back to the originating processes. Maybe a simple solution would be to rely on that: always charge against the current SCM_CREDENTIALS data (and in absence of any SO_PEERCRED). This would then mean that initially PID 1 would be responsible, until the first byte is written, in which moment ownership would be switched over. |
(btw, we seriously bumped RLIMIT_NOFILE by default for all userspace now (at least the hard limit, soft limit we can't because select() is stupid), i.e. all processes spawned by systemd, hence the memfd exhaustion thing might not be as easy to trigger — though it of course still exists) |
Due to policy checks against system users this cannot currently work, and it is non-obvious. In the future it might be implemented if support is added to dbus-broker/dbus-daemon, e.g.: bus1/dbus-broker#259
Due to policy checks against system users this cannot currently work, and it is non-obvious. In the future it might be implemented if support is added to dbus-broker/dbus-daemon, e.g.: bus1/dbus-broker#259
Due to policy checks against system users this cannot currently work, and it is non-obvious. In the future it might be implemented if support is added to dbus-broker/dbus-daemon, e.g.: bus1/dbus-broker#259
Due to policy checks against system users this cannot currently work, and it is non-obvious. In the future it might be implemented if support is added to dbus-broker/dbus-daemon, e.g.: bus1/dbus-broker#259
Due to policy checks against system users this cannot currently work, and it is non-obvious. In the future it might be implemented if support is added to dbus-broker/dbus-daemon, e.g.: bus1/dbus-broker#259
btw, my current thinking about this, is that pid 1 allocates a socket, then connects it to the broker, does some minimal handshake, claims names, sets policies, and then waits for POLLIN. But the originally suggested method call would work too |
I'd like to add support for a ".busname" concept in systemd, where people can declare a dbus service name to acquire as unit file, and it would list the full service name plus the matching policy. PID 1 would then parse that, and pass this to dbus-broker via some driver API, and get an fd back that can be used via socket activation.
The would fix a bunch of issues for us:
I'd suggest to drop the SASL and feature negotiation phase for sockets of this kind, i.e. sockets come readily set up for the main protocol of D-Bus. feature negotiation would have to take place in the unit files too, I guess.
Idea: dbus-broker's driver service would gain:
input:
output:
The text was updated successfully, but these errors were encountered: