diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index b949c4b8fd..a19dc3f6c8 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -65,6 +65,7 @@ #include "varlink-io.systemd.UserDatabase.h" #include "varlink-io.systemd.service.h" #include "varlink-util.h" +#include "xattr-util.h" /* Where to look for private/public keys that are used to sign the user records. We are not using * CONF_PATHS_NULSTR() here since we want to insert /var/lib/systemd/home/ in the middle. And we insert that @@ -1102,6 +1103,13 @@ static int manager_bind_varlink(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to bind to varlink socket '%s': %m", socket_path); + /* Reduce the noise routed to us: advertise that only look-ups for non-system users in the 16bit + * range are routed to us (excluding 'nobody', i.e. 0xfffe) */ + char text[DECIMAL_STR_MAX(uid_t) + 1 + DECIMAL_STR_MAX(gid_t) + 1]; + xsprintf(text, UID_FMT "-" UID_FMT, (uid_t) (SYSTEM_UID_MAX + 1), UID_NOBODY - 1); + FOREACH_STRING(xattr, "user.userdb.uid", "user.userdb.gid") + (void) xsetxattr(AT_FDCWD, socket_path, /* at_flags= */ 0, xattr, text); + r = sd_varlink_server_attach_event(m->varlink_server, m->event, SD_EVENT_PRIORITY_NORMAL); if (r < 0) return log_error_errno(r, "Failed to attach varlink connection to event loop: %m");