Files
urutau/deploy/probe/docker-compose.yml
Lucas RayanandClaude Sonnet 5.5 aefdcea8d2 feat(ingress): firewall telemetry of inbound attempts (host kit --ingress)
Observation-only nftables table (prerouting -150, counters and a
rate-limited log, never drops or modifies), a per-minute counters file,
probe sources ingress and ingresscnt, a per-host hourly aggregate in the
hub (exact totals, sampled ports/ASNs/countries, banned share by the
hub's own ban state, no ban feedback loop), GET /api/v1/ingress, a
Defense section, doctor check, docs EN/pt-BR and tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 09:09:16 -03:00

74 lines
3.6 KiB
YAML

# 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}
# Firewall telemetry (host kit --ingress): sampled attempts and exact counters.
URUTAU_INGRESS_LOG: ${URUTAU_INGRESS_LOG-/logs/host/ingress.log}
URUTAU_INGRESS_COUNTERS: ${URUTAU_INGRESS_COUNTERS-/logs/host/ingress.counters}
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