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
`model train` on a host without detections stops with "0 positive windows" and pointed at --inject-train FILE, but only the evaluation set (standard.trace) existed. Add config/traces/training.trace: 7 attack shapes (document macro dropper, web reverse shell, cron miner, /dev/shm perl stager, ssh key backdoor, npm postinstall, ld.so.preload) that differ from the evaluation set, so the gate never judges a model on what it trained on. P4 in test_trace enforces that (no shared trace name or exec sequence); it caught an evince -> python3 overlap in the first draft. Both installers put the traces in /usr/local/share/strawberry/traces/ (install_traces in install_common.sh); the hint and README name it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.2 KiB
Bash
62 lines
2.2 KiB
Bash
# shellcheck shell=bash
|
|
# Shared by scripts/install.sh (Linux) and scripts/macos_install.sh. Sourced,
|
|
# not run.
|
|
|
|
# sha256 of a file, hex only (sha256sum on Linux, shasum on macOS).
|
|
sha256_of() {
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
|
sha256sum < "$1" | cut -d' ' -f1
|
|
else
|
|
shasum -a 256 < "$1" | cut -d' ' -f1
|
|
fi
|
|
}
|
|
|
|
# Shell completions, generated from the CLI's command table.
|
|
# $1: installed strawberry binary.
|
|
install_completions() {
|
|
local bin="$1" entry shell target
|
|
for entry in "bash:/usr/local/share/bash-completion/completions/strawberry" \
|
|
"zsh:/usr/local/share/zsh/site-functions/_strawberry" \
|
|
"fish:/usr/local/share/fish/vendor_completions.d/strawberry.fish"; do
|
|
shell="${entry%%:*}"
|
|
target="${entry#*:}"
|
|
install -d -m 0755 "$(dirname "$target")"
|
|
if "$bin" completion "$shell" > "$target.tmp"; then
|
|
chmod 0644 "$target.tmp" && mv -f "$target.tmp" "$target"
|
|
else
|
|
echo "Warning: could not generate $shell completions"
|
|
rm -f "$target.tmp"
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Write the installed-files manifest atomically: root-owned, 0644, in
|
|
# sha256sum format. The daemon records writes to these persistence paths as
|
|
# evidence instead of raising findings while the content still matches.
|
|
# $1: manifest path, $2: owner group (root/wheel), then pairs of
|
|
# <source file> <installed path>.
|
|
write_installed_manifest() {
|
|
local manifest="$1" group="$2"
|
|
shift 2
|
|
: > "$manifest.tmp"
|
|
while [ $# -ge 2 ]; do
|
|
if [ -f "$1" ]; then
|
|
printf '%s %s\n' "$(sha256_of "$1")" "$2" >> "$manifest.tmp"
|
|
fi
|
|
shift 2
|
|
done
|
|
install -m 0644 -o root -g "$group" "$manifest.tmp" "$manifest"
|
|
rm -f "$manifest.tmp"
|
|
}
|
|
|
|
# Attack traces for replay and training (read-only data):
|
|
# standard.trace evaluates (strawberry replay --inject, the promotion gate),
|
|
# training.trace trains (strawberry model train --inject-train).
|
|
# $1: install prefix (/usr/local).
|
|
install_traces() {
|
|
local dir="$1/share/strawberry/traces" trace
|
|
install -d -m 0755 "$dir"
|
|
for trace in config/traces/*.trace; do
|
|
install -m 0644 "$trace" "$dir/$(basename "$trace")"
|
|
done
|
|
}
|