Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
6.4 KiB
Configuration
Harpia is configured by a single TOML file, by default config/harpia.toml
(override with --config on every command). harpia config check --config <path> validates it and prints, per group, the address count, effective
cron and cadence overlaps; run it after every edit, before restarting
serve/scanner.
Shape of the file
[escopo]
autorizado = ["10.0.0.0/8", "203.0.113.0/24"]
responsavel = "Infra Team <infra@example.org>"
[padrao]
cron = "@daily"
jitter = "10%"
perfil = "padrao"
taxa_maxima_pps = 500
hosts_simultaneos = 64
ausencias_para_sumir = 2
[padrao.feeds]
sincronizar_automaticamente = false
intervalo_sincronizacao = "24h"
[perfis.padrao]
tcp = "top-1000"
motor = "nativo"
vulnerabilidades = true
[[grupo]]
nome = "nucleo"
alvos = ["10.0.1.1", "10.0.1.10-10.0.1.20"]
cron = "*/5 * * * *"
perfil = "padrao"
criticidade = "critica"
See examples/harpia.toml for a fully commented
reference covering a corporate network, a DMZ and a core/critical tier with
two cadences (a light 5-minute check and a full 03:00 sweep).
[escopo]: authorized scope (hard limit)
autorizado: list of CIDR ranges every expanded target must fall inside. A target outside it (including a DNS name that resolves outside it) is rejected (config checkfails for static targets; a name is skipped for that sweep and logged asalvo_fora_do_escopoif it only drifts at resolution time).responsavel: free-text contact, shown in reports; not validated.
[padrao]: defaults inherited by every group
cron: 5-field cron expression or a shortcut (@hourly,@daily,@weekly,@monthly). Any group without its owncronuses this one.jitter: percentage of the interval to the next run, applied as a deterministic (not random) offset, seearchitecture.mdfor why.perfil: which[perfis.*]table a group uses when it doesn't set its own.taxa_maxima_pps/hosts_simultaneos: shared rate budget across the whole scanner process, not per group.ausencias_para_sumir: consecutive missed sweeps before a host is marked gone (host_sumiu); this protects against a single dropped sweep producing a false "host disappeared" event.[padrao.feeds]:sincronizar_automaticamente(bool, defaultfalse) andintervalo_sincronizacao(default"24h") control the background CVE/KEV refresh insideharpia serve, see Vulnerability feeds below.
[perfis.<nome>]: port and engine profiles
tcp:"top-1000", a range ("1-65535"), or an explicit list ("22,80,443").udp: list of UDP ports to probe (string list).motor:"nativo"(tries the raw-socket SYN engine, falls back tonativo-sem-rawautomatically ifCAP_NET_RAWisn't available, seedocker.md) or"nmap"(requires theharpia-scanner-nmapimage variant).vulnerabilidades: whether CVE/KEV correlation and the safe config checks (expired TLS cert, unencrypted admin port) run for this profile's findings.
[[grupo]]: target groups
Each [[grupo]] block is a named network with its own targets and,
optionally, its own cron/profile/criticality:
nome: unique name (also the asset-identity namespace, seearchitecture.md).alvos: list of CIDR ranges, single IPs, ranges ("10.0.1.10-10.0.1.20") or DNS names (re-resolved every sweep).excluir: optional list subtracted fromalvos(same formats, no DNS names).cron/perfil/criticidade: override the defaults for this group only.criticidadeis informational (shown in the dashboard/report), it does not change scheduling by itself; the cron does.
A host can belong to more than one group (e.g. a narrow high-frequency group
and a broad daily one covering the same address). The storage layer
deduplicates by asset identity, and config check lists the overlap with
each host's effective (shortest) cadence.
[[webhook]]: change alerts
After each ingested sweep, harpia serve posts the surface changes it found to
every [[webhook]] (one request per sweep, only when there is something to
send):
[[webhook]]
url = "https://hooks.slack.com/services/T000/B000/XXXX"
formato = "slack" # json (default) | slack | discord
eventos = ["porta_nova", "host_novo"] # empty or omitted: every kind
grupos = ["dmz"] # empty or omitted: every group
segredo_env = "HARPIA_WEBHOOK_KEY" # optional HMAC-SHA256 signature
formato = "json"sends{"fonte", "versao", "grupo", "sweep_id", "eventos"}with the same event objects as/api/changes.slack(also Mattermost and Rocket.Chat) anddiscordsend a short text listing up to 20 changes.eventos:host_novo,host_voltou,host_sumiu,porta_nova,porta_fechada,servico_alterado.segredo_envnames an environment variable; its value signs the body asX-Harpia-Signature: sha256=<hex HMAC>. The key itself never goes in the file.- Delivery runs in the background and never holds up ingestion. Network
errors,
5xxand429are retried twice (after 2 s and 4 s); the outcome is logged and counted in/metrics. - Chat webhook URLs are credentials:
GET /api/configand the logs show onlyscheme://host/…. harpia servereads the webhooks at start (and on dashboard edits); restart it after changing them by hand.
Editing a group from the dashboard
harpia serve's Groups view can create, edit and delete groups without
touching the file by hand (POST/PUT/DELETE /api/config/groups); every
mutation re-runs the same validation as config check and persists back to
the TOML file atomically. harpia scanner, running as a separate process,
picks up the change on its next tick by comparing the file's mtime; no
restart needed.
Vulnerability feeds
harpia feeds import <dir> --data-dir <path> loads a local NVD CVE JSON 2.0
dump and a CISA KEV file with no network access (for air-gapped networks).
harpia feeds sync --config <path> --data-dir <path> fetches both live, once,
and merges them into the existing local database. Setting
padrao.feeds.sincronizar_automaticamente = true makes harpia serve repeat
that sync on its own, every intervalo_sincronizacao, for as long as the
process runs; the CVE database then stays fresh independently of the image
or binary being rebuilt, the same principle Trivy uses for its vulnerability
database.