~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
main
80 lines · 7.1 KB Raw History

The Linux host contract

A Linux host that runs socialweb-computer install gateway or socialweb-computer install bidder must satisfy every check in the table below. socialweb-computer check-host probes the host as the installed account and prints each check with its fix. install runs the same probe as the account after it creates the account, and install fails when a check fails.

Run the check

Run check-host as the account that runs the host's components (gateway: socialweb, bidder: swc-bidder). Do not run it as root: the account check fails when the effective user is root.

socialweb-computer check-host -role gateway -state-dir <state>
socialweb-computer check-host -role bidder -state-dir <state>

<state> is the account's state dir. install writes it into the account's config; check-host reads -state-dir, or the SOCIALWEB_STATE_DIR environment variable when -state-dir is not passed.

OptionRequiredDefaultMeaning
-roleyesnonegateway or bidder; selects the check set
-state-diryesSOCIALWEB_STATE_DIRthe account's state dir, for the probe output and the POSIX ACL check
-asset-cacheno<state-dir>/runtimethe asset extraction root
-pastanononethe pasta executable for a dev build; a release build extracts the embedded one
-jsonnooffprint the results as JSON

The command prints one line per check, in table order. The status is OK, FAIL or INFO. A FAIL line is followed by a fix: line.

OK    account                      socialweb (uid 1000)
FAIL  dev-kvm                      /dev/kvm does not exist
                                   fix: enable hardware virtualization and load kvm_intel or kvm_amd (root); never chmod /dev/kvm

The command succeeds when no check has status FAIL: every line is OK or INFO and the exit code is 0. On a failure it names the failed checks on stderr as check-host: the <role> host contract is not met: <names>.

Exit codeMeaning
0The contract holds. No check failed.
1One or more checks failed. The names go to stderr.
2Usage error: a missing or unknown -role, a missing -state-dir, or an unknown flag.

Pass -json to print the results as a JSON array. Each element is an object with name, status (ok, fail or info), detail, and fix (present only on a failed check).

Checks

Applies to is both for the gateway and the bidder. The rows are in the order the report prints.

CheckApplies toPasses whenIf it fails
accountbothThe command runs as the host account, not as rootRun check-host as the account; install runs it as the account after it creates the account
systemd-versionbothThe account's user manager answers on its private socket and reports systemd 253 or newer (GetUnitByPIDFD)Upgrade the host to a distribution that ships systemd 253 or newer, and enable linger so the user manager runs
probe-unit-propertiesbothA transient socialweb-probe-<rand>.service starts with every property the runtime sets (MemoryMax, MemorySwapMax=0, OOMPolicy, TasksMax, CPUQuota, CPUWeight, CollectMode, After, Wants, Slice, KillSignal, TimeoutStopSec, StandardOutput=append:, plus FileDescriptorStoreMax for the gateway) and the user manager reads every one backUse a host whose systemd (253 or newer) keeps every property the runtime sets
cgroup-v2both/sys/fs/cgroup is the cgroup v2 unified hierarchyBoot the kernel with systemd.unified_cgroup_hierarchy=1 (the default on current distributions)
user-manager-delegationbothuser@<uid>.service cgroup.controllers include cpu, memory and pidsRun install, which writes the Delegate=cpu memory pids drop-in; then restart user@<uid> or reboot the host
lingerboth/var/lib/systemd/linger/<account> existsRun install, which enables linger once the account, its groups and the delegation drop-in are in place
runtime-dir-socket-lengthbothXDG_RUNTIME_DIR plus the longest runtime socket path is under 108 bytesUse the default /run/user/<uid> runtime directory
boot-idboth/proc/sys/kernel/random/boot_id is readableMount /proc normally; reboot detection reads boot_id
dev-kvmbidder/dev/kvm opens read-write as the accountEnable hardware virtualization and load kvm_intel or kvm_amd as root; run install bidder, which adds the account to the kvm group; never chmod /dev/kvm
user-manager-kvm-groupbidderThe groups of user@<uid>'s process include kvmRestart user@<uid> (this stops every VM) or reboot the host; logging in again does not refresh a lingering user manager
dev-net-tunbidder/dev/net/tun opens read-writeLoad the tun module as root: modprobe tun
pasta-usernsbidderThe embedded pasta creates a user and network namespace and execs through /bin/shOn Ubuntu 24.04 and newer run install bidder, which loads the AppArmor profile; otherwise allow unprivileged user namespaces through the kernel.unprivileged_userns_clone and user.max_user_namespaces sysctls
apparmor-pasta-profilebidderAppArmor does not restrict unprivileged user namespaces, or the socialweb-pasta profile is loadedRun install bidder, which writes /etc/apparmor.d/socialweb-pasta and loads it with apparmor_parser -r
subuid-subgid-rangebidderExactly one range of 65536 ids or more for the account in both /etc/subuid and /etc/subgid, overlapping no other entry of either fileRun install bidder, which reserves one contiguous range above every existing entry; remove the other tool's overlapping entry
newuidmap-newgidmapbidderThe distribution's newuidmap and newgidmap are setuid root or carry file capabilitiesInstall the distribution's uidmap (Debian/Ubuntu) or shadow-utils (Fedora/RHEL) package as root; never ship a setuid helper
newuidmap-first-vm-rangebidderA throwaway user namespace maps 0-65535 onto the account's first VM sub-range through newuidmap and newgidmapFix the subuid-subgid-range and newuidmap-newgidmap checks first
state-dir-posix-aclbidderThe state dir's filesystem supports POSIX ACLsPut the state dir on a filesystem mounted with ACL support (ext4, xfs and btrfs support ACLs by default)
systemd-oomdbothReported only; reports whether systemd-oomd is active and never failsNo action; every unit runs below socialweb.slice, outside the app.slice systemd-oomd watches
user-manager-fd-storegatewayFileDescriptorStoreMax reads back from a transient serviceUse a systemd whose user manager keeps an fd store for transient services; the kcp front restarts without a refused-connection window only with it
k3s-slot-hostnamegatewayReported only; never fails, and the check is not probed yetNo action
tzdatagateway/usr/share/zoneinfo/UTC exists (the embedded postgres uses the system tzdata path)Install the distribution's tzdata package as root

socialweb-computer dev check reports the development host subset; it changes nothing on the host.