strawberry/scripts/strawberry.service
trvon ad1676a594
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 / docker (push) Has been cancelled
Integrate features into the daemon, build and docs
Wire the policy, feeds, containment, exec guard, behavior, governor,
crash safety and event store into the daemon, detection pipeline, CLI
and meson build (zstd now required); Dockerfile, conan, systemd unit
(LimitCORE=0, resource limits) and installer updates; existing tests
adapted (store paths are directories now). Detections are counted and
notified even when evidence cannot be persisted (persist_failures in
status). prevention_timeout_ms is clamped and behavior dedupe handles
out-of-order events. Docs: API contract, developer guide, plan, UX,
agent rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:17:30 -06:00

82 lines
3.1 KiB
Desktop File

[Unit]
Description=Strawberry Security Scanner
Documentation=https://github.com/trvon/strawberry
After=local-fs.target
[Service]
Type=simple
ExecStart=/usr/local/bin/strawberry /etc/strawberry/strawberry.conf
Environment=XDG_DATA_HOME=/var/lib
Environment=STRAWBERRY_BPF_OBJECT=/usr/local/share/strawberry/process_monitor.bpf.o
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
# Runs as root but keeps only the capabilities it needs:
# CAP_BPF + CAP_PERFMON load and attach the exec tracepoints
# CAP_SYS_RESOURCE raise RLIMIT_MEMLOCK for BPF maps on older kernels
# CAP_SYS_PTRACE read /proc/<pid>/exe and cmdline of every process
# CAP_DAC_READ_SEARCH read any executable image for hashing/YARA
# CAP_SYS_ADMIN fanotify permission events (execution prevention)
# CAP_KILL suspend/kill a process from the app (response)
User=root
# Files and the control socket are group-owned by `strawberry`: members can
# read findings (read-only) and use the desktop app's controls.
Group=strawberry
CapabilityBoundingSet=CAP_BPF CAP_PERFMON CAP_SYS_RESOURCE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_SYS_ADMIN CAP_KILL
AmbientCapabilities=CAP_BPF CAP_PERFMON CAP_SYS_RESOURCE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_SYS_ADMIN CAP_KILL
NoNewPrivileges=true
# Filesystem: read-only view of the host, writable state dir only.
# /home and /tmp stay visible (read-only) on purpose: malware is commonly
# dropped and run from there, and the scanner must be able to read it.
ProtectSystem=strict
ProtectHome=read-only
PrivateTmp=false
StateDirectory=strawberry
StateDirectoryMode=0750
# OpenSnitch integration: Strawberry writes only strawberry-*.json rules here
# (ignored if OpenSnitch is not installed).
ReadWritePaths=-/etc/opensnitchd/rules
RuntimeDirectory=strawberry
RuntimeDirectoryMode=0750
UMask=0027
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
ProtectClock=true
ProtectHostname=true
RestrictRealtime=true
RestrictSUIDSGID=true
RestrictNamespaces=true
LockPersonality=true
MemoryDenyWriteExecute=true
PrivateNetwork=true
RestrictAddressFamilies=AF_UNIX
SystemCallArchitectures=native
SystemCallFilter=@system-service bpf perf_event_open fanotify_init fanotify_mark
SystemCallErrorNumber=EPERM
LimitNOFILE=65536
# Resource limits (scan_profile=balanced). The daemon also paces itself (see
# the resource governor); these are the kernel-enforced backstop so a scan can
# never take the desktop down. For another profile: `systemctl edit strawberry`.
# efficient: CPUWeight=20 IOWeight=20 MemoryHigh=384M MemoryMax=768M
# aggressive: CPUWeight=100 IOWeight=100 MemoryHigh=1536M MemoryMax=3G
CPUWeight=50
IOWeight=50
MemoryHigh=768M
MemoryMax=1536M
TasksMax=64
# Prefer reclaiming elsewhere before killing the scanner; MemoryMax still bounds it.
OOMScoreAdjust=-100
# Never core-dump: the dump helper is an exec, and execs wait on this daemon's
# fanotify permission events (2026-10-25 freeze). The daemon also marks itself
# non-dumpable and releases those events first on any fatal error.
LimitCORE=0
[Install]
WantedBy=multi-user.target