Reworks the Linux packaging so the service runs as an unprivileged, dedicated "tsunagi" user instead of root — the point of a native package is to set things up properly for that OS's users — and adds Arch Linux packages beside the deb. Both package families are built from the already-compiled static binary; nothing is recompiled. Service model (shared systemd unit, dist/linux/tsunagi.service): - User=tsunagi with AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE, so it creates the TUN and binds low ports without root. - StateDirectory/CacheDirectory/RuntimeDirectory give it /var/lib/tsunagi, /var/cache/tsunagi and /run/tsunagi, and the agent is pointed at them (and the socket at /run/tsunagi/agent.sock) through TSUNAGI_* env in the unit. - The polkit rule now grants the resolve1 actions to the "tsunagi" group; the service user is in it, and admins can add themselves. CLI: when no state dir is chosen, the control commands prefer the system service's socket at /run/tsunagi/agent.sock when it exists, so `sudo tsunagi status`/`join` reach the packaged daemon with no flags. A per-user agent (its socket absent from /run) still uses its own. Packaging: - deb (build-deb.sh): postinst now creates the tsunagi system user+group; unit installed to /lib/systemd/system, binary to /usr/bin. - Arch (new dist/arch/build-pkg.sh): a dependency-free .pkg.tar.zst assembled with bsdtar + zstd (no makepkg, no Arch host) — .PKGINFO, a .INSTALL scriptlet that creates the user and reloads systemd, and a gzipped .MTREE; unit to /usr/lib/systemd/system. - The polkit rule moved to dist/linux (shared by deb, Arch and the tarball), and the tarball install.sh now creates the user and installs the unit + rule. - Both release workflows build the deb and the Arch package on the two Linux matrix entries (deb_arch/pkg_arch), install libarchive-tools+zstd for it, and attach both to the release (Gitea API loop / gh). Not exercised in this session: the .deb and .pkg.tar.zst build and install only on Linux (no dpkg-deb/bsdtar+pacman locally); CLI build, clippy, fmt and tests pass, and all shell/YAML is syntax-checked. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Running tsunagi on Arch Linux
Install the package built for your architecture:
sudo pacman -U tsunagi-*-x86_64.pkg.tar.zst
It drops a static, dependency-free binary at /usr/bin/tsunagi, a systemd
service, and a polkit rule, and creates a dedicated system user tsunagi the
service runs as.
Start it:
sudo systemctl enable --now tsunagi
Control it with sudo (the agent's control socket is private to the service
user; sudo reaches it with no extra flags, because the CLI finds the running
service's socket at /run/tsunagi/agent.sock):
sudo tsunagi status
sudo tsunagi join <network-name> <tsn1…secret>
How it runs
The service runs as the unprivileged tsunagi user with just two capabilities
(CAP_NET_ADMIN, CAP_NET_BIND_SERVICE) granted by systemd — no root. systemd
creates and owns its directories:
| what | path |
|---|---|
| state | /var/lib/tsunagi |
| cache | /var/cache/tsunagi |
| control socket | /run/tsunagi/agent.sock |
The polkit rule lets anyone in the tsunagi group configure systemd-resolved
for the overlay zones (the service user is in that group). To run the agent as
your own user as well, add yourself to the group: sudo usermod -aG tsunagi "$USER".
Removal
sudo pacman -R tsunagi
stops and disables the service. The tsunagi user and /var/lib/tsunagi are
left in place; remove them by hand if you want them gone.