Skip to content

sd-bus: pass bus description (and comm name) to per via socket address binding on AF_UNIX#27573

Merged
poettering merged 7 commits into
systemd:mainfrom
poettering:sd-bus-description
May 16, 2023
Merged

sd-bus: pass bus description (and comm name) to per via socket address binding on AF_UNIX#27573
poettering merged 7 commits into
systemd:mainfrom
poettering:sd-bus-description

Conversation

@poettering

Copy link
Copy Markdown
Member

Let's make debugging a bit more helpful by conveying information about the peer of D-Bus connections as decoration of the AF_UNIX socket via the abstract socket path in AF_UNIX.

@github-actions github-actions Bot added busctl meson tests please-review PR is ready for (re-)review by a maintainer labels May 8, 2023
Comment thread src/libsystemd/sd-bus/bus-socket.c Outdated
Comment thread src/libsystemd/meson.build Outdated
Comment thread src/core/dbus.c Outdated
@bluca bluca added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR and removed please-review PR is ready for (re-)review by a maintainer labels May 8, 2023
@poettering poettering force-pushed the sd-bus-description branch from 4d41a4a to 96aa7f8 Compare May 15, 2023 13:18
@github-actions github-actions Bot added please-review PR is ready for (re-)review by a maintainer and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels May 15, 2023
@poettering poettering removed the ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR label May 15, 2023
@poettering

Copy link
Copy Markdown
Member Author

force pushed a new version with all issues addressed. ptal.

@yuwata

This comment was marked as outdated.

@yuwata yuwata added ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR and removed please-review PR is ready for (re-)review by a maintainer labels May 15, 2023
Comment thread src/libsystemd/sd-bus/bus-socket.c Outdated
Comment thread src/libsystemd/sd-bus/bus-control.c Outdated
Comment thread src/libsystemd/sd-bus/bus-socket.c
Comment thread src/libsystemd/sd-bus/bus-socket.c
… client comm + bus description string

Let's pass some additional meta information along bus connections
without actually altering the communication protocol.

Pass the client comm and client description string of the bus via
including it in the abstract namespace client socket address we connect
to. This is purely informational (and entirely user controlled), but has
the benefit that servers can make use of the information if they want,
but really don't have to. It works entirely transparently.

This takes inspiration from how we convey similar information via
credential socket connections.
@poettering poettering force-pushed the sd-bus-description branch from 96aa7f8 to 1654bee Compare May 16, 2023 08:26
@github-actions github-actions Bot added please-review PR is ready for (re-)review by a maintainer and removed ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR labels May 16, 2023
@poettering poettering force-pushed the sd-bus-description branch from 1654bee to db0dd80 Compare May 16, 2023 09:23
Comment thread src/libsystemd/sd-bus/bus-control.c Outdated
@yuwata yuwata added good-to-merge/with-minor-suggestions and removed please-review PR is ready for (re-)review by a maintainer labels May 16, 2023
… structure

Now that clients might convey comm/description strings via the sockaddr,
let's actually use them on the other side, read the data via
getpeername() parse it, and include it in the "owner" creds (which is
how we call the peer's creds).
…ming connections

Very useful for debugging, to see which clients actually connect.
Unlike most other bus connections in our codebase this one is created
manually and every setting set invididually. It hence does not have a
description by default (as all automatic connections have). Set one
explicitly.
@poettering poettering added good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed and removed good-to-merge/with-minor-suggestions labels May 16, 2023
@poettering poettering force-pushed the sd-bus-description branch from db0dd80 to acf4933 Compare May 16, 2023 10:25
@poettering poettering merged commit 3907b25 into systemd:main May 16, 2023
@github-actions github-actions Bot removed the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label May 16, 2023
valentindavid added a commit to valentindavid/snapd that referenced this pull request Mar 12, 2025
…re24

Since systemd/systemd#27573 we need to allow
binding on the client side of the dbus socket.

Also hostnamectl seems to need to read properties on
/org/freedesktop/systemd1 which should be fine.

To reproduce the issue, try to call `hostnamectl` from a snap
on Ubuntu Core 24.
valentindavid added a commit to canonical/snapd that referenced this pull request Mar 14, 2025
…re24

Since systemd/systemd#27573 we need to allow
binding on the client side of the dbus socket.

Also hostnamectl seems to need to read properties on
/org/freedesktop/systemd1 which should be fine.

To reproduce the issue, try to call `hostnamectl` from a snap
on Ubuntu Core 24.
valentindavid added a commit to valentindavid/snapd that referenced this pull request Jun 11, 2025
…bus socket

This is needed since systemd/systemd#27573 if
snap tries to call systemctl or any of its symlinks to shutdown.
ernestl pushed a commit to ernestl/snapd that referenced this pull request Jun 11, 2025
…re24

Since systemd/systemd#27573 we need to allow
binding on the client side of the dbus socket.

Also hostnamectl seems to need to read properties on
/org/freedesktop/systemd1 which should be fine.

To reproduce the issue, try to call `hostnamectl` from a snap
on Ubuntu Core 24.
ernestl pushed a commit to canonical/snapd that referenced this pull request Jun 12, 2025
…re24

Since systemd/systemd#27573 we need to allow
binding on the client side of the dbus socket.

Also hostnamectl seems to need to read properties on
/org/freedesktop/systemd1 which should be fine.

To reproduce the issue, try to call `hostnamectl` from a snap
on Ubuntu Core 24.
valentindavid added a commit to canonical/snapd that referenced this pull request Jun 12, 2025
…bus socket

This is needed since systemd/systemd#27573 if
snap tries to call systemctl or any of its symlinks to shutdown.
ndyer pushed a commit to ndyer/snapd that referenced this pull request Jul 8, 2025
…bus socket

This is needed since systemd/systemd#27573 if
snap tries to call systemctl or any of its symlinks to shutdown.
alfonsosanchezbeato pushed a commit to canonical/snapd that referenced this pull request Jul 31, 2025
…bus socket

This is needed since systemd/systemd#27573 if
snap tries to call systemctl or any of its symlinks to shutdown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants