Also corrects cli.md, which said MFA is required for everyone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
133 lines
6.1 KiB
Markdown
133 lines
6.1 KiB
Markdown
# Docker
|
|
|
|
**English** · [Português](pt-BR/docker.md)
|
|
|
|
Acauã is distributed as an official container image:
|
|
`git.lucasrguerra.dev.br/ciberfauna/acaua`.
|
|
|
|
Available image tags:
|
|
- `latest`: Most recent stable release.
|
|
- `X.Y.Z` / `X.Y`: Pinned semantic versions.
|
|
- `edge`: Built automatically from the `main` branch.
|
|
|
|
The container runs as an unprivileged system user (`acaua`, UID 10001), with a
|
|
read-only root filesystem (`read_only: true`), all capabilities dropped
|
|
(`cap_drop: [ALL]`), and security hardening (`no-new-privileges:true`).
|
|
|
|
## Compose deployment
|
|
|
|
The recommended production and lab deployment uses Docker Compose:
|
|
|
|
```bash
|
|
cp .env.example .env # configure ZEEK_INTERFACE (authorized networks only)
|
|
docker compose pull && docker compose up -d
|
|
```
|
|
|
|
To build and run locally from source:
|
|
|
|
```bash
|
|
docker compose up -d --build
|
|
```
|
|
|
|
The stack coordinates two services:
|
|
|
|
| Service | Image | Purpose | Security profile |
|
|
|---|---|---|---|
|
|
| `zeek` | `zeek/zeek:9.0.1` | Network packet capture and hourly log rotation | Host network, `NET_RAW` and `NET_ADMIN` capabilities |
|
|
| `acaua` | `git.lucasrguerra.dev.br/ciberfauna/acaua` | Analytical processing, API and web dashboard | Unprivileged (UID 10001), read-only rootfs, no capabilities |
|
|
|
|
## Volumes and data layout
|
|
|
|
The stack uses named volumes to manage ownership and permissions cleanly:
|
|
|
|
- `zeek-logs`: Shared volume mounted at `/logs` in the Zeek service and mounted
|
|
**read-only** at `/data/zeek:ro` in the Acauã service.
|
|
- `acaua-data`: Dedicated read-write volume mounted at `/data/acaua` for DuckDB
|
|
analytical store, Parquet partitions and runtime files.
|
|
|
|
To inspect or extract data on the host:
|
|
|
|
```bash
|
|
docker compose cp acaua:/data/acaua ./local-acaua-backup
|
|
```
|
|
|
|
Or run a one-off inspection container:
|
|
|
|
```bash
|
|
docker run --rm -v acaua_acaua-data:/data:ro debian:trixie-slim ls -la /data
|
|
```
|
|
|
|
## Authentication and transport
|
|
|
|
Login is mandatory in every mode; MFA is mandatory for administrators and optional
|
|
for analysts. Without a credential only these work: `GET /api/health`, `GET /api/auth/state`, `POST /api/auth/{bootstrap,login,mfa,password-change-required}` and the login assets (`/login.html`, `/login.js`, `/app.css`, `/logo.png`, `/i18n.js`, `/i18n-en.js`).
|
|
|
|
**First setup.** On the first start the daemon prints a one-time setup code
|
|
(valid for 1 hour) to its log: `docker compose logs acaua`. Open the dashboard,
|
|
enter the code, create the first administrator, then enroll an authenticator app
|
|
(TOTP) and store the recovery codes shown once. An expired code needs a daemon
|
|
restart (`docker compose restart acaua`), which prints a new one.
|
|
|
|
**Transport modes.** `ACAUA_TRANSPORT` is required; the image defaults to `local`.
|
|
|
|
| Mode | Meaning |
|
|
|---|---|
|
|
| `local` | Plain HTTP, loopback only. `ACAUA_PUBLISH` must be `127.0.0.1` or `[::1]`; the daemon refuses to start if `ACAUA_PUBLISHED` is anything else. Outside a container it also refuses a non-loopback `--bind`; the image sets `ACAUA_RUNTIME=container`, where `ACAUA_PUBLISHED` is the control. |
|
|
| `tls` | The daemon terminates HTTPS. Set `ACAUA_TLS_CERT` and `ACAUA_TLS_KEY` and mount the certificate and key in the container with a compose override; `--bind` must be an `IP:port`. |
|
|
| `proxy` | An HTTPS reverse proxy sits in front. Set `ACAUA_TRUSTED_PROXIES` to its address as CIDRs. The daemon port must be reachable only by the proxy. |
|
|
|
|
**Limits worth knowing.** A bare `docker run -p 0.0.0.0:8787:8787` without
|
|
`ACAUA_PUBLISHED` is not detected by `local` mode; login still protects the
|
|
dashboard, but the traffic is plain HTTP. Use compose.
|
|
|
|
**Secret key.** The key that seals MFA secrets is created in the data volume by
|
|
default. Anyone who copies the volume copies the key with it, so prefer a Docker
|
|
secret and point `ACAUA_SECRET_KEY_FILE` to it (for example
|
|
`/run/secrets/acaua_key`, 32 random bytes encoded as base64).
|
|
|
|
**Tokens.** Users create API tokens with `read` or `admin` scope. Changing a
|
|
password or disabling MFA revokes that user's admin tokens and keeps read tokens.
|
|
`/api/analyze` is admin-only.
|
|
|
|
**Failed logins.** Wrong passwords delay that username from that address (an IPv6
|
|
/48 counts as one address). Each username also has a budget of 100 failures per
|
|
rolling 24 hours from unknown addresses: once spent, those addresses are refused,
|
|
even with the right password. An address with a completed login in the last 30 days
|
|
skips the budget, so an attacker can delay a real user's login from a *new* address
|
|
for up to the budget window, and longer if they keep going, but not from a known
|
|
address, and not an open session. If you are locked out on a new address, log in
|
|
from a known one or run the reset below. Crossing the budget writes
|
|
`login.budget_exhausted` to the audit log (Admin screen), once per account per 24
|
|
hours. The audit log has no rotation yet. MFA remains recommended for analysts. A
|
|
restart clears the per-address counts, not the budgets.
|
|
|
|
**Recovery.** `docker compose exec acaua acaua auth reset --username <name> --data-dir /data/acaua`
|
|
(see [cli.md](cli.md#acaua-auth-reset)) works for any account: it prints a temporary
|
|
password and forces a password change; administrators also enroll MFA again.
|
|
Anyone with Docker access on the host can run it, so Docker access is
|
|
administrator access to Acauã.
|
|
|
|
## Updating
|
|
|
|
Because Acauã runs as a multi-user collective SOC daemon, updates are performed
|
|
by pulling the latest verified image:
|
|
|
|
```bash
|
|
docker compose pull && docker compose up -d
|
|
```
|
|
|
|
The running daemon shuts down cleanly on `SIGTERM` within sub-second intervals,
|
|
ensuring Parquet writes and DuckDB transactions are committed properly.
|
|
|
|
## Security notes
|
|
|
|
- The `zeek` service requires packet capture privileges (`NET_RAW`, `NET_ADMIN`).
|
|
Run it only on interfaces and networks you are explicitly authorized to monitor.
|
|
- The default dashboard binding is loopback-only (`ACAUA_PUBLISH=127.0.0.1:8787`).
|
|
Login is always required (MFA is mandatory for administrators, optional for
|
|
analysts), but only `tls` and `proxy` encrypt the
|
|
traffic: publish beyond loopback only with one of them
|
|
([details](#authentication-and-transport)).
|
|
- The image contains no telemetry. Outbound traffic is restricted to operator-initiated
|
|
update checks against the Gitea Releases API.
|