Files
urutau/docs/configuration.md
2026-11-23 09:09:54 -03:00

23 KiB

◂ Back to README

Configuration

Urutau has no configuration file. Everything is a flag with a URUTAU_* environment default (cli.md), which suits a container. The secrets are environment variables only.

Secrets

Variable Meaning
URUTAU_TOKEN Required. Access token of the dashboard and the API: at least 32 characters and about 128 bits of estimated entropy (length times Shannon entropy; periodic or sequential tokens are refused). Generate one with openssl rand -base64 48 (openssl rand -hex 32 also works; -hex 16 is refused by the entropy estimate).
URUTAU_TOKEN_FILE Path of a file holding the token (whitespace trimmed), instead of the variable. The variable wins when both are set.
URUTAU_PROBE_TOKEN Probe only, required. The token of one probe (urp_ plus 43 base64url characters), printed once by urutau probes create or by the Sources page. The hub keeps only its SHA-256 (probes.json), so a lost token is replaced, never recovered: revoke the probe and create it again.
URUTAU_PROBE_TOKEN_FILE Probe only. Path of a file holding the probe token, instead of the variable. The variable wins when both are set.

The 1.x federation secrets (URUTAU_PEER_TOKEN, URUTAU_PEER_TOKEN_FILE, URUTAU_PEER_TOKEN_<NAME>) do not exist any more; the hub refuses to start when one is set (migration-2.0.md).

Keep them in .env (never versioned) or in your orchestrator's secret store.

Settings

Settings are split by role. The hub (urutau serve) takes the variables in the sections up to Egress; the probe (urutau probe) takes the ones in Probe. Every variable below has a flag of the same meaning (cli.md); the flag wins over the variable.

Core

Variable Default Meaning
URUTAU_BIND 0.0.0.0:8790 listen address
URUTAU_NAME container hostname name of this instance and of the primary probe: the probe whose name equals it keeps its data in the data-dir root (exactly the 1.x layout); every other probe uses <data-dir>/probes/<name>/
URUTAU_DATA_DIR /data where the state lives: snapshot urutau-state.gob, geo/, tor/, events/, incidents.json and enforce.json of the primary probe, probes/<name>/ for the others, and probes.json
URUTAU_RETENTION 720h retention as a Go duration, from 1h to 720h (30 days); other values refuse to start
URUTAU_EVENTS_MAX 512MB size cap of the event registry (<data-dir>/events); a number with an optional unit (k, kb, kib, m, mb, mib, g, gb, gib, b), 0 turns it off
URUTAU_LOCATION empty default map position of the primary probe (the others get theirs on the hub, per probe), "lat,lon" or "lat,lon,Label" (validated at start). It is the destination of the arcs on the Live page; empty lets the page fall back to an estimated destination
GOMEMLIMIT 256 MiB soft limit standard Go memory limit; set it to override the default
TZ UTC time zone of fail2ban.log timestamps, which carry no zone

Noise, trust and monitoring

Variable Default Meaning
URUTAU_TRUSTED empty trusted CIDRs or IPs, comma separated; their web requests are counted as own traffic (class trusted) and never analysed: no score, threat, visitor or ban. Also feeds the exclusions of the second firewall and the egress allow list
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 (class internal), kept as the alias that carries the private ranges as default
URUTAU_MONITOR_UA (?i)^(Uptime-Kuma/|Beszel|Coolify|kube-probe/|Go-http-client/.*healthcheck) regular expression of monitoring User-Agents; empty disables; an invalid expression refuses to start
URUTAU_MONITOR_FROM empty CIDRs the monitors really come from; when set, the monitoring User-Agent only counts from them
URUTAU_ADMIN_USERS empty SSH users whose successful login keeps their IP out of the blocklist for 24 h after the last login (a later strong signal cancels it); the immunity is off unless this is set
URUTAU_DOMAINS empty allowlist of analytics domains, exact names or *.example.com; empty tracks every domain that answers 2xx; recommended, in practice required, when any backend answers 2xx for every Host (catch-all or wildcard), otherwise random Hosts can fill the 24 domain slots

Geolocation and Tor

Variable Default Meaning
URUTAU_GEO_DIR <data-dir>/geo where the DB-IP Lite databases live
URUTAU_GEO_UPDATE 24h interval between checks for a newer database; 0 disables the download
URUTAU_TOR_AUTO on on: download the official Tor exit and relay lists every 6 hours into <data-dir>/tor; off: do not download (air-gapped hosts)
URUTAU_TOR_EXITS empty file of Tor exit addresses, one per line (# comments allowed, at most 100000 addresses, 8 MiB), reloaded every 24 h when it changes; merged with the downloaded list

Reverse proxy

Variable Default Meaning
URUTAU_TRUSTED_PROXY 127.0.0.0/8,::1 (the compose file sets 10.250.0.0/24) reverse proxies whose X-Forwarded-For is trusted (read right to left); used by the login rate limit and by the probe authentication limiter

Second firewall (enforce)

Variable Default Meaning
URUTAU_ENFORCE off off; observe (decides in memory and shows what it would ban, sends nothing); on (also queues the decisions for the probe of the host, which appends them to its URUTAU_ENFORCE_LOG for the host fail2ban). Anything else refuses to start
URUTAU_ENFORCE_SHARE off on: a decision taken for one probe is also queued for the others; each node applies its own exclusions. Anything else refuses to start
URUTAU_ENFORCE_THRESHOLD 5 attack events in 10 minutes that justify a ban (1 to 1000)
URUTAU_ENFORCE_MAX_PER_MIN 60 most decisions written per minute; the excess is dropped and counted (1 to 10000)

An unparseable number falls back to the default; an out-of-range one refuses to start.

Egress

Variable Default Meaning
URUTAU_EGRESS auto auto (on for a probe that sends an egress log), on or off; anything else refuses to start
URUTAU_EGRESS_WORKLOADS empty default for the primary probe; every probe can have its own on the Sources page. Named workloads and their role, see Egress analysis
URUTAU_EGRESS_RESOLVERS empty DNS resolvers that are allowed, comma separated IPs; empty means the usual public ones (Cloudflare, Google, Quad9...) plus the nameservers of the resolv.conf each probe sends
URUTAU_EGRESS_ALLOW empty environment only, no flag: CIDRs or IPs of legitimate periodic pollers that must not raise beaconing findings. The probes' addresses, URUTAU_TRUSTED and the server's own public addresses are always allowed
URUTAU_EGRESS_PROVIDER_ASN empty environment only, no flag: AS numbers of your hosting provider, comma separated, so traffic to it is not reported as unusual

Probe

The probe has only these variables (flags in cli.md). A path turns a source on, empty turns it off, and a file that does not exist yet just stays at waiting.

Variable Default Meaning
URUTAU_HUB required hub URL: https://..., or http:// only for loopback and private addresses (for example http://urutau:8790 on the urutau-edge network)
URUTAU_PROBE_NAME required name registered on the hub (lowercase letters, digits and -, up to 32)
URUTAU_PROBE_TOKEN, URUTAU_PROBE_TOKEN_FILE required see Secrets
URUTAU_STATE_DIR /state spool, read positions and liveness mark; keep it on a volume
URUTAU_TRAEFIK_LOG /logs/traefik/access.log Traefik JSON access log
URUTAU_AUTH_LOG /logs/host/auth.log sshd log
URUTAU_FAIL2BAN_LOG /logs/host/fail2ban.log fail2ban log
URUTAU_PROBE_LOG /logs/host/probe.log kernel log of connections to unserved ports, written by the host kit (see Probes)
URUTAU_INGRESS_LOG, URUTAU_INGRESS_COUNTERS /logs/host/ingress.log, /logs/host/ingress.counters on the probe: sampled inbound attempts and the exact once-a-minute counters, written by install.sh --ingress (see Firewall telemetry)
URUTAU_EGRESS_LOG /logs/host/egress.log kernel log of new outbound connections, written by the host kit
URUTAU_EGRESS_CONTAINERS /logs/host/containers.map "<ip> <container>" map written by the host kit when a container starts (and every minute), so workloads keep their name when the address changes on a redeploy; sent whole when it changes
URUTAU_RESOLV /etc/resolv.conf of the host (mounted) resolvers of the host, sent whole when it changes
URUTAU_ENFORCE_LOG /logs/enforce/decisions.log file where the ban decisions of the hub are appended, read by the host jail; empty ignores ban commands and counts them as errors
URUTAU_ENFORCE_UNBAN_LOG /logs/enforce/unban.log file where unban requests are appended, read by the host; empty ignores them
URUTAU_PROBE_SPOOL_MAX 64MiB spool cap while the hub is unreachable; the oldest batches are dropped, counted, and shown on the Sources page
URUTAU_LOCATION empty "lat,lon,Label"; the setting on the hub prevails
TZ UTC time zone of the host: fail2ban.log timestamps carry no zone and the hub parses them, so it must be the same on the probe and on the hub

The probe image defaults to the paths above because the compose file in deploy/probe mounts the host logs there.

Noise and monitoring

  • Traefik headers. Log Sec-Fetch-Site, Sec-Fetch-Dest and Referer so Urutau can tell a page framing your site from a real visit: --accesslog.fields.headers.names.Sec-Fetch-Site=keep, --accesslog.fields.headers.names.Sec-Fetch-Dest=keep and --accesslog.fields.headers.names.Referer=keep. A request framed by another page (Sec-Fetch-Site of cross-site or same-site, or a sub-resource Sec-Fetch-Dest such as image or script) appears in the timeline and creates an IP record like any other, but weighs 0.25 per event, with at most 30 points per IP coming from such requests (below the hostile threshold), and never counts as a strong signal. With an attack-tool User-Agent the headers are ignored.
  • Trusted origins (URUTAU_TRUSTED): your own network, offices, monitors and other servers. URUTAU_IGNORE already covers loopback and the private ranges by default, so internal traffic never scores. Nothing is silently dropped: web requests from these origins are counted in aggregates only (not as one event record each) and shown in the Traffic page under "Own infrastructure and trusted origins"; they stay out of totals.requests, scores, threats, maps, visitors and the blocklist. SSH, fail2ban and network-probe lines from these origins are still ignored. Add your public monitor IPs. If your proxy reports the Docker gateway as the client, that address is private and counted as internal own traffic; fix the proxy to pass the real client address instead.
  • Monitoring User-Agent (URUTAU_MONITOR_UA): a Go regular expression. A request that matches and is benign is counted as "monitoring" instead of traffic. If the request is a scanner, exploit or bruteforce it counts as an attack: a User-Agent is trivial to forge, so it never grants immunity.
  • Where monitors come from (URUTAU_MONITOR_FROM): CIDRs of your monitors. When set, the monitoring User-Agent is honored only from those networks and benign requests (ok or notfound) are filtered. When empty, only ok answers are filtered: a notfound carrying a monitor User-Agent still counts, because anyone can send that header.

Geolocation and analytics

Country, city and ASN come from the DB-IP Lite databases (city and ASN), which Urutau downloads and refreshes by itself into URUTAU_GEO_DIR. Without them (for example on an air-gapped host) the dashboard works and the geographic fields stay empty; to run offline, place the dbip-city-lite-YYYY-MM.mmdb and dbip-asn-lite-YYYY-MM.mmdb files in that directory and set URUTAU_GEO_UPDATE=0. The databases are licensed CC BY 4.0: keep the attribution (the dashboard footer and the README already carry it).

The geolocation databases are checked every 24 hours (--geo-update), but DB-IP publishes a new one only once a month, so most checks find nothing new; the file is replaced after it is verified.

The Traffic page needs no setting. URUTAU_DOMAINS restricts which domains it tracks (exact names or *.example.com); a domain only gets a slot after a 2xx answer and inactive domains are pruned, so forged Host headers cannot fill the analytics. Top pages normalize token-looking path segments (ids, hashes, long random strings) to :id. It uses the Traefik log, counts unique visitors by a daily-salted hash and never persists the IP address of a legitimate visitor. See SECURITY.md.

Probes (hub mode)

A hub with nothing else to configure accepts no probe until you create one:

urutau probes create web1     # prints the token once

On the server of that probe, set URUTAU_HUB, URUTAU_PROBE_NAME=web1 and URUTAU_PROBE_TOKEN and start deploy/probe/docker-compose.yml (docker.md). The hub stores only the SHA-256 of the token; a wrong token gets a bare 401 under an attempt limiter. Revoking a probe (urutau probes revoke web1 or the Sources page) refuses it from then on and keeps its data. The location on the map and the egress settings (workloads, resolvers, allowed destinations) of each probe are edited on the Sources page and kept in probes.json; URUTAU_LOCATION, URUTAU_EGRESS_WORKLOADS, URUTAU_EGRESS_RESOLVERS and URUTAU_EGRESS_ALLOW are the defaults of the primary probe.

If the 1.x variables URUTAU_PEERS, URUTAU_PEER_TOKEN*, URUTAU_PEER_ALLOW or URUTAU_PEER_BLOCKLIST are set, or the log path variables on the hub, it stops at start: see migration-2.0.md.

Snapshot and retention

The snapshot file urutau-state.gob holds the aggregated state and the log offsets; it is saved every 60 seconds and on SIGTERM. Mount URUTAU_DATA_DIR on a volume to keep it across restarts. Delete the file to start from zero (the rotated logs will be read again); a snapshot that cannot be read is set aside at start. Retention (URUTAU_RETENTION, at most 720 hours) limits how long an IP is kept; the dashboard ranges are 1h, 24h, 7d and 30d.

Event registry

<data-dir>/events/ keeps one line per attacker event, one file per UTC day, older days gzip compressed, deleted after URUTAU_RETENTION, and capped in total by URUTAU_EVENTS_MAX (a number with an optional unit, 0 turns the registry off). It never holds a legitimate visitor. It lives in the same volume as the snapshot, so plan for the cap on top of the snapshot (about 27 MB in the worst case measured). A full disk or the cap drops events and never stops the service. See architecture.md.

Incidents

Tickets opened from egress findings (and their status: open, false positive, benign...) are stored in <data-dir>/incidents.json, in the same volume. A ticket marked false positive or benign can suppress the same finding later. A corrupt file is moved aside and the store starts empty; nothing else needs setting.

Probes (port scans)

Connections to ports nobody serves are not visible in the application logs. The host kit (docker.md) logs them from the kernel to /var/log/urutau/probe.log; the probe sends that file (URUTAU_PROBE_LOG) and the hub turns each line into a scanner event and keeps at most one event per address, port and protocol per minute. Without the kit the source stays at waiting and nothing else changes.

Firewall telemetry (inbound attempts)

The application logs only show what reaches Traefik, sshd and fail2ban. Two things never appear there: connection attempts to ports where nothing listens, and packets from addresses that are already banned (the firewall drops them without a log line). The host kit with --ingress (docker.md) observes both, and the probe sends two sources: ingress.counters (exact, one cumulative line a minute) and ingress.log (a rate-limited sample of the attempts). Nothing else needs setting; without the kit the sources stay at waiting.

  • Exact totals (attempts per hour, by protocol, closed versus served ports) are the difference between two counter lines. A counter that goes down means the table was reloaded and counts from zero. A malformed, absurd or out-of-window line is dropped and counted as malformed.
  • Details (top destination ports, top origin ASNs and countries, the banned share) come from the sample, and the panel says so. The exposure ratio is logged / total, shown as "Sampled".
  • Banned sources. The firewall sees a packet before fail2ban drops it, so the hub classifies each sampled line by its own ban state: an address is "banned" when a jail (fail2ban or the urutau jail) holds it in the hub's records at that moment, from the Ban, Unban and Restore Ban lines it has read. This is robust because it needs nothing from the host beyond the sampled line, and its limit is that a ban the hub never read is not counted. The share is of the sample; the estimate for the total applies it to the exact count and is labelled as an estimate.
  • No feedback loop. These attempts are telemetry only: they never become events, never raise a score and never feed the second firewall, port-scan included (the closed-port evidence of the second firewall stays with the probe.log source above, one event per address, port and protocol per minute). Attempts from an address that is already banned are therefore never new evidence against it, as with recidive and the urutau jail.
  • Scope. Retention is the 30 days of the other aggregates, in hourly buckets with capped top lists (48 ports, 48 networks, 64 countries per hour), kept in <data-dir>/probes/<name>/ingress.json (the primary probe in the root of the data directory). It is a few MB per host at most, well inside the hub memory limit. A cloud provider firewall (an Oracle Cloud security list, for example) blocks some ports before the host, so the metric is what reaches the host.
  • urutau doctor reports, per host, whether the source is present and fresh (last counters line under 5 minutes old).

Tor

Urutau marks addresses that are Tor exits or relays. By default (URUTAU_TOR_AUTO=on) it downloads the official exit list and relay list every 6 hours into <data-dir>/tor (exits.txt, relays.json; an invalid download keeps the previous cache); the container then needs outbound HTTPS to check.torproject.org and onionoo.torproject.org. On an air-gapped host set URUTAU_TOR_AUTO=off and maintain your own URUTAU_TOR_EXITS file.

Second firewall (enforce)

Optional and off by default. Neither Urutau process gets privileges: the hub decides which addresses deserve a ban and queues one line per decision for the probe of that host, the probe checks that the line has exactly the expected shape and appends it to a file, and a fail2ban jail on the host applies it.

  • URUTAU_ENFORCE=observe decides in memory and shows in the dashboard what it would ban; nothing is written. Use it first.
  • URUTAU_ENFORCE=on appends <time> urutau decision=ban ip=<ip> reason=<slug> score=<n> ttl=<s> host=<name> src=<local|peer:NAME> to the URUTAU_ENFORCE_LOG of the probe. The host side is the urutau jail and the urutau-allports action installed by install.sh --probe --enforce (docker.md). The jail uses the host's own ignoreip, so trusted addresses stay protected there too. Decisions wait until the log backfill finishes at start.

A ban needs one of these inside the window: two critical events (RCE, traversal, .env/credentials, VCS, webshell, SQL injection, Log4Shell), URUTAU_ENFORCE_THRESHOLD attack events in 10 minutes (doubled for a visitor with a legitimate visit), 5 SSH failures in 10 minutes, 10 distinct ports probed in 10 minutes, a known attacker, 10 SSH failures or 20 web events in 24 hours, 10 SSH failures or 10 web events without a legitimate visit in 7 days (an ssh-probe counts half), or one event from an address of a /24 (IPv4) or /64 (IPv6) where 3 or more addresses were banned in the last 24 hours (neighbor-campaign). The advisory TTL grows with repeat offences: 1 h, 6 h, 24 h, 7 d. Never banned: trusted and private addresses (URUTAU_TRUSTED, URUTAU_IGNORE), verified crawlers (forward-confirmed reverse DNS), addresses with an operator allow, infrastructure and peers' own hosts, Cloudflare addresses, and decisions from a peer the local instance cannot confirm. Bans of the urutau jail and of recidive do not count as evidence of the address's own behaviour. Reasons are a fixed list: scanner-flood, exploit-flood, web-bruteforce, wp-bruteforce, ssh-bruteforce, rce, path-traversal, env-probe, vcs-probe, webshell, sqli, log4shell, port-scan, known-attacker, neighbor-campaign.

The dashboard's Unban button (POST /api/v1/enforce/unban) drops the active ban, queues <time> urutau unban ip=<ip> allow=<seconds> for the probe (you choose the host, or all), which appends it to the unban file, and with URUTAU_ENFORCE_SHARE=on tells the other nodes. On the host urutau-unban.path runs urutau-unban, which unbans the address in every jail and, with allow above 0, ignores it for that many seconds (useful for authorized pentests). urutau doctor reports the mode, the file and whether it is writable (fail in on mode when it is not), and warns when Traefik logs Cloudflare addresses as clients (set forwardedHeaders.trustedIPs to the Cloudflare ranges so the real client is seen).

Egress analysis

Analyses what leaves the server: new outbound connections of the host and of the containers, logged by the host kit to /var/log/urutau/egress.log and sent by the probe. It finds beaconing, mining pools, spam, unauthorized scans, DNS that bypasses the allowed resolvers, and destinations known as hostile or Tor exits. With URUTAU_EGRESS=auto it turns on by itself for a probe that sends the log. Findings can become tickets (see Incidents).

URUTAU_EGRESS_WORKLOADS names the origins and gives each one a role, so expected behaviour is not reported (a scanner scans, a mail server talks on port 25):

URUTAU_EGRESS_WORKLOADS="scanner=name:scan-worker*:scanner;mail=10.0.7.0/24:mail;host-out=host"

Format: name=ITEM,ITEM:role;name2=.... An ITEM is a CIDR or an IP, host (the host's own output), name:<container> (exact container name, ignoring a trailing -<digits> suffix) or name:<prefix>* (every container whose name starts with the prefix). The role after the last colon is default, scanner, mail or resolver (default when omitted). A bad definition refuses to start.

Authentication and exposure

The default bind is 0.0.0.0 because the container is behind a proxy. Outside a container, bind to 127.0.0.1 or put a TLS reverse proxy in front. --insecure-no-auth exists only for local tests and is refused on non-loopback binds.