Files
harpia/docs/docker.md
T
Lucas RayanandClaude Sonnet 5 5ed6cb2c95
Release / Build image (amd64) (push) Successful in 10m49s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Successful in 20m40s
CI / Format and clippy (push) Successful in 5m43s
CI / Tests (Linux) (push) Successful in 16m5s
CI / Dependency audit (push) Successful in 11s
CI / Docker image (build and smoke test) (push) Skipped
Release / Build image (arm64) (push) Successful in 7m34s
Release / Publish tags (push) Successful in 15s
Release / Gitea release (push) Skipped
Release / CLI (linux-aarch64) (push) Skipped
Release / CLI (linux-x86_64) (push) Skipped
refactor!: rename project from Xexéu to Harpia
Renames the whole project, after the harpy eagle: crates
(xexeu-core/xexeu-cli -> harpia-core/harpia-cli), binary (xexeu ->
harpia), admin token env var (XEXEU_ADMIN_TOKEN -> HARPIA_ADMIN_TOKEN),
compose env vars (XEXEU_* -> HARPIA_*), container image
(ciberfauna/xexeu -> ciberfauna/harpia) and the Gitea repository
(ciberfauna/xexeu -> ciberfauna/harpia). Logo updated to the new brand
artwork. All docs (EN/PT-BR), CI workflows, scripts, GUI strings and
the openspec change history updated to match.

BREAKING CHANGE: binary, crate, env var and image names all changed;
existing .env files, scripts and deployments referencing the old
xexeu/XEXEU names must be updated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VAyr8cd6jzwpJM9cS1oGjy
2026-11-03 13:43:21 -03:00

97 lines
4.7 KiB
Markdown

<p align="center"><a href="../README.md">◂ Back to README</a></p>
# Docker
Harpia ships as two containers from one image, defined in
[`docker-compose.yml`](../docker-compose.yml):
```
harpia.toml (ro)
│
┌─────────────────────┴──────────────────────┐
▼ ▼
scanner (NET_RAW, host net) harpia (no capabilities)
schedules + probes targets ingests batches
writes immutable batches ──batches──► correlates CVEs, computes diffs
(harpia-sweeps volume) serves the API + dashboard
(harpia-data volume)
```
- **`scanner`** only emits packets at the authorized targets and writes
sweep batches. It never opens a listening port, never touches the
database, never makes an outbound connection. `network_mode: host` is
required so it sees the network the same way the host does (correct
source addresses, visibility of local-segment hosts for discovery).
- **`harpia`** never emits traffic at scan targets. It ingests batches
(mounted `:ro`), is SQLite's only writer, serves the API/dashboard, and
makes the only outbound connections the stack has (feed sync, update
check) — both opt-in and both disabled by default.
## Quick start
```bash
cp .env.example .env
cp examples/harpia.toml config/harpia.toml # edit the scope/groups first
docker compose pull && docker compose up -d # published image
# or, building locally:
docker compose up -d --build
```
The dashboard comes up at `http://127.0.0.1:8788` by default (`HARPIA_PUBLISH`
in `.env` to change the bind address/port). To add, edit or remove groups from
it, set `HARPIA_ADMIN_TOKEN` in `.env` (`openssl rand -hex 32`) or, leaving it
empty, take the one-off link from `docker compose logs harpia`; inside the
container it reads `http://0.0.0.0:8788/?token=…`, so swap the host for the
published address.
## Why `scanner` runs as `uid 0` restricted to `NET_RAW`
The raw-socket SYN engine (`nativo`, see [`architecture.md`](architecture.md))
needs `CAP_NET_RAW`. Docker's `cap_add` only grants a capability to a
process that is already root (`uid 0`) inside the container — a non-root
user does **not** receive an added capability unless the binary itself
carries it as a *file capability* (`setcap cap_net_raw+ep`), and this image
intentionally doesn't bake that in (a setuid-like file capability is itself
an attack-surface decision we'd rather not make silently). `no-new-privileges`
also blocks calling `setcap` at runtime as a workaround.
So the `scanner` service runs as `uid 0` but with **every other** capability
dropped (`cap_drop: [ALL]`, `cap_add: [NET_RAW]` only), a read-only root
filesystem, `tmpfs` for `/tmp`, and `no-new-privileges`. It is still
"root" in the Linux-user sense, but it can do essentially nothing a normal
root process could — no `NET_ADMIN`, no `SYS_ADMIN`, no filesystem writes
outside the two mounted volumes, nothing privileged except crafting raw TCP
packets.
If your platform's threat model doesn't tolerate `uid 0` at all regardless
of capability restriction, run the host with
[`--userns-remap`](https://docs.docker.com/engine/security/userns-remap/):
the container's `uid 0` then maps to an unprivileged host UID, and `NET_RAW`
still works inside the remapped namespace.
If the capability isn't usable for any reason (remapping misconfigured, a
platform that strips it, a profile with `motor = "nativo"` running outside
this compose file at all), `harpia` detects it automatically
(`harpia doctor` reports it, and every sweep manifest records which engine
actually ran) and falls back to `nativo-sem-raw` — never a hard failure.
## Volumes
- `harpia-sweeps`: batches written by `scanner`, read-only from `harpia`.
Pruned by `scanner` past `retencao_lotes` (see `architecture.md`).
- `harpia-data`: the SQLite state (`harpia`'s only write target) and the
local CVE/KEV database.
- `./config` (bind mount, read-only in both containers): `harpia.toml`.
Mutations from the dashboard's Groups view write back to this file from
inside the `harpia` container, so the host directory must be writable by
the container's user even though the mount itself stays `:ro` for
`scanner`.
## Optional `nmap` variant
Profiles with `motor = "nmap"` require the separate `harpia-scanner-nmap`
image (not built by the default `Dockerfile`), which bundles the external
`nmap` binary the way `scan::nmap` expects it on `PATH`. It is not part of
the standard image specifically to keep nmap's NPSL-licensed code out of
the default distribution.