Daemon guide: reyind
reyind is the backend binary that runs a print server, a sync hub, or both. It is the Unix slice; Windows service is not implemented.
reyind print server (Manager + IPP server)reyind --hub print server + SQLite hubreyind --hub-only SQLite hub onlyreyind --pdf-worker per-document PDF child processThe print server binds loopback by default. The PDF worker is a per-document child
under the same UID: it provides crash isolation only, not a sandbox. Release builds contain no PDFium (a developer build can enable it with --features pdfium; pdf.engine = "pdfium" is refused otherwise) (#255,
AR-1 is mitigated by default and the opt-in residual is unaccepted; see docs/security/accepted-residuals.md).
Configuration
Section titled “Configuration”Configuration is a TOML file with a data_dir, control socket path, TLS mode and hub options. See bins/reyind/contrib/reyind.toml.example and docs/crates/reyind.md. Key points:
- The data dir is tightened to 0700.
- The control socket is a local Unix socket (0600) with constant-time token auth.
- The hub database is owner-only (0600).
- A second instance in the same data dir is refused via an instance lock.
- Webhook deliveries wait in
automation.dbin the data dir until they are handed to a flow. A signed delivery keeps the buyer’s order (names, addresses, items) for at most 24 hours (setting range 1 to 24 hours, default 24; the sweep that removes it runs at least hourly, so allow up to one more hour); the order is removed when the delivery is handed over, dropped or expired, and the file’s write-ahead log is truncated afterwards. Run contexts hold order data until the run ends.hooks.purgeclears held orders on demand; the orders it clears will not print, and runs already started keep their copy (see docs/crates/reyind.md);hooks.deliverieslists deliveries without any order data. Exclude the data directory from cloud backups and from Time Machine. If you do not, say plainly to whoever owns those backups that they can hold up to 24 hours of order data, and that a restored backup can bring back orders that were already removed. - A flow file names its connections by alias (for example
shop). When you import it you givebindings, and a connection alias may be bound to a connection of your configuration that has a different name, for example{"connections": {"shop": "shop-eu"}, ...}. The stored flow then usesshop-eueverywhere; the summary you approve lists the pairs (renamed_connections) and its hash covers them. For a flow you hold for approval, callflow.getwith the samebindingsto see the summary and hash that approval will need. Printers and templates are bound to the name of the same text. A later revision of the file that still saysshopis held again until you approve it with the mapping.
Same-user access in the default mode (T142)
Section titled “Same-user access in the default mode (T142)”The High remains in the default single-user desktop mode: any process running as the same user can read the data directory and the control token and drive the daemon. The data directory is 0700, the control socket is 0600 and the control token is a file in the data directory, but all of them belong to the user who runs reyind, so malware running as that user can read the token, call the control API (including flow.approve_import and batch methods, subject to the confirmation rules) and read what the daemon keeps, such as held webhook orders and secret files the user can read. The operating-system keychain backend is not built, so secrets come from the environment or a user-only file.
A service-user mode (a dedicated account for reyind, the data directory 0700 for that account, a control socket reachable by a group with the peer-credential check) would narrow this; it is specified (next section) and not built. It is queued as a later package, “service-user mode (Linux first)”, to be started after Phase 3 (the editor screens; see the work packages), with one deep security review. Until it is built, threat T142 stays an open High in the automation threat model and in the risk register; it is not accepted. The maintainer decision behind this is MD-21 on the maintainer decisions page.
Service-user mode on Linux (specified, not built)
Section titled “Service-user mode on Linux (specified, not built)”Nothing in this section exists yet: it is the contract that the queued package builds to, and the default mode above is unchanged. The decision is MD-63.
On Linux an opt-in service-user mode narrows the default-mode High (rows T142-S1 to T142-S8 of the automation threat model). reyind runs as a system account named reyin; the data directory (/var/lib/reyin) is 0700 for that account, so another user id, including the person’s own programs, cannot read the database, the secrets or the held orders. The person still drives the daemon through a control directory (/run/reyin, 0750, group reyin-control) that holds a 0660 socket and a 0640 token. Two independent gates decide who connects: the kernel’s group check on the socket, and the daemon’s check of the connecting user id against an explicit allowed_users list.
What stays open, in plain words: a program running as a person on the allowed list can read the group-readable token and drive the control API. The confirmation rules are only a weak bound on that, because confirm is an assertion that a token holder can send (CA-24, T169); the kill switch and the daily caps also limit it. The mode protects what the daemon keeps and its own secrets, not the person’s session (T142-S2, a High residual that is not accepted). Approval outside the person’s session would close it and is not built in this edition.
How a person uses it, once built:
- Service mode is chosen explicitly: set
REYIN_CONTROL_DIR=/run/reyinor pass--control-dir. There is no automatic detection and no fallback to the default mode, in either direction. The client checks the owner, mode and group of the control directory, socket and token before it sends the token. - The client reads the account and group from
/etc/passwdand/etc/groupand requires both files, and/etcitself, to be owned by root and not writable by group or others. A process of the same user can unsetREYIN_CONTROL_DIRin the shell profile and so fall back to the default mode; no service token is sent then, but the command’s data goes to whatever answers there. The mode is never detected, so this stays a known same-user limit. - The commands that talk to the daemon are
reyin daemon,reyin automation,reyin flowandreyin hooks, and the editor.reyin batchruns in the CLI process and does not use the service account.reyin inbox putuses the explicit mode only to check the account and group, and sends no request to the daemon. - The daemon cannot read files in a home directory, so files for it go through the inbox (
/var/lib/reyin-inbox): usereyin inbox put FILE, orcpfollowed bychmod 660(a plaincpunder a restrictive umask leaves a file the daemon cannot read). The inbox is writable by the group, so it is never a place for secrets, and its files are order data that every group member can read. Nothing removes them: delete them after the run. Group members can delete each other’s files, which is fine for one person. reyin inbox put FILEis Linux only and needs the service mode (--control-dirorREYIN_CONTROL_DIR, as above; it is never detected and never defaults). It copies one regular file of at most 64 MiB into the inbox whole, as mode 0660, under a random name (the extension is kept when it is 1 to 8 lowercase letters or digits), and prints the new path (--json:path,name,bytes,mode). It never replaces an entry and never deletes one. It first checks that the inbox is a directory (a link in the last part of its path is refused) of the service account, of the control group, with exactly mode 2770, and refuses (exit 5, naming the check) when it is not. Do not change the source file while it is being copied: that is unsupported, and the command only makes a best effort to notice it. The file is written to an unnamed temporary file inside the inbox and given its name only when it is complete, so no other member ever sees a partial file or a temporary name. If the file system or kernel cannot make such a file, or the link is refused (for example because/procis not mounted), the command refuses with the check nameinbox_tmpfileorinbox_publishand does not try a slower route: usecpfollowed bychmod 660. It needs no administrator rights. If a member of the group changes the new entry in the instant after it is published, the command reports an error that names the entry and leaves it in place for you to check. The inbox path is fixed; an install that moved the daemon’sinput_dirselsewhere will see the daemon refuse the file, which is a safe failure. The daemon’s control socket must exist for the checks to pass, so start the daemon first.- The data directory of an earlier default-mode run is exactly what T142 describes. Moving it to the service account gains nothing until the old copy is deleted and its secrets are rotated. Install with
--no-startand migrate before the unit first starts, because a started service fills its data directory and the migration never merges (the order and the recovery are in service-user). - Linux only. macOS (Bluetooth and USB printing need the user session) and Windows keep the default mode and its open High. Shared machines, per-person tokens or roles, approval by a second person and audit reporting are team features and are not part of this edition.
The configuration file is policy: it is owned by root (recommended root:reyin, mode 0640) with no group or other write bit, in a directory chain owned by root, and the daemon refuses to start in service mode otherwise, so neither the person nor a compromised daemon can edit allowed_users, group or input_dirs.
The hardening the unit carries (the design’s minimum; the packaging package may add to it, and a system-call filter is deferred): NoNewPrivileges=yes, ProtectSystem=strict, ProtectHome=yes, PrivateTmp=yes, UMask=0077, StateDirectoryMode=0700, ConfigurationDirectory=reyin, ProtectKernelTunables=yes, ProtectKernelModules=yes, ProtectControlGroups=yes, ProtectClock=yes, ProtectProc=invisible, RestrictSUIDSGID=yes, RestrictNamespaces=yes, LockPersonality=yes, SystemCallArchitectures=native, RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK AF_BLUETOOTH, an empty CapabilityBoundingSet= (CAP_NET_BIND_SERVICE only when a bound port is below 1024), LimitCORE=0, ReadWritePaths=/var/lib/reyin /run/reyin, and ReadOnlyPaths=/var/lib/reyin-inbox (the daemon only reads the inbox). It needs systemd 247 or newer and a group lp on the host. USB access needs device access: PrivateDevices=no for now, and a DevicePolicy=closed allow list for USB printers is to be tried on hardware (hardware-pending, with Bluetooth).
The configuration keys are in the control API (CA-30); the install script and its guide are service-user.
Hub options
Section titled “Hub options”--hub-auth-jwks PATH require a JWT access ticket on every hub connection--hub-admin-socket PATH operator service (read root key, set/read quota, close/reopen a device or workspace)Tickets verify audience (hub bind address), subject (SHA-256 of the connecting device key), workspace id and a single-use jti while the hub process lives. Creation (purpose=create) tickets are parsed but not usable because workspace creation is not implemented (issue #60). The admin socket is local only and never exposed on the network.
Admin surface
Section titled “Admin surface”The admin socket supports status, quota, root_key, close_device and close_workspace. It is protected by an owner-only 0600 socket and a validated owner-only parent directory; it has no token or peer-credential check, so any same-UID process can administer the hub (investigating residual recorded in #76).
Service files
Section titled “Service files”Prepared but never installed:
- Linux: bins/reyind/contrib/systemd/reyind.service
- macOS: bins/reyind/contrib/launchd/com.reyin.reyind.plist
Connector subcommands
Section titled “Connector subcommands”reyind connect enrol|run|status are implemented; the connector crate has fake-relay tests. Live relay/TLS, full operations and vectors/fuzz remain deferred (#64).
Verifying
Section titled “Verifying”cargo test -p reyind --test daemonruns 31 tests covering IPP serving, authenticated control, hub mode, admin socket, cleanup and service-file checks.
See docs/crates/reyind.md for the full configuration, open risks and acceptance criteria, and services.md for the library-side IPP/sync/connector surfaces.
Source: docs/guides/daemon.md at fe2ada6890.