strawberry/scripts/strawberry-trackerd.service
trvon 94c8a8f9f1
Some checks failed
Build and Test / build (debug, clang) (push) Has been cancelled
Build and Test / build (debug, gcc) (push) Has been cancelled
Build and Test / build (release, clang) (push) Has been cancelled
Build and Test / build (release, gcc) (push) Has been cancelled
Build and Test / macos (push) Has been cancelled
Build and Test / docker (push) Has been cancelled
Privacy: host-namespace tracker relay + install/units/docs (WS2b/WS2c)
Second half of the sandbox-safe tracker transport. A small relay in the host
network namespace bridges OpenSnitch to the sandboxed daemon, so the daemon keeps
PrivateNetwork=true + RestrictAddressFamilies=AF_UNIX and never sees argv/env.

- `strawberry opensnitch relay` (new CLI verb, Map::flag -> --opensnitch-relay):
  binds the OpenSnitch loopback port via the existing OpenSnitchEventListener
  (root-peer check, argv/env dropped at parse), and forwards each redacted tuple
  (encode_connection) to the daemon's AF_UNIX ingest socket, reconnecting on
  failure. Foreground loop until SIGTERM/SIGINT; drops (not blocks) when the
  socket is down. Linux-only. The listener callback runs on one thread, so the
  sink needs no lock.
- scripts/strawberry-trackerd.service: runs the relay in the host namespace with
  only CAP_NET_BIND_SERVICE, no PrivateNetwork, and /proc/net kept readable for
  the peer check (no ProcSubset=pid); otherwise the same tight sandbox as
  strawberry-update.service. install.sh installs+manifests+starts it when
  OpenSnitch is present and privacy_trackers is not false.
- docs/tracker-attribution.md: replace the "known limitation" with the relay
  architecture (rejected alternatives noted). API_CONTRACT: privacy.listener now
  describes the ingest socket + relay; also documents feed-add max_severity (B1).

Suite 51/51; clang static analyzer and clang-tidy clean on main.cpp and
cli_commands.cpp. Full relay->OpenSnitch end-to-end needs host validation
(sudo + a real OpenSnitch); the socket path is covered by E9.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 17:56:23 -06:00

52 lines
1.7 KiB
Desktop File

[Unit]
Description=Strawberry tracker-attribution relay (OpenSnitch events -> daemon)
Documentation=https://github.com/trvon/strawberry
# Runs in the host network namespace so it can receive OpenSnitch's loopback
# connection events; forwards redacted tuples to the sandboxed daemon over its
# AF_UNIX ingest socket (docs/tracker-attribution.md). Advisory only.
After=strawberry.service opensnitchd.service
Wants=opensnitchd.service
[Service]
Type=simple
ExecStart=/usr/local/bin/strawberry opensnitch relay --config /etc/strawberry/strawberry.conf
Restart=on-failure
RestartSec=10
# Minimal privilege: it only needs to bind the loopback OpenSnitch port (<1024),
# read /proc/net/tcp to confirm the peer is root, and connect the daemon's
# AF_UNIX ingest socket. It parses untrusted event bytes and drops argv/env
# before forwarding, so it keeps no capabilities beyond CAP_NET_BIND_SERVICE.
User=root
Group=strawberry
UMask=0077
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
# NOT PrivateNetwork: the relay must share the host namespace with OpenSnitch.
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
ProtectClock=true
ProtectHostname=true
# ProtectProc=invisible is fine, but do NOT set ProcSubset=pid: the peer check
# reads /proc/net/tcp.
ProtectProc=invisible
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
LockPersonality=true
MemoryDenyWriteExecute=true
RestrictAddressFamilies=AF_UNIX AF_INET
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
SystemCallErrorNumber=EPERM
[Install]
WantedBy=multi-user.target