Files
urutau/docs/docker.md
T
Lucas RayanandClaude Opus 5.5 6941106172
Release / Plan (reuse the published image?) (push) Successful in 6s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 17s
Release / Gitea release (push) Skipped
docs: bring README, docs, screenshots and changelog up to 1.6.0
Rewritten README and interface/configuration/CLI/Docker/support/architecture
docs (EN and pt-BR) from the 1.6.0 code; all 80 screenshots regenerated,
incidents pages added; changelog audited against the tags (1.4.0 date,
1.4.6/1.4.7 items, 1.5.0 details, 1.5.8 shipped inside 1.6.0, compare
links); compose and .env.example expose the enforce, egress, probe and
Tor settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:41:50 -03:00

16 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 reads log files and writes one data volume (and, only if you turn on the second firewall, one decision file).

host                                          container urutau
/data/coolify/proxy/logs ── :ro ────────────► /logs/traefik     (access.log of Traefik)
/var/log/urutau          ── :ro ────────────► /logs/host        (auth.log, fail2ban.log, probe.log,
                                                                 egress.log, containers.map, resolv.conf)
/var/log/urutau-enforce  ── read and write ─► /logs/enforce     (decisions.log, unban.log; only with URUTAU_ENFORCE=on)
volume urutau-data       ── read and write ─► /data             (snapshot, geo, tor, events, incidents)

The compose file follows this layout, except the /logs/enforce mount, which you add when you enable the second firewall (see below). 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, built from a static Go binary. Its HEALTHCHECK is the binary itself (urutau healthcheck, every 30 s, which asks the local daemon for /api/health), so there is no curl in the image. The image sets URUTAU_BIND=0.0.0.0:8790, URUTAU_DATA_DIR=/data and the three log paths (/logs/traefik/access.log, /logs/host/auth.log, /logs/host/fail2ban.log); VOLUME /data, EXPOSE 8790, ENTRYPOINT ["urutau"], CMD ["serve"]. The compose file sets mem_limit: 384m (the Go soft limit is 256 MiB; the worst case measured is about 54 MiB of heap plus a snapshot of about 27 MB), cpus: 0.5, a read-only root filesystem, cap_drop: [ALL], no-new-privileges, group_add: ["4"] (the host adm group) and the urutau-edge network. The data volume also holds the event registry (/data/events, capped by URUTAU_EVENTS_MAX, 512 MB by default). It 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, URUTAU_ENFORCE*, URUTAU_EGRESS*, URUTAU_TOR_*, 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/auth.log /var/log/urutau/fail2ban.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

If you also install the host kit, the logrotate rule above names only auth.log and fail2ban.log on purpose: with the host kit, the kit rotates egress.log and probe.log itself and logrotate refuses duplicate entries.

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 probe, egress and container map defaults (/logs/host/...) are the binary's own. The binary's other 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 write targets are the /data volume and, in enforce mode, /logs/enforce.

Host kit

deploy/host/ holds an optional kit that needs root on the host and gives Urutau three more sources. Urutau itself never gets privileges: it only reads the logs the kit writes and, in enforce mode, writes a decision file.

sudo sh deploy/host/install.sh             # probe and egress logging + container map
sudo sh deploy/host/install.sh --enforce   # also the fail2ban jail of the second firewall
sudo sh deploy/host/install.sh --remove    # undo everything (logs are kept)

It is idempotent. URUTAU_WAN overrides the detected uplink interface and URUTAU_UID (default 10001) the uid that owns the enforce directory. It needs nft, rsyslog and Docker (and fail2ban and python3 for --enforce).

Part What it installs
egress logging nftables table inet urutau_egress (/etc/urutau/egress.nft, only logs, never drops, separate from the Docker and fail2ban tables) and the urutau-egress.service unit; rsyslog rule 41-urutau-egress.conf sends the kernel lines to /var/log/urutau/egress.log (URUTAU-EGRESS:) and /var/log/urutau/probe.log (URUTAU-PROBE:); logrotate daily, 7 copies, at most 200 MB (urutau-logrotate.timer)
probes the URUTAU-PROBE: rule logs new inbound connections on the uplink to ports no socket listens on (at most 10 per second per source); the set of open ports is refreshed every minute from ss, including ports Docker publishes
container map urutau-containers-map and its timer (every minute) write /var/log/urutau/containers.map (<ip> <container>) and /var/log/urutau/resolv.conf (the real upstream resolvers)
second firewall (--enforce) directory /var/log/urutau-enforce (owned by URUTAU_UID, group adm) with decisions.log and unban.log; fail2ban filter urutau, action urutau-allports and jail urutau (polling backend, maxretry = 1, bantime = 1h, actions on INPUT and DOCKER-USER, host ignoreip kept); urutau-unban.path and urutau-unban apply the Unban button

The urutau-allports action behaves like iptables-allports but only drops connections the banned address starts (conntrack original direction), so replies to connections the host opened keep flowing. The egress and probe files land in /var/log/urutau, which the compose file already mounts at /logs/host, so Urutau finds them at its defaults (URUTAU_EGRESS=auto turns on by itself once the file exists). For the second firewall add the mount and the variables to the compose file, start with observe and move to on when the decisions look right:

    environment:
      URUTAU_ENFORCE: observe            # off | observe | on
      # URUTAU_ENFORCE_SHARE: "on"       # exchange decisions with the peers
      # URUTAU_EGRESS_WORKLOADS: "mail=10.0.7.0/24:mail"
    volumes:
      - /var/log/urutau-enforce:/logs/enforce   # read and write, only for enforce=on

/logs/enforce must be writable by uid 10001 (the kit does it) and cannot be :ro. Check with docker compose exec urutau urutau doctor: the enforce line shows mode, file and whether it is writable. See configuration.md for the policy and the variables.

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. The Tor lists (URUTAU_TOR_AUTO=on) also need check.torproject.org and onionoo.torproject.org every 6 hours; with URUTAU_TOR_AUTO=off that is not needed. 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 GET /api/v1/peer/export on each peer (four ranges every 15 seconds), keeps one GET /api/v1/peer/stream open for the live events and fetches periods and egress on demand; with URUTAU_ENFORCE_SHARE=on both sides also exchange decisions and unbans every 30 seconds. All of it uses 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 data volume (plus the decision file, only when you enable URUTAU_ENFORCE=on). 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 or SIGINT the daemon stops accepting requests (5 second grace), saves the snapshot and exits 0.