Skip to content
Documentation

Packaging

This page is published from the agent repository. Edit on GitHub View source

This page explains how build output becomes an installable, running agent on each OS: what each package installs, how it cooperates with the self-updater, which build constraints apply (static ONNX Runtime, embedded eBPF probes, no public test key), and how tagged releases are published.

Self-update itself is described in Updates and releases. Building and testing during development is in Development.

Status by platform

PlatformArtifactBuilt in CIPublished on tagService integration
Debian/Ubuntu x86_64static musl .debyes (linux-deb-portability.yml)yessystemd unit, sysusers, tmpfiles
Alpine x86_64static musl .apkyes (linux-apk-portability.yml)yes (throwaway signing key)OpenRC (supervise-daemon)
RHEL/Fedora.rpmno (build-rpm.sh only)nosystemd, SELinux file contexts
Windows x86_64MSI (build.ps1)agent .exe only (windows-static-agent.yml)bare .exe, no MSISCM service registered by the watchdog
macOS arm64.pkg not builtagent binary only (macos-static-agent.yml)bare binary tarballlaunchd + system extension (design only)

Gaps tracked publicly: signed per-OS artifacts and the missing packages (#54), Authenticode signing (#55), the notarized macOS package (#26), arm64 builds (#62).

The bootstrap model

Package managers and the updater must never fight over the same files. On Linux:

  • the package owns /var/lib/synthaea/bootstrap/{agent,watchdog,cli}, the systemd unit, the system user and directories, and /etc/synthaea/agent.toml;
  • the updater owns /var/lib/synthaea/versions/ and the current symlink (Layout).

current starts pointing at bootstrap. A package upgrade replaces the bootstrap binaries and leaves versions/ alone; the updater never writes bootstrap/. Day-0 trust is the package manager's job; the updater's signature chain starts at the first update. The full tree is drawn in Updates and releases.

/usr/bin/synthaea-ctl is a root-owned copy of cli, not a symlink into current/: the unprivileged service user owns current and could otherwise repoint it to get root through sudo synthaea-ctl.

Linux

systemd unit

synthaea-agent.service, shared by .deb and .rpm:

  • runs as user synthaea (synthaea.sysusers), with directories from synthaea.tmpfiles (/run/synthaea, /var/log/synthaea, /var/lib/synthaea, /sys/fs/bpf/synthaea);
  • ExecStartPre recreates a missing current -> bootstrap and versions/, then runs bootstrap/watchdog recover --base-dir /var/lib/synthaea, which rolls back a release whose watchdog cannot execute (recovery.rs);
  • ExecStart is current/watchdog run --agent-bin current/agent --alerts /var/log/synthaea/alerts.ndjson; the watchdog supervises the agent and runs release probation;
  • Restart=always; capabilities granted as an ambient set (CAP_BPF, CAP_PERFMON, CAP_SYS_RESOURCE, CAP_DAC_READ_SEARCH, CAP_NET_ADMIN, CAP_KILL, CAP_AUDIT_READ) with a matching bounding set; NoNewPrivileges, ProtectSystem=strict, and write access limited to the state, log, runtime and BPF directories.

The Alpine package uses OpenRC's capabilities= directive under supervise-daemon for the same ambient set; file capabilities (setcap) are not used because they broke self-update and the watchdog's die-with-parent protection.

Static .deb

build-deb.sh must run on an x86_64 Alpine (musl) host provisioned by alpine-toolchain.sh. The output is fully static, so one .deb runs on any glibc Debian/Ubuntu without inheriting the build host's glibc or libstdc++. The script:

  1. pins cargo-deb to 3.8.0 and reinstalls any other version: the #DEBHELPER# snippet injected into postinst is cargo-deb's own template and changes between releases;
  2. builds ONNX Runtime from source unless ORT_LIB_LOCATION points at a musl static build, and derives the extra link flags with ort-static-link-flags.sh (failing loudly if it produces none);
  3. runs the ml tests and builds agent, watchdog, cli for x86_64-unknown-linux-musl with --no-default-features and +crt-static;
  4. refuses any binary with a program interpreter, scans the binaries for the test key, checks that both eBPF probe objects were embedded, and runs agent --help;
  5. packages with cargo deb --no-build, then extracts and sh -n-parses the generated maintainer scripts, because only the generated text proves the #DEBHELPER# substitution is valid.

CI (linux-deb-portability.yml) then runs the packaged agent in ubuntu:22.04, debian:12 and rockylinux:9, installs the package in containers without systemd, and installs it on a systemd host to check the first start.

.apk

APKBUILD builds the same static musl binaries with the rustup toolchain pinned by the repository (not Alpine's system Rust). CI builds, installs, upgrades and removes it, and runs the binaries on glibc userlands. The published .apk is signed only by a throwaway abuild key, so it installs with apk add --allow-untrusted.

.rpm

build-rpm.sh builds dynamically against the system ONNX Runtime (--no-default-features --features agent/dynamic-onnx), scans for the test key and runs rpmbuild with synthaea-agent.spec.template. No CI job runs it.

On SELinux hosts the binaries under /var/lib/synthaea would otherwise carry var_lib_t, which init_t cannot execute (status=203/EXEC). The spec's %post adds semanage fcontext rules that label bootstrap/ and versions/<n>/* as bin_t; apply-release runs restorecon on each new release (details). dnf remove keeps data and these rules; a full cleanup is manual, documented in packaging/linux/README.md.

Windows

Product.wxs (WiX v3) installs agent.exe and watchdog.exe into Program Files\Synthaea. Custom actions run watchdog.exe install / uninstall, so the watchdog registers the SynthaEDR service itself instead of WiX's service elements. On uninstall a CleanupInstallFolder action deletes the whole install folder, including runtime files the MSI never installed (alerts.ndjson, alerts.heartbeat, events.jsonl): uninstall must leave no residue, at the cost of the local logs' forensic value.

Build: cargo build --release --no-default-features --features agent/dynamic-onnx -p agent -p watchdog then build.ps1, which refuses binaries carrying the test-key marker. There is no binary self-update on Windows yet (#60). The release signs agent.exe with Authenticode when the Azure Trusted Signing secrets are set (Signing); the MSI is not built in CI yet (#55).

windows-static-agent.yml builds ONNX Runtime from source (cached by build-script hash), links the agent statically, and fails if check-pe-imports.py finds onnxruntime.dll, directml.dll or d3d12.dll among the imports.

macOS

There is no .pkg yet. packaging/macos/README.md records the design: a signed app bundle in /Applications hosting the network system extension (Apple only activates system extensions from one), a launchd daemon for the agent with the Endpoint Security entitlement, a shared app group, and MDM payloads that pre-approve the extension, filter and Full Disk Access. The restricted entitlements require Apple's grant before any build can run them on a SIP-enabled host.

macos-static-agent.yml builds ONNX Runtime from source on Apple Silicon (Intel only on manual dispatch), runs the ml tests, links the agent statically and fails if check-macho-imports.py finds a non-OS library or one naming onnxruntime.

Test-key exclusion

The agent crate's default features include test-key, which embeds updater keys derived from public seeds: anyone able to serve the release routes could sign for such a build. Packaged builds therefore always use --no-default-features, and several independent checks keep it that way:

CheckWhereWhat it looks at
check-no-test-key.shCI lint, release test-key-guardcargo tree feature resolution for the packaged flag sets on Linux, Windows and macOS targets (with a positive control on the default build), that each packaging script still builds without default features and scans its output, and that the binary scan can see the marker.
assert-no-test-key.shbuild-deb.sh, build-rpm.sh, static workflows, release publishthe marker string in the actual binaries.
check-no-temporary-keys.shrelease temporary-key-guardany crates/updater/keys/*.pub still marked TEMPORARY, or whose key line (the first non-comment line, the one the build embeds) is one of the three keys of 2026-11-12 (no custody), whatever its comments say. Fails the release, and the sign-windows and sign-macos jobs wait for it, so no signed or notarized binary carries those keys. Only a manual dispatch with allow-temporary-keys passes, with a warning, for a lab build, and it then leaves the release a draft and skips distribute. It does not run in CI: main holds those keys until the ceremony.
marker scan in build.ps1MSI buildagent.exe, watchdog.exe.

Feature unification is how the key would sneak back in (any crate in the build asking for updater/test-key is enough), which is why the check resolves features rather than reading Cargo.toml.

Release workflow

Releases are cut by merging the release PR that release-please keeps open; the tag it creates starts release.yml. Releasing covers the whole flow, the signing secrets and the unsigned-alpha rule; this section covers only how the release reuses the packaging jobs above.

flowchart LR
  T[tag v*] --> M[meta: validate tag,<br/>match package versions]
  M --> G[test-key-guard] & D[linux-deb] & A[linux-apk] & W[windows] & X[macos] & S[sbom] & SP[signing-policy]
  W & SP --> SW[sign-windows]
  X & SP --> SM[sign-macos]
  G & D & A & SW & SM & S --> P[publish: re-scan for test key,<br/>SHA256SUMS, GPG, attestations, release]
  P --> DI[distribute]
  • The four packaging workflows are reused through workflow_call with upload-artifact: true, so the release builds exactly what guards main.
  • meta fails when the tag differs from the workspace version in Cargo.toml, APKBUILD or the rpm spec; the release PR moves all of them together.
  • The signing jobs replace the Windows executable and the macOS tarball with signed copies when their platform's secrets exist; otherwise the unsigned build output ships, as an alpha pre-release.
  • publish re-scans every binary it is about to publish (extracted from the .deb, .apk and macOS tarball, plus the .exe), after signing, so a mix-up between jobs cannot ship the test key.
  • The workflow signs no updater or content manifest: those are signed offline from hardware tokens with release-tool.

Toolchain scripts

ScriptPurpose
linux-toolchain.sh, arch-toolchain.sh, alpine-toolchain.shProvision a build/test machine (apt, dnf, pacman, apk): Rust, the eBPF nightly with rust-src, bpf-linker, and lab packages. Idempotent. If the bpf-linker download fails, the machine is replay-only.
windows-toolchain.ps1Same for Windows build machines.
build-onnxruntime-static.sh, .ps1Build ONNX Runtime 1.30.0 from source as static libraries (Linux glibc/musl, macOS, Windows MSVC).
ort-static-link-flags.sh, .ps1Emit the link flags ort-sys omits: it walks the build output for every static library actually produced (abseil, utf8_range, model package...) rather than maintaining a list.
onnxruntime-static-build.md, onnxruntime-static-build-macos.mdStep-by-step guides and measurements.

The eBPF probe toolchain is pinned separately in packaging/toolchain/ebpf-toolchain.txt; the bpf-linker version and its SHA-256 are pinned in CI's linux-ebpf job and must match the provisioning scripts.

Static linking of ONNX Runtime exists so the agent ships as one binary: no runtime shared library to hijack, and a release manifest that covers everything that executes.