Files
harpia/docs/docker.md
T
Lucas Guerra 2298117c47
Release / Plan (reuse the published image?) (push) Successful in 4s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and clippy (push) Failing after 9s
CI / Dependency audit (push) Failing after 11s
CI / Tests (Linux) (push) Successful in 9m25s
Release / ci (push) Failing after 9m26s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
feat(scan): implement raw-socket SYN engine; fix Docker build and cross-container permissions; full v1.0 docs
- scan::syn_scan: raw TCP SYN half-open scanning (CAP_NET_RAW), validated
  end-to-end against a real target through the actual hardened Docker
  Compose stack (scanner uid 0 restricted to NET_RAW, xexeu uid 10001 zero
  capabilities). Automatic fallback to nativo-sem-raw, engine actually used
  recorded in every sweep manifest.
- caps::has_net_raw: CAP_NET_RAW detection via /proc/self/status, shared by
  the scan engine selection and `xexeu doctor`.
- Fix: Dockerfile never copied apps/ or logo.png, so the image never
  actually built until this was caught by a real `docker build`.
- Fix: sweep batches were written 0600 by scanner (uid 0); xexeu (uid 10001)
  couldn't read them through the read-only xexeu-sweeps mount. Now written
  0644/0755 explicitly.
- Fix: group names from the config CRUD API weren't validated as safe path
  components until a sweep tried to write a batch for them; now rejected
  immediately.
- Fix: CSV exports had no CSV/formula-injection guard; cells starting with
  =, +, -, @ or a tab are now prefixed to force plain-text interpretation.
- docs/: full EN/PT-BR set (architecture rewritten to match the real
  implementation — SQLite not DuckDB, include_str!/include_bytes! not
  rust-embed; new cli.md, configuration.md, docker.md, interface.md,
  support.md) with real dashboard/report screenshots.
- README, ROADMAP, CHANGELOG, SECURITY, CONTRIBUTING (EN/PT-BR): updated to
  reflect actual v1.0-candidate state instead of the initial-scaffolding
  status they still described.
2026-11-02 11:08:51 -03:00

93 lines
4.4 KiB
Markdown

<p align="center"><a href="../README.md">◂ Back to README</a></p>
# Docker
Xexéu ships as two containers from one image, defined in
[`docker-compose.yml`](../docker-compose.yml):
```
xexeu.toml (ro)
│
┌─────────────────────┴──────────────────────┐
▼ ▼
scanner (NET_RAW, host net) xexeu (no capabilities)
schedules + probes targets ingests batches
writes immutable batches ──batches──► correlates CVEs, computes diffs
(xexeu-sweeps volume) serves the API + dashboard
(xexeu-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).
- **`xexeu`** 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/xexeu.toml config/xexeu.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 (`XEXEU_PUBLISH`
in `.env` to change the bind address/port).
## 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), `xexeu` detects it automatically
(`xexeu doctor` reports it, and every sweep manifest records which engine
actually ran) and falls back to `nativo-sem-raw` — never a hard failure.
## Volumes
- `xexeu-sweeps`: batches written by `scanner`, read-only from `xexeu`.
Pruned by `scanner` past `retencao_lotes` (see `architecture.md`).
- `xexeu-data`: the SQLite state (`xexeu`'s only write target) and the
local CVE/KEV database.
- `./config` (bind mount, read-only in both containers): `xexeu.toml`.
Mutations from the dashboard's Groups view write back to this file from
inside the `xexeu` 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 `xexeu-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.