Files
urutau/docs/docker.md
T
Lucas RayanandClaude Opus 5.5 b7462c14fa
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 27s
CI / Dependency audit (push) Successful in 18s
CI / Tests (Linux, race detector) (push) Successful in 58s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Successful in 5s
feat: 1.2.0 attack intelligence, replay, 30-day history and new interface
Intelligence: attack families mapped to MITRE ATT&CK, network type from
ASN/rDNS without external APIs, request cadence, sessions with
recon/probe/exploit/access/banned stages, campaigns across IPs, verdict
with reasons, recommended actions, exposure detection (2xx with a body
on sensitive paths), STIX 2.1 export, FCrDNS for search engine bots,
optional Tor exit list.

Data: 30-day retention, twelve ranges plus custom from/to, an on-disk
event log (daily files, hourly gzip members, size cap, corruption and
disk-full tolerant), /events, /period, /metrics with stable per-hour
metrics, an extended /ip/{ip}, and peer /period merged on the hub.

Interface: layout system with fixed card sizes, range picker in the
URL, IP analysis page, Replay page, Geography down to state and city
(Natural Earth admin-1), Live page redesigned with stable metrics and a
reusable attack map. Demo data and documentation screenshots.

Security: bounded and deadline-limited period computations, linear
campaign clustering, singleflight caches, sanitized peer studies, event
query budgets, gzip bomb guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 21:45:59 -03:00

11 KiB

◂ Back to README

Docker

Urutau ships as one small container image (linux/amd64 and linux/arm64, about 28 MB, no curl), defined in docker-compose.yml. It only needs to read log files and to write one snapshot.

host                                          container urutau
/data/coolify/proxy/logs ── :ro ────────────► /logs/traefik     (access.log of Traefik)
/var/log/urutau          ── :ro ────────────► /logs/host        (auth.log, fail2ban.log)
volume urutau-data       ── read and write ─► /data             (snapshot, geo databases)

The compose file follows this layout. The Traefik log directory is mounted outside /data so it does not collide with the snapshot volume. Only the dedicated logs directory of the proxy is mounted, never the whole /data/coolify/proxy (which holds acme.json and the dynamic configuration).

The image runs as the unprivileged user urutau (uid 10001) on Alpine. Its HEALTHCHECK is the binary itself (urutau healthcheck, which asks the local daemon for /api/health), so there is no curl in the image. The compose file sets a memory limit (mem_limit); the soft Go limit is 256 MiB and the worst case measured is about 54 MiB of heap plus a snapshot of about 27 MB, so mem_limit: 384m is recommended. The data volume also holds the event registry (/data/events, capped by URUTAU_EVENTS_MAX, 512 MB by default). The compose file sets and cpus: 0.5, a read-only root filesystem, cap_drop: [ALL] and no-new-privileges, and passes from .env to the container: URUTAU_TOKEN, URUTAU_NAME, URUTAU_TRUSTED, URUTAU_PEERS, URUTAU_PEER_TOKEN, URUTAU_PEER_ALLOW, URUTAU_TRUSTED_PROXY, URUTAU_DOMAINS, URUTAU_MONITOR_FROM, URUTAU_ADMIN_USERS, URUTAU_GEO_UPDATE and TZ. To set any other URUTAU_* variable (URUTAU_MONITOR_UA, URUTAU_RETENTION, URUTAU_TOKEN_FILE, per-peer tokens, ...), add it to the environment block.

Quick start

cp .env.example .env
sed -i "s|^URUTAU_TOKEN=.*|URUTAU_TOKEN=$(openssl rand -base64 48 | tr -d '\n')|" .env
docker compose pull && docker compose up -d       # published image
# or, building locally:
docker compose up -d --build

The token needs 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 (openssl rand -hex 32 also qualifies). To keep the secret out of the environment, mount a file and set URUTAU_TOKEN_FILE (same for URUTAU_PEER_TOKEN_FILE).

The dashboard comes up at http://127.0.0.1:8790 by default (URUTAU_PUBLISH in .env changes the address and port). Check the sources:

docker compose exec urutau urutau doctor
docker compose logs urutau

Reading the logs

  • Traefik: the access log must be JSON and written to a dedicated directory. In Traefik's static configuration set --accesslog=true, --accesslog.format=json and --accesslog.filepath=/traefik/logs/access.log. On Coolify the host directory /data/coolify/proxy is /traefik inside the proxy container, so that file appears on the host as /data/coolify/proxy/logs/access.log, which is what the compose file mounts. In the Coolify UI open Servers, the server, Proxy, and add those three lines to the command list of the proxy configuration, then restart the proxy. In the same place add the headers Urutau uses to tell real visits from framed requests: --accesslog.fields.headers.names.Sec-Fetch-Site=keep, --accesslog.fields.headers.names.Sec-Fetch-Dest=keep and --accesslog.fields.headers.names.Referer=keep.
  • auth.log and fail2ban.log: the dedicated host directory /var/log/urutau is mounted read-only at /logs/host as a directory, because logrotate recreates these files by rename and a single-file mount would keep following the old inode. Prepare it as shown in Preparing the host logs. The files are owned by syslog:adm, so the container adds the host's adm group (GID 4) with group_add: ["4"], as the compose file does. Nothing else from the host /var/log is exposed.
  • Read-only: all log mounts are :ro. Urutau never writes to a log.
  • Rotation: the follower reopens the file when logrotate replaces or truncates it.

Preparing the host logs

Urutau reads a dedicated directory, /var/log/urutau, instead of the whole /var/log. Prepare it once on each server (the original /var/log/auth.log stays untouched):

sudo install -d -m 0750 -o syslog -g adm /var/log/urutau

# rsyslog: copy sshd lines into their own file
sudo tee /etc/rsyslog.d/40-urutau.conf >/dev/null <<'EOF'
if $programname == 'sshd' or $programname == 'sshd-session' then {
    action(type="omfile" file="/var/log/urutau/auth.log" template="RSYSLOG_FileFormat"
           fileOwner="syslog" fileGroup="adm" fileCreateMode="0640")
}
EOF
sudo systemctl restart rsyslog

# fail2ban: write its log there too
sudo tee /etc/fail2ban/fail2ban.d/urutau.local >/dev/null <<'EOF'
[Definition]
logtarget = /var/log/urutau/fail2ban.log
EOF
sudo systemctl restart fail2ban

# logrotate for both files
sudo tee /etc/logrotate.d/urutau >/dev/null <<'EOF'
/var/log/urutau/*.log {
    weekly
    rotate 4
    compress
    delaycompress
    missingok
    notifempty
    create 0640 syslog adm
    postrotate
        systemctl kill -s HUP rsyslog.service 2>/dev/null || true
        fail2ban-client flushlogs >/dev/null 2>&1 || true
    endscript
}
EOF

RSYSLOG_FileFormat writes ISO timestamps, which is the format Urutau parses. Check the adm GID with getent group adm. Known limitation: a local user of the host can forge sshd lines with logger -t sshd. Urutau limits the damage (a hostile level needs a strong signal and the admin immunity lasts 24 hours), but anyone with a shell on the host is already inside your trust boundary.

Example: Coolify

Create a Docker Compose resource on the Coolify server whose logs you want to watch, with this compose file:

services:
  urutau:
    image: git.lucasrguerra.dev.br/ciberfauna/urutau:latest
    restart: unless-stopped
    environment:
      URUTAU_TOKEN: ${URUTAU_TOKEN}
      URUTAU_NAME: server-1
      URUTAU_AUTH_LOG: /logs/host/auth.log
      URUTAU_FAIL2BAN_LOG: /logs/host/fail2ban.log
      URUTAU_TRUSTED_PROXY: 10.250.0.0/24
      TZ: UTC                   # the host's time zone (fail2ban.log has none)
    group_add: ["4"]            # adm: read auth.log and fail2ban.log
    read_only: true
    cap_drop: [ALL]
    security_opt: ["no-new-privileges:true"]
    volumes:
      - /data/coolify/proxy/logs:/logs/traefik:ro
      - /var/log/urutau:/logs/host:ro
      - urutau-data:/data
    networks: [urutau-edge]
    labels:
      - traefik.enable=true
      - traefik.docker.network=urutau-edge
      - traefik.http.routers.urutau.rule=Host(`urutau.example.com`)
      - traefik.http.routers.urutau.entrypoints=https
      - traefik.http.routers.urutau.tls=true
      - traefik.http.routers.urutau.tls.certresolver=letsencrypt
      - traefik.http.services.urutau.loadbalancer.server.port=8790

volumes:
  urutau-data:

networks:
  urutau-edge:
    external: true

Notes:

  • A network shared only with Traefik. --trusted-proxy defaults to loopback only, so by default X-Forwarded-For is ignored. The compose file creates the urutau-edge network (10.250.0.0/24) and sets URUTAU_TRUSTED_PROXY=10.250.0.0/24, so only the proxy on that network is believed (any other container there could forge client IPs, so keep it to the proxy). Connect the proxy once: docker network connect urutau-edge coolify-proxy. In a standalone compose like the example below, declare the network the same way and set the variable. The traefik.docker.network label tells Traefik to use it. Adapt the entrypoint and certificate resolver names to your proxy.
  • The image already points the sources at /logs/traefik/access.log, /logs/host/auth.log and /logs/host/fail2ban.log (its URUTAU_*_LOG defaults). The binary's own defaults (/data/coolify/proxy/access.log, /var/log/...) are for running it directly on the host.
  • Set URUTAU_TOKEN in the Coolify environment. Behind the proxy the dashboard is served over HTTPS, so the session cookie is Secure.
  • Do not publish port 8790 on the host when the proxy already routes it.
  • If the Traefik access log is missing or not JSON, the source stays at zero lines or malformed grows.
  • Urutau needs no tmpfs: the root filesystem is read-only and its only write target is the /data volume.

Geolocation database

The DB-IP Lite databases are downloaded into the data volume (/data/geo) on first start, so the container needs outbound HTTPS to download.db-ip.com once, and then once a month. If the host cannot reach the internet, copy the two .mmdb files into the volume and set URUTAU_GEO_UPDATE=0 (configuration.md). Data by DB-IP, CC BY 4.0.

Federation across servers

Run one Urutau per server with its own URUTAU_NAME. Every instance that is polled sets its own server token, URUTAU_PEER_TOKEN (or _FILE), and that is the only token its export accepts. The hub holds a client credential for each peer, equal to that peer's server token: one URUTAU_PEER_TOKEN_<NAME> per peer (the peer name uppercased, other characters turned into _, for example URUTAU_PEER_TOKEN_SERVER_2), with the hub's general URUTAU_PEER_TOKEN as fallback. A client credential does not open the hub's own export, and peer names that collapse to the same variable (my-peer and my_peer) are refused. Tokens need 32+ characters and about 128 bits of entropy, different from URUTAU_TOKEN (openssl rand -base64 48), and can come from ..._FILE. On the server that hosts the shared dashboard (the hub) add:

    environment:
      URUTAU_PEERS: server-2=https://urutau.server2.example.com,server-3=https://urutau.server3.example.com
      URUTAU_PEER_TOKEN_SERVER_2: ${TOKEN_FOR_SERVER_2}
      URUTAU_PEER_TOKEN_SERVER_3: ${TOKEN_FOR_SERVER_3}

The hub calls only GET /api/v1/peer/export on each peer (three ranges every 15 seconds) and keeps one GET /api/v1/peer/stream open for the live events, with that peer's token, which opens nothing else on the peer and is refused over plain http outside loopback. Set URUTAU_PEER_ALLOW on a peer to the hub's address to restrict who may call the export. Each peer keeps its own login token for its own dashboard.

Hardening

read_only: true, cap_drop: [ALL], no-new-privileges and read-only log mounts leave the container able to do one thing: read the logs and write its snapshot. Keep the image on a pinned tag (X.Y.Z) in production and latest only where you accept updates.

Health and shutdown

GET /api/health answers {"status":"ok"} without authentication. urutau healthcheck calls it locally and exits 0 when the daemon is healthy; the image uses it as its HEALTHCHECK. On SIGTERM the daemon stops accepting requests, saves the snapshot and exits.