check / check (push) Successful in 3m24s
smallwebwaf now copies its state to bans.json, clients.json and lookups.json in SWWAF_STATE_DIR, as "Persistent state" in SPEC.md describes, and reads them back at start, so a restart lifts no ban and gives no client a fresh allowance. Each client gains a history, and a ban's notes count the netblock's requests. bans.json is written SWWAF_STATE_WRITE_DELAY after a ban, and every file every SWWAF_STATE_COUNTER_INTERVAL and at the stop. A ban read back is masked to its netblock and refuses every client in it. A file that does not parse, an unknown version, an entry without a field it needs, or an unwritable directory stops the start. Deviation: no AS number or name, and no ban cause, reason or lifting yet. Model: opus-5-5
21 lines
538 B
Bash
Executable File
21 lines
538 B
Bash
Executable File
#!/bin/sh
|
|
# script/run: build bin/smallwebwaf with script/build and run it, with
|
|
# the settings in the environment. Unless SWWAF_STATE_DIR is set, the
|
|
# state files go in bin/state, beside the binary.
|
|
set -eu
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
|
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
|
|
|
main() {
|
|
"$SCRIPT_DIR/build"
|
|
if [ -z "${SWWAF_STATE_DIR+set}" ]; then
|
|
SWWAF_STATE_DIR="$ROOT/bin/state"
|
|
export SWWAF_STATE_DIR
|
|
mkdir -p "$SWWAF_STATE_DIR"
|
|
fi
|
|
exec "$ROOT/bin/smallwebwaf"
|
|
}
|
|
|
|
main "$@"
|