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
-6
@@ -2,9 +2,16 @@
|
||||
# Urutau host kit: egress logging (nftables + rsyslog), the container map and,
|
||||
# optionally, the fail2ban jail of the "second firewall".
|
||||
#
|
||||
# sudo sh install.sh # egress logging + container map
|
||||
# sudo sh install.sh --enforce # also the fail2ban jail for URUTAU_ENFORCE=on
|
||||
# sudo sh install.sh --remove # undo everything
|
||||
# sudo sh install.sh # egress logging + container map
|
||||
# sudo sh install.sh --enforce # also the fail2ban jail for URUTAU_ENFORCE=on
|
||||
# sudo sh install.sh --probe # a probe host: the kit above, no hub on this machine
|
||||
# sudo sh install.sh --probe --enforce # probe host that also applies the hub's bans
|
||||
# sudo sh install.sh --remove # undo everything
|
||||
#
|
||||
# --probe is for servers that run only the Urutau probe (deploy/probe): the
|
||||
# probe dials out to the hub, so nothing here opens or needs a port. It also
|
||||
# prepares /var/log/urutau-enforce (owned by the probe's uid) so the probe can
|
||||
# append the hub's decisions; the fail2ban jail still needs --enforce.
|
||||
#
|
||||
# Idempotent. Urutau itself never gets privileges: it only reads these logs and
|
||||
# writes its ban decisions to /var/log/urutau-enforce/decisions.log.
|
||||
@@ -12,9 +19,22 @@ set -eu
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
uid=${URUTAU_UID:-10001}
|
||||
|
||||
probe=0
|
||||
enforce=0
|
||||
remove=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--probe) probe=1 ;;
|
||||
--enforce) enforce=1 ;;
|
||||
--remove) remove=1 ;;
|
||||
-h | --help) awk 'NR > 1 { if (!/^#/) exit; sub(/^# ?/, ""); print }' "$0"; exit 0 ;;
|
||||
*) echo "unknown option: $arg (see --help)" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ "$(id -u)" = 0 ] || { echo "run as root" >&2; exit 1; }
|
||||
|
||||
if [ "${1:-}" = "--remove" ]; then
|
||||
if [ "$remove" = 1 ]; then
|
||||
systemctl disable --now urutau-egress.service urutau-containers-map.timer urutau-logrotate.timer urutau-unban.path 2>/dev/null || true
|
||||
rm -f /etc/systemd/system/urutau-egress.service /etc/systemd/system/urutau-containers-map.service \
|
||||
/etc/systemd/system/urutau-containers-map.timer /usr/local/sbin/urutau-containers-map \
|
||||
@@ -52,7 +72,16 @@ systemctl restart urutau-egress.service
|
||||
systemctl start urutau-containers-map.service urutau-containers-map.timer
|
||||
echo "egress logging on $wan: /var/log/urutau/egress.log, map: /var/log/urutau/containers.map"
|
||||
|
||||
if [ "${1:-}" = "--enforce" ]; then
|
||||
if [ "$probe" = 1 ] && [ "$enforce" = 0 ]; then
|
||||
# The probe appends the hub's decisions here even when the jail is not
|
||||
# installed yet, so the files must exist and belong to the probe's uid.
|
||||
install -d -m 0750 -o "$uid" -g adm /var/log/urutau-enforce
|
||||
for f in decisions.log unban.log; do
|
||||
[ -e "/var/log/urutau-enforce/$f" ] || install -m 0640 -o "$uid" -g adm /dev/null "/var/log/urutau-enforce/$f"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$enforce" = 1 ]; then
|
||||
install -d -m 0750 -o "$uid" -g adm /var/log/urutau-enforce
|
||||
[ -e /var/log/urutau-enforce/decisions.log ] || install -m 0640 -o "$uid" -g adm /dev/null /var/log/urutau-enforce/decisions.log
|
||||
install -m 0644 "$here/fail2ban-filter-urutau.conf" /etc/fail2ban/filter.d/urutau.conf
|
||||
@@ -65,5 +94,9 @@ if [ "${1:-}" = "--enforce" ]; then
|
||||
systemctl enable --now urutau-unban.path >/dev/null
|
||||
fail2ban-client -t >/dev/null
|
||||
fail2ban-client reload
|
||||
echo "fail2ban jail 'urutau' on; mount /var/log/urutau-enforce:/logs/enforce (rw) in the container"
|
||||
echo "fail2ban jail 'urutau' on; the probe container mounts /var/log/urutau-enforce:/logs/enforce (rw)"
|
||||
fi
|
||||
|
||||
if [ "$probe" = 1 ]; then
|
||||
echo "probe host ready: create the probe on the hub (urutau probes create <name>) and start deploy/probe/docker-compose.yml"
|
||||
fi
|
||||
@@ -0,0 +1,12 @@
|
||||
# Variables read by deploy/probe/docker-compose.yml.
|
||||
# Image tag: latest (last release), X.Y.Z (pinned) or edge (main).
|
||||
URUTAU_VERSION=latest
|
||||
URUTAU_PROBE_IMAGE=git.lucasrguerra.dev.br/ciberfauna/urutau-probe
|
||||
# Hub address: https://... (http only for loopback or private addresses).
|
||||
URUTAU_HUB=
|
||||
# Name registered on the hub: urutau probes create <name>
|
||||
URUTAU_PROBE_NAME=
|
||||
# Token printed once by that command (urp_...). Never commit this file.
|
||||
URUTAU_PROBE_TOKEN=
|
||||
# Time zone of this host (fail2ban.log is local time; must match the hub's TZ).
|
||||
TZ=UTC
|
||||
@@ -0,0 +1,70 @@
|
||||
# Urutau probe: one per server. It reads the host logs (read-only), sends the
|
||||
# lines to the hub over HTTPS and appends the hub's ban decisions to a file. It
|
||||
# opens no port: the connection goes out to the hub.
|
||||
#
|
||||
# urutau probes create <name> # on the hub: prints the token once
|
||||
# cp .env.example .env # set URUTAU_HUB, URUTAU_PROBE_NAME, URUTAU_PROBE_TOKEN
|
||||
# docker compose up -d
|
||||
#
|
||||
# Host kit (egress log, container map, optional fail2ban jail):
|
||||
# sudo sh ../host/install.sh --probe [--enforce]
|
||||
name: urutau-probe
|
||||
|
||||
services:
|
||||
probe:
|
||||
image: ${URUTAU_PROBE_IMAGE:-git.lucasrguerra.dev.br/ciberfauna/urutau-probe}:${URUTAU_VERSION:-latest}
|
||||
environment:
|
||||
# https://hub.example.org (plain http only to loopback or private hosts,
|
||||
# e.g. http://urutau:8790 on the urutau-edge network).
|
||||
URUTAU_HUB: ${URUTAU_HUB:?set URUTAU_HUB}
|
||||
# The name registered on the hub with `urutau probes create`.
|
||||
URUTAU_PROBE_NAME: ${URUTAU_PROBE_NAME:?set URUTAU_PROBE_NAME}
|
||||
# urp_... token, shown once at creation. The hub keeps only its hash.
|
||||
# Alternatively mount a file and set URUTAU_PROBE_TOKEN_FILE.
|
||||
URUTAU_PROBE_TOKEN: ${URUTAU_PROBE_TOKEN:-}
|
||||
URUTAU_STATE_DIR: /state
|
||||
# Sources: a path turns it on, empty turns it off. Missing files wait.
|
||||
URUTAU_TRAEFIK_LOG: ${URUTAU_TRAEFIK_LOG-/logs/traefik/access.log}
|
||||
URUTAU_AUTH_LOG: ${URUTAU_AUTH_LOG-/logs/host/auth.log}
|
||||
URUTAU_FAIL2BAN_LOG: ${URUTAU_FAIL2BAN_LOG-/logs/host/fail2ban.log}
|
||||
URUTAU_PROBE_LOG: ${URUTAU_PROBE_LOG-/logs/host/probe.log}
|
||||
URUTAU_EGRESS_LOG: ${URUTAU_EGRESS_LOG-/logs/host/egress.log}
|
||||
URUTAU_EGRESS_CONTAINERS: ${URUTAU_EGRESS_CONTAINERS-/logs/host/containers.map}
|
||||
URUTAU_RESOLV: ${URUTAU_RESOLV-/logs/resolv.conf}
|
||||
# Where the hub's ban decisions land; applied by the host fail2ban jail.
|
||||
# Empty ignores that kind of command.
|
||||
URUTAU_ENFORCE_LOG: ${URUTAU_ENFORCE_LOG-/logs/enforce/decisions.log}
|
||||
URUTAU_ENFORCE_UNBAN_LOG: ${URUTAU_ENFORCE_UNBAN_LOG-/logs/enforce/unban.log}
|
||||
# Disk spool while the hub is unreachable; the oldest batches go first
|
||||
# when it fills, and the loss is counted and shown on the hub.
|
||||
URUTAU_PROBE_SPOOL_MAX: ${URUTAU_PROBE_SPOOL_MAX:-64MiB}
|
||||
# Match the host: fail2ban.log timestamps are local time.
|
||||
TZ: ${TZ:-UTC}
|
||||
volumes:
|
||||
# Directories, not single files: logrotate recreates files by rename and a
|
||||
# file bind mount would keep following the old inode.
|
||||
- /data/coolify/proxy/logs:/logs/traefik:ro
|
||||
- /var/log/urutau:/logs/host:ro
|
||||
- /etc/resolv.conf:/logs/resolv.conf:ro
|
||||
# Decisions of the second firewall (read-write), only for ENFORCE=observe|on
|
||||
# on the hub; needs deploy/host/install.sh --probe --enforce.
|
||||
- /var/log/urutau-enforce:/logs/enforce
|
||||
- urutau-probe-state:/state
|
||||
group_add: ["4"] # adm: can read the logs in /var/log/urutau
|
||||
read_only: true
|
||||
cap_drop: [ALL]
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
mem_limit: 64m # the probe stays under 20 MB of RSS
|
||||
cpus: 0.25
|
||||
restart: unless-stopped
|
||||
# Only if the hub is the urutau service on the same host (internal address
|
||||
# http://urutau:8790): join its network (create it with the hub's compose).
|
||||
# networks: [urutau-edge]
|
||||
|
||||
volumes:
|
||||
urutau-probe-state:
|
||||
|
||||
# networks:
|
||||
# urutau-edge:
|
||||
# external: true
|
||||
Reference in new issue
Block a user