Skip to content

tree-wide: symlink well-known Varlink service entry point sockets into /run/varlink/registry/ - #40590

Merged
poettering merged 7 commits into
systemd:mainfrom
poettering:export-varlink
Feb 9, 2026
Merged

poettering merged 7 commits into
systemd:mainfrom
poettering:export-varlink

Conversation

@poettering

Copy link
Copy Markdown
Member

This is generally useful, but is particularly useful in context of https://github.com/mvo5/varlink-proxy-rs which can expose a set of local Varlink services via a HTTP bridge. The idea is that the sockets linked into /run/varlink/registry/ are candidates for being exposed like that.

/cc @mvo5

@yuwata

yuwata commented Feb 6, 2026

Copy link
Copy Markdown
Member
tmpfiles.d/meson.build:26:16: ERROR: File 20-systemd-varlink.conf does not exist.

@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 Feb 6, 2026
Comment thread src/basic/chase.c Resolved
Comment thread src/basic/chase.h Resolved
@poettering
poettering force-pushed the export-varlink branch 4 times, most recently from 7d83008 to 34d4774 Compare February 6, 2026 17:17
@bluca

bluca commented Feb 8, 2026

Copy link
Copy Markdown
Member

Yeah I have seen the interface, but the question was about auto-discovery, so that you can do systemctl service-log-level foo.service debug and systemctl figures out what's the socket for foo.service, like we do for D-Bus based LogControl1 commands now, so that the user doesn't need to know what socket file to talk to

we probably have to add a new setting to unit files that indicates the socket to connect to. or alternatiely we can turn things around and let daemons tell the service manager that via a special sd_notify() field?

Realized we actually already have a way to connect a service to a socket, the TriggeredBy field, so got a bit carried away: #40606

@mvo5 mvo5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This will work very nicely with the in-progress varlink-http-bridge code, one tiny nitpick/idea inline (my review of the C parts was a bit superficial though, so take it as a +0.75)

@poettering

Copy link
Copy Markdown
Member Author

thanks for the review. that should suffice. will set green label now.

@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 please-review PR is ready for (re-)review by a maintainer labels Feb 9, 2026
So far we didn't provide any concept to enumerate local Varlink
services. Let's change that.

Let's define very light-weight scheme for this: provide a well-known dir
/run/varlink/registry/ where services that implement public interfaces
can link their sockets into. When enumerating services it's thus
sufficient to enumerate inodes in that directory.

The usecase for this is twofold:

1. It's simply very useful to be able to see which public services are
   bound on the local system, for debugging/admin/development purposes.

2. At Amutable we'd like to optionally provide a HTTP-to-Varlink bridge
   on individual nodes, that allows remote peers (after authentication)
   to access local Varlink services. For that it's essential we know the
   list of services and their entrypoints to expose, it would be
   security-wise highly problematic for clients to provide AF_UNIX
   entrypoint paths when connecting. hence: let's instead just have a
   dir with the public stuff, and let's ensure the HTTP-to-Varlink
   bridge simply exposes that stuff, and nothing else.

Non-public interfaces (such as the oomd interfaces between PID 1 and
oomd), and interfaces with multiple implementors (such as the resolved
hook interface, or the metrics collection stuff) should not be linked
in.

This is inspired by the Varlink.org "registry" concept, briefly
explained here:

https://varlink.org/FAQ#how-do-i-find-the-service-which-implements-a-local-interface

Note however that the described Varlink interface is not actually
implemented here, the directory is introduced however in a fashion that
conceptually matches the registry defined there, and would allow us to
implement the registry interface on top of it. (One of the reason the
registry Varlink API is not implemented right now is that the URI format
it relies on is entirely unspecified in the Varlink docs right now. Some
research needs to be done to extract what's implemented in the reference
implementation and to determine how it maps to the Varlink entrypoint
address format systemd's own tooling currently uses)

This primarily installs the symlinks via Symlinks= in unit files and via
a new tmpfiles.d/ drop-in. But since we touch all .socket units relating
to Varlink this also sets the FileDescriptorName= to varlink for each,
just to minimize diffrences and make things work more alike (the
services in questin don't care about the name, so this doesn't change).
In one case we replace a pair of separate sockets for two closely
related varlink services by a socket and a symlink, so that we can
safely use Symlinks= to also install the registry symlinks.
Just like CHASE_MUST_BE_DIRECTORY and CHASE_MUST_BE_REGULAR, but test if
the inode is a socket.
Comment thread src/varlinkctl/varlinkctl.c Resolved
Comment thread src/varlinkctl/varlinkctl.c Resolved
@YHNdnzj YHNdnzj added needs-rebase good-to-merge/with-minor-suggestions and removed 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 labels Feb 9, 2026
@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 needs-rebase good-to-merge/with-minor-suggestions labels Feb 9, 2026
@poettering
poettering merged commit 7ae2329 into systemd:main Feb 9, 2026
46 of 50 checks passed
@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 Feb 9, 2026
keszybz pushed a commit to uapi-group/specifications that referenced this pull request Sep 15, 2026
Systemd implements the /run/varlink/registry/ directory in [1].
It was not mentioned in the spec but it should be listed here as
it complements the user.varlink xattr.

[1] systemd/systemd#40590
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.

5 participants