feat!: Urutau 2.0.0, ultralight probes and a single analysis hub
Each server runs an ultralight probe (scratch image, ~7 MiB RSS) that tails the logs, ships raw lines to the hub over HTTPS with an on-disk spool, and applies enforce decisions locally. The hub keeps one node per probe (primary node = the 1.x data dir, unchanged), does all analysis and serves the UI. Peer federation is removed. 'urutau import' brings 1.x data dirs in with hash and count verification. UI: probes page, host qualified incidents, IPs never wrap, egress heatmap labels, live and replay globes no longer auto-rotate, replay repeat, live traffic metrics. BREAKING CHANGE: URUTAU_PEERS, URUTAU_PEER_* and /api/v1/peer/* are gone; log path variables move from the hub to the probe. See docs/migration-2.0.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23a7a5963a
commit
8546d14cef
130 files changed
+9396
-3311
No files matched your search
+39
-20
@@ -5,14 +5,15 @@
|
||||
# database (MMDB, city + asn) that maps sub-ranges of the reserved documentation addresses
|
||||
# (198.18.0.0/15, 203.0.113.0/24, 198.51.100.0/24, 192.0.2.0/24, 2001:db8::/32) to real
|
||||
# cities, plus 30 days of synthetic Traefik / auth.log / fail2ban.log files for two servers
|
||||
# (edge-1, edge-2) with domains under example.com/.org/.net. Two Urutau instances (a hub and
|
||||
# one peer, ports 18880/18881) read them, new events keep arriving while the pages are
|
||||
# captured (so the live map has arcs), and headless Chrome takes the pictures.
|
||||
# (edge-1, edge-2) with domains under example.com/.org/.net. One hub (port 18880) and two
|
||||
# probes (edge-1 and edge-2, which read the files and push them to the hub over loopback)
|
||||
# serve them, new events keep arriving while the pages are captured (so the live map has
|
||||
# arcs), and headless Chrome takes the pictures.
|
||||
#
|
||||
# scripts/screenshots.sh # writes docs/img
|
||||
# OUT=/tmp/img scripts/screenshots.sh # writes elsewhere
|
||||
#
|
||||
# Variables: ONLY (comma list of page ids to capture), OUT, HUB_PORT (18880), PEER_PORT (18881), LOGIN_PORT (18882), CHROME,
|
||||
# Variables: ONLY (comma list of page ids to capture), OUT, HUB_PORT (18880), LOGIN_PORT (18882), CHROME,
|
||||
# PUPPETEER_CORE (default: newest Chrome in ~/.cache/puppeteer and puppeteer-core in
|
||||
# ~/.claude/tools/node_modules). Needs go, node, curl, openssl and Chrome. No network use.
|
||||
# Idempotent: it builds into a temporary directory, kills what it started (by PID) when done
|
||||
@@ -22,7 +23,6 @@ set -euo pipefail
|
||||
root=$(cd "$(dirname "$0")/.." && pwd)
|
||||
out=${OUT:-$root/docs/img}
|
||||
hub_port=${HUB_PORT:-18880}
|
||||
peer_port=${PEER_PORT:-18881}
|
||||
login_port=${LOGIN_PORT:-18882}
|
||||
|
||||
work=$(mktemp -d)
|
||||
@@ -34,7 +34,7 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
for port in "$hub_port" "$peer_port" "$login_port"; do
|
||||
for port in "$hub_port" "$login_port"; do
|
||||
if curl -fsS -m 1 "http://127.0.0.1:$port/api/health" >/dev/null 2>&1; then
|
||||
echo "port $port is already in use; stop that instance first" >&2
|
||||
exit 1
|
||||
@@ -56,33 +56,52 @@ demo="$work/bin/demo"
|
||||
"$demo" egress "$work/hub/egress"
|
||||
"$demo" check "$work"/hub/logs/* "$work"/peer/logs/* "$work"/hub/egress/* # fails on any IP outside the reserved ranges
|
||||
|
||||
export URUTAU_PEER_TOKEN=$(openssl rand -base64 48 | tr -d '\n')
|
||||
start() { # start name port dir [extra flags...]
|
||||
local name=$1 port=$2 dir=$3; shift 3
|
||||
"$urutau" serve --name "$name" --bind "127.0.0.1:$port" --data-dir "$dir/data" \
|
||||
--traefik-log "$dir/logs/access.log" --auth-log "$dir/logs/auth.log" --fail2ban-log "$dir/logs/fail2ban.log" \
|
||||
--geo-dir "$work/geo" --geo-update 0 --insecure-no-auth "$@" > "$dir.log" 2>&1 &
|
||||
# The hub reads no file. Probes edge-1 (the hub's own name, so its data lives in the
|
||||
# data-dir root) and edge-2 are registered offline, before the hub starts, and each
|
||||
# prints its token once.
|
||||
mkdir -p "$work/hub/data"
|
||||
probe_token() { # probe_token name: registers the probe and prints its urp_ token
|
||||
"$urutau" probes create --data-dir "$work/hub/data" "$1" | grep -o 'urp_[A-Za-z0-9_-]\{43\}' | head -n1
|
||||
}
|
||||
tok1=$(probe_token edge-1)
|
||||
tok2=$(probe_token edge-2)
|
||||
[ -n "$tok1" ] && [ -n "$tok2" ] || { echo "could not create the demo probes (urutau probes create)" >&2; exit 1; }
|
||||
|
||||
"$urutau" serve --name edge-1 --bind "127.0.0.1:$hub_port" --data-dir "$work/hub/data" \
|
||||
--geo-dir "$work/geo" --geo-update 0 --insecure-no-auth \
|
||||
--enforce observe --egress on --egress-workloads "ciberlab=name:ciberlab:scanner" \
|
||||
--location "50.1109,8.6821,edge-1" > "$work/hub.log" 2>&1 &
|
||||
pids+=($!)
|
||||
|
||||
start_probe() { # start_probe name token dir [env...]
|
||||
local name=$1 token=$2 dir=$3; shift 3
|
||||
mkdir -p "$dir/state" "$dir/enforce"
|
||||
env URUTAU_HUB="http://127.0.0.1:$hub_port" URUTAU_PROBE_NAME="$name" URUTAU_PROBE_TOKEN="$token" \
|
||||
URUTAU_STATE_DIR="$dir/state" URUTAU_TRAEFIK_LOG="$dir/logs/access.log" URUTAU_AUTH_LOG="$dir/logs/auth.log" \
|
||||
URUTAU_FAIL2BAN_LOG="$dir/logs/fail2ban.log" URUTAU_PROBE_LOG= URUTAU_EGRESS_LOG= URUTAU_EGRESS_CONTAINERS= URUTAU_RESOLV= \
|
||||
URUTAU_ENFORCE_LOG="$dir/enforce/decisions.log" URUTAU_ENFORCE_UNBAN_LOG="$dir/enforce/unban.log" "$@" \
|
||||
"$urutau" probe > "$dir.probe.log" 2>&1 &
|
||||
pids+=($!)
|
||||
}
|
||||
start edge-2 "$peer_port" "$work/peer" --location "39.0438,-77.4874,edge-2"
|
||||
start edge-1 "$hub_port" "$work/hub" --location "50.1109,8.6821,edge-1" \
|
||||
--enforce observe --egress on --egress-log "$work/hub/egress/egress.log" --egress-containers "$work/hub/egress/containers.map" \
|
||||
--egress-workloads "ciberlab=name:ciberlab:scanner" --peer "edge-2=http://127.0.0.1:$peer_port"
|
||||
# The hub must be answering before the probes dial it.
|
||||
for _ in $(seq 1 150); do curl -fsS "http://127.0.0.1:$hub_port/api/health" >/dev/null 2>&1 && break; sleep 0.2; done
|
||||
start_probe edge-1 "$tok1" "$work/hub" URUTAU_EGRESS_LOG="$work/hub/egress/egress.log" URUTAU_EGRESS_CONTAINERS="$work/hub/egress/containers.map"
|
||||
start_probe edge-2 "$tok2" "$work/peer" URUTAU_LOCATION="39.0438,-77.4874,edge-2"
|
||||
|
||||
# A third, short-lived instance with authentication on, only for the login page.
|
||||
mkdir -p "$work/login/data"
|
||||
URUTAU_TOKEN=$(openssl rand -base64 48 | tr -d '\n') URUTAU_PEER_TOKEN= "$urutau" serve --name edge-1 \
|
||||
--bind "127.0.0.1:$login_port" --data-dir "$work/login/data" --traefik-log "" --auth-log "" --fail2ban-log "" \
|
||||
URUTAU_TOKEN=$(openssl rand -base64 48 | tr -d '\n') "$urutau" serve --name edge-1 \
|
||||
--bind "127.0.0.1:$login_port" --data-dir "$work/login/data" \
|
||||
--geo-dir "$work/geo" --geo-update 0 > "$work/login.log" 2>&1 &
|
||||
pids+=($!)
|
||||
|
||||
for port in "$hub_port" "$peer_port" "$login_port"; do
|
||||
for port in "$hub_port" "$login_port"; do
|
||||
ok=0
|
||||
for _ in $(seq 1 150); do
|
||||
curl -fsS "http://127.0.0.1:$port/api/health" >/dev/null 2>&1 && { ok=1; break; }
|
||||
sleep 0.2
|
||||
done
|
||||
[ "$ok" = 1 ] || { echo "instance on port $port did not start:" >&2; tail -20 "$work"/*.log >&2; exit 1; }
|
||||
[ "$ok" = 1 ] || { echo "instance on port $port did not start:" >&2; tail -20 "$work"/*.log "$work"/*/*.probe.log "$work"/*.probe.log >&2; exit 1; }
|
||||
done
|
||||
# wait until the hub has read the backfill (the request counter stops growing)
|
||||
prev=-1
|
||||
|
||||
Reference in new issue
Block a user