Files
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

14 KiB

◂ Back to README

Terminal

urutau serve [flags]            run the hub: dashboard, API and probe ingestion (alias: urutau hub)
urutau probe [flags]            run a probe: read local logs and send them to the hub
urutau probes create|list|revoke  manage the probes registered on a hub
urutau import --from DIR --host NAME  bring a 1.x data directory into a hub
urutau doctor [--json] [flags]  check the sources and the data directory
urutau healthcheck [flags]       exit 0 when the local daemon answers /api/health
urutau version                  print the version
urutau help                     print the usage

The access token is never a flag: urutau serve and urutau probe read theirs (URUTAU_TOKEN and URUTAU_PROBE_TOKEN) from the environment variable, or from the file named by the same name with _FILE, so it does not show up in the process list. Tokens need at least 32 characters and about 128 bits of estimated entropy (length times Shannon entropy; periodic or sequential tokens are refused) (openssl rand -base64 48 is recommended (-hex 32 also works)). Every flag below has a URUTAU_* environment default; a flag wins over the variable. See configuration.md.

urutau serve

The hub reads no log file: the lines come from the probes (architecture.md). The 1.x log path flags (--traefik-log, --auth-log, --fail2ban-log, --probe-log, --egress-log, --egress-containers, --enforce-log, --enforce-unban-log) and the federation flags (--peer*) were removed; the hub refuses to start when their URUTAU_* variables are set, and the message points to migration-2.0.md.

Flag Variable Default Meaning
--bind URUTAU_BIND 0.0.0.0:8790 listen address
--name URUTAU_NAME hostname name of this instance, and of the primary probe: the one whose data lives in the data-dir root
--data-dir URUTAU_DATA_DIR /data state directory: snapshot urutau-state.gob, geo/, tor/, events/, incidents.json, enforce.json of the primary probe, probes/<name>/ of the others, probes.json
--trusted URUTAU_TRUSTED empty CIDRs of trusted origins; their events are dropped entirely. --ignore / URUTAU_IGNORE is an alias
--ignore URUTAU_IGNORE 127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,100.64.0.0/10,169.254.0.0/16 same effect as --trusted, with the private ranges as default
--monitor-ua URUTAU_MONITOR_UA (?i)^(Uptime-Kuma/|Beszel|Coolify|kube-probe/|Go-http-client/.*healthcheck) regular expression of monitoring User-Agents
--monitor-from URUTAU_MONITOR_FROM empty CIDRs the monitors come from; when set, the monitoring User-Agent only counts from them. Empty: only ok answers are filtered
--domains URUTAU_DOMAINS empty allowlist of analytics domains (exact or *.example.com); empty tracks every domain that answers 2xx; recommended when a backend answers 2xx for any Host
--geo-dir URUTAU_GEO_DIR <data-dir>/geo directory of the DB-IP Lite databases (city and ASN)
--geo-update URUTAU_GEO_UPDATE 24h how often to check for a newer database; 0 turns the download off
--admin-users URUTAU_ADMIN_USERS empty SSH users whose successful login keeps their IP out of the blocklist for 24 h; the immunity is off unless set
--location URUTAU_LOCATION empty default map position of the primary probe (each probe has its own, set on the hub), "lat,lon" or "lat,lon,Label"
--trusted-proxy URUTAU_TRUSTED_PROXY 127.0.0.0/8,::1 (the compose file sets 10.250.0.0/24) proxies whose X-Forwarded-For is trusted, read right to left (login rate limit, probe auth limiter)
--retention URUTAU_RETENTION 720h how long data is kept (1h to 720h, that is 30 days)
--events-max URUTAU_EVENTS_MAX 512MB size cap of the event registry in <data-dir>/events; 0 turns it off
--tor-auto URUTAU_TOR_AUTO on on downloads the official Tor exit and relay lists every 6 h into <data-dir>/tor; off does not
--tor-exits URUTAU_TOR_EXITS empty file with Tor exit addresses, one per line, reloaded every 24 h when it changes; empty disables
--enforce URUTAU_ENFORCE off second firewall: off, observe (decide in memory only) or on (also write decisions for the host fail2ban)
--enforce-share URUTAU_ENFORCE_SHARE off on also queues a decision taken for one probe on the others; each node applies its own exclusions
--enforce-threshold URUTAU_ENFORCE_THRESHOLD 5 attack events in 10 minutes that justify a ban (1 to 1000)
--enforce-max-per-min URUTAU_ENFORCE_MAX_PER_MIN 60 most decisions per minute, the excess is dropped and counted (1 to 10000)
--egress URUTAU_EGRESS auto egress analysis: auto (on for a probe that sends an egress log), on or off
--egress-workloads URUTAU_EGRESS_WORKLOADS empty default for the primary probe (per probe, edit them on the hub): "name=ITEM,ITEM:role;...", roles default, scanner, mail, resolver (configuration.md)
--egress-resolvers URUTAU_EGRESS_RESOLVERS empty allowed DNS resolvers, comma separated; empty: the usual public ones plus the resolv.conf the probe sends
--insecure-no-auth none off disable authentication; only on a loopback bind

URUTAU_EGRESS_ALLOW and URUTAU_EGRESS_PROVIDER_ASN exist only as environment variables (configuration.md). GOMEMLIMIT and TZ are the standard ones.

Validation at start (any failure exits with code 1 before listening): URUTAU_TOKEN needs at least 32 characters and about 128 bits of estimated entropy (periodic or sequential tokens are refused), unless --insecure-no-auth on a loopback bind; none of the removed 1.x variables may be set; --retention from 1h to 720h; --events-max a valid size; --location valid; --enforce-share on/off; --enforce off/observe/on; --enforce-threshold 1 to 1000 and --enforce-max-per-min 1 to 10000; --egress auto/on/off; --monitor-ua a valid regular expression; --ignore, --trusted, --trusted-proxy and --monitor-from valid CIDRs or IPs.

export URUTAU_TOKEN=$(openssl rand -base64 48)
urutau serve --bind 127.0.0.1:8790 --data-dir ./data

The daemon logs to stderr, saves a snapshot on SIGTERM or SIGINT and exits 0 on a clean stop.

urutau probe

The probe runs on each monitored server. It opens no port: it follows the log files, spools them to disk and pushes them to the hub over HTTPS, and applies the ban and unban commands the hub sends (architecture.md). Flags and variables, all with the same rules as serve:

Flag Variable Default Meaning
--hub URUTAU_HUB required hub URL; https://, or http:// only for loopback and private addresses
--name URUTAU_PROBE_NAME required name registered on the hub
none URUTAU_PROBE_TOKEN or URUTAU_PROBE_TOKEN_FILE required token printed once by urutau probes create (urp_...); never a flag
--state-dir URUTAU_STATE_DIR /state spool, positions and liveness mark
--traefik-log URUTAU_TRAEFIK_LOG /logs/traefik/access.log Traefik access log; empty disables
--auth-log URUTAU_AUTH_LOG /logs/host/auth.log sshd log; empty disables
--fail2ban-log URUTAU_FAIL2BAN_LOG /logs/host/fail2ban.log fail2ban log; empty disables
--probe-log URUTAU_PROBE_LOG /logs/host/probe.log kernel log of connections to unserved ports
--egress-log URUTAU_EGRESS_LOG /logs/host/egress.log kernel log of new outbound connections
--ingress-log URUTAU_INGRESS_LOG /logs/host/ingress.log sampled kernel log of new inbound attempts (host kit --ingress)
--ingresscnt-log URUTAU_INGRESS_COUNTERS /logs/host/ingress.counters exact inbound counters, one line a minute
--egress-containers URUTAU_EGRESS_CONTAINERS /logs/host/containers.map "<ip> <container>" map, sent whole when it changes
--resolv URUTAU_RESOLV /etc/resolv.conf (the host's, mounted) resolver list, sent whole when it changes
--enforce-log URUTAU_ENFORCE_LOG /logs/enforce/decisions.log where ban decisions are appended; empty ignores ban commands
--enforce-unban-log URUTAU_ENFORCE_UNBAN_LOG /logs/enforce/unban.log where unban requests are appended; empty ignores them
--spool-max URUTAU_PROBE_SPOOL_MAX 64MiB spool cap; the oldest batches are dropped and counted
--location URUTAU_LOCATION empty "lat,lon,Label"; the hub's setting prevails

urutau probe --check reads the liveness mark in the state directory and exits 0 when the probe is alive; it is the HEALTHCHECK of the probe image, which has no shell. A missing hub, name or token stops the probe at start with a clear message.

urutau probes

Manages the registry (<data-dir>/probes.json) of a hub. Without --url it works directly on the data directory (stop the hub first or expect the hub to reload on the next change); with --url and the user token it uses the API.

urutau probes create oracle        # prints the token ONCE; the hub stores only its SHA-256
urutau probes list                 # name, state, last line, lag, version, dropped
urutau probes revoke hostinger     # the probe is refused from now on; its data is kept

Names are 1 to 32 characters: lowercase letters, digits and -, starting with a letter or digit (the name is also the data subdirectory). The page Sources of the dashboard does the same and also edits the location and the egress settings of each probe.

urutau import

Brings the data directory of a 1.x instance into a hub as one probe, losing nothing (migration-2.0.md).

urutau import --from /backup/hostinger/data --host hostinger --dry-run   # what would be copied
urutau import --from /backup/hostinger/data --host hostinger             # with the hub stopped
urutau import --verify --from /backup/hostinger/data --host hostinger    # compare hashes and counts
urutau import --count /data                                              # print events, IPs, incidents, bans

It copies the whole directory through a temporary directory and an atomic rename, checks every SHA-256 and the counts, and is idempotent (a second run reports skipped). A different destination fails unless --force, which moves it to .bak-<timestamp> and never deletes. It refuses to run while the hub holds the data-dir lock.

Noise and monitoring

urutau serve --trusted "10.0.0.0/8,203.0.113.7" \
  --monitor-ua '(?i)uptime-kuma|statuscake'

--trusted drops every event from those origins. --monitor-ua matches the User-Agent of benign requests (ok or notfound) and counts them apart as "monitoring"; a request that is a scanner, exploit or bruteforce still counts as an attack.

Second firewall and egress

urutau serve --enforce observe                    # decide in memory, write nothing
urutau serve --enforce on          # decisions travel to the probes; each appends them to its decisions.log
urutau serve --egress on --egress-workloads "mail=10.0.7.0/24:mail"   # primary probe; others: Sources page

The host side (nftables logging, the urutau fail2ban jail) comes from deploy/host/install.sh --probe, see docker.md.

Geolocation

urutau serve --geo-dir /data/geo --geo-update 24h

Urutau downloads the DB-IP Lite city and ASN databases into --geo-dir when they are missing or older than 35 days, then checks every --geo-update for the current month's file. The file is verified before it replaces the old one, and a failed download never stops the service. Data by DB-IP, CC BY 4.0.

urutau doctor

Checks the configuration (token, bind and every validation above), that the data directory is writable, the registered probes and their state, the second firewall, the geolocation databases and the snapshot. The hub has no log source to check: what a probe reads is reported by the probe itself on the Sources page. Checks are named config, data-dir, probes, enforce (and enforce-cdn), geo and state. Statuses are ok, warn (a probe offline), fail and off (disabled). The exit code is 1 when any check is fail (for example --enforce=on with a decision file that is not writable), which makes it usable in a deploy script. It accepts the same flags as serve.

urutau doctor
docker exec urutau urutau doctor --json

--json prints {"version", "name", "ok", "checks": [{"name", "status", "detail"}], "geo", "state"}. geo reports the directory, update interval, attribution and the build dates of the loaded databases; state reports the snapshot (path, size, IPs, domains and requests in 7 days) or that none exists yet. A snapshot that cannot be read shows up as warn.

urutau healthcheck

Calls /api/health on the local bind address (0.0.0.0 and :: become 127.0.0.1; 3 second timeout, redirects are not followed) and exits 0 when it answers {"status":"ok"}, 1 otherwise. It is the container HEALTHCHECK, which is why the image has no curl. It accepts the same flags as serve (for a non-default --bind).

urutau version

Prints urutau <version>. --version and -v work too. urutau help (--help, -h) prints the usage; an unknown command prints it to stderr and exits 2.