docs: bring README, docs, screenshots and changelog up to 1.6.0
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
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>
No files matched your search
@@ -54,3 +54,18 @@ URUTAU_EVENTS_MAX=512MB
|
||||
URUTAU_RETENTION=720h
|
||||
# File with Tor exit addresses (one per line); same note as above.
|
||||
URUTAU_TOR_EXITS=
|
||||
|
||||
# Port probes (host kit) and Tor lists
|
||||
URUTAU_PROBE_LOG=/logs/host/probe.log
|
||||
URUTAU_TOR_AUTO=on
|
||||
|
||||
# Second firewall: off | observe | on (needs deploy/host/install.sh --enforce
|
||||
# and the /logs/enforce volume in docker-compose.yml)
|
||||
URUTAU_ENFORCE=off
|
||||
URUTAU_ENFORCE_SHARE=off
|
||||
URUTAU_ENFORCE_THRESHOLD=5
|
||||
|
||||
# Outbound traffic analysis: auto | on | off
|
||||
URUTAU_EGRESS=auto
|
||||
URUTAU_EGRESS_WORKLOADS=
|
||||
URUTAU_EGRESS_RESOLVERS=
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow SemVer.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Documentation
|
||||
|
||||
- Docs, README and screenshots updated to 1.6.0.
|
||||
|
||||
## [1.6.0] - 2026-11-15
|
||||
|
||||
### Fixed
|
||||
@@ -20,6 +26,8 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
|
||||
|
||||
## [1.5.8] - 2026-11-15
|
||||
|
||||
Not published on its own: there is no `v1.5.8` tag. This change (commit `bc3ce09`) was merged into the same release as 1.6.0 and shipped with it.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Phones: plain data tables (Concentration ranking, Errors routes, MITRE techniques, Defense, Integrity sources, and any other table without its own phone layout) rendered as squeezed columns with IPs broken letter by letter or sideways scrolling. Under 768 px their rows now become stacked cards with the column name as label, right-aligned numbers and long text wrapping; desktop is unchanged. One shared rule in `style.css` plus `cardTables()` in `app.js` covers all of them. `TABLES_ONLY=1 scripts/screenshots.sh` captures every table page at 375x812 and checks for horizontal overflow.
|
||||
@@ -74,6 +82,7 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
|
||||
- Incident management: every egress finding (severity above info) becomes a ticket `INC-<n>` keyed by `host|kind|workload|dst|dport|proto`, created by a sync on each merged egress report and every 60 s. Tickets have status (`open`, `investigating`, `true_positive`, `false_positive`, `benign`, `resolved`), severity, assignee, tags, verdict, comments and a change history; a resolved ticket reopens when the finding reappears. Stored in `<data-dir>/incidents.json` (atomic write, 0600; a corrupt file is moved to `.corrupt`); limits of 5000 tickets, 200 comments and 500 history entries each. Every write is also logged (id, field, author).
|
||||
- A ticket in `false_positive` or `benign` can suppress the findings with exactly its key: they leave `/api/v1/egress` (and the egress report) unless `?suppressed=1`. Findings now carry `ticket_id`, `ticket_status` and `suppressed`, and the response has `suppressed_count`.
|
||||
- API: `GET /api/v1/incidents`, `GET /api/v1/incidents/{id}`, `POST /api/v1/incidents`, `PATCH /api/v1/incidents/{id}`, `POST /api/v1/incidents/{id}/comments` and `GET /api/v1/incidents/export.csv` (not open to the peer token; writes refuse cross-site requests).
|
||||
- Suppression expires: a ticket suppresses its findings for 30 days by default (90 at most), and a host with more than 300 active tickets has the excess grouped in one flood ticket.
|
||||
|
||||
## [1.4.8] - 2026-11-15
|
||||
|
||||
@@ -89,7 +98,6 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
|
||||
### Fixed
|
||||
|
||||
- The unban file now defaults to `unban.log` next to `--enforce-log` (the default was lost, so the Unban button reported the file as not writable).
|
||||
- Second firewall: the 24 h rules also count from the persistent day counters, so they work when the event registry does not cover the whole day (after a reset or upgrade).
|
||||
|
||||
## [1.4.6] - 2026-11-15
|
||||
|
||||
@@ -97,6 +105,10 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
|
||||
|
||||
- Unban from the interface: an "Unban" button on recent decisions and on the address page asks the host (through `unban.log` next to `--enforce-log`, flag `--enforce-unban-log`) to lift the fail2ban block, and can keep the second firewall from banning the address again for 1 h, 24 h or 7 days (operator releases, listed and endable in Defense; shared with peers when sharing is on). API: `POST /api/v1/enforce/unban`, `DELETE /api/v1/enforce/allow`, `allows` in `GET /api/v1/enforce`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Second firewall: the 24 h rules also count from the persistent day counters, so they work when the event registry does not cover the whole day (after a reset or upgrade).
|
||||
|
||||
## [1.4.5] - 2026-11-15
|
||||
|
||||
### Fixed
|
||||
@@ -141,7 +153,7 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
|
||||
- Reports page: a preview of the HTML report itself, always an A4 sheet scaled to the screen, with only Download and Print; language selector, period and server from the header.
|
||||
- Report: sharp logo (the repository logo at 800 px) and the cover drawing is now the urutau's call, five descending notes.
|
||||
|
||||
## [1.4.0] - 2026-11-15
|
||||
## [1.4.0] - 2026-11-14
|
||||
|
||||
### Added
|
||||
|
||||
@@ -150,6 +162,7 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
|
||||
- Host kit in `deploy/host` (nftables table, rsyslog, logrotate, container map, fail2ban filter, action and jail, `install.sh`).
|
||||
- New page Outbound traffic and a Second firewall section in Defense.
|
||||
- HTML report (`/api/v1/report?format=html`): cover, executive summary in plain language, rule-based recommendations, threats, geography, errors and health, visitors, defense, second firewall and outbound traffic, printable on A4. The Reports page downloads or prints it.
|
||||
- API: `GET /api/v1/enforce` and `GET /api/v1/egress` (user only), and the federation routes `GET /api/v1/peer/egress`, `GET` and `POST /api/v1/peer/decisions` (decision sharing, only when `URUTAU_ENFORCE_SHARE` is on), which join the peer token routes.
|
||||
- Screenshot script covers every page.
|
||||
|
||||
## [1.3.0] - 2026-11-14
|
||||
@@ -254,3 +267,29 @@ First release.
|
||||
- The IP address of a legitimate visitor is never persisted; unique visitors use a hash with a daily salt.
|
||||
- Hostile log content is limited in length and escaped on output; the dashboard ships a strict Content-Security-Policy and the usual hardening headers.
|
||||
- `--insecure-no-auth` is refused unless the bind address is loopback.
|
||||
|
||||
[Unreleased]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.6.0...HEAD
|
||||
[1.6.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.7...v1.6.0
|
||||
[1.5.8]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/commit/bc3ce09
|
||||
[1.5.7]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.6...v1.5.7
|
||||
[1.5.6]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.5...v1.5.6
|
||||
[1.5.5]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.4...v1.5.5
|
||||
[1.5.4]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.3...v1.5.4
|
||||
[1.5.3]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.2...v1.5.3
|
||||
[1.5.2]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.1...v1.5.2
|
||||
[1.5.1]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.0...v1.5.1
|
||||
[1.5.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.8...v1.5.0
|
||||
[1.4.8]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.7...v1.4.8
|
||||
[1.4.7]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.6...v1.4.7
|
||||
[1.4.6]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.5...v1.4.6
|
||||
[1.4.5]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.4...v1.4.5
|
||||
[1.4.4]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.3...v1.4.4
|
||||
[1.4.3]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.2...v1.4.3
|
||||
[1.4.2]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.1...v1.4.2
|
||||
[1.4.1]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.0...v1.4.1
|
||||
[1.4.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.3.0...v1.4.0
|
||||
[1.3.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.2.0...v1.3.0
|
||||
[1.2.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.1.1...v1.2.0
|
||||
[1.1.1]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.1.0...v1.1.1
|
||||
[1.1.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.0.0...v1.1.0
|
||||
[1.0.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/releases/tag/v1.0.0
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/); versionamento segue SemVer.
|
||||
|
||||
## [Não lançado]
|
||||
|
||||
### Documentação
|
||||
|
||||
- Documentação, README e capturas de tela atualizados para a 1.6.0.
|
||||
|
||||
## [1.6.0] - 2026-11-15
|
||||
|
||||
### Corrigido
|
||||
@@ -20,6 +26,8 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/);
|
||||
|
||||
## [1.5.8] - 2026-11-15
|
||||
|
||||
Não publicada separadamente: não existe a tag `v1.5.8`. Esta alteração (commit `bc3ce09`) foi mesclada na mesma versão da 1.6.0 e saiu junto com ela.
|
||||
|
||||
### Corrigido
|
||||
|
||||
- Celular: tabelas de dados comuns (ranking da Concentração, rotas de Erros, técnicas MITRE, Defesa, fontes da Integridade e qualquer outra sem layout próprio para celular) apareciam com colunas espremidas, IPs quebrados letra por letra ou rolagem lateral. Abaixo de 768 px as linhas agora viram cartões empilhados com o nome da coluna como rótulo, números alinhados à direita e texto longo quebrando; o desktop não muda. Uma regra única em `style.css` e `cardTables()` em `app.js` cobre todas. `TABLES_ONLY=1 scripts/screenshots.sh` captura todas as páginas com tabela em 375x812 e verifica estouro horizontal.
|
||||
@@ -74,6 +82,7 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/);
|
||||
- Gestão de incidentes: cada achado de egress (severidade acima de info) vira um chamado `INC-<n>` com chave `host|kind|workload|dst|dport|proto`, criado por uma sincronização a cada relatório de egress mesclado e a cada 60 s. O chamado tem status (`open`, `investigating`, `true_positive`, `false_positive`, `benign`, `resolved`), severidade, responsável, etiquetas, conclusão, comentários e histórico de mudanças; um chamado resolvido reabre quando o achado reaparece. Fica em `<data-dir>/incidents.json` (escrita atômica, 0600; arquivo corrompido vai para `.corrupt`); limites de 5000 chamados, 200 comentários e 500 entradas de histórico cada. Toda escrita também vai para o log (id, campo, autor).
|
||||
- Um chamado em `false_positive` ou `benign` pode suprimir os achados com exatamente a sua chave: eles saem de `/api/v1/egress` (e do relatório de egress), salvo com `?suppressed=1`. Os achados agora trazem `ticket_id`, `ticket_status` e `suppressed`, e a resposta tem `suppressed_count`.
|
||||
- API: `GET /api/v1/incidents`, `GET /api/v1/incidents/{id}`, `POST /api/v1/incidents`, `PATCH /api/v1/incidents/{id}`, `POST /api/v1/incidents/{id}/comments` e `GET /api/v1/incidents/export.csv` (fechada ao token de peer; escritas recusam requisições cross-site).
|
||||
- A supressão expira: um chamado suprime seus achados por 30 dias por padrão (90 no máximo), e um host com mais de 300 chamados ativos tem o excedente agrupado em um chamado de inundação.
|
||||
|
||||
## [1.4.8] - 2026-11-15
|
||||
|
||||
@@ -89,7 +98,6 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/);
|
||||
### Corrigido
|
||||
|
||||
- O arquivo de desban agora tem como padrão `unban.log` ao lado de `--enforce-log` (o padrão se perdia, e o botão Desbanir dizia que o arquivo não era gravável).
|
||||
- Segundo firewall: as regras de 24 h também contam pelos contadores diários persistentes, então funcionam quando o registro de eventos não cobre o dia inteiro (após um reset ou atualização).
|
||||
|
||||
## [1.4.6] - 2026-11-15
|
||||
|
||||
@@ -97,6 +105,10 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/);
|
||||
|
||||
- Desbanir pela interface: botão "Desbanir" nas decisões recentes e na página do endereço pede ao host (por `unban.log` ao lado de `--enforce-log`, flag `--enforce-unban-log`) que libere o bloqueio do fail2ban, e pode impedir o segundo firewall de banir de novo por 1 h, 24 h ou 7 dias (liberações do operador, listadas e encerráveis em Defesa; compartilhadas com os parceiros quando o compartilhamento está ligado). API: `POST /api/v1/enforce/unban`, `DELETE /api/v1/enforce/allow`, `allows` em `GET /api/v1/enforce`.
|
||||
|
||||
### Corrigido
|
||||
|
||||
- Segundo firewall: as regras de 24 h também contam pelos contadores diários persistentes, então funcionam quando o registro de eventos não cobre o dia inteiro (após um reset ou atualização).
|
||||
|
||||
## [1.4.5] - 2026-11-15
|
||||
|
||||
### Corrigido
|
||||
@@ -141,7 +153,7 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/);
|
||||
- Página Relatórios: prévia do próprio relatório HTML, sempre uma folha A4 em escala, só com Baixar e Imprimir; seletor de idioma, período e servidor do topo.
|
||||
- Relatório: logo nítida (a logo do repositório em 800 px) e o desenho da capa agora é o canto do urutau, cinco notas descendentes.
|
||||
|
||||
## [1.4.0] - 2026-11-15
|
||||
## [1.4.0] - 2026-11-14
|
||||
|
||||
### Adicionado
|
||||
|
||||
@@ -150,6 +162,7 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/);
|
||||
- Kit de host em `deploy/host` (tabela nftables, rsyslog, logrotate, mapa de contêineres, filtro, ação e jail do fail2ban, `install.sh`).
|
||||
- Página nova Tráfego de saída e seção Segundo firewall em Defesa.
|
||||
- Relatório HTML (`/api/v1/report?format=html`): capa, sumário executivo em linguagem leiga, recomendações por regras, ameaças, geografia, erros e saúde, visitantes, defesa, segundo firewall e tráfego de saída, imprimível em A4. A página Relatórios baixa ou imprime.
|
||||
- API: `GET /api/v1/enforce` e `GET /api/v1/egress` (só usuário) e as rotas de federação `GET /api/v1/peer/egress` e `GET` e `POST /api/v1/peer/decisions` (compartilhamento de decisões, só com `URUTAU_ENFORCE_SHARE` ligado), que se juntam às rotas do token de peer.
|
||||
- O script de capturas cobre todas as páginas.
|
||||
|
||||
## [1.3.0] - 2026-11-14
|
||||
@@ -254,3 +267,29 @@ Primeira versão.
|
||||
- O endereço IP de um visitante legítimo nunca é persistido; visitantes únicos usam um hash com sal diário.
|
||||
- O conteúdo hostil dos logs tem tamanho limitado e é escapado na saída; o dashboard envia uma Content-Security-Policy estrita e os cabeçalhos de endurecimento usuais.
|
||||
- `--insecure-no-auth` é recusado a menos que o endereço de bind seja loopback.
|
||||
|
||||
[Não lançado]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.6.0...HEAD
|
||||
[1.6.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.7...v1.6.0
|
||||
[1.5.8]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/commit/bc3ce09
|
||||
[1.5.7]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.6...v1.5.7
|
||||
[1.5.6]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.5...v1.5.6
|
||||
[1.5.5]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.4...v1.5.5
|
||||
[1.5.4]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.3...v1.5.4
|
||||
[1.5.3]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.2...v1.5.3
|
||||
[1.5.2]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.1...v1.5.2
|
||||
[1.5.1]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.5.0...v1.5.1
|
||||
[1.5.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.8...v1.5.0
|
||||
[1.4.8]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.7...v1.4.8
|
||||
[1.4.7]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.6...v1.4.7
|
||||
[1.4.6]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.5...v1.4.6
|
||||
[1.4.5]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.4...v1.4.5
|
||||
[1.4.4]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.3...v1.4.4
|
||||
[1.4.3]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.2...v1.4.3
|
||||
[1.4.2]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.1...v1.4.2
|
||||
[1.4.1]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.4.0...v1.4.1
|
||||
[1.4.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.3.0...v1.4.0
|
||||
[1.3.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.2.0...v1.3.0
|
||||
[1.2.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.1.1...v1.2.0
|
||||
[1.1.1]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.1.0...v1.1.1
|
||||
[1.1.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/compare/v1.0.0...v1.1.0
|
||||
[1.0.0]: https://git.lucasrguerra.dev.br/ciberfauna/urutau/releases/tag/v1.0.0
|
||||
@@ -29,7 +29,7 @@ Always maintain document pairs: every `*.md` and `docs/*` file has an English ve
|
||||
|
||||
## Commits and releases
|
||||
|
||||
Commits follow Conventional Commits 1.0.0 in English (`feat:`, `fix:`, `chore:`, `ci:`, `docs:`, `refactor:`, `test:`, `perf:`, `build:`). Versions follow SemVer 2.0.0. Update the CHANGELOG in the same pull request as a user-visible change.
|
||||
Commits follow Conventional Commits 1.0.0 in English (`feat:`, `fix:`, `chore:`, `ci:`, `docs:`, `refactor:`, `test:`, `perf:`, `build:`). Versions follow SemVer 2.0.0. Update the CHANGELOG in the same pull request as a user-visible change: add it under `[Unreleased]`, and at release time rename that section to the version and date and add the comparison link at the end of the file.
|
||||
|
||||
Releases are multi-arch container images (`linux/amd64` and `linux/arm64`) published to the Gitea registry. Pushing a `v*` tag triggers the release workflow, which reuses the image already built for the same inputs when there is one, and creates the Gitea release from the CHANGELOG section.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ Mantenha sempre os pares de documentos: todo arquivo `*.md` e `docs/*` tem uma v
|
||||
|
||||
## Commits e releases
|
||||
|
||||
Commits seguem Conventional Commits 1.0.0 em inglês (`feat:`, `fix:`, `chore:`, `ci:`, `docs:`, `refactor:`, `test:`, `perf:`, `build:`). Versões seguem SemVer 2.0.0. Atualize o CHANGELOG no mesmo pull request de uma mudança visível ao usuário.
|
||||
Commits seguem Conventional Commits 1.0.0 em inglês (`feat:`, `fix:`, `chore:`, `ci:`, `docs:`, `refactor:`, `test:`, `perf:`, `build:`). Versões seguem SemVer 2.0.0. Atualize o CHANGELOG no mesmo pull request de uma mudança visível ao usuário: registre em `[Não lançado]` e, na hora do release, renomeie essa seção para a versão e a data e acrescente o link de comparação no fim do arquivo.
|
||||
|
||||
Os releases são imagens de container multi-arquitetura (`linux/amd64` e `linux/arm64`) publicadas no registro do Gitea. Enviar uma tag `v*` dispara o workflow de release, que reaproveita a imagem já construída para as mesmas entradas, quando existe, e cria o release no Gitea a partir da seção do CHANGELOG.
|
||||
|
||||
|
||||
@@ -16,37 +16,53 @@
|
||||
|
||||
<p align="center"><img src="docs/img/defense-dark.png" width="900" alt="Urutau defense page with the second firewall section"><br><sub>Defense: the second firewall in observe mode, next to the host fail2ban.</sub></p>
|
||||
|
||||
<p align="center"><img src="docs/img/egress-dark.png" width="900" alt="Egress"><br><sub>Egress: scan bursts, beacons and mining from containers.</sub></p>
|
||||
<p align="center"><img src="docs/img/egress-dark.png" width="900" alt="Urutau outbound traffic page: verdict, beacons, scan bursts and mining from containers"><br><sub>Outbound traffic: scan bursts, beacons and mining from containers.</sub></p>
|
||||
|
||||
**Status: stable, v1.0.0.** See [CHANGELOG.md](CHANGELOG.md) for exactly what shipped.
|
||||
<p align="center"><img src="docs/img/incidents-dark.png" width="900" alt="Urutau incidents page: tickets for outbound-traffic findings"><br><sub>Incidents: every outbound finding becomes a ticket you triage.</sub></p>
|
||||
|
||||
Urutau is a small panel that runs on each of your servers (as a container), reads the logs the server already writes, and answers one question: who is attacking me right now? It classifies hostile activity, scores every source IP, keeps a rolling window on disk and serves an embedded dashboard, a JSON API and an exportable blocklist.
|
||||
<p align="center"><img src="docs/img/overview-mobile.png" height="420" alt="Urutau overview on a phone"> <img src="docs/img/defense-mobile.png" height="420" alt="Urutau defense page on a phone"><br><sub>The phone layout: a tab bar replaces the side rail and tables become cards.</sub></p>
|
||||
|
||||
- **Reads what already exists:** the Traefik JSON access log, `/var/log/auth.log` (sshd) and `/var/log/fail2ban.log`. No agent on the network path, no packet capture, no telemetry.
|
||||
- **Classifies:** `scanner`, `exploit`, `bruteforce`, `ssh-fail`, `ssh-probe`, `ban`, plus the benign `ok`, `notfound` and `ssh-ok`.
|
||||
- **Scores IPs:** every event adds weight to its source IP. A score of 10 or more is **suspicious**; **hostile** needs 50 or more **and** a strong signal (an attack tool, two or more attack categories, a ban, or a clear exploit attempt that was refused). Scanner and exploit probes that got a 2xx or 3xx answer weigh only 0.5. An IP with a successful SSH login is never hostile and never reaches the blocklist.
|
||||
**Status: stable, v1.6.0.** See [CHANGELOG.md](CHANGELOG.md) for exactly what shipped.
|
||||
|
||||
Urutau is a small panel that runs on each of your servers (as a container), reads the logs the server already writes, and answers one question: who is attacking me right now? It classifies hostile activity, scores every source IP, keeps 30 days on disk, serves an embedded dashboard, a JSON API and an exportable blocklist, and can decide which attackers to block (a second firewall), watch what your own containers send out (outbound traffic analysis) and turn what it finds into tickets and an HTML report.
|
||||
|
||||
- **Reads what already exists:** the Traefik access log (JSON, or the default text format with fewer fields), `/var/log/auth.log` (sshd) and `/var/log/fail2ban.log`. Two optional sources come from the host kit in `deploy/host`: the network probe log (new inbound connections to ports nobody listens on, each a `port-scan` event) and the outbound connection log. No agent on the network path, no packet capture, no telemetry.
|
||||
- **Classifies:** `scanner`, `exploit`, `bruteforce`, `ssh-fail`, `ssh-probe`, `ban`, `port-scan`, plus the benign `ok`, `notfound` and `ssh-ok`. Browsing a public code forge (`/owner/repo/src/commit/<sha>/...`, `raw`, `blame`, `blob`, `tree` paths) is not an attack; real probes such as `/.env` or `/.git/config` still are.
|
||||
- **Scores IPs:** every event adds weight to its source IP. A score of 10 or more is **suspicious**; **hostile** needs 50 or more **and** a strong signal (an attack tool, two or more attack categories, a ban, or a clear exploit attempt that was refused). Scanner and exploit probes that got a 2xx or 3xx answer weigh only 0.5. An IP with a successful SSH login is never hostile and never reaches the blocklist. Bans of the `urutau` jail (Urutau's own decisions) and of `recidive` do not count as evidence, so the system does not feed itself.
|
||||
- **Second firewall (optional):** `URUTAU_ENFORCE=off|observe|on`. Urutau decides which attacking addresses to block and writes the decisions to a file; the host fail2ban (jail `urutau`) applies them, so Urutau needs no privileges. `observe` shows what would be blocked. See [Second firewall](#second-firewall).
|
||||
- **Outbound traffic analysis (optional):** new outbound connections of the host and containers are checked for beaconing, mining, IRC and SMTP ports, contact with attackers or Tor relays, DNS outside the allowed resolvers, unauthorised scans and new countries. See [Outbound traffic and incidents](#outbound-traffic-and-incidents).
|
||||
- **Incident management:** every outbound finding becomes a ticket (`INC-<n>`) with status, severity, assignee, tags, verdict, comments and history.
|
||||
- **HTML report:** a printable A4 report (`/api/v1/report?format=html`): cover, executive summary in plain language, rule-based recommendations, threats, geography, errors and health, visitors, defense, second firewall and outbound traffic. The Reports page previews, downloads or prints it.
|
||||
- **Tor:** the official exit and relay lists are downloaded every 6 hours (`URUTAU_TOR_AUTO`, on by default); requests from Tor exits are marked `tor`, and a workload talking to a Tor relay is a high outbound finding. `--tor-exits` adds your own file.
|
||||
- **Geolocation, offline:** country, city and ASN for every IP from the free DB-IP Lite databases, downloaded and refreshed by Urutau itself, read by a built-in MMDB reader with no dependency. Nothing is looked up online.
|
||||
- **Understands User-Agents:** browser, operating system, device, bots and attack tools.
|
||||
- **Understands User-Agents:** browser, operating system, device, bots and attack tools. Googlebot, Bingbot and Applebot are recognized by forward-confirmed reverse DNS whatever the User-Agent says.
|
||||
- **Web analytics for legitimate traffic:** unique visitors, pages, referrers, countries, browsers, devices, latency (p50 and p95) and bytes, with a world map, replacing your proxy's analytics. Separate **Threats** and **Traffic** pages.
|
||||
- **Lightweight:** Go standard library only, one static binary, a soft memory limit of 256 MiB, state in a single snapshot file. No database.
|
||||
- **Live dashboard:** embedded vanilla UI (English and Portuguese, light and dark), updated through Server-Sent Events, with nine pages (see below).
|
||||
- **Live dashboard:** embedded vanilla UI (English and Portuguese, light and dark, with a phone layout), updated through Server-Sent Events, with 23 pages in five groups (see [Interface](#interface)).
|
||||
- **Blocklist:** hostile, globally routable IPs as plain text or JSON, ready for fail2ban, ipset, nginx or a firewall. IPv6 is aggregated by /64 and exported as `x:x:x:x::/64`.
|
||||
- **Federation:** one instance (the hub) aggregates others with `--peer name=url`, pulling `/api/v1/peer/export` and relaying their live events through `/api/v1/peer/stream`.
|
||||
- **Federation:** one instance (the hub) aggregates others with `--peer name=url`, pulling `/api/v1/peer/export` and relaying their live events through `/api/v1/peer/stream`. Outbound reports and, when `URUTAU_ENFORCE_SHARE` is on, second firewall decisions and unbans travel the same way, each side applying its own exclusions.
|
||||
|
||||
## How it works
|
||||
|
||||
```
|
||||
Traefik access.log auth.log (sshd) fail2ban.log
|
||||
│ │ │
|
||||
└─────────┬───────────┴────────────────────┘
|
||||
▼
|
||||
tail + parse (rotation aware, bounded lines)
|
||||
▼
|
||||
classify ──► score per IP ──► state in memory ──► snapshot (/data)
|
||||
│
|
||||
┌─────────────────────────┼─────────────────────┐
|
||||
▼ ▼ ▼
|
||||
dashboard (SSE) /api/v1/* JSON blocklist.txt / .json
|
||||
Traefik access.log auth.log (sshd) fail2ban.log probe.log* egress.log*
|
||||
│ │ │ │ │
|
||||
└────────┬─────────┴─────────────────┴─────────────┘ │
|
||||
▼ │
|
||||
tail + parse (rotation aware, bounded lines) │
|
||||
▼ ▼
|
||||
classify ──► score per IP ──► state in memory ──► snapshot outbound analysis
|
||||
│ │ (/data) │
|
||||
▼ │ ▼
|
||||
second firewall* │ incident tickets
|
||||
(decisions.log ──► host │ (incidents.json)
|
||||
fail2ban, jail urutau) │
|
||||
┌────────────────────────┼─────────────────────┐
|
||||
▼ ▼ ▼
|
||||
dashboard (SSE) /api/v1/* JSON blocklist.txt / .json
|
||||
HTML report
|
||||
|
||||
* optional, fed by the host kit in deploy/host
|
||||
|
||||
hub ── GET /api/v1/peer/export (peer token) ──► peer A
|
||||
│ ── GET /api/v1/peer/stream (live events) ──► peer A
|
||||
@@ -59,17 +75,36 @@ Urutau is a small panel that runs on each of your servers (as a container), read
|
||||
|
||||
Beyond live numbers, Urutau remembers and explains. It keeps 30 days of state and an event registry on disk (`<data-dir>/events/`, capped by `--events-max`, 512 MB by default), so you can pick any period (twelve named ranges or a custom `from`/`to`), replay it, and open an IP analysis page with a verdict and its reasons, attack families, MITRE ATT&CK techniques, network type, cadence, sessions, campaigns and recommended actions, with a STIX 2.1 export. The registry holds attackers only: never the address of a legitimate visitor. See [docs/architecture.md](docs/architecture.md).
|
||||
|
||||
## Second firewall
|
||||
|
||||
Optional (`URUTAU_ENFORCE`, default `off`; `observe` decides in memory only, `on` also writes the decisions to `--enforce-log`). The host kit in `deploy/host` (`install.sh --enforce`) installs the fail2ban filter, action and jail `urutau`, which apply the decisions; the ban only drops connections the address starts, so replies to the server's own connections keep flowing. A decision has a reason, among them:
|
||||
|
||||
- a burst of attack events in 10 minutes (`--enforce-threshold`, default 5);
|
||||
- `known-attacker`: an address already hostile (or suspicious with score 100 or more) is banned on its first new malicious event;
|
||||
- slow attackers: 10 SSH failures (`ssh-probe` counts half) or 10 to 20 web scan/exploit events in 24 h or 7 days without a legitimate visit;
|
||||
- `port-scan`: 10 distinct unserved ports in 10 minutes;
|
||||
- `neighbor-campaign`: 3 or more distinct addresses of a /24 (IPv4) or /64 (IPv6) banned in the last 24 h make one attack event of another address of the prefix enough;
|
||||
- a sweep every 10 minutes bans addresses active in the last 24 h that nothing blocks yet, at most `--enforce-max-per-min` (default 60) decisions per minute.
|
||||
|
||||
It never blocks trusted addresses, private ranges, CDN (Cloudflare) and public resolver ranges, peers, the server itself, legitimate visitors, crawlers verified by forward-confirmed reverse DNS (Googlebot, Bingbot, Applebot) or addresses you released. The Defense page shows mode, recent decisions, coverage and releases; the **Unban** button (IPs, IP analysis and Defense) asks the host, through `unban.log` next to `--enforce-log`, to lift the block and can keep the address from being banned again for 1 h, 24 h or 7 days. With `URUTAU_ENFORCE_SHARE=on` a hub and its peers exchange decisions, applied only when the receiving server also saw the address attack. Coverage counts an attacker as protected when it is listed or banned by any jail.
|
||||
|
||||
## Outbound traffic and incidents
|
||||
|
||||
Optional (`URUTAU_EGRESS=auto|on|off`; `auto` turns it on when the outbound log exists). The host kit logs only new TCP connection attempts through nftables, and a container map names the workloads. Urutau checks them for beaconing (regular conversations with one destination), mining, IRC and SMTP ports, contact with addresses that attacked the server or with Tor relays, DNS outside the allowed resolvers (`URUTAU_EGRESS_RESOLVERS`), unauthorised outbound scans and new countries. Workloads are defined by network or container name (`URUTAU_EGRESS_WORKLOADS`); a `scanner` workload (an authorised surface scanner) has only its scan-shaped traffic summarised, everything else is judged like any other workload. The servers themselves, peers and the host's own provider never raise findings, cloud metadata services polled by the host are `infra`, and regular connections to large CDNs and clouds are low severity.
|
||||
|
||||
Every finding above info severity becomes a ticket `INC-<n>` (list, ticket page, manual tickets, CSV export, `/api/v1/incidents`). A ticket marked `false_positive` or `benign` can suppress findings with exactly its key; a resolved ticket reopens if the finding comes back.
|
||||
|
||||
## Interface
|
||||
|
||||
Pages are grouped in a side rail, with the view kept in the URL hash. A "?" button next to metrics and categories explains what they mean and what to do.
|
||||
Pages are grouped in a side rail (a tab bar on phones), with the view kept in the URL hash. A "?" button next to metrics and categories explains what they mean and what to do.
|
||||
|
||||
- **Monitor:** Overview (headline numbers, timeline, top IPs; a period selector applies everywhere), Live (attacks as animated arcs on a flat map or a 3D globe, including your peers; `--location` sets where this server sits on the map), Services (SLO, error budget and Apdex per service).
|
||||
- **Investigate:** IPs (the scored table and the IP analysis page, `#/ip/<ip>`), Sessions, Campaigns, Replay (a period played back on the map) and Event search.
|
||||
- **Analyze:** Threats, MITRE ATT&CK, Geography (country, state, city, `#/geo/BR/Pernambuco/Recife`), Evolution, Concentration, Survival (time to ban), Traffic (privacy-friendly analytics for legitimate visitors), Where errors come from (app, proxy, blocked, attack, bot, client) and Protocols and TLS.
|
||||
- **Operate:** Defense, Sources and hosts (log sources, peers and the blocklist) and Integrity.
|
||||
- **Reports.**
|
||||
- **Monitor:** Overview (headline numbers, timeline, top IPs; a period selector applies everywhere), Live (attacks as animated arcs on a flat map or a 3D globe, including your peers; `--location` sets where this server sits on the map), Services (SLO, error budget, burn rate and Apdex per service).
|
||||
- **Investigate:** IPs (the scored table and the IP analysis page, `#/ip/<ip>`), Sessions, Campaigns, Replay (a period played back on the map), Event search, Incidents (tickets for outbound findings) and Outbound traffic.
|
||||
- **Analyze:** Threats, MITRE ATT&CK, Geography (country, state, city, `#/geo/BR/Pernambuco/Recife`), Evolution, Concentration, Survival (time to ban), Traffic (privacy-friendly analytics for legitimate visitors), Where errors come from (app, proxy, blocked, attack, bot, client, unknown) and Protocols and TLS.
|
||||
- **Operate:** Defense (ban and blocklist coverage, second firewall, Unban), Sources and hosts (log sources, peers and the blocklist) and Integrity (health of sources, registry and snapshot).
|
||||
- **Reports:** the HTML report of a period.
|
||||
|
||||
See [docs/interface.md](docs/interface.md).
|
||||
On phones, plain data tables become stacked cards, so nothing scrolls sideways. See [docs/interface.md](docs/interface.md) for every page with screenshots and the HTTP routes.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -188,10 +223,11 @@ See **[CONTRIBUTING.md](CONTRIBUTING.md)** and **[docs/architecture.md](docs/arc
|
||||
|
||||
## Known limits
|
||||
|
||||
- Only three sources: Traefik JSON access log, sshd lines from `auth.log` (ISO timestamps) and `fail2ban.log`.
|
||||
- State is kept for 30 days at most (`--retention`), with up to 20,000 tracked IPs; the event registry is capped by `--events-max`.
|
||||
- The dashboard login is a single shared token; there are no user accounts.
|
||||
- Scores are heuristics, not proof of malicious intent.
|
||||
- Sources: Traefik access log (JSON or default text format), sshd lines from `auth.log` (ISO timestamps), `fail2ban.log`, and the optional probe and outbound connection logs written by the host kit.
|
||||
- State is kept for 30 days at most (`--retention`), with up to 20,000 tracked IPs; the event registry is capped by `--events-max`; incidents hold up to 5000 tickets.
|
||||
- The dashboard login is a single shared token; there are no user accounts, and a ticket author is a free-text name.
|
||||
- Scores and second firewall decisions are heuristics, not proof of malicious intent. Start with `observe`.
|
||||
- Outbound analysis and the second firewall need the host kit (nftables, rsyslog, fail2ban); without it those pages stay empty.
|
||||
|
||||
## Where it's going
|
||||
|
||||
@@ -201,6 +237,7 @@ Summary of the [ROADMAP](ROADMAP.md):
|
||||
|---|---|
|
||||
| **Done (1.0.0)** | Log collection, classification and scoring, offline geolocation, User-Agent parsing, privacy-friendly web analytics, snapshot persistence, dashboard with SSE, token login, blocklist, federation, Docker image and CI/CD |
|
||||
| **Done (1.2.0)** | 30-day retention, any period, on-disk event registry, replay, IP analysis with verdict, MITRE ATT&CK, campaigns, STIX 2.1 and stable metrics |
|
||||
| **Done (1.4.0 to 1.6.0)** | Second firewall with Unban and decision sharing, outbound traffic analysis, incident management, HTML report, Tor lists, network probes, text-format Traefik logs, verified crawlers and forge browsing recognized, phone layout |
|
||||
| **Next** | More log sources, webhook alerts, Prometheus metrics |
|
||||
| **Later** | IP reputation enrichment |
|
||||
| **Not planned** | Active scanning or counterattack, mandatory cloud services, telemetry |
|
||||
|
||||
@@ -16,37 +16,53 @@
|
||||
|
||||
<p align="center"><img src="docs/img/defense-dark-pt.png" width="900" alt="Página Defesa do Urutau com a seção do segundo firewall"><br><sub>Defesa: o segundo firewall em modo observe, ao lado do fail2ban do host.</sub></p>
|
||||
|
||||
<p align="center"><img src="docs/img/egress-dark-pt.png" width="900" alt="Egress"><br><sub>Saída: rajadas de varredura, beacons e mineração em contêineres.</sub></p>
|
||||
<p align="center"><img src="docs/img/egress-dark-pt.png" width="900" alt="Página Tráfego de saída do Urutau: veredito, beacons, rajadas de varredura e mineração em contêineres"><br><sub>Tráfego de saída: rajadas de varredura, beacons e mineração em contêineres.</sub></p>
|
||||
|
||||
**Status: estável, v1.0.0.** Veja o [CHANGELOG.pt-BR.md](CHANGELOG.pt-BR.md) para saber exatamente o que foi entregue.
|
||||
<p align="center"><img src="docs/img/incidents-dark-pt.png" width="900" alt="Página Incidentes do Urutau: chamados para achados do tráfego de saída"><br><sub>Incidentes: cada achado de saída vira um chamado que você tria.</sub></p>
|
||||
|
||||
O Urutau é um painel pequeno que roda em cada um dos seus servidores (como container), lê os logs que o servidor já escreve e responde a uma pergunta: quem está me atacando agora? Ele classifica a atividade hostil, pontua cada IP de origem, mantém uma janela móvel em disco e serve um dashboard embutido, uma API JSON e uma blocklist exportável.
|
||||
<p align="center"><img src="docs/img/overview-mobile.png" height="420" alt="Visão geral do Urutau no celular"> <img src="docs/img/defense-mobile.png" height="420" alt="Página Defesa do Urutau no celular"><br><sub>O layout de celular: uma barra de abas substitui a lateral e as tabelas viram cartões.</sub></p>
|
||||
|
||||
- **Lê o que já existe:** o access log JSON do Traefik, `/var/log/auth.log` (sshd) e `/var/log/fail2ban.log`. Sem agente no caminho da rede, sem captura de pacotes, sem telemetria.
|
||||
- **Classifica:** `scanner`, `exploit`, `bruteforce`, `ssh-fail`, `ssh-probe`, `ban`, além dos benignos `ok`, `notfound` e `ssh-ok`.
|
||||
- **Pontua IPs:** cada evento soma peso ao IP de origem. Pontuação 10 ou mais é **suspeito**; **hostil** exige 50 ou mais **e** um sinal forte (uma ferramenta de ataque, duas ou mais categorias de ataque, um ban ou uma tentativa clara de exploit recusada). Sondas de scanner e exploit que receberam resposta 2xx ou 3xx pesam só 0,5. Um IP com login SSH bem-sucedido nunca é hostil e nunca vai para a blocklist.
|
||||
**Status: estável, v1.6.0.** Veja o [CHANGELOG.pt-BR.md](CHANGELOG.pt-BR.md) para saber exatamente o que foi entregue.
|
||||
|
||||
O Urutau é um painel pequeno que roda em cada um dos seus servidores (como container), lê os logs que o servidor já escreve e responde a uma pergunta: quem está me atacando agora? Ele classifica a atividade hostil, pontua cada IP de origem, guarda 30 dias em disco, serve um dashboard embutido, uma API JSON e uma blocklist exportável, e ainda pode decidir quais atacantes bloquear (um segundo firewall), vigiar o que seus próprios contêineres enviam para fora (análise de tráfego de saída) e transformar o que encontra em chamados e num relatório HTML.
|
||||
|
||||
- **Lê o que já existe:** o access log do Traefik (JSON, ou o formato texto padrão, com menos campos), `/var/log/auth.log` (sshd) e `/var/log/fail2ban.log`. Duas fontes opcionais vêm do kit de host em `deploy/host`: o log de sondagens de rede (novas conexões de entrada a portas em que ninguém escuta, cada uma um evento `port-scan`) e o log de conexões de saída. Sem agente no caminho da rede, sem captura de pacotes, sem telemetria.
|
||||
- **Classifica:** `scanner`, `exploit`, `bruteforce`, `ssh-fail`, `ssh-probe`, `ban`, `port-scan`, além dos benignos `ok`, `notfound` e `ssh-ok`. Navegar num forge de código público (caminhos `/owner/repo/src/commit/<sha>/...`, `raw`, `blame`, `blob`, `tree`) não é ataque; sondas reais como `/.env` ou `/.git/config` continuam sendo.
|
||||
- **Pontua IPs:** cada evento soma peso ao IP de origem. Pontuação 10 ou mais é **suspeito**; **hostil** exige 50 ou mais **e** um sinal forte (uma ferramenta de ataque, duas ou mais categorias de ataque, um ban ou uma tentativa clara de exploit recusada). Sondas de scanner e exploit que receberam resposta 2xx ou 3xx pesam só 0,5. Um IP com login SSH bem-sucedido nunca é hostil e nunca vai para a blocklist. Bans da jail `urutau` (decisões do próprio Urutau) e da `recidive` não contam como evidência, para o sistema não se alimentar de si mesmo.
|
||||
- **Segundo firewall (opcional):** `URUTAU_ENFORCE=off|observe|on`. O Urutau decide quais endereços atacantes bloquear e grava as decisões num arquivo; o fail2ban do host (jail `urutau`) as aplica, então o Urutau não precisa de privilégios. `observe` mostra o que seria bloqueado. Veja [Segundo firewall](#segundo-firewall).
|
||||
- **Análise de tráfego de saída (opcional):** as novas conexões de saída do host e dos contêineres são checadas quanto a beaconing, mineração, portas de IRC e SMTP, contato com atacantes ou relays Tor, DNS fora dos resolvers permitidos, varreduras não autorizadas e países novos. Veja [Tráfego de saída e incidentes](#tráfego-de-saída-e-incidentes).
|
||||
- **Gestão de incidentes:** cada achado de saída vira um chamado (`INC-<n>`) com status, severidade, responsável, tags, conclusão, comentários e histórico.
|
||||
- **Relatório HTML:** um relatório A4 imprimível (`/api/v1/report?format=html`): capa, resumo executivo em linguagem simples, recomendações por regras, ameaças, geografia, erros e saúde, visitantes, defesa, segundo firewall e tráfego de saída. A página Relatórios mostra uma prévia, baixa ou imprime.
|
||||
- **Tor:** as listas oficiais de saída e de relays são baixadas a cada 6 horas (`URUTAU_TOR_AUTO`, ligado por padrão); requisições de saídas Tor são marcadas `tor`, e um workload falando com um relay Tor é um achado de saída alto. `--tor-exits` soma um arquivo seu.
|
||||
- **Geolocalização offline:** país, cidade e ASN de todo IP a partir das bases gratuitas DB-IP Lite, baixadas e atualizadas pelo próprio Urutau, lidas por um leitor MMDB embutido e sem dependências. Nada é consultado online.
|
||||
- **Entende User-Agents:** navegador, sistema operacional, dispositivo, bots e ferramentas de ataque.
|
||||
- **Entende User-Agents:** navegador, sistema operacional, dispositivo, bots e ferramentas de ataque. Googlebot, Bingbot e Applebot são reconhecidos por DNS reverso confirmado, seja qual for o User-Agent declarado.
|
||||
- **Web analytics do tráfego legítimo:** visitantes únicos, páginas, referrers, países, navegadores, dispositivos, latência (p50 e p95) e bytes, com mapa-múndi, no lugar do analytics do seu proxy. Páginas **Ameaças** e **Tráfego** separadas.
|
||||
- **Leve:** só biblioteca padrão do Go, um binário estático, limite suave de memória de 256 MiB, estado em um único arquivo de snapshot. Sem banco de dados.
|
||||
- **Dashboard ao vivo:** UI vanilla embutida (inglês e português, claro e escuro), atualizada por Server-Sent Events, com nove páginas (veja abaixo).
|
||||
- **Dashboard ao vivo:** UI vanilla embutida (inglês e português, claro e escuro, com layout para celular), atualizada por Server-Sent Events, com 23 páginas em cinco grupos (veja [Interface](#interface)).
|
||||
- **Blocklist:** IPs hostis e globalmente roteáveis em texto ou JSON, prontos para fail2ban, ipset, nginx ou firewall. O IPv6 é agregado por /64 e exportado como `x:x:x:x::/64`.
|
||||
- **Federação:** uma instância (o hub) agrega outras com `--peer nome=url`, puxando `/api/v1/peer/export` e repassando os eventos ao vivo deles por `/api/v1/peer/stream`.
|
||||
- **Federação:** uma instância (o hub) agrega outras com `--peer nome=url`, puxando `/api/v1/peer/export` e repassando os eventos ao vivo deles por `/api/v1/peer/stream`. Relatórios de saída e, com `URUTAU_ENFORCE_SHARE` ligado, decisões do segundo firewall e desbans viajam pelo mesmo caminho, cada lado aplicando as próprias exclusões.
|
||||
|
||||
## Como funciona
|
||||
|
||||
```
|
||||
access.log do Traefik auth.log (sshd) fail2ban.log
|
||||
│ │ │
|
||||
└─────────┬───────────┴────────────────────┘
|
||||
▼
|
||||
tail + parse (tolera rotação, linhas limitadas)
|
||||
▼
|
||||
classifica ──► pontua por IP ──► estado em memória ──► snapshot (/data)
|
||||
│
|
||||
┌───────────────────────────┼─────────────────────┐
|
||||
▼ ▼ ▼
|
||||
dashboard (SSE) /api/v1/* JSON blocklist.txt / .json
|
||||
access.log Traefik auth.log (sshd) fail2ban.log probe.log* egress.log*
|
||||
│ │ │ │ │
|
||||
└────────┬─────────┴─────────────────┴─────────────┘ │
|
||||
▼ │
|
||||
tail + parse (tolera rotação, linhas limitadas) │
|
||||
▼ ▼
|
||||
classifica ──► pontua por IP ──► estado em memória ──► snapshot análise de saída
|
||||
│ │ (/data) │
|
||||
▼ │ ▼
|
||||
segundo firewall* │ chamados (incidentes)
|
||||
(decisions.log ──► fail2ban │ (incidents.json)
|
||||
do host, jail urutau) │
|
||||
┌────────────────────────┼─────────────────────┐
|
||||
▼ ▼ ▼
|
||||
dashboard (SSE) /api/v1/* JSON blocklist.txt / .json
|
||||
relatório HTML
|
||||
|
||||
* opcional, alimentado pelo kit de host em deploy/host
|
||||
|
||||
hub ── GET /api/v1/peer/export (token de peer) ──► peer A
|
||||
│ ── GET /api/v1/peer/stream (eventos ao vivo) ──► peer A
|
||||
@@ -59,17 +75,36 @@ O Urutau é um painel pequeno que roda em cada um dos seus servidores (como cont
|
||||
|
||||
Além dos números ao vivo, o Urutau lembra e explica. Ele guarda 30 dias de estado e um registro de eventos em disco (`<data-dir>/events/`, limitado por `--events-max`, 512 MB por padrão), então você pode escolher qualquer período (doze intervalos nomeados ou um `from`/`to` personalizado), reproduzi-lo e abrir uma página de análise de IP com um veredito e suas razões, famílias de ataque, técnicas MITRE ATT&CK, tipo de rede, cadência, sessões, campanhas e ações recomendadas, com exportação STIX 2.1. O registro guarda só atacantes: nunca o endereço de um visitante legítimo. Veja [docs/pt-BR/arquitetura.md](docs/pt-BR/arquitetura.md).
|
||||
|
||||
## Segundo firewall
|
||||
|
||||
Opcional (`URUTAU_ENFORCE`, padrão `off`; `observe` decide só em memória, `on` também grava as decisões em `--enforce-log`). O kit de host em `deploy/host` (`install.sh --enforce`) instala o filtro, a ação e a jail `urutau` do fail2ban, que aplicam as decisões; o ban só derruba conexões que o endereço inicia, então as respostas às conexões do próprio servidor continuam fluindo. Cada decisão tem um motivo, entre eles:
|
||||
|
||||
- uma rajada de eventos de ataque em 10 minutos (`--enforce-threshold`, padrão 5);
|
||||
- `known-attacker`: um endereço já hostil (ou suspeito com pontuação 100 ou mais) é banido no primeiro novo evento malicioso;
|
||||
- atacantes lentos: 10 falhas de SSH (`ssh-probe` conta metade) ou 10 a 20 eventos de scan/exploit web em 24 h ou 7 dias sem uma visita legítima;
|
||||
- `port-scan`: 10 portas sem serviço distintas em 10 minutos;
|
||||
- `neighbor-campaign`: 3 ou mais endereços distintos de um /24 (IPv4) ou /64 (IPv6) banidos nas últimas 24 h fazem um evento de ataque de outro endereço do prefixo bastar;
|
||||
- uma varredura a cada 10 minutos bane endereços ativos nas últimas 24 h que nada bloqueia ainda, no máximo `--enforce-max-per-min` (padrão 60) decisões por minuto.
|
||||
|
||||
Nunca bloqueia endereços confiáveis, faixas privadas, faixas de CDN (Cloudflare) e de resolvers públicos, peers, o próprio servidor, visitantes legítimos, crawlers verificados por DNS reverso confirmado (Googlebot, Bingbot, Applebot) nem endereços que você liberou. A página Defesa mostra modo, decisões recentes, cobertura e liberações; o botão **Desbanir** (IPs, análise de IP e Defesa) pede ao host, por `unban.log` ao lado de `--enforce-log`, que levante o bloqueio e pode impedir novo ban do endereço por 1 h, 24 h ou 7 dias. Com `URUTAU_ENFORCE_SHARE=on` um hub e seus peers trocam decisões, aplicadas só quando o servidor receptor também viu o endereço atacar. A cobertura conta um atacante como protegido quando ele está listado ou banido por qualquer jail.
|
||||
|
||||
## Tráfego de saída e incidentes
|
||||
|
||||
Opcional (`URUTAU_EGRESS=auto|on|off`; `auto` liga quando o log de saída existe). O kit de host registra, pelo nftables, só tentativas novas de conexão TCP, e um mapa de contêineres nomeia os workloads. O Urutau checa beaconing (conversas regulares com um destino), mineração, portas de IRC e SMTP, contato com endereços que atacaram o servidor ou com relays Tor, DNS fora dos resolvers permitidos (`URUTAU_EGRESS_RESOLVERS`), varreduras de saída não autorizadas e países novos. Os workloads são definidos por nome de rede ou de contêiner (`URUTAU_EGRESS_WORKLOADS`); um workload `scanner` (um scanner de superfície autorizado) tem só o tráfego em forma de varredura resumido, o resto é julgado como qualquer outro workload. Os próprios servidores, peers e o provedor do host nunca geram achados, serviços de metadados de nuvem consultados pelo host são `infra`, e conexões regulares a grandes CDNs e nuvens têm severidade baixa.
|
||||
|
||||
Todo achado acima de info vira um chamado `INC-<n>` (lista, página do chamado, chamados manuais, exportação CSV, `/api/v1/incidents`). Um chamado marcado `false_positive` ou `benign` pode suprimir achados com exatamente a sua chave; um chamado resolvido reabre se o achado voltar.
|
||||
|
||||
## Interface
|
||||
|
||||
As páginas são agrupadas numa barra lateral, com a visão guardada no hash da URL. Um botão "?" ao lado de métricas e categorias explica o que significam e o que fazer.
|
||||
As páginas são agrupadas numa barra lateral (barra de abas no celular), com a visão guardada no hash da URL. Um botão "?" ao lado de métricas e categorias explica o que significam e o que fazer.
|
||||
|
||||
- **Monitorar:** Visão geral (números principais, linha do tempo, principais IPs; um seletor de período vale em todo lugar), Ao vivo (ataques como arcos animados em mapa plano ou globo 3D, incluindo seus peers; `--location` define onde este servidor fica no mapa), Serviços (SLO, orçamento de erro e Apdex por serviço).
|
||||
- **Investigar:** IPs (a tabela pontuada e a página de análise de IP, `#/ip/<ip>`), Sessões, Campanhas, Replay (um período reproduzido no mapa) e Busca de eventos.
|
||||
- **Analisar:** Ameaças, MITRE ATT&CK, Geografia (país, estado, cidade, `#/geo/BR/Pernambuco/Recife`), Evolução, Concentração, Sobrevivência (tempo até o ban), Tráfego (analytics amigável à privacidade para visitantes legítimos), De onde vêm os erros (app, proxy, blocked, attack, bot, client) e Protocolos e TLS.
|
||||
- **Operar:** Defesa, Fontes e hosts (fontes de log, peers e a blocklist) e Integridade.
|
||||
- **Relatórios.**
|
||||
- **Monitorar:** Visão geral (números principais, linha do tempo, principais IPs; um seletor de período vale em todo lugar), Ao vivo (ataques como arcos animados em mapa plano ou globo 3D, incluindo seus peers; `--location` define onde este servidor fica no mapa), Serviços (SLO, orçamento de erro, burn rate e Apdex por serviço).
|
||||
- **Investigar:** IPs (a tabela pontuada e a página de análise de IP, `#/ip/<ip>`), Sessões, Campanhas, Replay (um período reproduzido no mapa), Busca de eventos, Incidentes (chamados dos achados de saída) e Tráfego de saída.
|
||||
- **Analisar:** Ameaças, MITRE ATT&CK, Geografia (país, estado, cidade, `#/geo/BR/Pernambuco/Recife`), Evolução, Concentração, Sobrevivência (tempo até o ban), Tráfego (analytics amigável à privacidade para visitantes legítimos), De onde vêm os erros (app, proxy, blocked, attack, bot, client, unknown) e Protocolos e TLS.
|
||||
- **Operar:** Defesa (cobertura de bans e da blocklist, segundo firewall, Desbanir), Fontes e hosts (fontes de log, peers e a blocklist) e Integridade (saúde das fontes, do registro e do snapshot).
|
||||
- **Relatórios:** o relatório HTML de um período.
|
||||
|
||||
Veja [docs/pt-BR/interface.md](docs/pt-BR/interface.md).
|
||||
No celular, tabelas de dados simples viram cartões empilhados, e nada rola para o lado. Veja [docs/pt-BR/interface.md](docs/pt-BR/interface.md) para cada página com capturas de tela e as rotas HTTP.
|
||||
|
||||
## Instalação
|
||||
|
||||
@@ -188,10 +223,11 @@ Veja **[CONTRIBUTING.pt-BR.md](CONTRIBUTING.pt-BR.md)** e **[docs/pt-BR/arquitet
|
||||
|
||||
## Limites conhecidos
|
||||
|
||||
- Só três fontes: access log JSON do Traefik, linhas do sshd no `auth.log` (timestamps ISO) e `fail2ban.log`.
|
||||
- O estado é mantido por no máximo 30 dias (`--retention`), com até 20.000 IPs rastreados; o registro de eventos é limitado por `--events-max`.
|
||||
- O login do dashboard é um token único compartilhado; não há contas de usuário.
|
||||
- Pontuações são heurísticas, não prova de intenção maliciosa.
|
||||
- Fontes: access log do Traefik (JSON ou formato texto padrão), linhas do sshd no `auth.log` (timestamps ISO), `fail2ban.log` e os logs opcionais de sondagens e de conexões de saída escritos pelo kit de host.
|
||||
- O estado é mantido por no máximo 30 dias (`--retention`), com até 20.000 IPs rastreados; o registro de eventos é limitado por `--events-max`; os incidentes comportam até 5000 chamados.
|
||||
- O login do dashboard é um token único compartilhado; não há contas de usuário, e o autor de um chamado é um nome em texto livre.
|
||||
- Pontuações e decisões do segundo firewall são heurísticas, não prova de intenção maliciosa. Comece por `observe`.
|
||||
- A análise de saída e o segundo firewall precisam do kit de host (nftables, rsyslog, fail2ban); sem ele essas páginas ficam vazias.
|
||||
|
||||
## Para onde vai
|
||||
|
||||
@@ -201,6 +237,7 @@ Resumo do [ROADMAP](ROADMAP.pt-BR.md):
|
||||
|---|---|
|
||||
| **Feito (1.0.0)** | Coleta de logs, classificação e pontuação, geolocalização offline, parse de User-Agent, web analytics amigável à privacidade, snapshot em disco, dashboard com SSE, login por token, blocklist, federação, imagem Docker e CI/CD |
|
||||
| **Feito (1.2.0)** | Retenção de 30 dias, qualquer período, registro de eventos em disco, replay, análise de IP com veredito, MITRE ATT&CK, campanhas, STIX 2.1 e métricas estáveis |
|
||||
| **Feito (1.4.0 a 1.6.0)** | Segundo firewall com Desbanir e compartilhamento de decisões, análise de tráfego de saída, gestão de incidentes, relatório HTML, listas Tor, sondagens de rede, logs de texto do Traefik, crawlers verificados e navegação em forge reconhecidos, layout de celular |
|
||||
| **Próximo** | Mais fontes de log, alertas por webhook, métricas Prometheus |
|
||||
| **Depois** | Enriquecimento com reputação de IP |
|
||||
| **Fora do plano** | Varredura ativa ou contra-ataque, serviços de nuvem obrigatórios, telemetria |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**English** · [Português](ROADMAP.pt-BR.md)
|
||||
|
||||
Urutau is lightweight, always-on threat intelligence for self-hosted servers: it reads the logs your server already writes, classifies hostile activity, scores IPs and exports a blocklist. Always read-only toward the network, with no telemetry.
|
||||
Urutau is lightweight, always-on threat intelligence for self-hosted servers: it reads the logs your server already writes, classifies hostile activity, scores IPs and exports a blocklist. It never sends traffic to the IPs it lists and has no telemetry; the optional second firewall only writes a file that a host jail reads.
|
||||
|
||||
## Done
|
||||
|
||||
@@ -21,6 +21,16 @@ Urutau is lightweight, always-on threat intelligence for self-hosted servers: it
|
||||
|
||||
- **Investigation (1.2.0):** 30-day retention, twelve ranges and custom periods, an on-disk event registry, replay, IP analysis with verdict and reasons, attack families, MITRE ATT&CK, campaigns, STIX 2.1 export and stable metrics.
|
||||
|
||||
- **Service health and error classes (1.3.0):** per-service SLO, error budget, burn rate and Apdex, error classes, episodes with Kaplan-Meier survival, visitors counted as people with a real browser, a side rail of pages (Monitor, Investigate, Analyze, Operate, Reports) and the anonymous visits stream.
|
||||
|
||||
- **Second firewall and egress (1.4.0):** `--enforce` decisions applied by a host fail2ban jail, outbound connection analysis (beacons, mining, DNS bypass, unauthorised scans), the host kit in `deploy/host` and the HTML report.
|
||||
|
||||
- **Probes, Tor and unban (1.4.1 to 1.4.8):** network probes on closed ports, backend pagination, automatic Tor lists, text Traefik logs, history-based bans, unban from the interface with operator allowances and fewer egress false positives.
|
||||
|
||||
- **Incident management (1.5.0 to 1.5.7):** tickets from egress findings with status, comments, history and suppression, and mobile fixes.
|
||||
|
||||
- **Forge browsing, verified crawlers and coverage (1.6.0):** repository pages are not attacks, crawlers confirmed by reverse DNS are never banned, our own bans no longer feed the score, honest blocklist coverage and a slow-attacker policy; phone tables as cards (1.5.8, shipped inside 1.6.0).
|
||||
|
||||
## Next
|
||||
|
||||
- **More log sources:** other web servers and proxies (nginx, Caddy), and more daemons' auth failures.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[English](ROADMAP.md) · **Português**
|
||||
|
||||
O Urutau é threat intelligence leve e sempre ligado para servidores self-hosted: lê os logs que o servidor já escreve, classifica atividade hostil, pontua IPs e exporta uma blocklist. Sempre somente leitura em relação à rede, sem telemetria.
|
||||
O Urutau é threat intelligence leve e sempre ligado para servidores self-hosted: lê os logs que o servidor já escreve, classifica atividade hostil, pontua IPs e exporta uma blocklist. Nunca envia tráfego aos IPs que lista e não tem telemetria; o segundo firewall opcional só escreve um arquivo que uma jail do host lê.
|
||||
|
||||
## Feito
|
||||
|
||||
@@ -21,6 +21,16 @@ O Urutau é threat intelligence leve e sempre ligado para servidores self-hosted
|
||||
|
||||
- **Investigação (1.2.0):** retenção de 30 dias, doze intervalos e períodos personalizados, registro de eventos em disco, replay, análise de IP com veredito e razões, famílias de ataque, MITRE ATT&CK, campanhas, exportação STIX 2.1 e métricas estáveis.
|
||||
|
||||
- **Saúde dos serviços e classes de erro (1.3.0):** SLO por serviço, orçamento de erro, burn rate e Apdex, classes de erro, episódios com sobrevivência de Kaplan-Meier, visitantes contados como pessoas com navegador de verdade, um menu lateral de páginas (Monitorar, Investigar, Analisar, Operar, Relatórios) e o stream de visitas anônimas.
|
||||
|
||||
- **Segundo firewall e egress (1.4.0):** decisões de `--enforce` aplicadas por uma jail do fail2ban no host, análise das conexões de saída (beacons, mineração, desvio de DNS, varreduras não autorizadas), o kit do host em `deploy/host` e o relatório HTML.
|
||||
|
||||
- **Probes, Tor e desban (1.4.1 a 1.4.8):** probes de rede em portas fechadas, paginação no backend, listas Tor automáticas, logs de texto do Traefik, bans pelo histórico, desban pela interface com liberações do operador e menos falsos positivos no egress.
|
||||
|
||||
- **Gestão de incidentes (1.5.0 a 1.5.7):** chamados a partir dos achados de egress com status, comentários, histórico e supressão, e ajustes para celular.
|
||||
|
||||
- **Navegação em forge, crawlers verificados e cobertura (1.6.0):** páginas de repositório não são ataque, crawlers confirmados por DNS reverso nunca são banidos, nossos próprios bans deixam de alimentar a pontuação, cobertura honesta da blocklist e uma política para atacantes lentos; tabelas em cartões no celular (1.5.8, entregue dentro da 1.6.0).
|
||||
|
||||
## Próximo
|
||||
|
||||
- **Mais fontes de log:** outros servidores web e proxies (nginx, Caddy) e falhas de autenticação de mais daemons.
|
||||
|
||||
@@ -12,7 +12,7 @@ Do not open a public issue with exploit details. Open a minimal issue asking for
|
||||
|
||||
- **Hostile log fields:** paths, User-Agents, user names, hosts and jails are length-limited when parsed, kept as data, and escaped when rendered. A malformed, oversized or crafted line must be counted as malformed, never crash the daemon, exhaust memory or inject markup, a command or a script into the dashboard. The dashboard ships a Content-Security-Policy that forbids inline script and style.
|
||||
- **Authentication:** the dashboard and every API route except `/api/health` need `URUTAU_TOKEN` (at least 32 characters and about 128 bits of estimated entropy, compared in constant time; it can come from `URUTAU_TOKEN_FILE`), either as a bearer token or through a login that sets a session cookie (`HttpOnly`, `SameSite=Strict`, `Secure` over HTTPS) valid for 12 hours. The session is revocable: it is a random id kept in memory, logout revokes it and closes its live stream, and a restart invalidates all sessions. Login and logout reject cross-site requests. After 5 failures per 10 minutes from a client (IPv6 counted per /64) the login answers 429, yet the correct token still gets in after a 1 second delay, so an attacker cannot lock the owner out; wrong bearer tokens count as failures too. The client IP comes from the TCP peer; `X-Forwarded-For` is honored only when the peer is in `--trusted-proxy` (default: the private networks), read from right to left, so it cannot be spoofed from outside. Generate tokens with `openssl rand -base64 48` (`-hex 32` also works).
|
||||
- **Peer token:** The server token (`URUTAU_PEER_TOKEN`, also as `_FILE`; 32+ characters, about 128 bits of estimated entropy, not periodic or sequential, different from `URUTAU_TOKEN`) is the only credential the local export accepts, and it only opens the three federation routes, `GET /api/v1/peer/export`, the live stream `GET /api/v1/peer/stream` (at most 10 connections, malicious events only) and `GET /api/v1/peer/period` (the study a hub merges; at most two run at once); every other route answers 403 to it, and `URUTAU_TOKEN` is refused (401) on all three. Without a peer token they are a 404. `--peer-allow` restricts them to source CIDRs. `URUTAU_PEER_TOKEN_<NAME>` values are client credentials a hub sends to that peer; they never open the local export, and peer names that collide in the variable name are refused. A hub refuses to start with a peer that has no token, only talks to those two routes, requires `https` outside loopback, does not follow redirects, uses a 4 s timeout and an 8 MB limit, and sanitizes and caps everything a peer sends: an `admin` flag coming from a peer is ignored and a peer's `Strong` flag only counts with a score of 50 or more. The live relay from each peer is capped at about 50 events per second and about 1 MB/s (a peer that sends more is disconnected), lines of at most 16 KB, a 500-event buffer, reconnection with exponential backoff up to 60 s, and every relayed event is rebuilt from validated fields (address, known category, clipped strings without control characters, valid coordinates; the `host` is always the configured peer name). A compromised peer can still add hostile-looking global IPs to the hub's blocklist (only with score 50+ and a strong signal; `admin` and `forged` flags from peers are ignored); set `URUTAU_PEER_BLOCKLIST=off` to keep the blocklist to local observations. Treat a peer as able to read the top 500 IPs, paths and traffic figures its export carries, and its live attack events.
|
||||
- **Peer token:** The server token (`URUTAU_PEER_TOKEN`, also as `_FILE`; 32+ characters, about 128 bits of estimated entropy, not periodic or sequential, different from `URUTAU_TOKEN`) is the only credential the local export accepts, and it only opens the federation routes: `GET /api/v1/peer/export`, the live stream `GET /api/v1/peer/stream` (at most 10 connections, malicious events only), `GET /api/v1/peer/period` (the study a hub merges; at most two run at once), `GET /api/v1/peer/egress` and, with `--enforce-share`, `GET` and `POST /api/v1/peer/decisions` and `POST /api/v1/peer/unban`; every other route answers 403 to it, and `URUTAU_TOKEN` is refused (401) on them. Without a peer token they are a 404. `--peer-allow` restricts them to source CIDRs. `URUTAU_PEER_TOKEN_<NAME>` values are client credentials a hub sends to that peer; they never open the local export, and peer names that collide in the variable name are refused. A hub refuses to start with a peer that has no token, only talks to those routes, requires `https` outside loopback, does not follow redirects, uses a 4 s timeout and an 8 MB limit, and sanitizes and caps everything a peer sends: an `admin` flag coming from a peer is ignored and a peer's `Strong` flag only counts with a score of 50 or more. The live relay from each peer is capped at about 50 events per second and about 1 MB/s (a peer that sends more is disconnected), lines of at most 16 KB, a 500-event buffer, reconnection with exponential backoff up to 60 s, and every relayed event is rebuilt from validated fields (address, known category, clipped strings without control characters, valid coordinates; the `host` is always the configured peer name). A compromised peer can still add hostile-looking global IPs to the hub's blocklist (only with score 50+ and a strong signal; `admin` and `forged` flags from peers are ignored); set `URUTAU_PEER_BLOCKLIST=off` to keep the blocklist to local observations. Treat a peer as able to read the top 500 IPs, paths and traffic figures its export carries, and its live attack events.
|
||||
- **HTTP server limits:** header and body timeouts, `MaxHeaderBytes` of 16 KB, `POST /login` capped at 4 KB, and at most 20 simultaneous live-stream clients (a 21st gets 503 with `Retry-After`; the stream sends a heartbeat every 20 s).
|
||||
- **Information exposure:** `/api/health` returns only `{"status":"ok"}` (no version), log file paths are never shown in the dashboard or to peers, responses carry `Referrer-Policy: same-origin` and a strict Content-Security-Policy.
|
||||
- **Framed requests:** with the `Sec-Fetch-Site`, `Sec-Fetch-Dest` and `Referer` headers in the Traefik log, a request embedded by another page (cross-site or same-site, or a sub-resource destination such as image or script) creates an IP record like any other but weighs 0.25 per event, with at most 30 points per IP from such requests (below the hostile threshold), and never counts as a strong signal. With an attack-tool User-Agent the headers are ignored. The headers come from the client, so a framed visitor never becomes hostile, and a scanner that forges them shows up as suspicious instead of vanishing.
|
||||
@@ -20,12 +20,14 @@ Do not open a public issue with exploit details. Open a minimal issue asking for
|
||||
- **Analytics and blocklist hygiene:** a domain gets an analytics slot only after a 2xx answer (optionally restricted by `--domains`) and inactive domains are pruned, so forged `Host` headers cannot fill memory. The blocklist only contains hostile, globally routable addresses, never `--ignore` or `--trusted` ranges or an IP with a successful SSH login; IPv6 is aggregated by /64 (up to 20,000 tracked entries), so one attacker cannot flood the table. A monitoring User-Agent never excuses an attack request, and with `--monitor-from` it only counts from your monitor networks.
|
||||
- **No unauthenticated mode on the network:** `--insecure-no-auth` is refused unless the bind address is loopback. Exposing the port on a public interface still needs a reverse proxy with TLS.
|
||||
- **Container hardening:** the image runs as an unprivileged user (no `curl` or shell tools needed: its `HEALTHCHECK` is `urutau healthcheck`) with a read-only root filesystem and no capabilities. Logs are mounted read-only, and only the Traefik log directory is mounted from the proxy, never `acme.json` or its configuration. Logs come from a dedicated host directory, `/var/log/urutau`, not the whole `/var/log`. `--trusted-proxy` defaults to loopback only; the compose file creates the `urutau-edge` network (`10.250.0.0/24`) and trusts just that, so keep only the reverse proxy on it, since another container there could forge `X-Forwarded-For`. The only write target is the data volume (snapshot, mode `0700` directory).
|
||||
- **Read-only by design:** Urutau reads logs and never sends traffic to the IPs it lists. The only outbound connections are reverse DNS lookups, the periodic download of the DB-IP Lite databases from `download.db-ip.com` (verified by opening the file before it replaces the old one; a failure never stops the service) and, on a hub, the polls to the configured peers. Geolocation lookups are local.
|
||||
- **Read-only by design:** Urutau reads logs and never sends traffic to the IPs it lists. The only outbound connections are reverse DNS lookups, the periodic download of the DB-IP Lite databases from `download.db-ip.com` (verified by opening the file before it replaces the old one; a failure never stops the service), the Tor exit and relay lists from `check.torproject.org` and `onionoo.torproject.org` every 6 hours (`--tor-auto=off` turns it off) and, on a hub, the polls to the configured peers. Geolocation lookups are local.
|
||||
- **Second firewall:** it is off by default (`--enforce=off`). Urutau gains no privileges: it only appends lines to a decision file and a jail of the host fail2ban applies them. A line carries nothing the attacker controls (the address is re-formatted, the reason is one of a fixed list of slugs, host and source names are reduced to `[A-Za-z0-9._-]`), the file rotates at 20 MB, and at most `--enforce-max-per-min` decisions are written per minute. It never bans private ranges, `--trusted`, Cloudflare ranges, public resolvers, peers, the server itself, verified crawlers or addresses with a legitimate visit in the last 24 hours. Decisions from a peer are accepted only with a fixed reason, a TTL capped at 6 hours and an address this server also saw attacking. The unban file is written only by an authenticated user (`POST /api/v1/enforce/unban`), never by a peer token without `--enforce-share`.
|
||||
- **Egress and incidents:** egress analysis only reads a kernel log written by the host kit, which logs and never drops. Tickets in `<data-dir>/incidents.json` are written with mode 0600, bounded (5,000 tickets, 200 comments, 500 history entries), refuse cross-site writes and are closed to the peer token.
|
||||
- **Privacy and local-first:** there is no telemetry. IPs and request details stay on your servers (and on the hub you configure).
|
||||
- **Visitor privacy (LGPD and GDPR):** the Traffic page counts unique visitors with a hash computed with a daily salt, so a visitor cannot be followed across days, and the IP address of a legitimate visitor is never persisted. There are no cookies for visitors, no fingerprinting and no request to third parties. IPs are retained only for hostile activity, for at most the retention period (7 days). Whether this is enough for your legal basis and notices is your responsibility as the controller.
|
||||
- **Anonymous visits:** legitimate visitors are never stored. The optional `?visits=1` stream carries no address, User-Agent or referrer (city-level position only, at most 20 per second) and is never written to disk. Paths and `Referer` values are normalized to `:id` when they carry an e-mail address, a token or a long identifier, so personal data in a URL does not reach the lists. The newer analysis routes (`/api/v1/techniques`, `/evolution`, `/concentration`, `/survival`, `/sessions/funnel`, `/campaigns`, `/defense`, `/errors`, `/integrity`, `/report`, `/services`, `/protocols`) are user-only: the peer token gets 403 on them.
|
||||
- **Event registry (privacy):** `<data-dir>/events/` keeps one line per event for replay and investigation, but only about attackers: malicious events, bans, successful SSH logins, a 404 to an attack tool, and answers to addresses that are already suspicious or hostile. The address of a legitimate visitor is never written. Files are removed after the retention (30 days at most) and the total is capped by `--events-max` (512 MB by default, `0` turns the registry off). Treat the directory as personal data under the LGPD and the GDPR: same retention, same access control as the rest of the data volume. A full disk or the size cap drops events instead of stopping the service, and a corrupted line is skipped.
|
||||
- **Outbound lookups for verdicts:** the network type is inferred locally from the ASN, organisation and reverse DNS (no external API). Forward-confirmed reverse DNS is used only to confirm a claimed Googlebot or Bingbot. The optional Tor exit list is a local file (`--tor-exits`).
|
||||
- **Outbound lookups for verdicts:** the network type is inferred locally from the ASN, organisation and reverse DNS (no external API). Forward-confirmed reverse DNS is used only to confirm a claimed Googlebot, Bingbot or Applebot (a confirmed crawler is never banned by the second firewall). The Tor lists are cached locally, and `--tor-exits` accepts a local file.
|
||||
- **Third-party data:** the geolocation databases are DB-IP Lite, CC BY 4.0, and the attribution must be kept where the data is shown. The state and city boundaries on the Geography page are from Natural Earth, public domain.
|
||||
|
||||
## Known limitation
|
||||
|
||||
@@ -12,7 +12,7 @@ Não abra uma issue pública com detalhes de exploração. Abra uma issue mínim
|
||||
|
||||
- **Campos hostis de log:** caminhos, User-Agents, usuários, hosts e jails têm tamanho limitado no parse, são mantidos como dado e escapados ao renderizar. Uma linha malformada, gigante ou forjada deve ser contada como malformada, nunca derrubar o daemon, esgotar memória ou injetar marcação, comando ou script no dashboard. O dashboard envia uma Content-Security-Policy que proíbe script e estilo inline.
|
||||
- **Autenticação:** o dashboard e toda rota da API, exceto `/api/health`, exigem `URUTAU_TOKEN` (no mínimo 32 caracteres e cerca de 128 bits de entropia estimada, comparado em tempo constante; pode vir de `URUTAU_TOKEN_FILE`), como bearer token ou por um login que define um cookie de sessão (`HttpOnly`, `SameSite=Strict`, `Secure` em HTTPS) válido por 12 horas. A sessão é revogável: é um id aleatório guardado em memória, o logout a revoga e fecha o stream ao vivo dela, e um reinício invalida todas as sessões. Login e logout rejeitam requisições cross-site. Após 5 falhas a cada 10 minutos de um cliente (IPv6 contado por /64) o login responde 429, mas o token correto ainda entra após 1 segundo de atraso, para que um atacante não tranque o dono do lado de fora; bearer tokens errados também contam como falha. O IP do cliente vem do peer TCP; `X-Forwarded-For` só vale quando o peer está em `--trusted-proxy` (padrão: as redes privadas), lido da direita para a esquerda, então não pode ser forjado de fora. Gere tokens com `openssl rand -base64 48` (`-hex 32` também serve).
|
||||
- **Token de peer:** O token de servidor (`URUTAU_PEER_TOKEN`, também via `_FILE`; 32+ caracteres, cerca de 128 bits de entropia estimada, sem padrão periódico nem sequencial, diferente de `URUTAU_TOKEN`) é a única credencial que o export local aceita, e só abre as duas rotas de federação, `GET /api/v1/peer/export` o fluxo ao vivo `GET /api/v1/peer/stream` (no máximo 10 conexões, só eventos maliciosos) e `GET /api/v1/peer/period` (o estudo que um hub mescla; no máximo dois ao mesmo tempo); todas as outras rotas respondem 403 a ele, e o `URUTAU_TOKEN` é recusado (401) nas três. Sem token de peer elas são 404. `--peer-allow` restringe as três a CIDRs de origem. Os valores `URUTAU_PEER_TOKEN_<NOME>` são credenciais de cliente que um hub envia àquele peer; nunca abrem o export local, e nomes de peer que colidem no nome da variável são recusados. Um hub se recusa a iniciar com um peer sem token, só fala com essas duas rotas, exige `https` fora de loopback, não segue redirects, usa timeout de 4 s e limite de 8 MB, e sanitiza e limita tudo o que um peer envia: um sinalizador `admin` vindo de um peer é ignorado e o `Strong` de um peer só vale com pontuação 50 ou mais. O repasse ao vivo de cada peer é limitado a cerca de 50 eventos por segundo e cerca de 1 MB/s (um peer que manda mais é desconectado), linhas de no máximo 16 KB, buffer de 500 eventos e reconexão com backoff exponencial até 60 s, e cada evento repassado é reconstruído a partir de campos validados (endereço, categoria conhecida, textos cortados e sem caracteres de controle, coordenadas válidas; o `host` é sempre o nome configurado do peer). Um peer comprometido ainda pode pôr IPs globais com cara de hostis na blocklist do hub (só com pontuação 50+ e sinal forte; os sinalizadores `admin` e `forged` vindos de peers são ignorados); defina `URUTAU_PEER_BLOCKLIST=off` para restringir a blocklist às observações locais. Trate um peer como alguém que pode ler os 500 IPs principais, caminhos e números de tráfego que o export carrega, e os seus eventos de ataque ao vivo.
|
||||
- **Token de peer:** O token de servidor (`URUTAU_PEER_TOKEN`, também via `_FILE`; 32+ caracteres, cerca de 128 bits de entropia estimada, sem padrão periódico nem sequencial, diferente de `URUTAU_TOKEN`) é a única credencial que o export local aceita, e só abre as rotas de federação: `GET /api/v1/peer/export`, o fluxo ao vivo `GET /api/v1/peer/stream` (no máximo 10 conexões, só eventos maliciosos), `GET /api/v1/peer/period` (o estudo que um hub mescla; no máximo dois ao mesmo tempo), `GET /api/v1/peer/egress` e, com `--enforce-share`, `GET` e `POST /api/v1/peer/decisions` e `POST /api/v1/peer/unban`; todas as outras rotas respondem 403 a ele, e o `URUTAU_TOKEN` é recusado (401) nelas. Sem token de peer elas são 404. `--peer-allow` restringe essas rotas a CIDRs de origem. Os valores `URUTAU_PEER_TOKEN_<NOME>` são credenciais de cliente que um hub envia àquele peer; nunca abrem o export local, e nomes de peer que colidem no nome da variável são recusados. Um hub se recusa a iniciar com um peer sem token, só fala com essas rotas, exige `https` fora de loopback, não segue redirects, usa timeout de 4 s e limite de 8 MB, e sanitiza e limita tudo o que um peer envia: um sinalizador `admin` vindo de um peer é ignorado e o `Strong` de um peer só vale com pontuação 50 ou mais. O repasse ao vivo de cada peer é limitado a cerca de 50 eventos por segundo e cerca de 1 MB/s (um peer que manda mais é desconectado), linhas de no máximo 16 KB, buffer de 500 eventos e reconexão com backoff exponencial até 60 s, e cada evento repassado é reconstruído a partir de campos validados (endereço, categoria conhecida, textos cortados e sem caracteres de controle, coordenadas válidas; o `host` é sempre o nome configurado do peer). Um peer comprometido ainda pode pôr IPs globais com cara de hostis na blocklist do hub (só com pontuação 50+ e sinal forte; os sinalizadores `admin` e `forged` vindos de peers são ignorados); defina `URUTAU_PEER_BLOCKLIST=off` para restringir a blocklist às observações locais. Trate um peer como alguém que pode ler os 500 IPs principais, caminhos e números de tráfego que o export carrega, e os seus eventos de ataque ao vivo.
|
||||
- **Limites do servidor HTTP:** timeouts de cabeçalho e corpo, `MaxHeaderBytes` de 16 KB, `POST /login` limitado a 4 KB e no máximo 20 clientes simultâneos no stream ao vivo (o 21º recebe 503 com `Retry-After`; o stream envia heartbeat a cada 20 s).
|
||||
- **Exposição de informação:** `/api/health` devolve só `{"status":"ok"}` (sem versão), os caminhos dos arquivos de log nunca aparecem no dashboard nem para peers, e as respostas levam `Referrer-Policy: same-origin` e uma Content-Security-Policy estrita.
|
||||
- **Requisições enquadradas:** com os cabeçalhos `Sec-Fetch-Site`, `Sec-Fetch-Dest` e `Referer` no log do Traefik, uma requisição embutida por outra página (cross-site ou same-site, ou destino de subrecurso como image ou script) aparece na linha do tempo e cria registro de IP como qualquer outra, mas pesa 0,25 por evento, com no máximo 30 pontos por IP vindos delas (abaixo do limiar hostil), e nunca conta como sinal forte. Com User-Agent de ferramenta de ataque os cabeçalhos são ignorados. Os cabeçalhos vêm do cliente, então um visitante enquadrado nunca vira hostil, e um scanner que os forja aparece como suspeito em vez de sumir.
|
||||
@@ -20,12 +20,14 @@ Não abra uma issue pública com detalhes de exploração. Abra uma issue mínim
|
||||
- **Higiene do analytics e da blocklist:** um domínio só ganha vaga no analytics após uma resposta 2xx (opcionalmente restrito por `--domains`) e domínios inativos são podados, então `Host` forjados não enchem a memória. A blocklist só contém endereços hostis e globalmente roteáveis, nunca faixas de `--ignore` ou `--trusted` nem um IP com login SSH bem-sucedido; o IPv6 é agregado por /64 (até 20.000 entradas rastreadas), então um atacante não inunda a tabela. Um User-Agent de monitoramento nunca desculpa uma requisição de ataque, e com `--monitor-from` só vale vindo das suas redes de monitoramento.
|
||||
- **Sem modo aberto na rede:** `--insecure-no-auth` é recusado a menos que o bind seja loopback. Expor a porta em uma interface pública ainda exige um proxy reverso com TLS.
|
||||
- **Endurecimento do container:** a imagem roda com usuário sem privilégios (sem `curl` nem ferramentas de shell: o `HEALTHCHECK` é `urutau healthcheck`), sistema de arquivos raiz somente leitura e sem capabilities. Os logs são montados somente leitura, e do proxy só o diretório de logs do Traefik é montado, nunca o `acme.json` nem a configuração. Os logs vêm de um diretório dedicado do host, `/var/log/urutau`, não do `/var/log` inteiro. `--trusted-proxy` tem como padrão só o loopback; o compose cria a rede `urutau-edge` (`10.250.0.0/24`) e confia só nela, então deixe nela apenas o proxy reverso, pois outro container ali poderia forjar o `X-Forwarded-For`. O único destino de escrita é o volume de dados (snapshot, diretório com modo `0700`).
|
||||
- **Somente leitura por desenho:** o Urutau lê logs e nunca envia tráfego aos IPs que lista. As únicas conexões de saída são as consultas de DNS reverso, o download periódico das bases DB-IP Lite em `download.db-ip.com` (verificado abrindo o arquivo antes de substituir o antigo; uma falha nunca interrompe o serviço) e, em um hub, as consultas aos peers configurados. As consultas de geolocalização são locais.
|
||||
- **Somente leitura por desenho:** o Urutau lê logs e nunca envia tráfego aos IPs que lista. As únicas conexões de saída são as consultas de DNS reverso, o download periódico das bases DB-IP Lite em `download.db-ip.com` (verificado abrindo o arquivo antes de substituir o antigo; uma falha nunca interrompe o serviço), as listas de saídas e relays do Tor em `check.torproject.org` e `onionoo.torproject.org` a cada 6 horas (`--tor-auto=off` desliga) e, em um hub, as consultas aos peers configurados. As consultas de geolocalização são locais.
|
||||
- **Segundo firewall:** vem desligado (`--enforce=off`). O Urutau não ganha privilégios: só acrescenta linhas a um arquivo de decisões e uma jail do fail2ban do host as aplica. Uma linha não carrega nada que o atacante controla (o endereço é reformatado, o motivo é um de uma lista fixa de slugs, nomes de host e origem são reduzidos a `[A-Za-z0-9._-]`), o arquivo rotaciona em 20 MB e no máximo `--enforce-max-per-min` decisões são gravadas por minuto. Nunca bane faixas privadas, `--trusted`, faixas da Cloudflare, resolvedores públicos, peers, o próprio servidor, crawlers verificados nem endereços com visita legítima nas últimas 24 horas. Decisões de um peer só são aceitas com motivo fixo, TTL limitado a 6 horas e um endereço que este servidor também viu atacar. O arquivo de desban só é escrito por um usuário autenticado (`POST /api/v1/enforce/unban`), nunca por um token de peer sem `--enforce-share`.
|
||||
- **Egress e incidentes:** a análise de egress só lê um log do kernel escrito pelo kit do host, que registra e nunca descarta. Os chamados em `<data-dir>/incidents.json` são gravados com modo 0600, limitados (5.000 chamados, 200 comentários, 500 entradas de histórico), recusam escritas cross-site e ficam fechados ao token de peer.
|
||||
- **Privacidade e local-first:** não há telemetria. IPs e detalhes de requisições ficam nos seus servidores (e no hub que você configurar).
|
||||
- **Privacidade dos visitantes (LGPD e GDPR):** a página Tráfego conta visitantes únicos com um hash calculado com sal diário, então um visitante não pode ser seguido entre dias, e o endereço IP de um visitante legítimo nunca é persistido. Não há cookies para visitantes, fingerprinting nem requisição a terceiros. IPs são retidos apenas para atividade hostil, por no máximo o período de retenção (7 dias). Se isso basta para a sua base legal e seus avisos é responsabilidade sua, como controlador.
|
||||
- **Visitas anônimas:** visitantes legítimos nunca são armazenados. O stream opcional `?visits=1` não carrega endereço, User-Agent nem referrer (só posição no nível da cidade, no máximo 20 por segundo) e nunca é gravado em disco. Caminhos e valores de `Referer` são normalizados para `:id` quando carregam e-mail, token ou identificador longo, para que dado pessoal numa URL não chegue às listas. As rotas de análise mais novas (`/api/v1/techniques`, `/evolution`, `/concentration`, `/survival`, `/sessions/funnel`, `/campaigns`, `/defense`, `/errors`, `/integrity`, `/report`, `/services`, `/protocols`) são só de usuário: o token de peer recebe 403 nelas.
|
||||
- **Registro de eventos (privacidade):** `<data-dir>/events/` guarda uma linha por evento para replay e investigação, mas só de atacantes: eventos maliciosos, bans, logins SSH bem-sucedidos, um 404 para uma ferramenta de ataque, e respostas a endereços já suspeitos ou hostis. O endereço de um visitante legítimo nunca é gravado. Os arquivos são removidos após a retenção (30 dias no máximo) e o total é limitado por `--events-max` (512 MB por padrão, `0` desliga o registro). Trate o diretório como dado pessoal perante a LGPD e o GDPR: mesma retenção e mesmo controle de acesso do resto do volume de dados. Disco cheio ou o teto de tamanho descartam eventos em vez de parar o serviço, e uma linha corrompida é ignorada.
|
||||
- **Consultas para os vereditos:** o tipo de rede é inferido localmente a partir do ASN, da organização e do DNS reverso (sem API externa). O DNS reverso confirmado serve apenas para confirmar um Googlebot ou Bingbot declarado. A lista opcional de saídas do Tor é um arquivo local (`--tor-exits`).
|
||||
- **Consultas para os vereditos:** o tipo de rede é inferido localmente a partir do ASN, da organização e do DNS reverso (sem API externa). O DNS reverso confirmado serve apenas para confirmar um Googlebot, Bingbot ou Applebot declarado (um crawler confirmado nunca é banido pelo segundo firewall). As listas do Tor ficam em cache local, e `--tor-exits` aceita um arquivo local.
|
||||
- **Dados de terceiros:** as bases de geolocalização são DB-IP Lite, CC BY 4.0, e a atribuição deve ser mantida onde os dados são exibidos. Os limites de estados e cidades da página Geografia são do Natural Earth, domínio público.
|
||||
|
||||
## Limitação conhecida
|
||||
|
||||
@@ -38,6 +38,22 @@ services:
|
||||
URUTAU_ADMIN_USERS: ${URUTAU_ADMIN_USERS:-}
|
||||
# Geo database refresh interval (0 disables the download).
|
||||
URUTAU_GEO_UPDATE: ${URUTAU_GEO_UPDATE:-24h}
|
||||
# Port probes logged by the host kit (deploy/host/install.sh); empty disables.
|
||||
URUTAU_PROBE_LOG: ${URUTAU_PROBE_LOG:-/logs/host/probe.log}
|
||||
# Download the official Tor exit/relay lists (on|off).
|
||||
URUTAU_TOR_AUTO: ${URUTAU_TOR_AUTO:-on}
|
||||
# Second firewall: off | observe | on. "on" appends ban decisions to
|
||||
# /logs/enforce/decisions.log, applied by the host fail2ban jail "urutau"
|
||||
# (install the kit with deploy/host/install.sh --enforce and uncomment the
|
||||
# /logs/enforce volume below).
|
||||
URUTAU_ENFORCE: ${URUTAU_ENFORCE:-off}
|
||||
URUTAU_ENFORCE_SHARE: ${URUTAU_ENFORCE_SHARE:-off}
|
||||
URUTAU_ENFORCE_THRESHOLD: ${URUTAU_ENFORCE_THRESHOLD:-5}
|
||||
# Outbound traffic analysis (auto | on | off) from the kit's nftables log.
|
||||
URUTAU_EGRESS: ${URUTAU_EGRESS:-auto}
|
||||
# name=container-prefix:role, comma separated (see docs/configuration.md).
|
||||
URUTAU_EGRESS_WORKLOADS: ${URUTAU_EGRESS_WORKLOADS:-}
|
||||
URUTAU_EGRESS_RESOLVERS: ${URUTAU_EGRESS_RESOLVERS:-}
|
||||
# Match the host time zone: fail2ban.log timestamps are local time.
|
||||
TZ: ${TZ:-UTC}
|
||||
ports:
|
||||
@@ -53,6 +69,8 @@ services:
|
||||
# directory, not single files: logrotate recreates them by rename, and a
|
||||
# file bind mount would keep following the old inode. See docs/docker.md.
|
||||
- /var/log/urutau:/logs/host:ro
|
||||
# Second firewall decisions (read-write), only with URUTAU_ENFORCE=observe|on:
|
||||
# - /var/log/urutau-enforce:/logs/enforce
|
||||
- urutau-data:/data
|
||||
group_add: ["4"] # adm: can read the logs in /var/log/urutau
|
||||
networks: [urutau-edge]
|
||||
|
||||
@@ -5,45 +5,68 @@
|
||||
Urutau is one Go binary with no third-party dependency. Everything runs in one process.
|
||||
|
||||
```
|
||||
cmd/urutau entry point: serve, doctor, version
|
||||
internal/app flags, wiring, the log runner, doctor
|
||||
cmd/urutau entry point: serve, doctor, healthcheck, version
|
||||
internal/app flags, wiring, the log runner, probe source, Tor lists, enforce and egress wiring, doctor
|
||||
internal/tail rotation-aware file follower and rotated-file reader
|
||||
internal/core event model, parsers (Traefik, sshd, fail2ban), classifier
|
||||
internal/store in-memory state, summaries, merge, snapshot
|
||||
internal/core event model, parsers (Traefik JSON and text, sshd, fail2ban), classifier, error classes
|
||||
internal/store in-memory state, summaries, merge, snapshot, analytics, services, defense, roster
|
||||
internal/rdns reverse DNS cache and forward-confirmed reverse DNS
|
||||
internal/evlog on-disk event registry
|
||||
internal/intel families, MITRE, network type, cadence, sessions, campaigns, verdicts, STIX, metrics
|
||||
internal/fed hub that polls peers
|
||||
internal/server HTTP handler, auth, embedded dashboard (web/)
|
||||
internal/geo dependency-free MMDB reader and database updater (DB-IP Lite)
|
||||
internal/ua User-Agent parser (browser, system, device, bot, attack tool)
|
||||
internal/enforce second firewall: ban decisions, decision file, unban requests, operator allowances
|
||||
internal/egress outbound connection analysis: workloads, findings (beacon, C2, mining, scan...)
|
||||
internal/incidents tickets opened from egress findings or by hand, stored in incidents.json
|
||||
internal/fed hub that polls peers, live relay, study merge, decision and egress exchange
|
||||
internal/server HTTP handler, auth, API routes, HTML report, embedded dashboard (web/)
|
||||
deploy/host host kit: nftables table, rsyslog, logrotate, container map, fail2ban jail, installer
|
||||
```
|
||||
|
||||
The only dependency is the Go standard library.
|
||||
|
||||
## Data flow
|
||||
|
||||
```
|
||||
Traefik access.log auth.log fail2ban.log
|
||||
│ │ │
|
||||
└──── tail.Follower (one goroutine per source) ────┐
|
||||
▼
|
||||
parse (core.ParseTraefik / ParseAuth / ParseFail2ban) → Event
|
||||
▼
|
||||
Traefik access.log auth.log fail2ban.log probe.log (nft, closed ports)
|
||||
│ │ │ │
|
||||
└──── tail.Follower (one goroutine per source) ┘
|
||||
▼
|
||||
parse (core.ParseTraefik / ParseAuth / ParseFail2ban / probe parser) → Event
|
||||
▼
|
||||
trusted CIDRs? drop. monitoring UA and benign? count aside.
|
||||
▼
|
||||
store.Ingest: counters, per-IP record, live feed
|
||||
▼
|
||||
snapshot every 60 s ◄── state ──► summaries / IP table / SSE
|
||||
▼
|
||||
classify (core): category, error class, forge browsing exempt
|
||||
▼
|
||||
store.Ingest: counters, per-IP record, live feed ──► evlog (events/)
|
||||
▼
|
||||
intel (computed on demand): family, MITRE, network type, cadence, sessions,
|
||||
campaigns, verdict ──► dashboard, API, STIX, blocklist, HTML report
|
||||
▼
|
||||
enforce (optional): decision per attacking IP ──► decisions.log
|
||||
▼
|
||||
host fail2ban jail "urutau" reads decisions.log and bans in the firewall
|
||||
▼
|
||||
fail2ban.log "Ban urutau" returns as an event (not counted as evidence)
|
||||
|
||||
egress.log (nft, new outbound connections) ──► egress.Source ──► findings
|
||||
findings ──► incidents (tickets INC-n, suppression) ──► API and report
|
||||
```
|
||||
|
||||
Snapshot every 60 s: `state` ◄──► summaries, IP table, SSE. The second firewall never gains privileges: it only appends lines to a file that a jail on the host reads.
|
||||
|
||||
## Sources
|
||||
|
||||
Each source is followed by its own goroutine and reports a state: `following`, `waiting` (the file does not exist yet), `backfill` (first start, reading rotated copies) or `error`. A line larger than 64 KiB is dropped and counted as malformed. On the first start without a snapshot, the rotated copies (`path.1`, `path.N.gz` up to 9) are read oldest first so the window is not empty.
|
||||
Each source is followed by its own goroutine and reports a state: `following`, `waiting` (the file does not exist yet), `backfill` (first start, reading rotated copies), `degraded` (more than 20% of the last 1000 lines are unreadable, with at least 50 samples) or `error`. A line larger than 64 KiB is dropped and counted as malformed. On the first start without a snapshot, the rotated copies (`path.1`, `path.N.gz` up to 9) are read oldest first so the window is not empty.
|
||||
|
||||
Lines are decoded as follows:
|
||||
|
||||
- **Traefik:** one JSON object per line. Client address, host, method, path, status and User-Agent are read; paths and User-Agents are clipped.
|
||||
- **Traefik:** one JSON object per line; the default text format is read too, with fewer fields (no host or service). Client address, host, method, path, status and User-Agent are read; paths and User-Agents are clipped.
|
||||
- **sshd:** the lines of `auth.log` with ISO timestamps. Failed passwords and keys, invalid users, closed-before-auth connections and `Accepted` logins; negotiation errors, banner exchange failures and protocol mismatches count as probes.
|
||||
- **probe:** the `URUTAU-PROBE:` lines that the host kit logs for inbound connections to ports nobody listens on (`--probe-log`). Each becomes a `scanner` event with source `probe` (MITRE T1046), at most one per address, port and protocol per minute.
|
||||
- **fail2ban:** `Ban`, `Unban` and `Restore Ban` lines. A restored ban (replayed after a fail2ban restart) updates the ban state and is not scored.
|
||||
|
||||
Log file paths are never exposed: neither the dashboard nor a peer export shows where a source reads from, only its name and state.
|
||||
The egress log (`--egress-log`) has its own source, described in the egress section. Log file paths are never exposed: neither the dashboard nor a peer export shows where a source reads from, only its name and state.
|
||||
|
||||
Lines that are valid but carry nothing to record are ignored silently; lines that cannot be parsed are counted as malformed and shown per source in the dashboard.
|
||||
|
||||
@@ -71,6 +94,8 @@ The level combines the score with evidence:
|
||||
- **Never hostile:** an IP with a successful SSH login (`ssh-ok`), which is most likely you.
|
||||
- Otherwise **low**.
|
||||
|
||||
Pages of a code forge that show repository content (Gitea or Forgejo `/owner/repo/src/commit/<sha>/<file>`, GitHub and GitLab `blob`, `tree`, `raw`, `blame`, `commits`) are not probes even when the file is called `.env` or `.gitignore`; `/.env`, `/.git/config` and traversal are unchanged. A fail2ban ban made by the `urutau` jail (our own decision) or by `recidive` (which only repeats bans) is not evidence: it adds no score, no strong signal and no blocklist listing. Bans of independent jails (sshd, traefik) count.
|
||||
|
||||
IPv6 clients are tracked by their /64 prefix, since one subscriber holds a whole /64 and per-address keys would let one attacker flood the table. IPs are tracked up to 20,000 entries.
|
||||
|
||||
The malicious categories (`scanner`, `exploit`, `bruteforce`, `ssh-fail`, `ssh-probe`) feed the "malicious" totals.
|
||||
@@ -136,14 +161,14 @@ Failure behavior: a full disk, the size cap or the day cap drop events (counted,
|
||||
The investigation layer is computed from the IP table and the registry, with no external API:
|
||||
|
||||
- **Attack families** (`traversal`, `log4shell`, `sqli`, `xss`, `rce-injection`, `webshell`, `env-credentials`, `vcs`, `backup`, `wordpress`, `phpmyadmin-db`, `actuator-debug`, `iot-cgi`, `admin-panel`, `generic-404`) and the **MITRE ATT&CK** techniques they map to.
|
||||
- **Network type** from the ASN, the AS organisation and reverse DNS: `vpn`, `research-scanner`, `isp-cn`, `hosting`, `mobile`, `isp/mobile`, `residential`, `unknown`, and `tor` when the address is in the `--tor-exits` file (reloaded every 24 hours when it changes).
|
||||
- **Network type** from the ASN, the AS organisation and reverse DNS: `vpn`, `research-scanner`, `isp-cn`, `hosting`, `mobile`, `isp/mobile`, `residential`, `unknown`, and `tor` when the address is in the `--tor-exits` file (reloaded every 24 hours when it changes) or in the official lists that `--tor-auto` (on by default) downloads every 6 hours into `<data-dir>/tor`.
|
||||
- **Cadence** of the requests of one IP: `automated`, `human-like`, `mixed` or `insufficient` (fewer than 3 requests).
|
||||
- **Sessions:** bursts of one IP separated by a gap (30 minutes by default), each with a stage in increasing severity: `recon`, `probe`, `exploit`, `access`, `banned`.
|
||||
- **Campaigns:** at least 3 IPs whose sessions have the same signature (similar normalized paths, Jaccard 0.6 or more, same tool) within a window; the signature id is `c-` plus 8 hex characters.
|
||||
- **Exposure:** a 2xx answer to a request on a sensitive path.
|
||||
- **Verdict with reasons**, each reason a stable code with a weight (`exploits_refused`, `tool_ua`, `banned_jail`, `multi_category`, `exposure`, `ssh_login_after_bruteforce`, `admin`, `immune`), and **recommended actions** (`block`, `report`, `investigate`, `incident`); administrators and immune sources get none.
|
||||
- **STIX 2.1** export of an IP (`/api/v1/ip/{ip}/stix`), with deterministic UUIDv5 ids.
|
||||
- **Crawlers:** a User-Agent claiming Googlebot or Bingbot is confirmed by forward-confirmed reverse DNS; a fake one stays an attacker.
|
||||
- **Crawlers:** a User-Agent claiming Googlebot (and its variants such as GoogleOther), Bingbot or Applebot is confirmed by forward-confirmed reverse DNS (`googlebot.com`, `google.com`, `search.msn.com`, `applebot.apple.com`); a fake one stays an attacker, and a confirmed crawler is excluded from bans whatever its User-Agent says.
|
||||
- SSH users listed in `--admin-users` are marked as administrators.
|
||||
|
||||
## Metrics
|
||||
@@ -170,9 +195,68 @@ The investigation layer is computed from the IP table and the registry, with no
|
||||
|
||||
Sessions, exposure, refused exploits and `ok_after_fail` need the event registry and read at most a bounded number of events (`truncated` says when the window was cut).
|
||||
|
||||
## Second firewall
|
||||
|
||||
`internal/enforce` is optional (`--enforce=off|observe|on`). Urutau decides which attacking addresses deserve a ban and appends one line per decision to `--enforce-log`; the host fail2ban jail `urutau` reads the file and applies the ban. The process gets no privileges. In `observe` mode decisions stay in memory and the interface shows what would be banned.
|
||||
|
||||
Rules (the first that matches, per address):
|
||||
|
||||
- 2 critical events (traversal, log4shell, sqli, rce, webshell, env, vcs) in 10 minutes.
|
||||
- SSH: `--enforce-threshold` failures in 10 minutes (default 5); an `ssh-probe` counts half a failure.
|
||||
- Port scan: 10 distinct ports probed in 10 minutes (reason `port-scan`).
|
||||
- Web: `--enforce-threshold` attack events in 10 minutes (dominant reason, otherwise `scanner-flood`).
|
||||
- Neighbor: 3 or more distinct addresses of the same /24 (IPv4) or /64 (IPv6) were banned in the last 24 hours and another address of the prefix attacks (`neighbor-campaign`).
|
||||
- Known attacker: the verdict is hostile, or suspicious with a score of 100 or more (`known-attacker`).
|
||||
- Slow attackers: 10 SSH failures or 20 web scan/exploit events in 24 hours; 10 SSH failures or 10 web scan/exploit events in 7 days (the web one only without a legitimate visit).
|
||||
|
||||
A sweep every 10 minutes, and after the start-up backfill, applies the same rules to the addresses active in the last 24 hours that nothing blocks yet. At most `--enforce-max-per-min` decisions are written per minute (default 60); the excess is dropped and counted. The advisory TTL grows with the number of earlier bans: 1 h, 6 h, 24 h, 7 d.
|
||||
|
||||
Never banned: private and reserved ranges, `--trusted`, the Cloudflare ranges, well known public resolvers, the peers and the server's own addresses, a verified crawler, an address with a legitimate visit in the last 24 hours, and an operator allowance (below). Each skip is counted by reason.
|
||||
|
||||
Decision file, one line per ban (`MaxLogBytes` 20 MB, then rotated to `.1`):
|
||||
|
||||
```
|
||||
2026-11-15T10:00:00Z urutau decision=ban ip=203.0.113.9 reason=ssh-bruteforce score=75 ttl=3600 host=web1 src=local
|
||||
```
|
||||
|
||||
Nothing the attacker controls enters the line: the address is re-formatted, the reason must be one of a fixed list of slugs and the host and source names are reduced to `[A-Za-z0-9._-]`. State (bans, allowances, counters) goes to `<data-dir>/enforce.json`.
|
||||
|
||||
Unban: `POST /api/v1/enforce/unban` appends `<time> urutau unban ip=<ip> allow=<seconds>` to the unban file (`--enforce-unban-log`, by default `unban.log` next to the decision file); a systemd path unit of the host kit lifts the fail2ban block. With `allow` above zero the engine does not ban the address again for that long (at most 30 days); `DELETE /api/v1/enforce/allow` ends the allowance.
|
||||
|
||||
Sharing (`--enforce-share=on`): hub and peers exchange decisions through `GET` and `POST /api/v1/peer/decisions` and unbans through `POST /api/v1/peer/unban`. Each side applies its own exclusions, accepts only the fixed reason slugs, caps the TTL at 6 hours, and bans on a peer's word only an address it also saw attacking in the last 7 days (otherwise the skip is `peer_unconfirmed`).
|
||||
|
||||
## Egress analysis
|
||||
|
||||
`internal/egress` reads the nftables log of new outbound connections (`--egress=auto|on|off`, `--egress-log`; `auto` turns it on when the file exists). The host kit logs only TCP connection attempts (SYN without ACK) under the prefix `URUTAU-EGRESS:`. The state is in memory: on start the rotated copies and the live file are replayed, which rebuilds the beacon history.
|
||||
|
||||
A **workload** is a group of sources (a CIDR, an address, `host` for the host's own traffic, or a container name or prefix from the `containers.map` file the host kit writes) with a role: `default`, `scanner`, `mail` or `resolver` (`--egress-workloads`). The principle: traffic shaped like a scan is suppressed only for `scanner` workloads; everything else is judged the same for all of them.
|
||||
|
||||
Findings (`kind`, severity):
|
||||
|
||||
| Kind | Meaning |
|
||||
|---|---|
|
||||
| `beacon` | regular conversation with one destination: at least 8 connections within 30 minutes with an interval between 10 s and 6 h and a low jitter |
|
||||
| `infra` | the same pattern toward cloud metadata services, the provider or the servers themselves (informational) |
|
||||
| `bad_dst` | contact with an address that attacked this server |
|
||||
| `tor` | connection to a Tor relay |
|
||||
| `port` | SMTP from a non-mail workload, IRC, mining pool (stratum) or Tor ORPort ports |
|
||||
| `dns_bypass` | DNS (53) or DoT (853) to a public address that is not an allowed resolver |
|
||||
| `scan` | fan-out of more than 50 destinations or 100 ports in 10 minutes, outside `scanner` workloads |
|
||||
| `new_geo` | first contact with a country after the workload's learning time (24 h) |
|
||||
|
||||
Destinations of peers, trusted addresses and the server's own public addresses never raise findings, and regular connections to large CDNs and clouds are low severity unless the destination attacked the server. Limits: 50,000 pairs and destinations, 2,000 findings, 720 hourly buckets. `GET /api/v1/egress` returns the findings, workloads, countries and an hourly timeline; a hub also merges the `GET /api/v1/peer/egress` answer of each peer.
|
||||
|
||||
## Incidents
|
||||
|
||||
`internal/incidents` keeps tickets `INC-<n>` in `<data-dir>/incidents.json` (atomic write, 0600; a corrupt file is moved to `.corrupt`). Every egress finding with severity above `info` becomes a ticket keyed by `host|kind|workload|dst|dport|proto`, created by a sync on each merged egress report and every 60 seconds; a resolved ticket reopens when the finding reappears. A ticket has status (`open`, `investigating`, `true_positive`, `false_positive`, `benign`, `resolved`), severity, assignee, up to 10 tags, verdict, comments and a change history. Limits: 5,000 tickets, 200 comments and 500 history entries each. A ticket in `false_positive` or `benign` can suppress exactly its key for 30 days (90 at most); suppressed findings leave `/api/v1/egress` unless `?suppressed=1`. A host with more than 300 active tickets has the excess grouped in one flood ticket. Writes refuse cross-site requests, and every write is logged (id, field, author).
|
||||
|
||||
## HTML report
|
||||
|
||||
`GET /api/v1/report?format=html` renders one self-contained A4 document (cover, executive summary, recommendations by rule, threats, geography, errors and health, visitors, defense, second firewall and outbound traffic) in the language of `lang`. The text goes through `html/template` and the charts are SVG built from escaped values, so no log text reaches the page unescaped. `format=json` returns the same figures.
|
||||
|
||||
## State and persistence
|
||||
|
||||
The state lives in memory: minute buckets for the latest 48 hours and hourly data up to 30 days, hourly top lists (paths, domains, User-Agents, users), a table of up to 20,000 IPs (when full, the 10% with the lowest score are evicted; banned IPs are kept), a feed of the latest 500 events and the active bans. `--retention` (1h to 168h) bounds how long IPs are kept; old IPs are pruned every 10 minutes.
|
||||
The state lives in memory: minute buckets for the latest 48 hours and hourly data up to 30 days, hourly top lists (paths, domains, User-Agents, users), a table of up to 20,000 IPs (when full, the 10% with the lowest score are evicted; banned IPs are kept), a feed of the latest 500 events and the active bans. `--retention` (1h to 720h) bounds how long IPs are kept; old IPs are pruned every 10 minutes.
|
||||
|
||||
Every 60 seconds, and on shutdown, the state is written to `urutau-state.gob` in the data directory together with the inode and offset of every source. On start it is restored and each source resumes exactly where it stopped, so a restart never counts a log twice. A snapshot is skipped while a backfill runs. An unreadable snapshot is moved to `urutau-state.gob.corrupt` and the service starts empty, reading the logs again (including the rotated copies).
|
||||
|
||||
@@ -180,7 +264,7 @@ The process sets a soft memory limit of 256 MiB unless `GOMEMLIMIT` is set. The
|
||||
|
||||
## Federation
|
||||
|
||||
A hub is an ordinary instance started with `--peer name=https://url`, and it needs `URUTAU_PEER_TOKEN`. Every 15 seconds it calls each peer's `GET /api/v1/peer/export?range=...` (for the background ranges `1h`, `24h`, `7d` and `30d`; any other range or custom period is fetched on demand) with the peer token and keeps the latest answer. The export is `{"v":1,"summary":...,"traffic":{...}}` with the top 500 IPs and their detail, cached for 5 seconds on the peer. The peer token opens three routes: the export, the live stream and `GET /api/v1/peer/period`, the study (sessions, campaigns, metrics) the hub merges for a period or an IP; a peer runs at most two studies at once. The hub never follows redirects, requires `https` outside loopback, uses a 4 second timeout, caps the body at 8 MB and sanitizes and caps whatever a peer sends. A peer that fails is marked offline and the others carry on. The dashboard host selector then offers `all`, the hub itself and each peer; summaries, traffic and IP tables are merged, and every row carries the host it came from.
|
||||
A hub is an ordinary instance started with `--peer name=https://url`, and it needs `URUTAU_PEER_TOKEN`. Every 15 seconds it calls each peer's `GET /api/v1/peer/export?range=...` (for the background ranges `1h`, `24h`, `7d` and `30d`; any other range or custom period is fetched on demand) with the peer token and keeps the latest answer. The export is `{"v":1,"summary":...,"traffic":{...}}` with the top 500 IPs and their detail, cached for 5 seconds on the peer. The peer token opens only the federation routes: the export, the live stream, `GET /api/v1/peer/period` (the study of sessions, campaigns and metrics the hub merges for a period or an IP; a peer runs at most two at once), `GET /api/v1/peer/egress` (the egress report) and, with `--enforce-share`, `GET` and `POST /api/v1/peer/decisions` and `POST /api/v1/peer/unban`. The hub never follows redirects, requires `https` outside loopback, uses a 4 second timeout, caps the body at 8 MB and sanitizes and caps whatever a peer sends. A peer that fails is marked offline and the others carry on. The dashboard host selector then offers `all`, the hub itself and each peer; summaries, traffic and IP tables are merged, and every row carries the host it came from.
|
||||
|
||||
### Live relay
|
||||
|
||||
@@ -192,4 +276,43 @@ Besides the export, a hub keeps one `GET /api/v1/peer/stream` connection open pe
|
||||
|
||||
## HTTP layer
|
||||
|
||||
The server sets read, write and idle timeouts, `MaxHeaderBytes` of 16 KB, caps `POST /login` at 4 KB and accepts at most 20 simultaneous live-stream (SSE) clients (the 21st gets 503 with `Retry-After`; each stream sends a heartbeat every 20 s). The handler uses the standard `net/http` mux. Every response carries a strict Content-Security-Policy (`default-src 'self'`), `X-Content-Type-Options`, `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer`, cross-origin isolation headers and, over HTTPS, HSTS. API answers are `Cache-Control: no-store`. The dashboard files are embedded in the binary. See [interface.md](interface.md) for the routes and [configuration.md](configuration.md) for the settings.
|
||||
The server sets read, write and idle timeouts, `MaxHeaderBytes` of 16 KB, caps `POST /login` at 4 KB and accepts at most 20 simultaneous live-stream (SSE) clients (the 21st gets 503 with `Retry-After`; each stream sends a heartbeat every 20 s). The handler uses the standard `net/http` mux. Every response carries a strict Content-Security-Policy (`default-src 'self'`), `X-Content-Type-Options`, `X-Frame-Options: DENY`, `Referrer-Policy: same-origin`, `Permissions-Policy`, cross-origin isolation headers and, over HTTPS, HSTS. API answers are `Cache-Control: no-store`. The dashboard files are embedded in the binary. See [interface.md](interface.md) for the pages and [configuration.md](configuration.md) for the settings.
|
||||
|
||||
## API routes
|
||||
|
||||
All `/api/v1/*` routes except the federation ones need `URUTAU_TOKEN` (bearer) or a session cookie; the peer token gets 403 on them. Analysis routes live in `internal/server/api_<name>.go` files and register themselves with `registerUserRoute`. Routes that take a range accept `range`, or `from` and `to`.
|
||||
|
||||
| Route | Purpose |
|
||||
|---|---|
|
||||
| `GET /api/health` | `{"status":"ok"}`, no authentication |
|
||||
| `GET /login`, `POST /login`, `POST /logout` | session cookie |
|
||||
| `GET /api/v1/summary`, `/traffic`, `/ips`, `/ip/{ip}`, `/ip/{ip}/stix` | totals, web analytics, IP table, one address, STIX 2.1 bundle |
|
||||
| `GET /api/v1/period`, `/period/events`, `/events`, `/events/sessions` | study of a period, event registry search (cursor), sessions |
|
||||
| `GET /api/v1/events/stream` | live stream over SSE (`?visits=1` adds anonymous visits) |
|
||||
| `GET /api/v1/live/recent`, `/geo` | latest live events, geography |
|
||||
| `GET /api/v1/metrics`, `/evolution`, `/concentration`, `/survival`, `/techniques`, `/sessions/funnel` | stable metrics and analytics |
|
||||
| `GET /api/v1/campaigns`, `/campaigns/{id}` | campaigns |
|
||||
| `GET /api/v1/services`, `/services/{svc}`, `/errors`, `/protocols` | SLO, error classes, protocols and TLS |
|
||||
| `GET /api/v1/defense`, `/integrity` | blocklist coverage, bans, sources and data integrity |
|
||||
| `GET /api/v1/blocklist.txt`, `/blocklist.json` | exportable blocklist (`?family=4\|6`) |
|
||||
| `GET /api/v1/enforce`, `POST /enforce/unban`, `DELETE /enforce/allow` | second firewall |
|
||||
| `GET /api/v1/egress` | outbound findings |
|
||||
| `GET /api/v1/incidents`, `/incidents/export.csv`, `/incidents/{id}`, `POST /incidents`, `PATCH /incidents/{id}`, `POST /incidents/{id}/comments` | tickets |
|
||||
| `GET /api/v1/report` | report as JSON or HTML (`?format=`) |
|
||||
| `GET /api/v1/peer/export`, `/peer/stream`, `/peer/period`, `/peer/egress` | federation, peer token only |
|
||||
| `GET`, `POST /api/v1/peer/decisions`, `POST /api/v1/peer/unban` | decision sharing, peer token only, `--enforce-share` |
|
||||
|
||||
List endpoints (IPs, sessions, campaigns, events of an address) are paginated by the backend; event search pages by cursor.
|
||||
|
||||
## Files
|
||||
|
||||
| Where | What |
|
||||
|---|---|
|
||||
| `<data-dir>/urutau-state.gob` | state snapshot with the offset of every source (`.corrupt` when unreadable) |
|
||||
| `<data-dir>/events/YYYY-MM-DD.jsonl[.gz]` | event registry, one JSON line per event |
|
||||
| `<data-dir>/geo/` | DB-IP Lite city and ASN databases |
|
||||
| `<data-dir>/tor/` | cache of the Tor exit and relay lists |
|
||||
| `<data-dir>/enforce.json` | state of the second firewall |
|
||||
| `<data-dir>/incidents.json` | tickets |
|
||||
| `--enforce-log`, `unban.log` | decision file read by the host jail and unban requests read by the host |
|
||||
| `--probe-log`, `--egress-log`, `--egress-containers` | kernel logs and container map written by the host kit in `deploy/host` |
|
||||
@@ -18,10 +18,11 @@ The access token is never a flag: `urutau serve` reads it from the `URUTAU_TOKEN
|
||||
|---|---|---|---|
|
||||
| `--bind` | `URUTAU_BIND` | `0.0.0.0:8790` | listen address |
|
||||
| `--name` | `URUTAU_NAME` | hostname | name of this instance |
|
||||
| `--data-dir` | `URUTAU_DATA_DIR` | `/data` | directory of the snapshot (`urutau-state.gob`) |
|
||||
| `--data-dir` | `URUTAU_DATA_DIR` | `/data` | state directory: snapshot `urutau-state.gob`, `geo/`, `tor/`, `events/`, `incidents.json`, `enforce.json` |
|
||||
| `--traefik-log` | `URUTAU_TRAEFIK_LOG` | `/data/coolify/proxy/access.log` | Traefik JSON access log; empty disables |
|
||||
| `--auth-log` | `URUTAU_AUTH_LOG` | `/var/log/auth.log` | sshd log; empty disables |
|
||||
| `--fail2ban-log` | `URUTAU_FAIL2BAN_LOG` | `/var/log/fail2ban.log` | fail2ban log; empty disables |
|
||||
| `--probe-log` | `URUTAU_PROBE_LOG` | `/logs/host/probe.log` | kernel log of connections to unserved ports, written by the host kit; empty disables |
|
||||
| `--trusted` | `URUTAU_TRUSTED` | empty | CIDRs of trusted origins; their events are dropped entirely. `--ignore` / `URUTAU_IGNORE` is an alias |
|
||||
| `--ignore` | `URUTAU_IGNORE` | `127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,100.64.0.0/10,169.254.0.0/16` | same effect as `--trusted`, with the private ranges as default |
|
||||
| `--monitor-ua` | `URUTAU_MONITOR_UA` | `(?i)^(Uptime-Kuma/\|Beszel\|Coolify\|kube-probe/\|Go-http-client/.*healthcheck)` | regular expression of monitoring User-Agents |
|
||||
@@ -29,8 +30,8 @@ The access token is never a flag: `urutau serve` reads it from the `URUTAU_TOKEN
|
||||
| `--domains` | `URUTAU_DOMAINS` | empty | allowlist of analytics domains (exact or `*.example.com`); empty tracks every domain that answers 2xx; recommended when a backend answers 2xx for any Host |
|
||||
| `--geo-dir` | `URUTAU_GEO_DIR` | `<data-dir>/geo` | directory of the DB-IP Lite databases (city and ASN) |
|
||||
| `--geo-update` | `URUTAU_GEO_UPDATE` | `24h` | how often to check for a newer database; `0` turns the download off |
|
||||
| `--peer` | `URUTAU_PEERS` | none | peer `name=https://url`; repeat the flag, or comma separate the variable |
|
||||
| `--peer-token` | `URUTAU_PEER_TOKEN` | empty | token shared with the peers; prefer the variable or `URUTAU_PEER_TOKEN_FILE` (a flag shows up in the process list). Per-peer: `URUTAU_PEER_TOKEN_<NAME>` |
|
||||
| `--peer` | `URUTAU_PEERS` | none | peer `name=https://url`; repeat the flag, or comma separate the variable (the flag wins) |
|
||||
| `--peer-token` | `URUTAU_PEER_TOKEN` | empty | token shared with the peers; prefer the variable or `URUTAU_PEER_TOKEN_FILE` (a flag shows up in the process list). Per-peer: `URUTAU_PEER_TOKEN_<NAME>` or `..._<NAME>_FILE` |
|
||||
| `--admin-users` | `URUTAU_ADMIN_USERS` | empty | SSH users whose successful login keeps their IP out of the blocklist for 24 h; the immunity is off unless set |
|
||||
| `--peer-allow` | `URUTAU_PEER_ALLOW` | empty | source CIDRs allowed to call the federation routes; empty accepts any source with the token |
|
||||
| `--peer-blocklist` | `URUTAU_PEER_BLOCKLIST` | `on` | `on` lists in the hub's blocklist the hostile IPs seen only by peers (score 50+ and a strong signal); `off` keeps the blocklist to this instance's own IPs |
|
||||
@@ -38,10 +39,24 @@ The access token is never a flag: `urutau serve` reads it from the `URUTAU_TOKEN
|
||||
| `--trusted-proxy` | `URUTAU_TRUSTED_PROXY` | `127.0.0.0/8,::1` (the compose file sets `10.250.0.0/24`) | proxies whose `X-Forwarded-For` is trusted, read right to left (login rate limit, `--peer-allow`) |
|
||||
| `--retention` | `URUTAU_RETENTION` | `720h` | how long data is kept (1h to 720h, that is 30 days) |
|
||||
| `--events-max` | `URUTAU_EVENTS_MAX` | `512MB` | size cap of the event registry in `<data-dir>/events`; `0` turns it off |
|
||||
| `--tor-auto` | `URUTAU_TOR_AUTO` | `on` | `on` downloads the official Tor exit and relay lists every 6 h into `<data-dir>/tor`; `off` does not |
|
||||
| `--tor-exits` | `URUTAU_TOR_EXITS` | empty | file with Tor exit addresses, one per line, reloaded every 24 h when it changes; empty disables |
|
||||
| `--enforce` | `URUTAU_ENFORCE` | `off` | second firewall: `off`, `observe` (decide in memory only) or `on` (also write decisions for the host fail2ban) |
|
||||
| `--enforce-log` | `URUTAU_ENFORCE_LOG` | `/logs/enforce/decisions.log` | decision file appended in `on` mode (required then) |
|
||||
| `--enforce-unban-log` | `URUTAU_ENFORCE_UNBAN_LOG` | `unban.log` next to `--enforce-log` | file the Unban button writes its requests to |
|
||||
| `--enforce-share` | `URUTAU_ENFORCE_SHARE` | `off` | `on` exchanges decisions and unbans with the peers; each side applies its own exclusions |
|
||||
| `--enforce-threshold` | `URUTAU_ENFORCE_THRESHOLD` | `5` | attack events in 10 minutes that justify a ban (1 to 1000) |
|
||||
| `--enforce-max-per-min` | `URUTAU_ENFORCE_MAX_PER_MIN` | `60` | most decisions per minute, the excess is dropped and counted (1 to 10000) |
|
||||
| `--egress` | `URUTAU_EGRESS` | `auto` | egress analysis: `auto` (on when `--egress-log` exists), `on` or `off` |
|
||||
| `--egress-log` | `URUTAU_EGRESS_LOG` | `/logs/host/egress.log` | kernel log of new outbound connections, written by the host kit |
|
||||
| `--egress-containers` | `URUTAU_EGRESS_CONTAINERS` | `/logs/host/containers.map` | `"<ip> <container>"` map written by the host kit |
|
||||
| `--egress-workloads` | `URUTAU_EGRESS_WORKLOADS` | empty | `"name=ITEM,ITEM:role;..."`, roles `default`, `scanner`, `mail`, `resolver` ([configuration.md](configuration.md#egress-analysis)) |
|
||||
| `--egress-resolvers` | `URUTAU_EGRESS_RESOLVERS` | empty | allowed DNS resolvers, comma separated; empty: the usual public ones plus the host's `resolv.conf` |
|
||||
| `--insecure-no-auth` | none | off | disable authentication; only on a loopback bind |
|
||||
|
||||
Validation at start: peers must be `name=https://host` (plain `http` only on loopback), `URUTAU_PEER_TOKEN` must be set and different from `URUTAU_TOKEN`, names must be unique and cannot be `all` or the instance's own name, `--retention` must be at least 1h (and at most 720h), and `URUTAU_TOKEN` and every peer token must have at least 32 characters and about 128 bits of estimated entropy; each peer needs a client token (`URUTAU_PEER_TOKEN_<NAME>` or the general `URUTAU_PEER_TOKEN` as fallback), and peer names must not collide in that variable name (unless `--insecure-no-auth` on a loopback address).
|
||||
`URUTAU_EGRESS_ALLOW` and `URUTAU_EGRESS_PROVIDER_ASN` exist only as environment variables ([configuration.md](configuration.md)). `GOMEMLIMIT` and `TZ` are the standard ones.
|
||||
|
||||
Validation at start (any failure exits with code 1 before listening): `URUTAU_TOKEN` and every peer token need at least 32 characters and about 128 bits of estimated entropy (periodic or sequential tokens are refused), and a peer token must differ from `URUTAU_TOKEN`, unless `--insecure-no-auth` on a loopback bind; peers must be `name=https://host` (plain `http` only on loopback), names unique and not `all` or the instance's own name, and each peer needs a client token (`URUTAU_PEER_TOKEN_<NAME>` or the general `URUTAU_PEER_TOKEN`), with no two names collapsing to the same variable; `--retention` from 1h to 720h; `--events-max` a valid size; `--location` valid; `--peer-blocklist`, `--enforce-share` `on`/`off`; `--enforce` `off`/`observe`/`on` (`on` needs `--enforce-log`); `--enforce-threshold` 1 to 1000 and `--enforce-max-per-min` 1 to 10000; `--egress` `auto`/`on`/`off`; `--monitor-ua` a valid regular expression; `--ignore`, `--trusted`, `--peer-allow`, `--trusted-proxy` and `--monitor-from` valid CIDRs or IPs.
|
||||
|
||||
```bash
|
||||
export URUTAU_TOKEN=$(openssl rand -base64 48)
|
||||
@@ -60,6 +75,16 @@ urutau serve --trusted "10.0.0.0/8,203.0.113.7" \
|
||||
|
||||
`--trusted` drops every event from those origins. `--monitor-ua` matches the User-Agent of benign requests (`ok` or `notfound`) and counts them apart as "monitoring"; a request that is a `scanner`, `exploit` or `bruteforce` still counts as an attack.
|
||||
|
||||
## Second firewall and egress
|
||||
|
||||
```bash
|
||||
urutau serve --enforce observe # decide in memory, write nothing
|
||||
urutau serve --enforce on --enforce-log /var/log/urutau-enforce/decisions.log
|
||||
urutau serve --egress on --egress-workloads "mail=10.0.7.0/24:mail"
|
||||
```
|
||||
|
||||
The host side (nftables logging, the `urutau` fail2ban jail) comes from `deploy/host/install.sh`, see [docker.md](docker.md#host-kit).
|
||||
|
||||
## Geolocation
|
||||
|
||||
```bash
|
||||
@@ -70,7 +95,7 @@ Urutau downloads the DB-IP Lite city and ASN databases into `--geo-dir` when the
|
||||
|
||||
## `urutau doctor`
|
||||
|
||||
Checks the configuration (token, peers, bind), each log source (readable, size), that the data directory is writable, the geolocation databases and the snapshot. Statuses are `ok`, `warn` (a source that cannot be opened yet), `fail` and `off` (disabled). The exit code is 1 when any check is `fail`, which makes it usable in a healthcheck or a deploy script.
|
||||
Checks the configuration (token, peers, bind and every validation above), each log source (readable, size; Traefik also for a malformed-line rate above 20%), that the data directory is writable, the second firewall, the geolocation databases and the snapshot. The probe and egress logs are not checked. Checks are named `config`, `source traefik`, `source ssh`, `source fail2ban`, `source traefik format`, `data-dir`, `enforce` (and `enforce-cdn`), `geo` and `state`. Statuses are `ok`, `warn` (a source that cannot be opened yet), `fail` and `off` (disabled). The exit code is 1 when any check is `fail` (for example `--enforce=on` with a decision file that is not writable), which makes it usable in a deploy script. It accepts the same flags as `serve`.
|
||||
|
||||
```bash
|
||||
urutau doctor
|
||||
@@ -81,8 +106,8 @@ docker exec urutau urutau doctor --json
|
||||
|
||||
## `urutau healthcheck`
|
||||
|
||||
Calls `/api/health` on the local bind address and exits 0 when it answers `{"status":"ok"}`, 1 otherwise. It is the container `HEALTHCHECK`, which is why the image has no `curl`. It accepts the same flags as `serve` (for a non-default `--bind`).
|
||||
Calls `/api/health` on the local bind address (`0.0.0.0` and `::` become `127.0.0.1`; 3 second timeout, redirects are not followed) and exits 0 when it answers `{"status":"ok"}`, 1 otherwise. It is the container `HEALTHCHECK`, which is why the image has no `curl`. It accepts the same flags as `serve` (for a non-default `--bind`).
|
||||
|
||||
## `urutau version`
|
||||
|
||||
Prints `urutau <version>`. `--version` and `-v` work too.
|
||||
Prints `urutau <version>`. `--version` and `-v` work too. `urutau help` (`--help`, `-h`) prints the usage; an unknown command prints it to stderr and exits 2.
|
||||
@@ -10,7 +10,7 @@ Urutau has no configuration file. Everything is a flag with a `URUTAU_*` environ
|
||||
|---|---|
|
||||
| `URUTAU_TOKEN` | **Required.** Access token of the dashboard and the API: at least 32 characters and about 128 bits of estimated entropy (length times Shannon entropy; periodic or sequential tokens are refused). Generate one with `openssl rand -base64 48` (`openssl rand -hex 32` also works; `-hex 16` is refused by the entropy estimate). |
|
||||
| `URUTAU_TOKEN_FILE` | Path of a file holding the token (whitespace trimmed), instead of the variable. The variable wins when both are set. |
|
||||
| `URUTAU_PEER_TOKEN` | Optional. The server token of this instance: the only token its federation routes (`GET /api/v1/peer/export` and `GET /api/v1/peer/stream`) accept, and it opens nothing else. Same strength rules as `URUTAU_TOKEN` (32+ characters, about 128 bits of estimated entropy, not periodic or sequential), and it must differ from it. When this instance is a hub, it is also the fallback client token sent to peers that have no token of their own. |
|
||||
| `URUTAU_PEER_TOKEN` | Optional. The server token of this instance: the only token its federation routes (see [Peers](#peers-hub-mode)) accept, and it opens nothing else. Same strength rules as `URUTAU_TOKEN` (32+ characters, about 128 bits of estimated entropy, not periodic or sequential), and it must differ from it. When this instance is a hub, it is also the fallback client token sent to peers that have no token of their own. |
|
||||
| `URUTAU_PEER_TOKEN_FILE` | Path of a file holding the general peer token. |
|
||||
| `URUTAU_PEER_TOKEN_<NAME>` and `..._<NAME>_FILE` | The client credential a hub sends to that one peer; it must equal the peer's own `URUTAU_PEER_TOKEN`. `<NAME>` is the peer name uppercased with every character other than a letter or digit turned into `_` (`my-peer` becomes `MY_PEER`). It does **not** open the local export. Two peer names that collapse to the same variable (`my-peer` and `my_peer`) are refused. A hub with a peer and no token for it refuses to start. |
|
||||
|
||||
@@ -18,34 +18,85 @@ Keep both in `.env` (never versioned) or in your orchestrator's secret store.
|
||||
|
||||
## Settings
|
||||
|
||||
Every variable below has a flag of the same meaning ([cli.md](cli.md)); the flag wins over the variable.
|
||||
|
||||
### Core
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `URUTAU_BIND` | `0.0.0.0:8790` | listen address |
|
||||
| `URUTAU_NAME` | container hostname | name shown in the dashboard and used by the hub |
|
||||
| `URUTAU_DATA_DIR` | `/data` | where the snapshot `urutau-state.gob` is written |
|
||||
| `URUTAU_TRAEFIK_LOG` | `/data/coolify/proxy/access.log` | Traefik JSON access log, empty disables |
|
||||
| `URUTAU_AUTH_LOG` | `/var/log/auth.log` | sshd log, empty disables |
|
||||
| `URUTAU_FAIL2BAN_LOG` | `/var/log/fail2ban.log` | fail2ban log, empty disables |
|
||||
| `URUTAU_TRUSTED` | empty | trusted CIDRs or IPs, comma separated; their events are dropped entirely |
|
||||
| `URUTAU_IGNORE` | `127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,100.64.0.0/10,169.254.0.0/16` | same effect, kept as the alias that carries the private ranges as default |
|
||||
| `URUTAU_MONITOR_UA` | `(?i)^(Uptime-Kuma/\|Beszel\|Coolify\|kube-probe/\|Go-http-client/.*healthcheck)` | regular expression of monitoring User-Agents |
|
||||
| `URUTAU_GEO_DIR` | `<data-dir>/geo` | where the DB-IP Lite databases live |
|
||||
| `URUTAU_GEO_UPDATE` | `24h` | interval between checks for a newer database; `0` disables the download |
|
||||
| `URUTAU_PEER_ALLOW` | empty | CIDRs allowed to call the federation routes; empty accepts any source that has the token |
|
||||
| `URUTAU_PEER_BLOCKLIST` | `on` | `on`: the hub's blocklist includes hostile IPs seen only by peers (score 50+ and a strong signal); `off`: only this instance's own IPs |
|
||||
| `URUTAU_DATA_DIR` | `/data` | where the state lives: snapshot `urutau-state.gob`, `geo/`, `tor/`, `events/`, `incidents.json` and `enforce.json` |
|
||||
| `URUTAU_RETENTION` | `720h` | retention as a Go duration, from `1h` to `720h` (30 days); other values refuse to start |
|
||||
| `URUTAU_EVENTS_MAX` | `512MB` | size cap of the event registry (`<data-dir>/events`); a number with an optional unit (`k`, `kb`, `kib`, `m`, `mb`, `mib`, `g`, `gb`, `gib`, `b`), `0` turns it off |
|
||||
| `URUTAU_LOCATION` | empty | where this instance is on the map, `"lat,lon"` or `"lat,lon,Label"` (validated at start). It is the destination of the arcs on the Live page and is shared with the hub; empty lets the page fall back to an estimated destination |
|
||||
| `URUTAU_TRUSTED_PROXY` | `127.0.0.0/8,::1` (the compose file sets `10.250.0.0/24`) | reverse proxies whose `X-Forwarded-For` is trusted (read right to left); used by the login rate limit and by `URUTAU_PEER_ALLOW` |
|
||||
| `URUTAU_DOMAINS` | empty | allowlist of analytics domains, exact names or `*.example.com`; empty tracks every domain that answers 2xx; recommended, in practice required, when any backend answers 2xx for every Host (catch-all or wildcard), otherwise random Hosts can fill the 24 domain slots |
|
||||
| `URUTAU_MONITOR_FROM` | empty | CIDRs the monitors really come from; when set, the monitoring User-Agent only counts from them |
|
||||
| `URUTAU_ADMIN_USERS` | empty | SSH users whose successful login keeps their IP out of the blocklist for 24 h after the last login (a later strong signal cancels it); the immunity is off unless this is set |
|
||||
| `URUTAU_PEERS` | empty | peers to aggregate, comma separated `name=https://url` |
|
||||
| `URUTAU_RETENTION` | `720h` | retention as a Go duration, from `1h` to `720h` (30 days) |
|
||||
| `URUTAU_EVENTS_MAX` | `512MB` | size cap of the event registry (`<data-dir>/events`); `0` turns it off |
|
||||
| `URUTAU_TOR_EXITS` | empty | file of Tor exit addresses, one per line, reloaded every 24 h when it changes |
|
||||
| `GOMEMLIMIT` | 256 MiB soft limit | standard Go memory limit; set it to override the default |
|
||||
| `TZ` | UTC | time zone of `fail2ban.log` timestamps, which carry no zone |
|
||||
|
||||
In the container image the three log paths default to `/logs/traefik/access.log`, `/logs/host/auth.log` and `/logs/host/fail2ban.log` (the compose file mounts the host logs there). The compose file adds `URUTAU_VERSION` (image tag), `URUTAU_IMAGE` and `URUTAU_PUBLISH` (host address and port), see `.env.example`.
|
||||
### Log sources
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `URUTAU_TRAEFIK_LOG` | `/data/coolify/proxy/access.log` | Traefik JSON access log, empty disables |
|
||||
| `URUTAU_AUTH_LOG` | `/var/log/auth.log` | sshd log, empty disables |
|
||||
| `URUTAU_FAIL2BAN_LOG` | `/var/log/fail2ban.log` | fail2ban log, empty disables |
|
||||
| `URUTAU_PROBE_LOG` | `/logs/host/probe.log` | kernel log of new connections to ports nobody serves, written by the host kit (see [Probes](#probes-port-scans)); empty disables, a missing file just stays at `waiting` |
|
||||
|
||||
### Noise, trust and monitoring
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `URUTAU_TRUSTED` | empty | trusted CIDRs or IPs, comma separated; their events are dropped entirely. Also feeds the exclusions of the second firewall and the egress allow list |
|
||||
| `URUTAU_IGNORE` | `127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,100.64.0.0/10,169.254.0.0/16` | same effect, kept as the alias that carries the private ranges as default |
|
||||
| `URUTAU_MONITOR_UA` | `(?i)^(Uptime-Kuma/\|Beszel\|Coolify\|kube-probe/\|Go-http-client/.*healthcheck)` | regular expression of monitoring User-Agents; empty disables; an invalid expression refuses to start |
|
||||
| `URUTAU_MONITOR_FROM` | empty | CIDRs the monitors really come from; when set, the monitoring User-Agent only counts from them |
|
||||
| `URUTAU_ADMIN_USERS` | empty | SSH users whose successful login keeps their IP out of the blocklist for 24 h after the last login (a later strong signal cancels it); the immunity is off unless this is set |
|
||||
| `URUTAU_DOMAINS` | empty | allowlist of analytics domains, exact names or `*.example.com`; empty tracks every domain that answers 2xx; recommended, in practice required, when any backend answers 2xx for every Host (catch-all or wildcard), otherwise random Hosts can fill the 24 domain slots |
|
||||
|
||||
### Geolocation and Tor
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `URUTAU_GEO_DIR` | `<data-dir>/geo` | where the DB-IP Lite databases live |
|
||||
| `URUTAU_GEO_UPDATE` | `24h` | interval between checks for a newer database; `0` disables the download |
|
||||
| `URUTAU_TOR_AUTO` | `on` | `on`: download the official Tor exit and relay lists every 6 hours into `<data-dir>/tor`; `off`: do not download (air-gapped hosts) |
|
||||
| `URUTAU_TOR_EXITS` | empty | file of Tor exit addresses, one per line (`#` comments allowed, at most 100000 addresses, 8 MiB), reloaded every 24 h when it changes; merged with the downloaded list |
|
||||
|
||||
### Federation
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `URUTAU_PEERS` | empty | peers to aggregate, comma separated `name=https://url` (the flag `--peer` repeats instead) |
|
||||
| `URUTAU_PEER_ALLOW` | empty | CIDRs allowed to call the federation routes; empty accepts any source that has the token |
|
||||
| `URUTAU_PEER_BLOCKLIST` | `on` | `on`: the hub's blocklist includes hostile IPs seen only by peers (score 50+ and a strong signal); `off`: only this instance's own IPs. Anything else refuses to start |
|
||||
| `URUTAU_TRUSTED_PROXY` | `127.0.0.0/8,::1` (the compose file sets `10.250.0.0/24`) | reverse proxies whose `X-Forwarded-For` is trusted (read right to left); used by the login rate limit and by `URUTAU_PEER_ALLOW` |
|
||||
|
||||
### Second firewall (enforce)
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `URUTAU_ENFORCE` | `off` | `off`; `observe` (decides in memory and shows what it would ban, writes nothing); `on` (also appends the decisions to `URUTAU_ENFORCE_LOG` for the host fail2ban). Anything else refuses to start |
|
||||
| `URUTAU_ENFORCE_LOG` | `/logs/enforce/decisions.log` | decision file appended in `on` mode; `on` without it refuses to start |
|
||||
| `URUTAU_ENFORCE_UNBAN_LOG` | `unban.log` next to `URUTAU_ENFORCE_LOG` | file where the dashboard's Unban button writes its requests, read by the host |
|
||||
| `URUTAU_ENFORCE_SHARE` | `off` | `on`: exchange decisions and unbans with the peers every 30 s; each side applies its own exclusions. Anything else refuses to start |
|
||||
| `URUTAU_ENFORCE_THRESHOLD` | `5` | attack events in 10 minutes that justify a ban (1 to 1000) |
|
||||
| `URUTAU_ENFORCE_MAX_PER_MIN` | `60` | most decisions written per minute; the excess is dropped and counted (1 to 10000) |
|
||||
|
||||
An unparseable number falls back to the default; an out-of-range one refuses to start.
|
||||
|
||||
### Egress
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `URUTAU_EGRESS` | `auto` | `auto` (on when `URUTAU_EGRESS_LOG` exists at start), `on` or `off`; anything else refuses to start |
|
||||
| `URUTAU_EGRESS_LOG` | `/logs/host/egress.log` | kernel log of new outbound connections, written by the host kit |
|
||||
| `URUTAU_EGRESS_CONTAINERS` | `/logs/host/containers.map` | `"<ip> <container>"` map written by the host kit every minute, so workloads keep their name when the address changes on a redeploy |
|
||||
| `URUTAU_EGRESS_WORKLOADS` | empty | named workloads and their role, see [Egress analysis](#egress-analysis) |
|
||||
| `URUTAU_EGRESS_RESOLVERS` | empty | DNS resolvers that are allowed, comma separated IPs; empty means the usual public ones (Cloudflare, Google, Quad9...) plus the nameservers of `/etc/resolv.conf` and `/logs/host/resolv.conf` |
|
||||
| `URUTAU_EGRESS_ALLOW` | empty | environment only, no flag: CIDRs or IPs of legitimate periodic pollers that must not raise beaconing findings. The peers' addresses, `URUTAU_TRUSTED` and the server's own public addresses are always allowed |
|
||||
| `URUTAU_EGRESS_PROVIDER_ASN` | empty | environment only, no flag: AS numbers of your hosting provider, comma separated, so traffic to it is not reported as unusual |
|
||||
|
||||
In the container image the log paths default to `/logs/traefik/access.log`, `/logs/host/auth.log` and `/logs/host/fail2ban.log` (the compose file mounts the host logs there); the probe, egress and container map files are in the same `/logs/host` directory. The compose file adds `URUTAU_VERSION` (image tag), `URUTAU_IMAGE` and `URUTAU_PUBLISH` (host address and port), see `.env.example`. It passes only some variables to the container ([docker.md](docker.md)); add any other `URUTAU_*` variable, such as the `URUTAU_ENFORCE_*` and `URUTAU_EGRESS_*` ones, to its `environment` block.
|
||||
|
||||
## Noise and monitoring
|
||||
|
||||
@@ -69,16 +120,51 @@ URUTAU_PEERS=web1=https://urutau.web1.example,db1=https://urutau.db1.example
|
||||
URUTAU_PEER_TOKEN=<shared secret>
|
||||
```
|
||||
|
||||
On each peer, set the same `URUTAU_PEER_TOKEN`. The hub calls only `GET /api/v1/peer/export` (once per range, `1h`, `24h` and `7d`, every 15 seconds). Peer URLs must be `https` (plain `http` is accepted only for loopback): the peer token travels in a header. To restrict who may call the export, set `URUTAU_PEER_ALLOW` on the peer to the hub's address. Peer names must be unique and cannot be `all` or the hub's own name.
|
||||
On each peer, set the same `URUTAU_PEER_TOKEN` (or one `URUTAU_PEER_TOKEN_<NAME>` per peer on the hub). The peer token opens only the federation routes: `GET /api/v1/peer/export` (the hub asks every 15 seconds for `1h`, `24h`, `7d` and `30d`), `GET /api/v1/peer/stream` (live events), `GET /api/v1/peer/period` (the study of a period or an IP), `GET /api/v1/peer/egress` and, when `URUTAU_ENFORCE_SHARE=on`, `GET`/`POST /api/v1/peer/decisions` and `POST /api/v1/peer/unban`. Peer URLs must be `https` (plain `http` is accepted only for loopback): the peer token travels in a header. To restrict who may call these routes, set `URUTAU_PEER_ALLOW` on the peer to the hub's address; when the peer sits behind a proxy, also set `URUTAU_TRUSTED_PROXY` so the real client address is the one compared. Peer names must be unique and cannot be `all` or the hub's own name. With `URUTAU_PEER_BLOCKLIST=off` the hub's blocklist lists only its own IPs.
|
||||
|
||||
## Snapshot and retention
|
||||
|
||||
The snapshot file holds the aggregated state and the log offsets. Mount `URUTAU_DATA_DIR` on a volume to keep it across restarts. Delete the file to start from zero (the rotated logs will be read again). Retention limits how long an IP is kept, at most 168 hours; the dashboard ranges are `1h`, `24h` and `7d`.
|
||||
The snapshot file `urutau-state.gob` holds the aggregated state and the log offsets; it is saved every 60 seconds and on `SIGTERM`. Mount `URUTAU_DATA_DIR` on a volume to keep it across restarts. Delete the file to start from zero (the rotated logs will be read again); a snapshot that cannot be read is set aside at start. Retention (`URUTAU_RETENTION`, at most 720 hours) limits how long an IP is kept; the dashboard ranges are `1h`, `24h`, `7d` and `30d`.
|
||||
|
||||
## Event registry
|
||||
|
||||
`<data-dir>/events/` keeps one line per attacker event, one file per UTC day, older days gzip compressed, deleted after `URUTAU_RETENTION`, and capped in total by `URUTAU_EVENTS_MAX` (a number with an optional unit, `0` turns the registry off). It never holds a legitimate visitor. It lives in the same volume as the snapshot, so plan for the cap on top of the snapshot (about 27 MB in the worst case measured). A full disk or the cap drops events and never stops the service. See [architecture.md](architecture.md).
|
||||
|
||||
## Incidents
|
||||
|
||||
Tickets opened from egress findings (and their status: open, false positive, benign...) are stored in `<data-dir>/incidents.json`, in the same volume. A ticket marked false positive or benign can suppress the same finding later. A corrupt file is moved aside and the store starts empty; nothing else needs setting.
|
||||
|
||||
## Probes (port scans)
|
||||
|
||||
Connections to ports nobody serves are not visible in the application logs. The host kit ([docker.md](docker.md#host-kit)) logs them from the kernel to `/var/log/urutau/probe.log`; Urutau reads that file as `URUTAU_PROBE_LOG`, turns each line into a scanner event and keeps at most one event per address, port and protocol per minute. Without the kit the source stays at `waiting` and nothing else changes.
|
||||
|
||||
## Tor
|
||||
|
||||
Urutau marks addresses that are Tor exits or relays. By default (`URUTAU_TOR_AUTO=on`) it downloads the official exit list and relay list every 6 hours into `<data-dir>/tor` (`exits.txt`, `relays.json`; an invalid download keeps the previous cache); the container then needs outbound HTTPS to `check.torproject.org` and `onionoo.torproject.org`. On an air-gapped host set `URUTAU_TOR_AUTO=off` and maintain your own `URUTAU_TOR_EXITS` file.
|
||||
|
||||
## Second firewall (enforce)
|
||||
|
||||
Optional and off by default. Urutau never gets privileges: it only decides which addresses deserve a ban and appends one line per decision to a file, and a fail2ban jail on the host applies it.
|
||||
|
||||
- `URUTAU_ENFORCE=observe` decides in memory and shows in the dashboard what it would ban; nothing is written. Use it first.
|
||||
- `URUTAU_ENFORCE=on` appends `<time> urutau decision=ban ip=<ip> reason=<slug> score=<n> ttl=<s> host=<name> src=<local|peer>` to `URUTAU_ENFORCE_LOG`. The host side is the `urutau` jail and the `urutau-allports` action installed by `install.sh --enforce` ([docker.md](docker.md#host-kit)). The jail uses the host's own `ignoreip`, so trusted addresses stay protected there too. Decisions wait until the log backfill finishes at start.
|
||||
|
||||
A ban needs one of these inside the window: two critical events (RCE, traversal, `.env`/credentials, VCS, webshell, SQL injection, Log4Shell), `URUTAU_ENFORCE_THRESHOLD` attack events in 10 minutes (doubled for a visitor with a legitimate visit), 5 SSH failures in 10 minutes, 10 distinct ports probed in 10 minutes, a known attacker, 10 SSH failures or 20 web events in 24 hours, 10 SSH failures or 10 web events without a legitimate visit in 7 days (an `ssh-probe` counts half), or one event from an address of a /24 (IPv4) or /64 (IPv6) where 3 or more addresses were banned in the last 24 hours (`neighbor-campaign`). The advisory TTL grows with repeat offences: 1 h, 6 h, 24 h, 7 d. Never banned: trusted and private addresses (`URUTAU_TRUSTED`, `URUTAU_IGNORE`), verified crawlers (forward-confirmed reverse DNS), addresses with an operator allow, infrastructure and peers' own hosts, Cloudflare addresses, and decisions from a peer the local instance cannot confirm. Bans of the `urutau` jail and of `recidive` do not count as evidence of the address's own behaviour. Reasons are a fixed list: `scanner-flood`, `exploit-flood`, `web-bruteforce`, `wp-bruteforce`, `ssh-bruteforce`, `rce`, `path-traversal`, `env-probe`, `vcs-probe`, `webshell`, `sqli`, `log4shell`, `port-scan`, `known-attacker`, `neighbor-campaign`.
|
||||
|
||||
The dashboard's Unban button (`POST /api/v1/enforce/unban`) drops the active ban, writes `<time> urutau unban ip=<ip> allow=<seconds>` to the unban file and, with `URUTAU_ENFORCE_SHARE=on`, tells the peers. On the host `urutau-unban.path` runs `urutau-unban`, which unbans the address in every jail and, with `allow` above 0, ignores it for that many seconds (useful for authorized pentests). `urutau doctor` reports the mode, the file and whether it is writable (`fail` in `on` mode when it is not), and warns when Traefik logs Cloudflare addresses as clients (set `forwardedHeaders.trustedIPs` to the Cloudflare ranges so the real client is seen).
|
||||
|
||||
## Egress analysis
|
||||
|
||||
Analyses what leaves the server: new outbound connections of the host and of the containers, logged by the host kit to `/var/log/urutau/egress.log`. It finds beaconing, mining pools, spam, unauthorized scans, DNS that bypasses the allowed resolvers, and destinations known as hostile or Tor exits. With `URUTAU_EGRESS=auto` it turns on by itself when the log exists. Findings can become tickets (see Incidents).
|
||||
|
||||
`URUTAU_EGRESS_WORKLOADS` names the origins and gives each one a role, so expected behaviour is not reported (a scanner scans, a mail server talks on port 25):
|
||||
|
||||
```
|
||||
URUTAU_EGRESS_WORKLOADS="scanner=name:scan-worker*:scanner;mail=10.0.7.0/24:mail;host-out=host"
|
||||
```
|
||||
|
||||
Format: `name=ITEM,ITEM:role;name2=...`. An ITEM is a CIDR or an IP, `host` (the host's own output), `name:<container>` (exact container name, ignoring a trailing `-<digits>` suffix) or `name:<prefix>*` (every container whose name starts with the prefix). The role after the last colon is `default`, `scanner`, `mail` or `resolver` (default when omitted). A bad definition refuses to start.
|
||||
|
||||
## Authentication and exposure
|
||||
|
||||
The default bind is `0.0.0.0` because the container is behind a proxy. Outside a container, bind to `127.0.0.1` or put a TLS reverse proxy in front. `--insecure-no-auth` exists only for local tests and is refused on non-loopback binds.
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
# Docker
|
||||
|
||||
Urutau ships as one small container image (`linux/amd64` and `linux/arm64`, about 28 MB, no `curl`), defined in [`docker-compose.yml`](../docker-compose.yml). It only needs to read log files and to write one snapshot.
|
||||
Urutau ships as one small container image (`linux/amd64` and `linux/arm64`, about 28 MB, no `curl`), defined in [`docker-compose.yml`](../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)
|
||||
volume urutau-data ── read and write ─► /data (snapshot, geo databases)
|
||||
/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. 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 compose file follows this layout, except the `/logs/enforce` mount, which you add when you enable the second firewall (see [below](#host-kit)). 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. Its `HEALTHCHECK` is the binary itself (`urutau healthcheck`, which asks the local daemon for `/api/health`), so there is no `curl` in the image. The compose file sets a memory limit (`mem_limit`); the soft Go limit is 256 MiB and the worst case measured is about 54 MiB of heap plus a snapshot of about 27 MB, so `mem_limit: 384m` is recommended. The data volume also holds the event registry (`/data/events`, capped by `URUTAU_EVENTS_MAX`, 512 MB by default). The compose file sets and `cpus: 0.5`, a read-only root filesystem, `cap_drop: [ALL]` and `no-new-privileges`, and 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`, per-peer tokens, ...), add it to the `environment` block.
|
||||
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
|
||||
|
||||
@@ -66,7 +68,7 @@ sudo systemctl restart fail2ban
|
||||
|
||||
# logrotate for both files
|
||||
sudo tee /etc/logrotate.d/urutau >/dev/null <<'EOF'
|
||||
/var/log/urutau/*.log {
|
||||
/var/log/urutau/auth.log /var/log/urutau/fail2ban.log {
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
@@ -82,6 +84,8 @@ sudo tee /etc/logrotate.d/urutau >/dev/null <<'EOF'
|
||||
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
|
||||
@@ -129,15 +133,47 @@ networks:
|
||||
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 binary's own defaults (`/data/coolify/proxy/access.log`, `/var/log/...`) are for running it directly on the host.
|
||||
- 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 only write target is the `/data` volume.
|
||||
- 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.
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```yaml
|
||||
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](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. If the host cannot reach the internet, copy the two `.mmdb` files into the volume and set `URUTAU_GEO_UPDATE=0` ([configuration.md](configuration.md)). Data by [DB-IP](https://db-ip.com), CC BY 4.0.
|
||||
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](configuration.md)). Data by [DB-IP](https://db-ip.com), CC BY 4.0.
|
||||
|
||||
## Federation across servers
|
||||
|
||||
@@ -150,12 +186,12 @@ Run one Urutau per server with its own `URUTAU_NAME`. Every instance that is pol
|
||||
URUTAU_PEER_TOKEN_SERVER_3: ${TOKEN_FOR_SERVER_3}
|
||||
```
|
||||
|
||||
The hub calls only `GET /api/v1/peer/export` on each peer (three ranges every 15 seconds) and keeps one `GET /api/v1/peer/stream` open for the live events, with 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.
|
||||
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 snapshot. Keep the image on a pinned tag (`X.Y.Z`) in production and `latest` only where you accept updates.
|
||||
`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` the daemon stops accepting requests, saves the snapshot and exits.
|
||||
`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.
|
||||
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 217 KiB |
|
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 188 KiB |
|
Before Width: | Height: | Size: 437 KiB After Width: | Height: | Size: 463 KiB |
|
Before Width: | Height: | Size: 413 KiB After Width: | Height: | Size: 437 KiB |
|
Before Width: | Height: | Size: 421 KiB After Width: | Height: | Size: 446 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 693 KiB After Width: | Height: | Size: 698 KiB |
|
Before Width: | Height: | Size: 677 KiB After Width: | Height: | Size: 683 KiB |
|
Before Width: | Height: | Size: 690 KiB After Width: | Height: | Size: 696 KiB |
|
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 225 KiB After Width: | Height: | Size: 233 KiB |
|
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 222 KiB |
|
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 292 KiB |
|
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 173 KiB |
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 201 KiB |
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 185 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 171 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 218 KiB |
|
Before Width: | Height: | Size: 206 KiB After Width: | Height: | Size: 206 KiB |
|
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 255 KiB After Width: | Height: | Size: 253 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 187 KiB |
|
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 416 KiB After Width: | Height: | Size: 414 KiB |
|
Before Width: | Height: | Size: 391 KiB After Width: | Height: | Size: 402 KiB |
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 296 KiB After Width: | Height: | Size: 295 KiB |
|
Before Width: | Height: | Size: 612 KiB After Width: | Height: | Size: 622 KiB |
|
Before Width: | Height: | Size: 617 KiB After Width: | Height: | Size: 615 KiB |
|
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 212 KiB |
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 224 KiB After Width: | Height: | Size: 225 KiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 209 KiB |
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 234 KiB |
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 229 KiB |
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 399 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 392 KiB |
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 187 KiB |
|
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 390 KiB After Width: | Height: | Size: 237 KiB |
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 231 KiB |
|
Before Width: | Height: | Size: 381 KiB After Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 312 KiB After Width: | Height: | Size: 312 KiB |
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 167 KiB After Width: | Height: | Size: 170 KiB |
|
Before Width: | Height: | Size: 198 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 212 KiB After Width: | Height: | Size: 215 KiB |
|
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 215 KiB |
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
@@ -2,7 +2,7 @@
|
||||
|
||||
# Interface
|
||||
|
||||
The dashboard is embedded in the binary: plain HTML, CSS and JavaScript, no build step and no external request (fonts, scripts and styles are all served by Urutau, which the Content-Security-Policy enforces). It follows the system light or dark theme, can be switched by hand, and speaks English or Portuguese (button in the header; the choice is remembered in the browser).
|
||||
Urutau 1.6.0. The dashboard is embedded in the binary: plain HTML, CSS and JavaScript, no build step and no external request (fonts, scripts and styles are all served by Urutau, which the Content-Security-Policy enforces). It follows the system light or dark theme, can be switched by hand, speaks English or Portuguese (button in the header; the choice is remembered in the browser) and has a phone layout. 23 pages, listed below.
|
||||
|
||||
## Login
|
||||
|
||||
@@ -12,7 +12,7 @@ Open the address of the instance. Without a session you are sent to `/login`: pa
|
||||
|
||||
## Navigation
|
||||
|
||||
A side rail (a tab bar on phones) holds the pages. Each page opens with a sentence carrying the number that matters, and the active slice (range, host, domain) is always written under the title. The page lives in the URL hash (`#/overview`, `#/threats`, `#/geo`, `#/live`, `#/replay`, `#/traffic`, `#/ips`, `#/ip/<ip>`, `#/sources`), so a view can be bookmarked or shared; the Geography page goes deeper, as in `#/geo/BR/Pernambuco/Recife` (country, state, city). An IP detail drawer opens from any IP.
|
||||
A side rail (a tab bar on phones, with a "More" menu that scrolls when it is taller than the screen) holds the pages, in five groups. Each page opens with a sentence carrying the number that matters, and the active slice (range, host, domain) is always written under the title. The page lives in the URL hash (`#/overview`, `#/threats`, `#/geo`, `#/live`, `#/replay`, `#/traffic`, `#/ips`, `#/ip/<ip>`, `#/sources`, `#/incidents`, `#/incidents/<id>`, `#/campaigns/<id>`, and so on), so a view can be bookmarked or shared; the Geography page goes deeper, as in `#/geo/BR/Pernambuco/Recife` (country, state, city). An IP detail drawer opens from any IP. The Incidents item in the rail carries a small counter of open tickets.
|
||||
|
||||
## Header
|
||||
|
||||
@@ -21,79 +21,139 @@ A side rail (a tab bar on phones) holds the pages. Each page opens with a senten
|
||||
- The **period** selector: twelve ranges (`1h`, `2h`, `3h`, `6h`, `12h`, `24h`, `2d`, `3d`, `5d`, `7d`, `15d`, `30d`) or a custom period (`from` and `to`, at most 30 days). It applies to every page.
|
||||
- Language, theme and logout buttons.
|
||||
|
||||
|
||||
## Page groups
|
||||
|
||||
| Group | Pages |
|
||||
|---|---|
|
||||
| **Monitor** | Overview, Live, Services |
|
||||
| **Investigate** | IPs, Sessions, Campaigns, Replay, Event search, Incidents, Outbound traffic |
|
||||
| **Analyze** | Threats, MITRE ATT&CK, Geography, Evolution, Concentration, Survival, Traffic, Where errors come from, Protocols and TLS |
|
||||
| **Operate** | Defense, Sources and hosts, Integrity |
|
||||
| **Reports** | Reports |
|
||||
|
||||
## Pages
|
||||
|
||||
- **Overview:** the headline numbers (requests, malicious events, hostile and suspicious IPs, bans, the "monitoring" counter of benign monitor requests kept out of the traffic numbers), the timeline and the top IPs.
|
||||
### Monitor
|
||||
|
||||
**Overview** (`#/overview`): the headline numbers (requests, malicious events, hostile and suspicious IPs, bans, the "monitoring" counter of benign monitor requests kept out of the traffic numbers), the timeline and the top IPs.
|
||||
|
||||
<p align="center"><img src="img/overview-dark.png" width="900" alt="Overview page"><br><sub>Overview (demo data).</sub></p>
|
||||
- **Threats:** stacked counters per category, the live feed of the latest events (log fields are shown as text, never as markup) and the top attacked paths, domains, User-Agents and targeted users.
|
||||
|
||||
<p align="center"><img src="img/threats-dark.png" width="900" alt="Threats page"><br><sub>Threats: categories over time, KPIs and the latest events.</sub></p>
|
||||
- **Geography:** a world map by attacker country. Select a country to see its states or regions and its cities (drawn as circles on the zoomed country), the categories and the top IPs; select a region to narrow cities and IPs. The view is `#/geo/<CC>/<region>`.
|
||||
|
||||
<p align="center"><img src="img/geo-world-dark.png" width="900" alt="Geography page: world map by attacker country"><br><sub>Geography: the world by attacker country.</sub></p>
|
||||
<p align="center"><img src="img/geo-brazil-dark.png" width="900" alt="Geography page zoomed on Brazil, by state"><br><sub>Geography: a country, by state and city.</sub></p>
|
||||
<p align="center"><img src="img/geo-pernambuco-dark.png" width="900" alt="Geography page zoomed on the state of Pernambuco, with its city"><br><sub>Geography: a region, with its cities and top IPs.</sub></p>
|
||||
- **Live:** attacks drawn as animated arcs from their origin to the server that saw them, on a flat map or a 3D globe, with the rate, categories, servers, recent origins, a metrics column and latest events, filters, pause and full screen. It opens by replaying the latest events (`/api/v1/live/recent`), so it is not still on a quiet server. On a hub it also shows the events of every peer. The position of each server comes from `--location`.
|
||||
**Live** (`#/live`): attacks drawn as animated arcs from their origin to the server that saw them, on a flat map or a 3D globe, with the rate, categories, servers, recent origins, a metrics column and latest events, filters, pause and full screen. It opens by replaying the latest events (`/api/v1/live/recent`), so it is not still on a quiet server. On a hub it also shows the events of every peer. The position of each server comes from `--location`.
|
||||
|
||||
<p align="center"><img src="img/live-flat-dark.png" width="900" alt="Live page on the flat map"><br><sub>Live: flat map.</sub></p>
|
||||
<p align="center"><img src="img/live-globe-dark.png" width="900" alt="Live page on the 3D globe"><br><sub>Live: 3D globe.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/replay-dark.png" width="900" alt="Replay page: a period replayed on the map with the ordered event list and the incident timeline"><br><sub>Replay: a period played back, with incidents on the timeline.</sub></p>
|
||||
- **Traffic:** privacy-friendly web analytics for legitimate traffic, built from the same Traefik log: unique visitors, pages, referrers, countries, browsers, operating systems, devices, response latency (p50 and p95), bytes sent and a world map of visitor countries, per domain. Unique visitors are counted by a hash with a daily salt; the IP of a legitimate visitor is never stored. See [SECURITY.md](../SECURITY.md).
|
||||
|
||||
<p align="center"><img src="img/traffic-dark.png" width="900" alt="Traffic page: web analytics of legitimate visitors"><br><sub>Traffic: privacy-friendly web analytics.</sub></p>
|
||||
- **IPs:** a table with score, level (`hostile`, `suspicious`, `low`), categories, hosts, reverse DNS, country, city and ASN, last seen and ban state, with a search box (IP or reverse DNS), a level filter, a "banned only" filter, sorting and paging. The detail drawer shows first and last seen, per-category counts, sample paths, User-Agents (parsed into browser, OS, device, bot or attack tool), domains, users and jails.
|
||||
|
||||
<p align="center"><img src="img/ips-dark.png" width="900" alt="IPs page: table of addresses with score, level, origin and ban state"><br><sub>IPs: every address with score and level.</sub></p>
|
||||
<p align="center"><img src="img/ip-analysis-dark.png" width="900" alt="IP analysis page for one attacker"><br><sub>IP analysis: verdict, evidence and recommended actions.</sub></p>
|
||||
- **IP analysis** (`#/ip/<ip>`, opened from any IP): the verdict with its reasons, recommended actions, attack families and MITRE ATT&CK techniques, network type, cadence, sessions with their stage, campaigns, exposure, the event history and a STIX 2.1 download.
|
||||
- **Replay** (`#/replay`): a period played back on the map with the ordered event list and the incident timeline, from the event registry.
|
||||
- **Sources and hosts:** every instance with its state (online, latency, version), every log source with its state (`following`, `waiting`, `backfill`, `error`), lines read, malformed lines and last event (file paths are not shown), and the **blocklist**: pick a minimum score (default 50), copy or download it. It only lists hostile, globally routable addresses (never `--ignore` or `--trusted` ranges, never an IP with a successful SSH login); IPv6 appears as its /64, written `x:x:x:x::/64`.
|
||||
|
||||
<p align="center"><img src="img/sources-dark.png" width="900" alt="Sources and hosts page: instances, log sources and blocklist"><br><sub>Sources and hosts.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/sessions-dark.png" width="900" alt="Page: Sessions"><br><sub>Sessions: the stages of each attacker, with a replay link.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/campaigns-dark.png" width="900" alt="Page: Campaigns"><br><sub>Campaigns: coordinated groups of addresses (Gantt and similarity).</sub></p>
|
||||
|
||||
<p align="center"><img src="img/campaign-detail-dark.png" width="900" alt="Page: Campaign detail"><br><sub>Campaign detail: members, timeline and shared traits.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/search-dark.png" width="900" alt="Page: Search"><br><sub>Search: filter the event registry by IP, path, family and status.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/mitre-dark.png" width="900" alt="Page: MITRE ATT&CK"><br><sub>MITRE ATT&CK: techniques observed, by tactic.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/defense-dark.png" width="900" alt="Page: Defense, with the second firewall"><br><sub>Defense: coverage of the host fail2ban and the second firewall (observe mode).</sub></p>
|
||||
|
||||
<p align="center"><img src="img/egress-dark.png" width="900" alt="Page: Egress traffic"><br><sub>Egress: outbound connections of the host and containers, with scan bursts, beacons and mining.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/evolution-dark.png" width="900" alt="Page: Evolution"><br><sub>Evolution: how attacks change over time.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/concentration-dark.png" width="900" alt="Page: Concentration"><br><sub>Concentration: how much of the hostility a few sources or networks account for.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/survival-dark.png" width="900" alt="Page: Survival"><br><sub>Survival: how long attackers keep coming back.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/errors-dark.png" width="900" alt="Page: Errors"><br><sub>Errors: response classes, targets and hosts.</sub></p>
|
||||
**Services** (`#/slo`): a plain-language verdict, KPIs with sparklines, and services from worst to best with availability against the 99.5% SLO, error budget left, burn rate (1 h and 6 h), Apdex and latency. A service detail shows requests and errors, how requests were answered, p95 by hour and failing routes split into service errors, blocked attacks and client mistakes. Services come from the Traefik router and service names.
|
||||
|
||||
<p align="center"><img src="img/slo-dark.png" width="900" alt="Page: Services"><br><sub>Services: availability and latency of each service.</sub></p>
|
||||
|
||||
### Investigate
|
||||
|
||||
**IPs** (`#/ips`): a table with score, level (`hostile`, `suspicious`, `low`), categories, hosts, reverse DNS, country, city and ASN, last seen and ban state, with a search box (IP or reverse DNS), a level filter, a "banned only" filter, sorting and paging. The detail drawer shows first and last seen, per-category counts, sample paths, User-Agents (parsed into browser, OS, device, bot or attack tool), domains, users and jails. Banned addresses carry an **Unban** button (see Defense).
|
||||
|
||||
<p align="center"><img src="img/ips-dark.png" width="900" alt="IPs page: table of addresses with score, level, origin and ban state"><br><sub>IPs: every address with score and level.</sub></p>
|
||||
|
||||
**IP analysis** (`#/ip/<ip>`, opened from any IP): the verdict with its reasons, recommended actions, attack families and MITRE ATT&CK techniques, network type (VPN, hosting, mobile, residential, Tor, research scanner), cadence (automated, human-like, mixed), sessions with their stage, campaigns, exposure, the event history, an Unban button and a STIX 2.1 download.
|
||||
|
||||
<p align="center"><img src="img/ip-analysis-dark.png" width="900" alt="IP analysis page for one attacker"><br><sub>IP analysis: verdict, evidence and recommended actions.</sub></p>
|
||||
|
||||
**Sessions** (`#/sessions`): the stages of each attacker (recon, probe, exploit, access, banned) as a funnel and a list, with a replay link.
|
||||
|
||||
<p align="center"><img src="img/sessions-dark.png" width="900" alt="Page: Sessions"><br><sub>Sessions: the stages of each attacker, with a replay link.</sub></p>
|
||||
|
||||
**Campaigns** (`#/campaigns`, and `#/campaigns/<id>` for one): coordinated groups of addresses doing the same thing, with a Gantt and similarity; the detail page shows members, timeline and shared traits.
|
||||
|
||||
<p align="center"><img src="img/campaigns-dark.png" width="900" alt="Page: Campaigns"><br><sub>Campaigns: coordinated groups of addresses (Gantt and similarity).</sub></p>
|
||||
<p align="center"><img src="img/campaign-detail-dark.png" width="900" alt="Page: Campaign detail"><br><sub>Campaign detail: members, timeline and shared traits.</sub></p>
|
||||
|
||||
**Replay** (`#/replay`): a period played back on the map with the ordered event list and the incident timeline, from the event registry.
|
||||
|
||||
<p align="center"><img src="img/replay-dark.png" width="900" alt="Replay page: a period replayed on the map with the ordered event list and the incident timeline"><br><sub>Replay: a period played back, with incidents on the timeline.</sub></p>
|
||||
|
||||
**Event search** (`#/search`): filter the event registry by IP, path, family and status, paged by cursor.
|
||||
|
||||
<p align="center"><img src="img/search-dark.png" width="900" alt="Page: Search"><br><sub>Search: filter the event registry by IP, path, family and status.</sub></p>
|
||||
|
||||
**Incidents** (`#/incidents`, `#/incidents/<id>`): every outbound-traffic finding above info severity becomes a ticket `INC-<n>`, keyed by `host|kind|workload|dst|dport|proto`. The list is a dense table with status tabs (`open`, `investigating`, `true_positive`, `false_positive`, `benign`, `resolved`), filters, sorting (updated, severity, last seen), paging and CSV export; `?status=` in the link opens it filtered. A ticket page has a sticky header with quick actions, a summary with a unified timeline of comments and changes, and a sidebar with inline-saved properties (severity, assignee, tags, verdict) and compact technical data. A ticket in `false_positive` or `benign` can suppress findings with exactly its key, which then leave the Outbound traffic page. A resolved ticket reopens when the finding reappears; you can also open a ticket by hand. Stored in `<data-dir>/incidents.json`.
|
||||
|
||||
<p align="center"><img src="img/incidents-dark.png" width="900" alt="Page: Incidents"><br><sub>Incidents: tickets for outbound-traffic findings.</sub></p>
|
||||
<p align="center"><img src="img/incident-detail-dark.png" width="900" alt="Page: Incident ticket"><br><sub>Incident ticket: summary, activity timeline and properties.</sub></p>
|
||||
|
||||
**Outbound traffic** (`#/egress`, needs `URUTAU_EGRESS` and the host kit in `deploy/host`): the new outbound connections of the host and containers, logged by nftables, analysed for beaconing (regular conversations with one destination, with the interval histogram), mining, IRC and SMTP ports, contact with addresses that attacked the server or Tor relays, DNS outside the allowed resolvers, unauthorised outbound scans and new countries. It shows a plain-language verdict, evidence cards, a destination map, activity by hour, compact workloads (by network or container name, `URUTAU_EGRESS_WORKLOADS`; a `scanner` workload has only its scan-shaped traffic summarised) and the timeline of authorised scans. Servers themselves, peers and the host's own provider never raise findings; regular connections to large CDNs and clouds are low severity.
|
||||
|
||||
<p align="center"><img src="img/egress-dark.png" width="900" alt="Page: Outbound traffic"><br><sub>Outbound traffic: scan bursts, beacons and mining from containers.</sub></p>
|
||||
|
||||
### Analyze
|
||||
|
||||
**Threats** (`#/threats`): stacked counters per category, the live feed of the latest events (log fields are shown as text, never as markup) and the top attacked paths, domains, User-Agents and targeted users.
|
||||
|
||||
<p align="center"><img src="img/threats-dark.png" width="900" alt="Threats page"><br><sub>Threats: categories over time, KPIs and the latest events.</sub></p>
|
||||
|
||||
**MITRE ATT&CK** (`#/mitre`): the techniques seen, by tactic, and when each was first seen. Probes of unserved ports reported by the host kit are `port-scan` (T1046).
|
||||
|
||||
<p align="center"><img src="img/mitre-dark.png" width="900" alt="Page: MITRE ATT&CK"><br><sub>MITRE ATT&CK: techniques observed, by tactic.</sub></p>
|
||||
|
||||
**Geography** (`#/geo`): a world map by attacker country. Select a country to see its states or regions and its cities (drawn as circles on the zoomed country), the categories and the top IPs; select a region to narrow cities and IPs. The view is `#/geo/<CC>/<region>`.
|
||||
|
||||
<p align="center"><img src="img/geo-world-dark.png" width="900" alt="Geography page: world map by attacker country"><br><sub>Geography: the world by attacker country.</sub></p>
|
||||
<p align="center"><img src="img/geo-brazil-dark.png" width="900" alt="Geography page zoomed on Brazil, by state"><br><sub>Geography: a country, by state and city.</sub></p>
|
||||
<p align="center"><img src="img/geo-pernambuco-dark.png" width="900" alt="Geography page zoomed on the state of Pernambuco, with its city"><br><sub>Geography: a region, with its cities and top IPs.</sub></p>
|
||||
|
||||
**Evolution** (`#/evolution`): how attacks change over time.
|
||||
|
||||
<p align="center"><img src="img/evolution-dark.png" width="900" alt="Page: Evolution"><br><sub>Evolution: how attacks change over time.</sub></p>
|
||||
|
||||
**Concentration** (`#/concentration`): how much of the hostility a few IPs or ASNs account for.
|
||||
|
||||
<p align="center"><img src="img/concentration-dark.png" width="900" alt="Page: Concentration"><br><sub>Concentration: how much of the hostility a few sources or networks account for.</sub></p>
|
||||
|
||||
**Survival** (`#/survival`): time to ban and Kaplan-Meier survival curves over attack episodes, with who blocked and how fast (the host fail2ban jails apart from the Urutau second firewall).
|
||||
|
||||
<p align="center"><img src="img/survival-dark.png" width="900" alt="Page: Survival"><br><sub>Survival: how long attackers keep coming back.</sub></p>
|
||||
|
||||
**Traffic** (`#/traffic`): privacy-friendly web analytics for legitimate traffic, built from the same Traefik log: unique visitors, pages, referrers, countries, browsers, operating systems, devices, response latency (p50 and p95), bytes sent and a world map of visitor countries, per domain. A unique visitor is a person with a real browser (a successful GET of a document by a browser User-Agent, one per IP per day, deduplicated globally); bots, tools and unknown clients are counted apart as "non-human clients". Visitors are counted by a hash with a daily salt; the IP of a legitimate visitor is never stored. See [SECURITY.md](../SECURITY.md).
|
||||
|
||||
<p align="center"><img src="img/traffic-dark.png" width="900" alt="Traffic page: web analytics of legitimate visitors"><br><sub>Traffic: privacy-friendly web analytics.</sub></p>
|
||||
|
||||
**Where errors come from** (`#/errors`): errors split into the classes `app`, `proxy`, `blocked`, `attack`, `bot`, `client` and `unknown`, so a 5xx from your app is told apart from a broken link or a scanner; response classes, targets and hosts.
|
||||
|
||||
<p align="center"><img src="img/errors-dark.png" width="900" alt="Page: Errors"><br><sub>Errors: response classes, targets and hosts.</sub></p>
|
||||
|
||||
**Protocols and TLS** (`#/protocol`): HTTP versions, TLS versions and cipher suites in use, with the methods and the breakdown by class.
|
||||
|
||||
<p align="center"><img src="img/protocol-dark.png" width="900" alt="Page: Protocols and TLS"><br><sub>Protocols and TLS: HTTP and TLS versions by class.</sub></p>
|
||||
|
||||
### Operate
|
||||
|
||||
**Defense** (`#/defense`): coverage and leaks of bans and of the blocklist. An attacker counts as protected when it is listed or banned by any jail; the API also splits one-shot from repeat attackers (`one_shot`, `repeat_ips`). It also holds the **second firewall** section (`URUTAU_ENFORCE=off|observe|on`): the mode, recent decisions with their reason (for example `known-attacker`, `port-scan`, `neighbor-campaign`), coverage, and the operator releases. Urutau only decides and writes the decisions to a file; the host fail2ban (jail `urutau`) applies them, and in `observe` mode it shows what would be blocked. It never blocks trusted addresses, private ranges, CDN and public resolver ranges, peers, the server itself or crawlers verified by forward-confirmed reverse DNS (Googlebot, Bingbot, Applebot). An **Unban** button on recent decisions and on the address page asks the host to lift the block (through `unban.log` next to `--enforce-log`) and can keep the second firewall from banning the address again for 1 h, 24 h or 7 days. With `URUTAU_ENFORCE_SHARE` a hub and its peers exchange decisions, each side applying its own exclusions.
|
||||
|
||||
<p align="center"><img src="img/defense-dark.png" width="900" alt="Page: Defense, with the second firewall"><br><sub>Defense: coverage of the host fail2ban and the second firewall (observe mode).</sub></p>
|
||||
|
||||
**Sources and hosts** (`#/sources`): every instance with its state (online, latency, version), every log source with its state (`following`, `waiting`, `backfill`, `error`, and degraded when more than 20% of the last 1000 lines are unreadable), lines read, malformed lines and last event (file paths are not shown), and the **blocklist**: pick a minimum score (default 50), copy or download it. It only lists hostile, globally routable addresses (never `--ignore` or `--trusted` ranges, never an IP with a successful SSH login, never an address whose only evidence is a ban by the `urutau` or `recidive` jails); IPv6 appears as its /64, written `x:x:x:x::/64`.
|
||||
|
||||
<p align="center"><img src="img/sources-dark.png" width="900" alt="Sources and hosts page: instances, log sources and blocklist"><br><sub>Sources and hosts.</sub></p>
|
||||
|
||||
**Integrity** (`#/integrity`): health of the data: log sources, event registry and snapshot.
|
||||
|
||||
<p align="center"><img src="img/integrity-dark.png" width="900" alt="Page: Integrity"><br><sub>Integrity: health of the log sources and the registry.</sub></p>
|
||||
|
||||
### Reports
|
||||
|
||||
**Reports** (`#/reports`): a preview of the HTML report itself (`GET /api/v1/report?format=html`), always an A4 sheet scaled to the screen, with only Download and Print; language, period and server come from the header. The report has a cover, an executive summary in plain language, rule-based recommendations, threats, geography, errors and health, visitors, defense, second firewall and outbound traffic, printable on A4.
|
||||
|
||||
<p align="center"><img src="img/reports-dark.png" width="900" alt="Page: Reports"><br><sub>Reports: the exportable report.</sub></p>
|
||||
|
||||
## Themes and phones
|
||||
|
||||
<p align="center"><img src="img/overview-light.png" width="620" alt="Overview in the light theme"> <img src="img/overview-mobile.png" height="420" alt="Overview on a phone"><br><sub>The light theme on a desktop and the phone layout (a tab bar replaces the side rail).</sub></p>
|
||||
|
||||
## Page groups
|
||||
<p align="center"><img src="img/defense-light.png" width="620" alt="Defense in the light theme"> <img src="img/defense-mobile.png" height="420" alt="Defense on a phone"><br><sub>Defense in the light theme and on a phone.</sub></p>
|
||||
|
||||
The side rail groups the pages:
|
||||
<p align="center"><img src="img/egress-light.png" width="620" alt="Outbound traffic in the light theme"> <img src="img/egress-mobile.png" height="420" alt="Outbound traffic on a phone"><br><sub>Outbound traffic in the light theme and on a phone.</sub></p>
|
||||
|
||||
- **Monitor:** Overview, Live, Services (per-service SLO, error budget, burn rate and Apdex; `#/slo`).
|
||||
- **Investigate:** IPs, Sessions (the funnel from recon to access), Campaigns (and a page per campaign), Replay and Event search.
|
||||
- **Analyze:** Threats, MITRE ATT&CK (techniques seen and when first seen), Geography, Evolution (change over time), Concentration (how much comes from few IPs or ASNs), Survival (time to ban, Kaplan-Meier), Traffic, Where errors come from (classes `app`, `proxy`, `blocked`, `attack`, `bot`, `client`, `unknown`) and Protocols and TLS (HTTP versions and TLS versions in use).
|
||||
- **Operate:** Defense (ban and blocklist coverage and leaks), Sources and hosts, Integrity (health of the data: sources, registry, snapshot).
|
||||
- **Reports:** a summary of a period, from `GET /api/v1/report`.
|
||||
On phones, plain data tables (concentration ranking, error routes, MITRE techniques, Defense, Integrity sources) turn into stacked cards with the column name as a label, and nothing scrolls sideways.
|
||||
|
||||
## Glossary and tooltips
|
||||
|
||||
@@ -130,7 +190,7 @@ State and city boundaries on the Geography page are from [Natural Earth](https:/
|
||||
| `GET /api/v1/defense` | session or bearer | ban and blocklist coverage and leaks |
|
||||
| `GET /api/v1/errors` | session or bearer | errors by class (`app`, `proxy`, `blocked`, `attack`, `bot`, `client`, `unknown`) |
|
||||
| `GET /api/v1/integrity` | session or bearer | health of the data: sources, registry, snapshot |
|
||||
| `GET /api/v1/report` | session or bearer | summary of a period (requests, attacks, hostile IPs, bans, visitors, non-human clients, page views, top IPs) |
|
||||
| `GET /api/v1/report` | session or bearer | summary of a period (`format=html` returns the printable A4 report, with `lang`) (requests, attacks, hostile IPs, bans, visitors, non-human clients, page views, top IPs) |
|
||||
| `GET /api/v1/services`, `/api/v1/services/{svc}` | session or bearer | per-service SLI, SLO, error budget, burn rate and Apdex |
|
||||
| `GET /api/v1/protocols` | session or bearer | HTTP and TLS versions in use |
|
||||
| `GET /api/v1/ips` | session or bearer | IP table. Query: `range`, `host`, `min_score`, `level`, `q`, `banned=1`, `sort` (`score`, `last`, `first`, `events`, `ip`), `order=asc`, `per` (1 to 200, default 50), `page` |
|
||||
@@ -144,11 +204,14 @@ State and city boundaries on the Geography page are from [Natural Earth](https:/
|
||||
| `POST /api/v1/incidents` | session or bearer | opens a manual ticket `{title,detail,severity,host,tags,author}` (body up to 64 KiB, unknown fields refused; cross-site refused) |
|
||||
| `PATCH /api/v1/incidents/{id}` | session or bearer | partial update `{status,severity,assignee,tags,title,verdict,suppress,author}`; each change is a history entry. `suppress` only in `false_positive` or `benign`, and hides findings with the exact same key in `/api/v1/egress` (add `suppressed=1` to see them) |
|
||||
| `POST /api/v1/incidents/{id}/comments` | session or bearer | adds a comment `{text,author}` |
|
||||
| `GET /api/v1/egress` | session or bearer | outbound-traffic analysis: verdict, findings (with `samples`, `ticket_id`, `ticket_status`, `suppressed`), workloads, `by_country`, `suppressed_count`. Query: `range`, `host`, `suppressed=1` |
|
||||
| `GET /api/v1/enforce` | session or bearer | second firewall: mode, recent decisions, coverage and operator releases (`allows`) |
|
||||
| `POST /api/v1/enforce/unban` | session or bearer | asks the host to lift a block and, optionally, keeps the address from being banned again for 1 h, 24 h or 7 days (cross-site refused) |
|
||||
| `DELETE /api/v1/enforce/allow` | session or bearer | ends an operator release |
|
||||
| `GET /api/v1/peer/egress`, `GET`/`POST /api/v1/peer/decisions`, `POST /api/v1/peer/unban` | peer token only | federation: the egress report a hub merges, and the exchange of second firewall decisions and unbans |
|
||||
|
||||
An invalid `range` or period answers 400, and `range` in the responses is an object `{name,from,to,step,clipped}` (`step` is the timeline granularity in seconds).
|
||||
|
||||
API clients send `Authorization: Bearer <URUTAU_TOKEN>`. The peer token is accepted only by `/api/v1/peer/export`, `/api/v1/peer/stream` and `/api/v1/peer/period`; every other route answers 403 to it.
|
||||
API clients send `Authorization: Bearer <URUTAU_TOKEN>`. The peer token is accepted only by the `/api/v1/peer/*` routes (`export`, `stream`, `period`, `egress`, `decisions`, `unban`); every other route answers 403 to it.
|
||||
|
||||
<p align="center"><img src="img/defense-light.png" width="620" alt="Defense"> <img src="img/defense-mobile.png" height="420" alt="Defense"><br><sub>Defense, egress and campaigns in the light theme and on a phone.</sub></p>
|
||||
|
||||
<p align="center"><img src="img/egress-light.png" width="620" alt="Egress"> <img src="img/egress-mobile.png" height="420" alt="Egress"></p>
|
||||
@@ -5,45 +5,68 @@
|
||||
O Urutau é um único binário Go sem dependência de terceiros. Tudo roda em um processo.
|
||||
|
||||
```
|
||||
cmd/urutau ponto de entrada: serve, doctor, version
|
||||
internal/app flags, ligação das peças, runner dos logs, doctor
|
||||
cmd/urutau ponto de entrada: serve, doctor, healthcheck, version
|
||||
internal/app flags, ligação das peças, runner dos logs, fonte de probes, listas Tor, enforce e egress, doctor
|
||||
internal/tail seguidor de arquivo que tolera rotação e leitor de rotacionados
|
||||
internal/core modelo de evento, parsers (Traefik, sshd, fail2ban), classificador
|
||||
internal/store estado em memória, resumos, merge, snapshot
|
||||
internal/core modelo de evento, parsers (Traefik JSON e texto, sshd, fail2ban), classificador, classes de erro
|
||||
internal/store estado em memória, resumos, merge, snapshot, análises, serviços, defesa, roster
|
||||
internal/rdns cache de DNS reverso e DNS reverso confirmado
|
||||
internal/evlog registro de eventos em disco
|
||||
internal/intel famílias, MITRE, tipo de rede, cadência, sessões, campanhas, vereditos, STIX, métricas
|
||||
internal/fed hub que consulta os peers
|
||||
internal/server handler HTTP, autenticação, dashboard embutido (web/)
|
||||
internal/geo leitor MMDB sem dependências e atualizador das bases (DB-IP Lite)
|
||||
internal/ua parser de User-Agent (navegador, sistema, dispositivo, bot, ferramenta de ataque)
|
||||
internal/enforce segundo firewall: decisões de ban, arquivo de decisões, pedidos de desban, liberações do operador
|
||||
internal/egress análise das conexões de saída: workloads, achados (beacon, C2, mineração, varredura...)
|
||||
internal/incidents chamados abertos a partir de achados de egress ou à mão, guardados em incidents.json
|
||||
internal/fed hub que consulta os peers, repasse ao vivo, mescla de estudos, troca de decisões e egress
|
||||
internal/server handler HTTP, autenticação, rotas da API, relatório HTML, dashboard embutido (web/)
|
||||
deploy/host kit do host: tabela nftables, rsyslog, logrotate, mapa de contêineres, jail do fail2ban, instalador
|
||||
```
|
||||
|
||||
A única dependência é a biblioteca padrão do Go.
|
||||
|
||||
## Fluxo de dados
|
||||
|
||||
```
|
||||
access.log do Traefik auth.log fail2ban.log
|
||||
│ │ │
|
||||
└──── tail.Follower (uma goroutine por fonte) ────┐
|
||||
▼
|
||||
parse (core.ParseTraefik / ParseAuth / ParseFail2ban) → Event
|
||||
▼
|
||||
access.log do Traefik auth.log fail2ban.log probe.log (nft, portas fechadas)
|
||||
│ │ │ │
|
||||
└──── tail.Follower (uma goroutine por fonte) ─┘
|
||||
▼
|
||||
parse (core.ParseTraefik / ParseAuth / ParseFail2ban / parser de probes) → Event
|
||||
▼
|
||||
origem confiável? descarta. UA de monitor e benigno? conta à parte.
|
||||
▼
|
||||
store.Ingest: contadores, registro por IP, feed ao vivo
|
||||
▼
|
||||
snapshot a cada 60 s ◄── estado ──► resumos / tabela de IPs / SSE
|
||||
▼
|
||||
classifica (core): categoria, classe de erro, navegação em forge isenta
|
||||
▼
|
||||
store.Ingest: contadores, registro por IP, feed ao vivo ──► evlog (events/)
|
||||
▼
|
||||
intel (calculada sob demanda): família, MITRE, tipo de rede, cadência, sessões,
|
||||
campanhas, veredito ──► dashboard, API, STIX, blocklist, relatório HTML
|
||||
▼
|
||||
enforce (opcional): decisão por IP atacante ──► decisions.log
|
||||
▼
|
||||
jail "urutau" do fail2ban no host lê decisions.log e bane no firewall
|
||||
▼
|
||||
fail2ban.log "Ban urutau" volta como evento (não conta como evidência)
|
||||
|
||||
egress.log (nft, conexões novas de saída) ──► egress.Source ──► achados
|
||||
achados ──► incidents (chamados INC-n, supressão) ──► API e relatório
|
||||
```
|
||||
|
||||
Snapshot a cada 60 s: `estado` ◄──► resumos, tabela de IPs, SSE. O segundo firewall nunca ganha privilégios: ele só acrescenta linhas a um arquivo que uma jail do host lê.
|
||||
|
||||
## Fontes
|
||||
|
||||
Cada fonte é seguida por sua própria goroutine e reporta um estado: `following`, `waiting` (o arquivo ainda não existe), `backfill` (primeira inicialização, lendo as cópias rotacionadas) ou `error`. Uma linha maior que 64 KiB é descartada e contada como malformada. Na primeira inicialização sem snapshot, as cópias rotacionadas (`path.1`, `path.N.gz` até 9) são lidas da mais antiga para a mais nova, para que a janela não comece vazia.
|
||||
Cada fonte é seguida por sua própria goroutine e reporta um estado: `following`, `waiting` (o arquivo ainda não existe), `backfill` (primeira inicialização, lendo as cópias rotacionadas), `degraded` (mais de 20% das últimas 1000 linhas ilegíveis, com pelo menos 50 amostras) ou `error`. Uma linha maior que 64 KiB é descartada e contada como malformada. Na primeira inicialização sem snapshot, as cópias rotacionadas (`path.1`, `path.N.gz` até 9) são lidas da mais antiga para a mais nova, para que a janela não comece vazia.
|
||||
|
||||
As linhas são decodificadas assim:
|
||||
|
||||
- **Traefik:** um objeto JSON por linha. Lê-se endereço do cliente, host, método, caminho, status e User-Agent; caminhos e User-Agents são cortados.
|
||||
- **Traefik:** um objeto JSON por linha; o formato de texto padrão também é lido, com menos campos (sem host nem serviço). Lê-se endereço do cliente, host, método, caminho, status e User-Agent; caminhos e User-Agents são cortados.
|
||||
- **sshd:** as linhas do `auth.log` com timestamps ISO. Senhas e chaves recusadas, usuários inválidos, conexões fechadas antes da autenticação e logins `Accepted`; erros de negociação, falhas de banner e versões de protocolo incompatíveis contam como sondagens.
|
||||
- **probe:** as linhas `URUTAU-PROBE:` que o kit do host registra para conexões de entrada a portas em que ninguém escuta (`--probe-log`). Cada uma vira um evento `scanner` com fonte `probe` (MITRE T1046), no máximo um por endereço, porta e protocolo por minuto.
|
||||
- **fail2ban:** linhas `Ban`, `Unban` e `Restore Ban`. Um ban restaurado (reaplicado após um reinício do fail2ban) atualiza o estado de ban e não é pontuado.
|
||||
|
||||
Os caminhos dos arquivos de log nunca são expostos: nem o dashboard nem o export de um peer mostram de onde uma fonte lê, só o nome e o estado dela.
|
||||
O log de egress (`--egress-log`) tem sua própria fonte, descrita na seção de egress. Os caminhos dos arquivos de log nunca são expostos: nem o dashboard nem o export de um peer mostram de onde uma fonte lê, só o nome e o estado dela.
|
||||
|
||||
Linhas válidas que não trazem nada a registrar são ignoradas em silêncio; linhas que não dá para interpretar são contadas como malformadas e aparecem por fonte no dashboard.
|
||||
|
||||
@@ -71,6 +94,8 @@ O nível combina a pontuação com evidência:
|
||||
- **Nunca hostil:** um IP com login SSH bem-sucedido (`ssh-ok`), que provavelmente é você.
|
||||
- Caso contrário, **baixo**.
|
||||
|
||||
Páginas de um forge de código que mostram conteúdo de repositório (Gitea ou Forgejo `/dono/repo/src/commit/<sha>/<arquivo>`, `blob`, `tree`, `raw`, `blame` e `commits` do GitHub e do GitLab) não são sondagem, mesmo quando o arquivo se chama `.env` ou `.gitignore`; `/.env`, `/.git/config` e traversal continuam iguais. Um ban do fail2ban feito pela jail `urutau` (decisão nossa) ou por `recidive` (que só repete bans) não é evidência: não soma pontuação, não é sinal forte e não entra na blocklist. Bans de jails independentes (sshd, traefik) contam.
|
||||
|
||||
Clientes IPv6 são rastreados pelo prefixo /64, já que um assinante tem um /64 inteiro e chaves por endereço deixariam um atacante inundar a tabela. São rastreados até 20.000 IPs.
|
||||
|
||||
As categorias maliciosas (`scanner`, `exploit`, `bruteforce`, `ssh-fail`, `ssh-probe`) alimentam os totais de "malicioso".
|
||||
@@ -136,14 +161,14 @@ Comportamento em falha: disco cheio, o teto de tamanho ou o teto diário descart
|
||||
A camada de investigação é calculada a partir da tabela de IPs e do registro, sem API externa:
|
||||
|
||||
- **Famílias de ataque** (`traversal`, `log4shell`, `sqli`, `xss`, `rce-injection`, `webshell`, `env-credentials`, `vcs`, `backup`, `wordpress`, `phpmyadmin-db`, `actuator-debug`, `iot-cgi`, `admin-panel`, `generic-404`) e as técnicas **MITRE ATT&CK** a que correspondem.
|
||||
- **Tipo de rede** a partir do ASN, da organização do AS e do DNS reverso: `vpn`, `research-scanner`, `isp-cn`, `hosting`, `mobile`, `isp/mobile`, `residential`, `unknown`, e `tor` quando o endereço está no arquivo `--tor-exits` (recarregado a cada 24 horas quando muda).
|
||||
- **Tipo de rede** a partir do ASN, da organização do AS e do DNS reverso: `vpn`, `research-scanner`, `isp-cn`, `hosting`, `mobile`, `isp/mobile`, `residential`, `unknown`, e `tor` quando o endereço está no arquivo `--tor-exits` (recarregado a cada 24 horas quando muda) ou nas listas oficiais que `--tor-auto` (ligado por padrão) baixa a cada 6 horas em `<data-dir>/tor`.
|
||||
- **Cadência** das requisições de um IP: `automated`, `human-like`, `mixed` ou `insufficient` (menos de 3 requisições).
|
||||
- **Sessões:** rajadas de um IP separadas por uma pausa (30 minutos por padrão), cada uma com um estágio em severidade crescente: `recon`, `probe`, `exploit`, `access`, `banned`.
|
||||
- **Campanhas:** pelo menos 3 IPs cujas sessões têm a mesma assinatura (caminhos normalizados parecidos, Jaccard 0,6 ou mais, mesma ferramenta) em uma janela; o id da assinatura é `c-` mais 8 caracteres hexadecimais.
|
||||
- **Exposição:** uma resposta 2xx a uma requisição em caminho sensível.
|
||||
- **Veredito com razões**, cada razão um código estável com peso (`exploits_refused`, `tool_ua`, `banned_jail`, `multi_category`, `exposure`, `ssh_login_after_bruteforce`, `admin`, `immune`), e **ações recomendadas** (`block`, `report`, `investigate`, `incident`); administradores e fontes imunes não recebem nenhuma.
|
||||
- Exportação **STIX 2.1** de um IP (`/api/v1/ip/{ip}/stix`), com ids UUIDv5 determinísticos.
|
||||
- **Crawlers:** um User-Agent que se diz Googlebot ou Bingbot é confirmado por DNS reverso confirmado; um falso continua sendo atacante.
|
||||
- **Crawlers:** um User-Agent que se diz Googlebot (e variantes como GoogleOther), Bingbot ou Applebot é confirmado por DNS reverso confirmado (`googlebot.com`, `google.com`, `search.msn.com`, `applebot.apple.com`); um falso continua sendo atacante, e um crawler confirmado fica fora dos bans qualquer que seja o User-Agent.
|
||||
- Usuários SSH listados em `--admin-users` são marcados como administradores.
|
||||
|
||||
## Métricas
|
||||
@@ -170,9 +195,68 @@ A camada de investigação é calculada a partir da tabela de IPs e do registro,
|
||||
|
||||
Sessões, exposição, exploits recusados e `ok_after_fail` precisam do registro de eventos e leem um número limitado de eventos (`truncated` indica quando a janela foi cortada).
|
||||
|
||||
## Segundo firewall
|
||||
|
||||
`internal/enforce` é opcional (`--enforce=off|observe|on`). O Urutau decide quais endereços atacantes merecem ban e acrescenta uma linha por decisão a `--enforce-log`; a jail `urutau` do fail2ban no host lê o arquivo e aplica o ban. O processo não ganha privilégios. No modo `observe` as decisões ficam só na memória e a interface mostra o que seria banido.
|
||||
|
||||
Regras (vale a primeira que casar, por endereço):
|
||||
|
||||
- 2 eventos críticos (traversal, log4shell, sqli, rce, webshell, env, vcs) em 10 minutos.
|
||||
- SSH: `--enforce-threshold` falhas em 10 minutos (padrão 5); um `ssh-probe` conta meia falha.
|
||||
- Varredura de portas: 10 portas distintas sondadas em 10 minutos (motivo `port-scan`).
|
||||
- Web: `--enforce-threshold` eventos de ataque em 10 minutos (motivo dominante, senão `scanner-flood`).
|
||||
- Vizinhança: 3 ou mais endereços distintos do mesmo /24 (IPv4) ou /64 (IPv6) foram banidos nas últimas 24 horas e outro endereço do prefixo ataca (`neighbor-campaign`).
|
||||
- Atacante conhecido: o veredito é hostil, ou suspeito com pontuação 100 ou mais (`known-attacker`).
|
||||
- Atacantes lentos: 10 falhas de SSH ou 20 eventos web de scanner/exploit em 24 horas; 10 falhas de SSH ou 10 eventos web de scanner/exploit em 7 dias (o de web só sem visita legítima).
|
||||
|
||||
Uma varredura a cada 10 minutos, e depois do backfill da partida, aplica as mesmas regras aos endereços ativos nas últimas 24 horas que nada bloqueia ainda. No máximo `--enforce-max-per-min` decisões são gravadas por minuto (padrão 60); o excedente é descartado e contado. O TTL consultivo cresce com o número de bans anteriores: 1 h, 6 h, 24 h, 7 d.
|
||||
|
||||
Nunca são banidos: faixas privadas e reservadas, `--trusted`, as faixas da Cloudflare, resolvedores públicos conhecidos, os peers e os endereços do próprio servidor, um crawler verificado, um endereço com visita legítima nas últimas 24 horas e uma liberação do operador (abaixo). Cada exclusão é contada por motivo.
|
||||
|
||||
Arquivo de decisões, uma linha por ban (`MaxLogBytes` de 20 MB, depois rotacionado para `.1`):
|
||||
|
||||
```
|
||||
2026-11-15T10:00:00Z urutau decision=ban ip=203.0.113.9 reason=ssh-bruteforce score=75 ttl=3600 host=web1 src=local
|
||||
```
|
||||
|
||||
Nada que o atacante controla entra na linha: o endereço é reformatado, o motivo precisa ser um de uma lista fixa de slugs e os nomes de host e origem são reduzidos a `[A-Za-z0-9._-]`. O estado (bans, liberações, contadores) vai para `<data-dir>/enforce.json`.
|
||||
|
||||
Desban: `POST /api/v1/enforce/unban` acrescenta `<hora> urutau unban ip=<ip> allow=<segundos>` ao arquivo de desban (`--enforce-unban-log`, por padrão `unban.log` ao lado do arquivo de decisões); uma unit `path` do systemd do kit do host libera o bloqueio do fail2ban. Com `allow` maior que zero o motor não bane o endereço de novo por esse tempo (no máximo 30 dias); `DELETE /api/v1/enforce/allow` encerra a liberação.
|
||||
|
||||
Compartilhamento (`--enforce-share=on`): hub e peers trocam decisões por `GET` e `POST /api/v1/peer/decisions` e desbans por `POST /api/v1/peer/unban`. Cada lado aplica as próprias exclusões, aceita só os slugs fixos de motivo, limita o TTL a 6 horas e, pela palavra de um peer, só bane um endereço que ele também viu atacar nos últimos 7 dias (senão a exclusão é `peer_unconfirmed`).
|
||||
|
||||
## Análise de egress
|
||||
|
||||
`internal/egress` lê o log do nftables das conexões novas de saída (`--egress=auto|on|off`, `--egress-log`; `auto` liga quando o arquivo existe). O kit do host registra só tentativas de conexão TCP (SYN sem ACK) com o prefixo `URUTAU-EGRESS:`. O estado fica em memória: ao iniciar, as cópias rotacionadas e o arquivo atual são relidos, o que reconstrói o histórico de beacons.
|
||||
|
||||
Um **workload** é um grupo de origens (um CIDR, um endereço, `host` para o tráfego do próprio host, ou o nome ou prefixo de um contêiner a partir do arquivo `containers.map` que o kit do host escreve) com um papel: `default`, `scanner`, `mail` ou `resolver` (`--egress-workloads`). O princípio: tráfego com formato de varredura só é suprimido para workloads `scanner`; todo o resto é julgado igual para todos.
|
||||
|
||||
Achados (`kind`, severidade):
|
||||
|
||||
| Tipo | Significado |
|
||||
|---|---|
|
||||
| `beacon` | conversa regular com um destino: pelo menos 8 conexões em 30 minutos, com intervalo entre 10 s e 6 h e pouca variação |
|
||||
| `infra` | o mesmo padrão para serviços de metadados de nuvem, o provedor ou os próprios servidores (informativo) |
|
||||
| `bad_dst` | contato com um endereço que atacou este servidor |
|
||||
| `tor` | conexão a um relay Tor |
|
||||
| `port` | SMTP de um workload que não é de e-mail, IRC, pool de mineração (stratum) ou ORPort do Tor |
|
||||
| `dns_bypass` | DNS (53) ou DoT (853) para um endereço público que não é um resolvedor permitido |
|
||||
| `scan` | abertura para mais de 50 destinos ou 100 portas em 10 minutos, fora de workloads `scanner` |
|
||||
| `new_geo` | primeiro contato com um país depois do tempo de aprendizado do workload (24 h) |
|
||||
|
||||
Destinos de peers, endereços confiáveis e os endereços públicos do próprio servidor nunca geram achados, e conexões regulares a grandes CDNs e nuvens têm severidade baixa, salvo se o destino atacou o servidor. Limites: 50.000 pares e destinos, 2.000 achados, 720 buckets por hora. `GET /api/v1/egress` devolve achados, workloads, países e uma linha do tempo por hora; um hub também mescla a resposta de `GET /api/v1/peer/egress` de cada peer.
|
||||
|
||||
## Incidentes
|
||||
|
||||
`internal/incidents` guarda chamados `INC-<n>` em `<data-dir>/incidents.json` (escrita atômica, 0600; arquivo corrompido vai para `.corrupt`). Todo achado de egress com severidade acima de `info` vira um chamado com chave `host|kind|workload|dst|dport|proto`, criado por uma sincronização a cada relatório de egress mesclado e a cada 60 segundos; um chamado resolvido reabre quando o achado reaparece. Um chamado tem status (`open`, `investigating`, `true_positive`, `false_positive`, `benign`, `resolved`), severidade, responsável, até 10 etiquetas, conclusão, comentários e histórico de mudanças. Limites: 5.000 chamados, 200 comentários e 500 entradas de histórico cada. Um chamado em `false_positive` ou `benign` pode suprimir exatamente a sua chave por 30 dias (90 no máximo); os achados suprimidos saem de `/api/v1/egress`, salvo com `?suppressed=1`. Um host com mais de 300 chamados ativos tem o excedente agrupado em um chamado de inundação. Escritas recusam requisições cross-site, e toda escrita vai para o log (id, campo, autor).
|
||||
|
||||
## Relatório HTML
|
||||
|
||||
`GET /api/v1/report?format=html` gera um documento A4 autocontido (capa, sumário executivo, recomendações por regra, ameaças, geografia, erros e saúde, visitantes, defesa, segundo firewall e tráfego de saída) no idioma de `lang`. O texto passa por `html/template` e os gráficos são SVG montado a partir de valores escapados, então nenhum texto de log chega à página sem escape. `format=json` devolve os mesmos números.
|
||||
|
||||
## Estado e persistência
|
||||
|
||||
O estado vive em memória: buckets por minuto das últimas 48 horas e dados por hora até 30 dias, listas de top por hora (caminhos, domínios, User-Agents, usuários), uma tabela de até 20.000 IPs (quando cheia, 10% com a menor pontuação são removidos; IPs banidos são mantidos), um feed dos últimos 500 eventos e os bans ativos. `--retention` (1h a 168h) limita quanto tempo os IPs ficam; IPs antigos são podados a cada 10 minutos.
|
||||
O estado vive em memória: buckets por minuto das últimas 48 horas e dados por hora até 30 dias, listas de top por hora (caminhos, domínios, User-Agents, usuários), uma tabela de até 20.000 IPs (quando cheia, 10% com a menor pontuação são removidos; IPs banidos são mantidos), um feed dos últimos 500 eventos e os bans ativos. `--retention` (1h a 720h) limita quanto tempo os IPs ficam; IPs antigos são podados a cada 10 minutos.
|
||||
|
||||
A cada 60 segundos, e no desligamento, o estado é gravado em `urutau-state.gob` no diretório de dados junto com o inode e a posição de cada fonte. Na inicialização ele é restaurado e cada fonte retoma exatamente de onde parou, então um reinício nunca conta um log duas vezes. O snapshot é pulado enquanto um backfill roda. Um snapshot ilegível é movido para `urutau-state.gob.corrupt` e o serviço sobe vazio, lendo os logs de novo (incluindo as cópias rotacionadas).
|
||||
|
||||
@@ -180,7 +264,7 @@ O processo define um limite suave de memória de 256 MiB, a menos que `GOMEMLIMI
|
||||
|
||||
## Federação
|
||||
|
||||
Um hub é uma instância comum iniciada com `--peer nome=https://url`, e precisa de `URUTAU_PEER_TOKEN`. A cada 15 segundos ele chama `GET /api/v1/peer/export?range=...` de cada peer (para os intervalos de fundo `1h`, `24h`, `7d` e `30d`; qualquer outro intervalo ou período personalizado é buscado sob demanda) com o token de peer e guarda a última resposta. O export é `{"v":1,"summary":...,"traffic":{...}}` com os 500 IPs principais e seus detalhes, em cache de 5 segundos no peer. O token de peer abre três rotas: o export, o stream ao vivo e `GET /api/v1/peer/period`, o estudo (sessões, campanhas, métricas) que o hub mescla para um período ou um IP; um peer executa no máximo dois estudos ao mesmo tempo. O hub nunca segue redirects, exige `https` fora de loopback, usa timeout de 4 segundos, limita o corpo a 8 MB e sanitiza e limita o que um peer enviar. Um peer que falha é marcado offline e os demais seguem. O seletor de host do dashboard passa a oferecer `all`, o próprio hub e cada peer; resumos, tráfego e tabelas de IPs são mesclados, e cada linha carrega o host de origem.
|
||||
Um hub é uma instância comum iniciada com `--peer nome=https://url`, e precisa de `URUTAU_PEER_TOKEN`. A cada 15 segundos ele chama `GET /api/v1/peer/export?range=...` de cada peer (para os intervalos de fundo `1h`, `24h`, `7d` e `30d`; qualquer outro intervalo ou período personalizado é buscado sob demanda) com o token de peer e guarda a última resposta. O export é `{"v":1,"summary":...,"traffic":{...}}` com os 500 IPs principais e seus detalhes, em cache de 5 segundos no peer. O token de peer abre só as rotas de federação: o export, o stream ao vivo, `GET /api/v1/peer/period` (o estudo de sessões, campanhas e métricas que o hub mescla para um período ou um IP; um peer executa no máximo dois ao mesmo tempo), `GET /api/v1/peer/egress` (o relatório de egress) e, com `--enforce-share`, `GET` e `POST /api/v1/peer/decisions` e `POST /api/v1/peer/unban`. O hub nunca segue redirects, exige `https` fora de loopback, usa timeout de 4 segundos, limita o corpo a 8 MB e sanitiza e limita o que um peer enviar. Um peer que falha é marcado offline e os demais seguem. O seletor de host do dashboard passa a oferecer `all`, o próprio hub e cada peer; resumos, tráfego e tabelas de IPs são mesclados, e cada linha carrega o host de origem.
|
||||
|
||||
### Repasse ao vivo
|
||||
|
||||
@@ -192,4 +276,43 @@ Além do export, um hub mantém uma conexão `GET /api/v1/peer/stream` aberta po
|
||||
|
||||
## Camada HTTP
|
||||
|
||||
O servidor define timeouts de leitura, escrita e ociosidade, `MaxHeaderBytes` de 16 KB, limita `POST /login` a 4 KB e aceita no máximo 20 clientes simultâneos do stream ao vivo (SSE) (o 21º recebe 503 com `Retry-After`; cada stream envia heartbeat a cada 20 s). O handler usa o mux padrão do `net/http`. Toda resposta leva uma Content-Security-Policy estrita (`default-src 'self'`), `X-Content-Type-Options`, `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer`, cabeçalhos de isolamento de origem cruzada e, em HTTPS, HSTS. As respostas da API são `Cache-Control: no-store`. Os arquivos do dashboard são embutidos no binário. Veja [interface.md](interface.md) para as rotas e [configuracao.md](configuracao.md) para os ajustes.
|
||||
O servidor define timeouts de leitura, escrita e ociosidade, `MaxHeaderBytes` de 16 KB, limita `POST /login` a 4 KB e aceita no máximo 20 clientes simultâneos do stream ao vivo (SSE) (o 21º recebe 503 com `Retry-After`; cada stream envia heartbeat a cada 20 s). O handler usa o mux padrão do `net/http`. Toda resposta leva uma Content-Security-Policy estrita (`default-src 'self'`), `X-Content-Type-Options`, `X-Frame-Options: DENY`, `Referrer-Policy: same-origin`, `Permissions-Policy`, cabeçalhos de isolamento de origem cruzada e, em HTTPS, HSTS. As respostas da API são `Cache-Control: no-store`. Os arquivos do dashboard são embutidos no binário. Veja [interface.md](interface.md) para as páginas e [configuracao.md](configuracao.md) para os ajustes.
|
||||
|
||||
## Rotas da API
|
||||
|
||||
Todas as rotas `/api/v1/*`, exceto as de federação, exigem `URUTAU_TOKEN` (bearer) ou um cookie de sessão; o token de peer recebe 403 nelas. As rotas de análise ficam em arquivos `internal/server/api_<nome>.go` e se registram com `registerUserRoute`. As rotas que recebem intervalo aceitam `range`, ou `from` e `to`.
|
||||
|
||||
| Rota | Finalidade |
|
||||
|---|---|
|
||||
| `GET /api/health` | `{"status":"ok"}`, sem autenticação |
|
||||
| `GET /login`, `POST /login`, `POST /logout` | cookie de sessão |
|
||||
| `GET /api/v1/summary`, `/traffic`, `/ips`, `/ip/{ip}`, `/ip/{ip}/stix` | totais, web analytics, tabela de IPs, um endereço, bundle STIX 2.1 |
|
||||
| `GET /api/v1/period`, `/period/events`, `/events`, `/events/sessions` | estudo de um período, busca no registro de eventos (cursor), sessões |
|
||||
| `GET /api/v1/events/stream` | stream ao vivo por SSE (`?visits=1` inclui visitas anônimas) |
|
||||
| `GET /api/v1/live/recent`, `/geo` | últimos eventos ao vivo, geografia |
|
||||
| `GET /api/v1/metrics`, `/evolution`, `/concentration`, `/survival`, `/techniques`, `/sessions/funnel` | métricas estáveis e análises |
|
||||
| `GET /api/v1/campaigns`, `/campaigns/{id}` | campanhas |
|
||||
| `GET /api/v1/services`, `/services/{svc}`, `/errors`, `/protocols` | SLO, classes de erro, protocolos e TLS |
|
||||
| `GET /api/v1/defense`, `/integrity` | cobertura da blocklist, bans, fontes e integridade dos dados |
|
||||
| `GET /api/v1/blocklist.txt`, `/blocklist.json` | blocklist exportável (`?family=4\|6`) |
|
||||
| `GET /api/v1/enforce`, `POST /enforce/unban`, `DELETE /enforce/allow` | segundo firewall |
|
||||
| `GET /api/v1/egress` | achados de saída |
|
||||
| `GET /api/v1/incidents`, `/incidents/export.csv`, `/incidents/{id}`, `POST /incidents`, `PATCH /incidents/{id}`, `POST /incidents/{id}/comments` | chamados |
|
||||
| `GET /api/v1/report` | relatório em JSON ou HTML (`?format=`) |
|
||||
| `GET /api/v1/peer/export`, `/peer/stream`, `/peer/period`, `/peer/egress` | federação, só token de peer |
|
||||
| `GET`, `POST /api/v1/peer/decisions`, `POST /api/v1/peer/unban` | compartilhamento de decisões, só token de peer, `--enforce-share` |
|
||||
|
||||
Os endpoints de lista (IPs, sessões, campanhas, eventos de um endereço) são paginados pelo backend; a busca de eventos pagina por cursor.
|
||||
|
||||
## Arquivos
|
||||
|
||||
| Onde | O quê |
|
||||
|---|---|
|
||||
| `<data-dir>/urutau-state.gob` | snapshot do estado com o offset de cada fonte (`.corrupt` quando ilegível) |
|
||||
| `<data-dir>/events/AAAA-MM-DD.jsonl[.gz]` | registro de eventos, uma linha JSON por evento |
|
||||
| `<data-dir>/geo/` | bases DB-IP Lite de cidade e ASN |
|
||||
| `<data-dir>/tor/` | cache das listas de saídas e relays do Tor |
|
||||
| `<data-dir>/enforce.json` | estado do segundo firewall |
|
||||
| `<data-dir>/incidents.json` | chamados |
|
||||
| `--enforce-log`, `unban.log` | arquivo de decisões lido pela jail do host e pedidos de desban lidos pelo host |
|
||||
| `--probe-log`, `--egress-log`, `--egress-containers` | logs do kernel e mapa de contêineres escritos pelo kit do host em `deploy/host` |
|
||||
@@ -18,10 +18,11 @@ O token de acesso nunca é uma flag: `urutau serve` o lê da variável de ambien
|
||||
|---|---|---|---|
|
||||
| `--bind` | `URUTAU_BIND` | `0.0.0.0:8790` | endereço de escuta |
|
||||
| `--name` | `URUTAU_NAME` | hostname | nome desta instância |
|
||||
| `--data-dir` | `URUTAU_DATA_DIR` | `/data` | diretório do snapshot (`urutau-state.gob`) |
|
||||
| `--data-dir` | `URUTAU_DATA_DIR` | `/data` | diretório de estado: snapshot `urutau-state.gob`, `geo/`, `tor/`, `events/`, `incidents.json`, `enforce.json` |
|
||||
| `--traefik-log` | `URUTAU_TRAEFIK_LOG` | `/data/coolify/proxy/access.log` | access log JSON do Traefik; vazio desativa |
|
||||
| `--auth-log` | `URUTAU_AUTH_LOG` | `/var/log/auth.log` | log do sshd; vazio desativa |
|
||||
| `--fail2ban-log` | `URUTAU_FAIL2BAN_LOG` | `/var/log/fail2ban.log` | log do fail2ban; vazio desativa |
|
||||
| `--probe-log` | `URUTAU_PROBE_LOG` | `/logs/host/probe.log` | log do kernel de conexões a portas não servidas, gravado pelo kit do host; vazio desativa |
|
||||
| `--trusted` | `URUTAU_TRUSTED` | vazio | CIDRs de origens confiáveis; os eventos delas são descartados por completo. `--ignore` / `URUTAU_IGNORE` é um alias |
|
||||
| `--ignore` | `URUTAU_IGNORE` | `127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,100.64.0.0/10,169.254.0.0/16` | mesma função de `--trusted`, com as faixas privadas como padrão |
|
||||
| `--monitor-ua` | `URUTAU_MONITOR_UA` | `(?i)^(Uptime-Kuma/\|Beszel\|Coolify\|kube-probe/\|Go-http-client/.*healthcheck)` | expressão regular de User-Agents de monitoramento; vazio desativa |
|
||||
@@ -38,10 +39,24 @@ O token de acesso nunca é uma flag: `urutau serve` o lê da variável de ambien
|
||||
| `--trusted-proxy` | `URUTAU_TRUSTED_PROXY` | `127.0.0.0/8,::1` (o compose define `10.250.0.0/24`) | proxies cujo `X-Forwarded-For` é confiável, lido da direita para a esquerda (limite de login, `--peer-allow`) |
|
||||
| `--retention` | `URUTAU_RETENTION` | `720h` | por quanto tempo os dados ficam (1h a 720h, ou seja, 30 dias) |
|
||||
| `--events-max` | `URUTAU_EVENTS_MAX` | `512MB` | teto de tamanho do registro de eventos em `<data-dir>/events`; `0` desliga |
|
||||
| `--tor-auto` | `URUTAU_TOR_AUTO` | `on` | `on` baixa as listas oficiais de saídas e relays do Tor a cada 6 h em `<data-dir>/tor`; `off` não baixa |
|
||||
| `--tor-exits` | `URUTAU_TOR_EXITS` | vazio | arquivo com endereços de saída do Tor, um por linha, recarregado a cada 24 h quando muda; vazio desativa |
|
||||
| `--enforce` | `URUTAU_ENFORCE` | `off` | segundo firewall: `off`, `observe` (decide só em memória) ou `on` (também grava as decisões para o fail2ban do host) |
|
||||
| `--enforce-log` | `URUTAU_ENFORCE_LOG` | `/logs/enforce/decisions.log` | arquivo de decisões acrescentado no modo `on` (obrigatório nele) |
|
||||
| `--enforce-unban-log` | `URUTAU_ENFORCE_UNBAN_LOG` | `unban.log` ao lado de `--enforce-log` | arquivo onde o botão Desbanir grava os pedidos |
|
||||
| `--enforce-share` | `URUTAU_ENFORCE_SHARE` | `off` | `on` troca decisões e desbanimentos com os peers; cada lado aplica suas exclusões |
|
||||
| `--enforce-threshold` | `URUTAU_ENFORCE_THRESHOLD` | `5` | eventos de ataque em 10 minutos que justificam um banimento (1 a 1000) |
|
||||
| `--enforce-max-per-min` | `URUTAU_ENFORCE_MAX_PER_MIN` | `60` | máximo de decisões por minuto, o excedente é descartado e contado (1 a 10000) |
|
||||
| `--egress` | `URUTAU_EGRESS` | `auto` | análise de egress: `auto` (liga quando `--egress-log` existe), `on` ou `off` |
|
||||
| `--egress-log` | `URUTAU_EGRESS_LOG` | `/logs/host/egress.log` | log do kernel de conexões novas de saída, gravado pelo kit do host |
|
||||
| `--egress-containers` | `URUTAU_EGRESS_CONTAINERS` | `/logs/host/containers.map` | mapa `"<ip> <container>"` gravado pelo kit do host |
|
||||
| `--egress-workloads` | `URUTAU_EGRESS_WORKLOADS` | vazio | `"nome=ITEM,ITEM:papel;..."`, papéis `default`, `scanner`, `mail`, `resolver` ([configuracao.md](configuracao.md#análise-de-egress)) |
|
||||
| `--egress-resolvers` | `URUTAU_EGRESS_RESOLVERS` | vazio | resolvedores DNS permitidos, separados por vírgula; vazio: os públicos usuais mais o `resolv.conf` do host |
|
||||
| `--insecure-no-auth` | nenhuma | desligado | desativa a autenticação; só em bind loopback |
|
||||
|
||||
Validação na inicialização: peers devem ser `nome=https://host` (`http` simples só em loopback), `URUTAU_PEER_TOKEN` deve estar definido e ser diferente de `URUTAU_TOKEN`, os nomes devem ser únicos e não podem ser `all` nem o nome da própria instância, `--retention` deve ser de pelo menos 1h (e no máximo 720h) e `URUTAU_TOKEN` e todo token de peer devem ter pelo menos 32 caracteres e cerca de 128 bits de entropia estimada; cada peer precisa de um token de cliente (`URUTAU_PEER_TOKEN_<NOME>` ou o geral `URUTAU_PEER_TOKEN` como reserva), e os nomes de peer não podem colidir nesse nome de variável (salvo `--insecure-no-auth` em endereço loopback).
|
||||
`URUTAU_EGRESS_ALLOW` e `URUTAU_EGRESS_PROVIDER_ASN` existem só como variáveis de ambiente ([configuracao.md](configuracao.md)). `GOMEMLIMIT` e `TZ` são as padrão.
|
||||
|
||||
Validação na partida (qualquer falha sai com código 1 antes de escutar): `URUTAU_TOKEN` e todo token de peer precisam de pelo menos 32 caracteres e cerca de 128 bits de entropia estimada (tokens periódicos ou sequenciais são recusados), e um token de peer deve ser diferente de `URUTAU_TOKEN`, exceto com `--insecure-no-auth` em bind loopback; peers devem ser `nome=https://host` (`http` simples só em loopback), nomes únicos e diferentes de `all` e do nome da própria instância, e cada peer precisa de um token de cliente (`URUTAU_PEER_TOKEN_<NOME>` ou o geral `URUTAU_PEER_TOKEN`), sem dois nomes que resultem na mesma variável; `--retention` de 1h a 720h; `--events-max` um tamanho válido; `--location` válida; `--peer-blocklist` e `--enforce-share` `on`/`off`; `--enforce` `off`/`observe`/`on` (`on` exige `--enforce-log`); `--enforce-threshold` de 1 a 1000 e `--enforce-max-per-min` de 1 a 10000; `--egress` `auto`/`on`/`off`; `--monitor-ua` uma expressão regular válida; `--ignore`, `--trusted`, `--peer-allow`, `--trusted-proxy` e `--monitor-from` CIDRs ou IPs válidos.
|
||||
|
||||
```bash
|
||||
export URUTAU_TOKEN=$(openssl rand -base64 48)
|
||||
@@ -60,6 +75,16 @@ urutau serve --trusted "10.0.0.0/8,203.0.113.7" \
|
||||
|
||||
`--trusted` descarta todo evento dessas origens. `--monitor-ua` casa com o User-Agent de requisições benignas (`ok` ou `notfound`) e as conta à parte como "monitoring"; uma requisição que seja `scanner`, `exploit` ou `bruteforce` continua contando como ataque.
|
||||
|
||||
## Segundo firewall e egress
|
||||
|
||||
```bash
|
||||
urutau serve --enforce observe # decide em memória, não grava nada
|
||||
urutau serve --enforce on --enforce-log /var/log/urutau-enforce/decisions.log
|
||||
urutau serve --egress on --egress-workloads "mail=10.0.7.0/24:mail"
|
||||
```
|
||||
|
||||
O lado do host (registro com nftables, jail `urutau` do fail2ban) vem de `deploy/host/install.sh`, veja [docker.md](docker.md#kit-do-host).
|
||||
|
||||
## Geolocalização
|
||||
|
||||
```bash
|
||||
@@ -70,7 +95,7 @@ O Urutau baixa as bases DB-IP Lite de cidade e ASN em `--geo-dir` quando faltam
|
||||
|
||||
## `urutau doctor`
|
||||
|
||||
Confere a configuração (token, peers, bind), cada fonte de log (legível, tamanho), se o diretório de dados é gravável, as bases de geolocalização e o snapshot. Os status são `ok`, `warn` (uma fonte que ainda não pode ser aberta), `fail` e `off` (desativada). O código de saída é 1 quando algum teste é `fail`, o que o torna utilizável em um healthcheck ou script de deploy.
|
||||
Confere a configuração (token, peers, bind e todas as validações acima), cada fonte de log (legível, tamanho; no Traefik também se mais de 20% das linhas são malformadas), se o diretório de dados é gravável, o segundo firewall, as bases de geolocalização e o snapshot. Os logs de sondagem e egress não são conferidos. Os checks se chamam `config`, `source traefik`, `source ssh`, `source fail2ban`, `source traefik format`, `data-dir`, `enforce` (e `enforce-cdn`), `geo` e `state`. Os estados são `ok`, `warn` (uma fonte que ainda não abre), `fail` e `off` (desativada). O código de saída é 1 quando algum check é `fail` (por exemplo `--enforce=on` com o arquivo de decisões não gravável), o que o torna útil num script de deploy. Aceita as mesmas flags de `serve`.
|
||||
|
||||
```bash
|
||||
urutau doctor
|
||||
@@ -81,8 +106,8 @@ docker exec urutau urutau doctor --json
|
||||
|
||||
## `urutau healthcheck`
|
||||
|
||||
Chama `/api/health` no endereço de bind local e sai com 0 quando responde `{"status":"ok"}`, 1 caso contrário. É o `HEALTHCHECK` do container, e por isso a imagem não tem `curl`. Aceita as mesmas flags do `serve` (para um `--bind` diferente do padrão).
|
||||
Chama `/api/health` no endereço de bind local (`0.0.0.0` e `::` viram `127.0.0.1`; timeout de 3 segundos, redirecionamentos não são seguidos) e sai com 0 quando responde `{"status":"ok"}`, 1 caso contrário. É o `HEALTHCHECK` do container, e por isso a imagem não tem `curl`. Aceita as mesmas flags do `serve` (para um `--bind` diferente do padrão).
|
||||
|
||||
## `urutau version`
|
||||
|
||||
Imprime `urutau <versão>`. `--version` e `-v` também funcionam.
|
||||
Imprime `urutau <versão>`. `--version` e `-v` também funcionam. `urutau help` (`--help`, `-h`) imprime o uso; um comando desconhecido o imprime em stderr e sai com 2.
|
||||
@@ -10,7 +10,7 @@ O Urutau não tem arquivo de configuração. Tudo é uma flag com padrão em var
|
||||
|---|---|
|
||||
| `URUTAU_TOKEN` | **Obrigatória.** Token de acesso do dashboard e da API: no mínimo 32 caracteres e cerca de 128 bits de entropia estimada (comprimento vezes entropia de Shannon; tokens periódicos ou sequenciais são recusados). Gere um com `openssl rand -base64 48` (`openssl rand -hex 32` também serve; `-hex 16` é recusado pela estimativa de entropia). |
|
||||
| `URUTAU_TOKEN_FILE` | Caminho de um arquivo com o token (espaços nas pontas são removidos), no lugar da variável. A variável vence quando as duas existem. |
|
||||
| `URUTAU_PEER_TOKEN` | Opcional. O token de servidor desta instância: o único que as rotas de federação dela (`GET /api/v1/peer/export` e `GET /api/v1/peer/stream`) aceitam, e não abre mais nada. Mesmas regras de força do `URUTAU_TOKEN` (32+ caracteres, cerca de 128 bits de entropia estimada, sem padrão periódico nem sequencial), e deve ser diferente dele. Quando esta instância é um hub, também é o token de cliente de reserva enviado aos peers que não têm o seu. |
|
||||
| `URUTAU_PEER_TOKEN` | Opcional. O token de servidor desta instância: o único que as rotas de federação dela (veja [Peers](#peers-modo-hub)) aceitam, e não abre mais nada. Mesmas regras de força do `URUTAU_TOKEN` (32+ caracteres, cerca de 128 bits de entropia estimada, sem padrão periódico nem sequencial), e deve ser diferente dele. Quando esta instância é um hub, também é o token de cliente de reserva enviado aos peers que não têm o seu. |
|
||||
| `URUTAU_PEER_TOKEN_FILE` | Caminho de um arquivo com o token de peer geral. |
|
||||
| `URUTAU_PEER_TOKEN_<NOME>` e `..._<NOME>_FILE` | A credencial de cliente que um hub envia àquele peer; deve ser igual ao `URUTAU_PEER_TOKEN` do próprio peer. `<NOME>` é o nome do peer em maiúsculas, com todo caractere que não seja letra ou dígito virando `_` (`my-peer` vira `MY_PEER`). Ela **não** abre o export local. Dois nomes de peer que viram a mesma variável (`my-peer` e `my_peer`) são recusados. Um hub com um peer sem token para ele se recusa a iniciar. |
|
||||
|
||||
@@ -18,34 +18,85 @@ Guarde os dois no `.env` (nunca versionado) ou no cofre de segredos do seu orque
|
||||
|
||||
## Ajustes
|
||||
|
||||
Toda variável abaixo tem uma flag de mesmo sentido ([cli.md](cli.md)); a flag vence a variável.
|
||||
|
||||
### Geral
|
||||
|
||||
| Variável | Padrão | Significado |
|
||||
|---|---|---|
|
||||
| `URUTAU_BIND` | `0.0.0.0:8790` | endereço de escuta |
|
||||
| `URUTAU_NAME` | hostname do container | nome exibido no dashboard e usado pelo hub |
|
||||
| `URUTAU_DATA_DIR` | `/data` | onde o snapshot `urutau-state.gob` é gravado |
|
||||
| `URUTAU_TRAEFIK_LOG` | `/data/coolify/proxy/access.log` | access log JSON do Traefik, vazio desativa |
|
||||
| `URUTAU_AUTH_LOG` | `/var/log/auth.log` | log do sshd, vazio desativa |
|
||||
| `URUTAU_FAIL2BAN_LOG` | `/var/log/fail2ban.log` | log do fail2ban, vazio desativa |
|
||||
| `URUTAU_TRUSTED` | vazio | CIDRs ou IPs confiáveis, separados por vírgula; os eventos deles são descartados por completo |
|
||||
| `URUTAU_IGNORE` | `127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,100.64.0.0/10,169.254.0.0/16` | mesmo efeito, mantido como o alias que traz as faixas privadas como padrão |
|
||||
| `URUTAU_MONITOR_UA` | `(?i)^(Uptime-Kuma/\|Beszel\|Coolify\|kube-probe/\|Go-http-client/.*healthcheck)` | expressão regular de User-Agents de monitoramento |
|
||||
| `URUTAU_GEO_DIR` | `<data-dir>/geo` | onde ficam as bases DB-IP Lite |
|
||||
| `URUTAU_GEO_UPDATE` | `24h` | intervalo entre buscas por uma base mais nova; `0` desativa o download |
|
||||
| `URUTAU_PEER_ALLOW` | vazio | CIDRs autorizados a chamar as rotas de federação; vazio aceita qualquer origem que tenha o token |
|
||||
| `URUTAU_PEER_BLOCKLIST` | `on` | `on`: a blocklist do hub inclui IPs hostis vistos só pelos peers (pontuação 50+ e sinal forte); `off`: só os IPs da própria instância |
|
||||
| `URUTAU_LOCATION` | vazio | onde esta instância fica no mapa, `"lat,lon"` ou `"lat,lon,Rótulo"` (validado na partida). É o destino dos arcos da página Ao vivo e é repassado ao hub; vazio faz a página usar um destino estimado |
|
||||
| `URUTAU_TRUSTED_PROXY` | `127.0.0.0/8,::1` (o compose define `10.250.0.0/24`) | proxies reversos cujo `X-Forwarded-For` é confiável (lido da direita para a esquerda); usado no limite de tentativas de login e em `URUTAU_PEER_ALLOW` |
|
||||
| `URUTAU_DOMAINS` | vazio | lista de domínios permitidos no analytics, nomes exatos ou `*.exemplo.com`; vazio acompanha todo domínio que responde 2xx; recomendado, na prática obrigatório, quando algum backend responde 2xx para qualquer Host (catch-all ou wildcard), senão Hosts aleatórios podem ocupar as 24 vagas de domínio |
|
||||
| `URUTAU_MONITOR_FROM` | vazio | CIDRs de onde os monitores realmente vêm; quando definido, o User-Agent de monitoramento só vale vindo deles |
|
||||
| `URUTAU_ADMIN_USERS` | vazio | usuários SSH cujo login bem-sucedido mantém o IP fora da blocklist por 24 h após o último login (um sinal forte posterior anula); a imunidade fica desligada a menos que seja definido |
|
||||
| `URUTAU_PEERS` | vazio | peers a agregar, `nome=https://url` separados por vírgula |
|
||||
| `URUTAU_RETENTION` | `720h` | retenção como duração do Go, de `1h` a `720h` (30 dias) |
|
||||
| `URUTAU_EVENTS_MAX` | `512MB` | teto de tamanho do registro de eventos (`<data-dir>/events`); `0` desliga |
|
||||
| `URUTAU_TOR_EXITS` | vazio | arquivo de endereços de saída do Tor, um por linha, recarregado a cada 24 h quando muda |
|
||||
| `URUTAU_NAME` | hostname do container | nome mostrado no dashboard e usado pelo hub |
|
||||
| `URUTAU_DATA_DIR` | `/data` | onde fica o estado: snapshot `urutau-state.gob`, `geo/`, `tor/`, `events/`, `incidents.json` e `enforce.json` |
|
||||
| `URUTAU_RETENTION` | `720h` | retenção como duração do Go, de `1h` a `720h` (30 dias); outros valores impedem a inicialização |
|
||||
| `URUTAU_EVENTS_MAX` | `512MB` | limite de tamanho do registro de eventos (`<data-dir>/events`); número com unidade opcional (`k`, `kb`, `kib`, `m`, `mb`, `mib`, `g`, `gb`, `gib`, `b`), `0` desliga |
|
||||
| `URUTAU_LOCATION` | vazio | onde esta instância está no mapa, `"lat,lon"` ou `"lat,lon,Rótulo"` (validado na partida). É o destino dos arcos da página Ao vivo e é compartilhado com o hub; vazio faz a página estimar um destino |
|
||||
| `GOMEMLIMIT` | limite suave de 256 MiB | limite de memória padrão do Go; defina para sobrescrever |
|
||||
| `TZ` | UTC | fuso dos timestamps do `fail2ban.log`, que não trazem fuso |
|
||||
|
||||
Na imagem do container os três caminhos de log têm como padrão `/logs/traefik/access.log`, `/logs/host/auth.log` e `/logs/host/fail2ban.log` (o compose monta os logs do host ali). O compose acrescenta `URUTAU_VERSION` (tag da imagem), `URUTAU_IMAGE` e `URUTAU_PUBLISH` (endereço e porta no host), veja o `.env.example`.
|
||||
### Fontes de log
|
||||
|
||||
| Variável | Padrão | Significado |
|
||||
|---|---|---|
|
||||
| `URUTAU_TRAEFIK_LOG` | `/data/coolify/proxy/access.log` | access log JSON do Traefik, vazio desativa |
|
||||
| `URUTAU_AUTH_LOG` | `/var/log/auth.log` | log do sshd, vazio desativa |
|
||||
| `URUTAU_FAIL2BAN_LOG` | `/var/log/fail2ban.log` | log do fail2ban, vazio desativa |
|
||||
| `URUTAU_PROBE_LOG` | `/logs/host/probe.log` | log do kernel de conexões novas a portas que ninguém serve, gravado pelo kit do host (veja [Sondagens](#sondagens-varreduras-de-portas)); vazio desativa, arquivo ausente só deixa a fonte em `waiting` |
|
||||
|
||||
### Ruído, confiança e monitoramento
|
||||
|
||||
| Variável | Padrão | Significado |
|
||||
|---|---|---|
|
||||
| `URUTAU_TRUSTED` | vazio | CIDRs ou IPs confiáveis, separados por vírgula; os eventos deles são descartados por completo. Também alimenta as exclusões do segundo firewall e a lista de permitidos do egress |
|
||||
| `URUTAU_IGNORE` | `127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,100.64.0.0/10,169.254.0.0/16` | mesmo efeito, mantido como o alias que carrega as faixas privadas como padrão |
|
||||
| `URUTAU_MONITOR_UA` | `(?i)^(Uptime-Kuma/\|Beszel\|Coolify\|kube-probe/\|Go-http-client/.*healthcheck)` | expressão regular de User-Agents de monitoramento; vazio desativa; expressão inválida impede a inicialização |
|
||||
| `URUTAU_MONITOR_FROM` | vazio | CIDRs de onde os monitores realmente vêm; quando definido, o User-Agent de monitoramento só vale vindo deles |
|
||||
| `URUTAU_ADMIN_USERS` | vazio | usuários SSH cujo login bem-sucedido mantém o IP fora da lista de bloqueio por 24 h após o último login (um sinal forte posterior cancela); a imunidade fica desligada se isto não for definido |
|
||||
| `URUTAU_DOMAINS` | vazio | lista de domínios do analytics, nomes exatos ou `*.exemplo.com`; vazio acompanha todo domínio que responde 2xx; recomendado, na prática obrigatório, quando algum backend responde 2xx para qualquer Host (catch-all ou curinga), senão Hosts aleatórios podem encher as 24 vagas de domínio |
|
||||
|
||||
### Geolocalização e Tor
|
||||
|
||||
| Variável | Padrão | Significado |
|
||||
|---|---|---|
|
||||
| `URUTAU_GEO_DIR` | `<data-dir>/geo` | onde ficam as bases DB-IP Lite |
|
||||
| `URUTAU_GEO_UPDATE` | `24h` | intervalo entre conferências de base nova; `0` desativa o download |
|
||||
| `URUTAU_TOR_AUTO` | `on` | `on`: baixa as listas oficiais de saídas e relays do Tor a cada 6 horas em `<data-dir>/tor`; `off`: não baixa (hosts isolados) |
|
||||
| `URUTAU_TOR_EXITS` | vazio | arquivo com endereços de saída do Tor, um por linha (comentários `#` aceitos, no máximo 100000 endereços, 8 MiB), recarregado a cada 24 h quando muda; combinado com a lista baixada |
|
||||
|
||||
### Federação
|
||||
|
||||
| Variável | Padrão | Significado |
|
||||
|---|---|---|
|
||||
| `URUTAU_PEERS` | vazio | peers a agregar, `nome=https://url` separados por vírgula (a flag `--peer` se repete) |
|
||||
| `URUTAU_PEER_ALLOW` | vazio | CIDRs autorizados a chamar as rotas de federação; vazio aceita qualquer origem que tenha o token |
|
||||
| `URUTAU_PEER_BLOCKLIST` | `on` | `on`: a lista de bloqueio do hub inclui IPs hostis vistos só pelos peers (score 50+ e sinal forte); `off`: só os IPs desta instância. Qualquer outro valor impede a inicialização |
|
||||
| `URUTAU_TRUSTED_PROXY` | `127.0.0.0/8,::1` (o compose define `10.250.0.0/24`) | proxies reversos cujo `X-Forwarded-For` é confiável (lido da direita para a esquerda); usado pelo limite de tentativas de login e por `URUTAU_PEER_ALLOW` |
|
||||
|
||||
### Segundo firewall (enforce)
|
||||
|
||||
| Variável | Padrão | Significado |
|
||||
|---|---|---|
|
||||
| `URUTAU_ENFORCE` | `off` | `off`; `observe` (decide em memória e mostra o que baniria, não grava nada); `on` (também acrescenta as decisões em `URUTAU_ENFORCE_LOG` para o fail2ban do host). Qualquer outro valor impede a inicialização |
|
||||
| `URUTAU_ENFORCE_LOG` | `/logs/enforce/decisions.log` | arquivo de decisões acrescentado no modo `on`; `on` sem ele impede a inicialização |
|
||||
| `URUTAU_ENFORCE_UNBAN_LOG` | `unban.log` ao lado de `URUTAU_ENFORCE_LOG` | arquivo onde o botão Desbanir do dashboard grava os pedidos, lido pelo host |
|
||||
| `URUTAU_ENFORCE_SHARE` | `off` | `on`: troca decisões e desbanimentos com os peers a cada 30 s; cada lado aplica suas próprias exclusões. Qualquer outro valor impede a inicialização |
|
||||
| `URUTAU_ENFORCE_THRESHOLD` | `5` | eventos de ataque em 10 minutos que justificam um banimento (1 a 1000) |
|
||||
| `URUTAU_ENFORCE_MAX_PER_MIN` | `60` | máximo de decisões gravadas por minuto; o excedente é descartado e contado (1 a 10000) |
|
||||
|
||||
Um número ilegível volta ao padrão; um fora da faixa impede a inicialização.
|
||||
|
||||
### Egress
|
||||
|
||||
| Variável | Padrão | Significado |
|
||||
|---|---|---|
|
||||
| `URUTAU_EGRESS` | `auto` | `auto` (liga quando `URUTAU_EGRESS_LOG` existe na partida), `on` ou `off`; qualquer outro valor impede a inicialização |
|
||||
| `URUTAU_EGRESS_LOG` | `/logs/host/egress.log` | log do kernel de conexões novas de saída, gravado pelo kit do host |
|
||||
| `URUTAU_EGRESS_CONTAINERS` | `/logs/host/containers.map` | mapa `"<ip> <container>"` gravado pelo kit do host a cada minuto, para que as cargas mantenham o nome quando o endereço muda num redeploy |
|
||||
| `URUTAU_EGRESS_WORKLOADS` | vazio | cargas nomeadas e seu papel, veja [Análise de egress](#análise-de-egress) |
|
||||
| `URUTAU_EGRESS_RESOLVERS` | vazio | resolvedores DNS permitidos, IPs separados por vírgula; vazio significa os públicos usuais (Cloudflare, Google, Quad9...) mais os nameservers de `/etc/resolv.conf` e `/logs/host/resolv.conf` |
|
||||
| `URUTAU_EGRESS_ALLOW` | vazio | só variável de ambiente, sem flag: CIDRs ou IPs de consultores periódicos legítimos que não devem gerar achados de beaconing. Endereços dos peers, `URUTAU_TRUSTED` e os endereços públicos do próprio servidor são sempre permitidos |
|
||||
| `URUTAU_EGRESS_PROVIDER_ASN` | vazio | só variável de ambiente, sem flag: números de AS do seu provedor de hospedagem, separados por vírgula, para que o tráfego até ele não seja apontado como incomum |
|
||||
|
||||
Na imagem do container os caminhos de log têm como padrão `/logs/traefik/access.log`, `/logs/host/auth.log` e `/logs/host/fail2ban.log` (o compose monta os logs do host ali); os arquivos de sondagem, egress e mapa de containers ficam no mesmo diretório `/logs/host`. O compose acrescenta `URUTAU_VERSION` (tag da imagem), `URUTAU_IMAGE` e `URUTAU_PUBLISH` (endereço e porta do host), veja `.env.example`. Ele repassa só algumas variáveis ao container ([docker.md](docker.md)); acrescente qualquer outra variável `URUTAU_*`, como as `URUTAU_ENFORCE_*` e `URUTAU_EGRESS_*`, ao bloco `environment`.
|
||||
|
||||
## Ruído e monitoramento
|
||||
|
||||
@@ -69,15 +120,50 @@ URUTAU_PEERS=web1=https://urutau.web1.example,db1=https://urutau.db1.example
|
||||
URUTAU_PEER_TOKEN=<segredo compartilhado>
|
||||
```
|
||||
|
||||
Em cada peer, defina o mesmo `URUTAU_PEER_TOKEN`. O hub chama apenas `GET /api/v1/peer/export` (uma vez por intervalo, `1h`, `24h` e `7d`, a cada 15 segundos). As URLs dos peers devem ser `https` (`http` simples só é aceito em loopback): o token de peer viaja em um cabeçalho. Para restringir quem pode chamar o export, defina `URUTAU_PEER_ALLOW` no peer com o endereço do hub. Os nomes dos peers devem ser únicos e não podem ser `all` nem o nome do próprio hub.
|
||||
Em cada peer, defina o mesmo `URUTAU_PEER_TOKEN` (ou um `URUTAU_PEER_TOKEN_<NOME>` por peer no hub). O token de peer abre só as rotas de federação: `GET /api/v1/peer/export` (o hub pede a cada 15 segundos `1h`, `24h`, `7d` e `30d`), `GET /api/v1/peer/stream` (eventos ao vivo), `GET /api/v1/peer/period` (o estudo de um período ou de um IP), `GET /api/v1/peer/egress` e, com `URUTAU_ENFORCE_SHARE=on`, `GET`/`POST /api/v1/peer/decisions` e `POST /api/v1/peer/unban`. As URLs dos peers devem ser `https` (`http` simples só é aceito em loopback): o token de peer viaja em um cabeçalho. Para restringir quem chama essas rotas, defina `URUTAU_PEER_ALLOW` no peer com o endereço do hub; se o peer está atrás de um proxy, defina também `URUTAU_TRUSTED_PROXY` para que o endereço real do cliente seja o comparado. Os nomes de peer devem ser únicos e não podem ser `all` nem o nome do próprio hub. Com `URUTAU_PEER_BLOCKLIST=off` a lista de bloqueio do hub traz só os IPs dele.
|
||||
|
||||
## Snapshot e retenção
|
||||
|
||||
O arquivo de snapshot guarda o estado agregado e as posições dos logs. Monte `URUTAU_DATA_DIR` em um volume para mantê-lo entre reinícios. Apague o arquivo para começar do zero (os logs rotacionados serão lidos de novo). A retenção limita por quanto tempo um IP fica, no máximo 168 horas; os intervalos do dashboard são `1h`, `24h` e `7d`.
|
||||
O arquivo de snapshot `urutau-state.gob` guarda o estado agregado e as posições dos logs; é salvo a cada 60 segundos e em `SIGTERM`. Monte `URUTAU_DATA_DIR` em um volume para mantê-lo entre reinícios. Apague o arquivo para começar do zero (os logs rotacionados serão lidos de novo); um snapshot ilegível é posto de lado na partida. A retenção (`URUTAU_RETENTION`, no máximo 720 horas) limita por quanto tempo um IP fica; os intervalos do dashboard são `1h`, `24h`, `7d` e `30d`.
|
||||
|
||||
## Registro de eventos
|
||||
|
||||
`<data-dir>/events/` guarda uma linha por evento de atacante, um arquivo por dia UTC, dias antigos compactados com gzip, apagados após `URUTAU_RETENTION`, e limitado no total por `URUTAU_EVENTS_MAX` (um número com unidade opcional, `0` desliga o registro). Nunca guarda um visitante legítimo. Ele vive no mesmo volume do snapshot, então planeje o teto além do snapshot (cerca de 27 MB no pior caso medido). Disco cheio ou o teto descartam eventos e nunca param o serviço. Veja [arquitetura.md](arquitetura.md).
|
||||
`<data-dir>/events/` guarda uma linha por evento de atacante, um arquivo por dia UTC, dias antigos compactados com gzip, apagados após `URUTAU_RETENTION`, e limitado no total por `URUTAU_EVENTS_MAX` (um número com unidade opcional, `0` desliga o registro). Nunca guarda visitante legítimo. Fica no mesmo volume do snapshot, então reserve o limite além do snapshot (cerca de 27 MB no pior caso medido). Disco cheio ou o limite descartam eventos e nunca param o serviço. Veja [arquitetura.md](arquitetura.md).
|
||||
|
||||
## Incidentes
|
||||
|
||||
Os chamados abertos a partir de achados de egress (e o estado deles: aberto, falso positivo, benigno...) ficam em `<data-dir>/incidents.json`, no mesmo volume. Um chamado marcado como falso positivo ou benigno pode suprimir o mesmo achado depois. Um arquivo corrompido é movido de lado e o armazenamento recomeça vazio; nada mais precisa ser configurado.
|
||||
|
||||
## Sondagens (varreduras de portas)
|
||||
|
||||
Conexões a portas que ninguém serve não aparecem nos logs das aplicações. O kit do host ([docker.md](docker.md#kit-do-host)) as registra do kernel em `/var/log/urutau/probe.log`; o Urutau lê esse arquivo como `URUTAU_PROBE_LOG`, transforma cada linha em um evento de scanner e guarda no máximo um evento por endereço, porta e protocolo por minuto. Sem o kit a fonte fica em `waiting` e mais nada muda.
|
||||
|
||||
## Tor
|
||||
|
||||
O Urutau marca endereços que são saídas ou relays do Tor. Por padrão (`URUTAU_TOR_AUTO=on`) baixa a lista oficial de saídas e a de relays a cada 6 horas em `<data-dir>/tor` (`exits.txt`, `relays.json`; um download inválido mantém o cache anterior); o container então precisa de HTTPS de saída para `check.torproject.org` e `onionoo.torproject.org`. Num host isolado defina `URUTAU_TOR_AUTO=off` e mantenha seu próprio arquivo `URUTAU_TOR_EXITS`.
|
||||
|
||||
## Segundo firewall (enforce)
|
||||
|
||||
Opcional e desligado por padrão. O Urutau nunca ganha privilégios: ele só decide quais endereços merecem banimento e acrescenta uma linha por decisão em um arquivo, e uma jail do fail2ban no host a aplica.
|
||||
|
||||
- `URUTAU_ENFORCE=observe` decide em memória e mostra no dashboard o que baniria; nada é gravado. Use primeiro.
|
||||
- `URUTAU_ENFORCE=on` acrescenta `<hora> urutau decision=ban ip=<ip> reason=<slug> score=<n> ttl=<s> host=<nome> src=<local|peer>` em `URUTAU_ENFORCE_LOG`. O lado do host é a jail `urutau` e a ação `urutau-allports` instaladas por `install.sh --enforce` ([docker.md](docker.md#kit-do-host)). A jail usa o `ignoreip` do próprio host, então endereços confiáveis ficam protegidos ali também. As decisões esperam o backfill dos logs terminar na partida.
|
||||
|
||||
Um banimento exige uma destas condições dentro da janela: dois eventos críticos (RCE, traversal, `.env`/credenciais, VCS, webshell, SQL injection, Log4Shell), `URUTAU_ENFORCE_THRESHOLD` eventos de ataque em 10 minutos (o dobro para quem fez uma visita legítima), 5 falhas de SSH em 10 minutos, 10 portas distintas sondadas em 10 minutos, um atacante conhecido, 10 falhas de SSH ou 20 eventos web em 24 horas, 10 falhas de SSH ou 10 eventos web sem visita legítima em 7 dias (um `ssh-probe` conta metade), ou um evento de um endereço de um /24 (IPv4) ou /64 (IPv6) em que 3 ou mais endereços foram banidos nas últimas 24 horas (`neighbor-campaign`). O TTL sugerido cresce com a reincidência: 1 h, 6 h, 24 h, 7 d. Nunca são banidos: endereços confiáveis e privados (`URUTAU_TRUSTED`, `URUTAU_IGNORE`), crawlers verificados (DNS reverso confirmado), endereços com permissão do operador, infraestrutura e hosts dos próprios peers, endereços da Cloudflare e decisões de um peer que a instância local não consegue confirmar. Banimentos da jail `urutau` e de `recidive` não contam como evidência do comportamento do próprio endereço. Os motivos são uma lista fixa: `scanner-flood`, `exploit-flood`, `web-bruteforce`, `wp-bruteforce`, `ssh-bruteforce`, `rce`, `path-traversal`, `env-probe`, `vcs-probe`, `webshell`, `sqli`, `log4shell`, `port-scan`, `known-attacker`, `neighbor-campaign`.
|
||||
|
||||
O botão Desbanir do dashboard (`POST /api/v1/enforce/unban`) remove o banimento ativo, grava `<hora> urutau unban ip=<ip> allow=<segundos>` no arquivo de unban e, com `URUTAU_ENFORCE_SHARE=on`, avisa os peers. No host, `urutau-unban.path` roda `urutau-unban`, que desbane o endereço em todas as jails e, com `allow` maior que 0, o ignora por esse tempo (útil em pentests autorizados). `urutau doctor` informa o modo, o arquivo e se é gravável (`fail` no modo `on` quando não é) e avisa quando o Traefik registra endereços da Cloudflare como clientes (defina `forwardedHeaders.trustedIPs` com as faixas da Cloudflare para enxergar o cliente real).
|
||||
|
||||
## Análise de egress
|
||||
|
||||
Analisa o que sai do servidor: conexões novas de saída do host e dos containers, registradas pelo kit do host em `/var/log/urutau/egress.log`. Encontra beaconing, mineração, spam, varreduras não autorizadas, DNS que contorna os resolvedores permitidos e destinos conhecidos como hostis ou saídas do Tor. Com `URUTAU_EGRESS=auto` liga sozinha quando o log existe. Os achados podem virar chamados (veja Incidentes).
|
||||
|
||||
`URUTAU_EGRESS_WORKLOADS` nomeia as origens e dá um papel a cada uma, para que o comportamento esperado não seja apontado (um scanner varre, um servidor de e-mail fala na porta 25):
|
||||
|
||||
```
|
||||
URUTAU_EGRESS_WORKLOADS="scanner=name:scan-worker*:scanner;mail=10.0.7.0/24:mail;host-out=host"
|
||||
```
|
||||
|
||||
Formato: `nome=ITEM,ITEM:papel;nome2=...`. Um ITEM é um CIDR ou IP, `host` (a saída do próprio host), `name:<container>` (nome exato do container, ignorando um sufixo `-<dígitos>` no fim) ou `name:<prefixo>*` (todo container cujo nome começa com o prefixo). O papel, depois dos últimos dois-pontos, é `default`, `scanner`, `mail` ou `resolver` (`default` quando omitido). Uma definição inválida impede a inicialização.
|
||||
|
||||
## Autenticação e exposição
|
||||
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
# Docker
|
||||
|
||||
O Urutau é distribuído como uma imagem de container pequena (`linux/amd64` e `linux/arm64`, cerca de 28 MB, sem `curl`), definida no [`docker-compose.yml`](../../docker-compose.yml). Ele só precisa ler arquivos de log e gravar um snapshot.
|
||||
O Urutau é distribuído como uma imagem de container pequena (`linux/amd64` e `linux/arm64`, cerca de 28 MB, sem `curl`), definida no [`docker-compose.yml`](../../docker-compose.yml). Ele lê arquivos de log e grava um volume de dados (e, só se você ligar o segundo firewall, um arquivo de decisões).
|
||||
|
||||
```
|
||||
host container urutau
|
||||
/data/coolify/proxy/logs ── :ro ────────────► /logs/traefik (access.log do Traefik)
|
||||
/var/log/urutau ── :ro ────────────► /logs/host (auth.log, fail2ban.log)
|
||||
volume urutau-data ── leitura e escrita ► /data (snapshot, bases de geolocalização)
|
||||
/var/log/urutau ── :ro ────────────► /logs/host (auth.log, fail2ban.log, probe.log,
|
||||
egress.log, containers.map, resolv.conf)
|
||||
/var/log/urutau-enforce ── leitura e escrita ► /logs/enforce (decisions.log, unban.log; só com URUTAU_ENFORCE=on)
|
||||
volume urutau-data ── leitura e escrita ► /data (snapshot, geo, tor, events, incidents)
|
||||
```
|
||||
|
||||
O compose segue esse layout. O diretório de logs do Traefik é montado fora de `/data` para não colidir com o volume do snapshot. Só o diretório `logs` dedicado do proxy é montado, nunca o `/data/coolify/proxy` inteiro (que guarda `acme.json` e a configuração dinâmica).
|
||||
O compose segue esse layout, exceto a montagem `/logs/enforce`, que você acrescenta ao ligar o segundo firewall (veja [abaixo](#kit-do-host)). O diretório de logs do Traefik é montado fora de `/data` para não colidir com o volume do snapshot. Só o diretório `logs` dedicado do proxy é montado, nunca o `/data/coolify/proxy` inteiro (que guarda `acme.json` e a configuração dinâmica).
|
||||
|
||||
A imagem roda com o usuário sem privilégios `urutau` (uid 10001) em Alpine. O `HEALTHCHECK` é o próprio binário (`urutau healthcheck`, que pergunta `/api/health` ao daemon local), então não há `curl` na imagem. O compose define um limite de memória (`mem_limit`); o limite suave do Go é 256 MiB e o pior caso medido é cerca de 54 MiB de heap mais um snapshot de cerca de 27 MB, então recomenda-se `mem_limit: 384m`. O volume de dados também guarda o registro de eventos (`/data/events`, limitado por `URUTAU_EVENTS_MAX`, 512 MB por padrão). O compose define e `cpus: 0.5`, sistema de arquivos raiz somente leitura, `cap_drop: [ALL]` e `no-new-privileges`, e repassa do `.env` ao 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` e `TZ`. Para definir qualquer outra variável `URUTAU_*` (`URUTAU_MONITOR_UA`, `URUTAU_RETENTION`, `URUTAU_TOKEN_FILE`, tokens por peer, ...), acrescente-a ao bloco `environment`.
|
||||
A imagem roda com o usuário sem privilégios `urutau` (uid 10001) em Alpine, a partir de um binário Go estático. O `HEALTHCHECK` é o próprio binário (`urutau healthcheck`, a cada 30 s, que pergunta `/api/health` ao daemon local), então não há `curl` na imagem. A imagem define `URUTAU_BIND=0.0.0.0:8790`, `URUTAU_DATA_DIR=/data` e os três caminhos de log (`/logs/traefik/access.log`, `/logs/host/auth.log`, `/logs/host/fail2ban.log`); `VOLUME /data`, `EXPOSE 8790`, `ENTRYPOINT ["urutau"]`, `CMD ["serve"]`. O compose define `mem_limit: 384m` (o limite suave do Go é 256 MiB; o pior caso medido é cerca de 54 MiB de heap mais um snapshot de uns 27 MB), `cpus: 0.5`, sistema de arquivos raiz somente leitura, `cap_drop: [ALL]`, `no-new-privileges`, `group_add: ["4"]` (o grupo `adm` do host) e a rede `urutau-edge`. O volume de dados também guarda o registro de eventos (`/data/events`, limitado por `URUTAU_EVENTS_MAX`, 512 MB por padrão). Ele repassa do `.env` ao 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` e `TZ`. Para definir qualquer outra variável `URUTAU_*` (`URUTAU_MONITOR_UA`, `URUTAU_RETENTION`, `URUTAU_TOKEN_FILE`, `URUTAU_ENFORCE*`, `URUTAU_EGRESS*`, `URUTAU_TOR_*`, tokens por peer, ...), acrescente-a ao bloco `environment`.
|
||||
|
||||
## Início rápido
|
||||
|
||||
@@ -66,7 +68,7 @@ sudo systemctl restart fail2ban
|
||||
|
||||
# logrotate para os dois arquivos
|
||||
sudo tee /etc/logrotate.d/urutau >/dev/null <<'EOF'
|
||||
/var/log/urutau/*.log {
|
||||
/var/log/urutau/auth.log /var/log/urutau/fail2ban.log {
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
@@ -82,7 +84,9 @@ sudo tee /etc/logrotate.d/urutau >/dev/null <<'EOF'
|
||||
EOF
|
||||
```
|
||||
|
||||
O `RSYSLOG_FileFormat` grava timestamps ISO, que é o formato que o Urutau interpreta. Confira o GID do `adm` com `getent group adm`. Limitação conhecida: um usuário local do host pode forjar linhas do sshd com `logger -t sshd`. O Urutau limita o dano (o nível hostil exige sinal forte e a imunidade de admin dura 24 horas), mas quem tem shell no host já está dentro do seu limite de confiança.
|
||||
O A regra de logrotate acima cita só `auth.log` e `fail2ban.log` de propósito: com o kit do host, é o kit que rotaciona `egress.log` e `probe.log`, e o logrotate recusa entradas duplicadas.
|
||||
|
||||
`RSYSLOG_FileFormat` grava timestamps ISO, que é o formato que o Urutau interpreta. Confira o GID do `adm` com `getent group adm`. Limitação conhecida: um usuário local do host pode forjar linhas do sshd com `logger -t sshd`. O Urutau limita o dano (o nível hostil exige sinal forte e a imunidade de admin dura 24 horas), mas quem tem shell no host já está dentro do seu limite de confiança.
|
||||
|
||||
## Exemplo: Coolify
|
||||
|
||||
@@ -129,15 +133,47 @@ networks:
|
||||
Notas:
|
||||
|
||||
- **Uma rede compartilhada só com o Traefik.** `--trusted-proxy` tem como padrão só o loopback, então por padrão o `X-Forwarded-For` é ignorado. O compose cria a rede `urutau-edge` (`10.250.0.0/24`) e define `URUTAU_TRUSTED_PROXY=10.250.0.0/24`, então só o proxy dessa rede é acreditado (qualquer outro container ali poderia forjar IPs de cliente, então deixe só o proxy). Conecte o proxy uma vez: `docker network connect urutau-edge coolify-proxy`. Em um compose avulso como o exemplo abaixo, declare a rede do mesmo jeito e defina a variável. O label `traefik.docker.network` diz ao Traefik para usá-la. Adapte os nomes do entrypoint e do certresolver ao seu proxy.
|
||||
- A imagem já aponta as fontes para `/logs/traefik/access.log`, `/logs/host/auth.log` e `/logs/host/fail2ban.log` (seus padrões `URUTAU_*_LOG`). Os padrões do próprio binário (`/data/coolify/proxy/access.log`, `/var/log/...`) servem para rodá-lo direto no host.
|
||||
- A imagem já aponta as fontes para `/logs/traefik/access.log`, `/logs/host/auth.log` e `/logs/host/fail2ban.log` (seus padrões `URUTAU_*_LOG`); os padrões de sondagem, egress e mapa de containers (`/logs/host/...`) são os do próprio binário. Os outros padrões do binário (`/data/coolify/proxy/access.log`, `/var/log/...`) servem para rodá-lo direto no host.
|
||||
- Defina `URUTAU_TOKEN` no ambiente do Coolify. Atrás do proxy o dashboard é servido por HTTPS, então o cookie de sessão é `Secure`.
|
||||
- Não publique a porta 8790 no host quando o proxy já a roteia.
|
||||
- Se o access log do Traefik não existir ou não for JSON, a fonte fica em zero linhas ou `malformed` cresce.
|
||||
- O Urutau não precisa de `tmpfs`: o sistema de arquivos raiz é somente leitura e seu único destino de escrita é o volume `/data`.
|
||||
- O Urutau não precisa de `tmpfs`: o sistema de arquivos raiz é somente leitura e seus destinos de escrita são o volume `/data` e, no modo enforce, `/logs/enforce`.
|
||||
|
||||
## Kit do host
|
||||
|
||||
`deploy/host/` traz um kit opcional, que precisa de root no host e dá ao Urutau mais três fontes. O Urutau em si nunca ganha privilégios: ele só lê os logs que o kit grava e, no modo enforce, grava um arquivo de decisões.
|
||||
|
||||
```bash
|
||||
sudo sh deploy/host/install.sh # registro de sondagens e egress + mapa de containers
|
||||
sudo sh deploy/host/install.sh --enforce # também a jail do fail2ban do segundo firewall
|
||||
sudo sh deploy/host/install.sh --remove # desfaz tudo (os logs são mantidos)
|
||||
```
|
||||
|
||||
É idempotente. `URUTAU_WAN` sobrescreve a interface de saída detectada e `URUTAU_UID` (padrão `10001`) o uid dono do diretório de enforce. Precisa de `nft`, `rsyslog` e Docker (e de `fail2ban` e `python3` para `--enforce`).
|
||||
|
||||
| Parte | O que instala |
|
||||
|---|---|
|
||||
| registro de egress | tabela nftables `inet urutau_egress` (`/etc/urutau/egress.nft`, só registra, nunca descarta, separada das tabelas do Docker e do fail2ban) e a unit `urutau-egress.service`; a regra rsyslog `41-urutau-egress.conf` manda as linhas do kernel para `/var/log/urutau/egress.log` (`URUTAU-EGRESS:`) e `/var/log/urutau/probe.log` (`URUTAU-PROBE:`); logrotate diário, 7 cópias, no máximo 200 MB (`urutau-logrotate.timer`) |
|
||||
| sondagens | a regra `URUTAU-PROBE:` registra conexões novas de entrada pela interface externa a portas em que nenhum socket escuta (no máximo 10 por segundo por origem); o conjunto de portas abertas é atualizado a cada minuto a partir do `ss`, incluindo as portas que o Docker publica |
|
||||
| mapa de containers | `urutau-containers-map` e seu timer (a cada minuto) gravam `/var/log/urutau/containers.map` (`<ip> <container>`) e `/var/log/urutau/resolv.conf` (os resolvedores reais de upstream) |
|
||||
| segundo firewall (`--enforce`) | diretório `/var/log/urutau-enforce` (dono `URUTAU_UID`, grupo `adm`) com `decisions.log` e `unban.log`; filtro `urutau`, ação `urutau-allports` e jail `urutau` do fail2ban (backend `polling`, `maxretry = 1`, `bantime = 1h`, ações em `INPUT` e `DOCKER-USER`, `ignoreip` do host mantido); `urutau-unban.path` e `urutau-unban` aplicam o botão Desbanir |
|
||||
|
||||
A ação `urutau-allports` funciona como `iptables-allports`, mas só descarta conexões que o endereço banido inicia (direção original do conntrack), então as respostas a conexões que o host abriu continuam fluindo. Os arquivos de egress e sondagem caem em `/var/log/urutau`, que o compose já monta em `/logs/host`, então o Urutau os encontra nos padrões (`URUTAU_EGRESS=auto` liga sozinho assim que o arquivo existe). Para o segundo firewall, acrescente a montagem e as variáveis ao compose, comece com `observe` e passe para `on` quando as decisões parecerem certas:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
URUTAU_ENFORCE: observe # off | observe | on
|
||||
# URUTAU_ENFORCE_SHARE: "on" # troca decisões com os peers
|
||||
# URUTAU_EGRESS_WORKLOADS: "mail=10.0.7.0/24:mail"
|
||||
volumes:
|
||||
- /var/log/urutau-enforce:/logs/enforce # leitura e escrita, só para enforce=on
|
||||
```
|
||||
|
||||
`/logs/enforce` precisa ser gravável pelo uid 10001 (o kit cuida disso) e não pode ser `:ro`. Confira com `docker compose exec urutau urutau doctor`: a linha `enforce` mostra modo, arquivo e se é gravável. Veja [configuracao.md](configuracao.md) para a política e as variáveis.
|
||||
|
||||
## Base de geolocalização
|
||||
|
||||
As bases DB-IP Lite são baixadas no volume de dados (`/data/geo`) na primeira inicialização, então o container precisa de HTTPS de saída para `download.db-ip.com` uma vez, e depois uma vez por mês. Se o host não alcança a internet, copie os dois arquivos `.mmdb` para o volume e defina `URUTAU_GEO_UPDATE=0` ([configuracao.md](configuracao.md)). Dados por [DB-IP](https://db-ip.com), CC BY 4.0.
|
||||
As bases DB-IP Lite são baixadas no volume de dados (`/data/geo`) na primeira inicialização, então o container precisa de HTTPS de saída para `download.db-ip.com` uma vez, e depois uma vez por mês. As listas do Tor (`URUTAU_TOR_AUTO=on`) também precisam de `check.torproject.org` e `onionoo.torproject.org` a cada 6 horas; com `URUTAU_TOR_AUTO=off` isso não é necessário. Se o host não alcança a internet, copie os dois arquivos `.mmdb` para o volume e defina `URUTAU_GEO_UPDATE=0` ([configuracao.md](configuracao.md)). Dados por [DB-IP](https://db-ip.com), CC BY 4.0.
|
||||
|
||||
## Federação entre servidores
|
||||
|
||||
@@ -150,12 +186,12 @@ Rode um Urutau por servidor, cada um com seu `URUTAU_NAME`. Toda instância cons
|
||||
URUTAU_PEER_TOKEN_SERVER_3: ${TOKEN_FOR_SERVER_3}
|
||||
```
|
||||
|
||||
O hub chama apenas `GET /api/v1/peer/export` em cada peer (três intervalos a cada 15 segundos) e mantém um `GET /api/v1/peer/stream` aberto para os eventos ao vivo, com o token daquele peer, que não abre mais nada no peer e é recusado em `http` simples fora de loopback. Defina `URUTAU_PEER_ALLOW` em um peer com o endereço do hub para restringir quem pode chamar o export. Cada peer mantém seu próprio token de login para o próprio dashboard.
|
||||
O hub chama `GET /api/v1/peer/export` em cada peer (quatro intervalos a cada 15 segundos), mantém um `GET /api/v1/peer/stream` aberto para os eventos ao vivo e busca períodos e egress sob demanda; com `URUTAU_ENFORCE_SHARE=on` os dois lados também trocam decisões e desbanimentos a cada 30 segundos. Tudo usa o token daquele peer, que não abre mais nada no peer e é recusado em `http` simples fora de loopback. Defina `URUTAU_PEER_ALLOW` em um peer com o endereço do hub para restringir quem pode chamar o export. Cada peer mantém seu próprio token de login para o próprio dashboard.
|
||||
|
||||
## Endurecimento
|
||||
|
||||
`read_only: true`, `cap_drop: [ALL]`, `no-new-privileges` e montagens de log somente leitura deixam o container capaz de uma coisa só: ler os logs e gravar seu snapshot. Mantenha a imagem em uma tag fixa (`X.Y.Z`) em produção e `latest` só onde você aceita atualizações.
|
||||
`read_only: true`, `cap_drop: [ALL]`, `no-new-privileges` e montagens de log somente leitura deixam o container capaz de uma coisa só: ler os logs e gravar seu volume de dados (mais o arquivo de decisões, só quando você liga `URUTAU_ENFORCE=on`). Mantenha a imagem em uma tag fixa (`X.Y.Z`) em produção e `latest` só onde você aceita atualizações.
|
||||
|
||||
## Saúde e desligamento
|
||||
|
||||
`GET /api/health` responde `{"status":"ok"}` sem autenticação. `urutau healthcheck` o chama localmente e sai com 0 quando o daemon está saudável; a imagem o usa como `HEALTHCHECK`. Em `SIGTERM` o daemon para de aceitar requisições, salva o snapshot e sai.
|
||||
`GET /api/health` responde `{"status":"ok"}` sem autenticação. `urutau healthcheck` o chama localmente e sai com 0 quando o daemon está saudável; a imagem o usa como `HEALTHCHECK`. Em `SIGTERM` o daemon para de aceitar requisições, salva o snapshot e sai (`SIGINT` também; 5 segundos de tolerância, código 0).
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Interface
|
||||
|
||||
O dashboard é embutido no binário: HTML, CSS e JavaScript puros, sem etapa de build e sem requisição externa (fontes, scripts e estilos são todos servidos pelo Urutau, o que a Content-Security-Policy garante). Segue o tema claro ou escuro do sistema, pode ser alternado à mão e fala inglês ou português (botão no cabeçalho; a escolha fica guardada no navegador).
|
||||
Urutau 1.6.0. O dashboard é embutido no binário: HTML, CSS e JavaScript puros, sem etapa de build e sem requisição externa (fontes, scripts e estilos são todos servidos pelo Urutau, o que a Content-Security-Policy garante). Segue o tema claro ou escuro do sistema, pode ser alternado à mão, fala inglês ou português (botão no cabeçalho; a escolha fica guardada no navegador) e tem layout para celular. 23 páginas, listadas abaixo.
|
||||
|
||||
## Login
|
||||
|
||||
@@ -12,7 +12,7 @@ Abra o endereço da instância. Sem sessão você é enviado a `/login`: cole o
|
||||
|
||||
## Navegação
|
||||
|
||||
Uma barra lateral (barra de abas no celular) reúne as páginas. Cada página abre com uma frase com o número que importa, e o recorte ativo (intervalo, host, domínio) fica sempre escrito sob o título. A página vive no hash da URL (`#/overview`, `#/threats`, `#/geo`, `#/live`, `#/replay`, `#/traffic`, `#/ips`, `#/ip/<ip>`, `#/sources`), então uma visão pode ser salva ou compartilhada; a página Geografia vai mais fundo, como em `#/geo/BR/Pernambuco/Recife` (país, estado, cidade). Um painel de detalhe do IP abre a partir de qualquer IP.
|
||||
Uma barra lateral (barra de abas no celular, com um menu "Mais" que rola quando é mais alto que a tela) reúne as páginas, em cinco grupos. Cada página abre com uma frase com o número que importa, e o recorte ativo (intervalo, host, domínio) fica sempre escrito sob o título. A página vive no hash da URL (`#/overview`, `#/threats`, `#/geo`, `#/live`, `#/replay`, `#/traffic`, `#/ips`, `#/ip/<ip>`, `#/sources`, `#/incidents`, `#/incidents/<id>`, `#/campaigns/<id>` e assim por diante), então uma visão pode ser salva ou compartilhada; a página Geografia vai mais fundo, como em `#/geo/BR/Pernambuco/Recife` (país, estado, cidade). Um painel de detalhe do IP abre a partir de qualquer IP. O item Incidentes na barra traz um pequeno contador de chamados abertos.
|
||||
|
||||
## Cabeçalho
|
||||
|
||||
@@ -21,80 +21,143 @@ Uma barra lateral (barra de abas no celular) reúne as páginas. Cada página ab
|
||||
- O seletor de **período**: doze intervalos (`1h`, `2h`, `3h`, `6h`, `12h`, `24h`, `2d`, `3d`, `5d`, `7d`, `15d`, `30d`) ou um período personalizado (`from` e `to`, no máximo 30 dias). Vale para todas as páginas.
|
||||
- Botões de idioma, tema e sair.
|
||||
|
||||
## Páginas
|
||||
|
||||
- **Visão geral:** os números principais (requisições, eventos maliciosos, IPs hostis e suspeitos, bans, o contador "monitoring" de requisições benignas de monitores, fora dos números de tráfego), a linha do tempo e os principais IPs.
|
||||
|
||||
<p align="center"><img src="../img/overview-dark-pt.png" width="900" alt="Página Visão geral"><br><sub>Visão geral (dados de demonstração).</sub></p>
|
||||
- **Ameaças:** contadores empilhados por categoria, o feed ao vivo dos últimos eventos (campos dos logs são mostrados como texto, nunca como marcação) e os principais caminhos atacados, domínios, User-Agents e usuários visados.
|
||||
|
||||
<p align="center"><img src="../img/threats-dark-pt.png" width="900" alt="Página Ameaças"><br><sub>Ameaças: categorias ao longo do tempo, KPIs e os últimos eventos.</sub></p>
|
||||
- **Geografia:** um mapa-múndi por país do atacante. Selecione um país para ver seus estados ou regiões e suas cidades (desenhadas como círculos no país ampliado), as categorias e os principais IPs; selecione uma região para restringir cidades e IPs. A visão é `#/geo/<CC>/<região>`.
|
||||
|
||||
<p align="center"><img src="../img/geo-world-dark-pt.png" width="900" alt="Página Geografia: mapa-múndi por país do atacante"><br><sub>Geografia: o mundo por país do atacante.</sub></p>
|
||||
- **Ao vivo:** ataques desenhados como arcos animados da origem até o servidor que os viu, em mapa plano ou globo 3D, com taxa, categorias, servidores, origens recentes, uma coluna de métricas e últimos eventos, filtros, pausa e tela cheia. Abre reproduzindo os últimos eventos (`/api/v1/live/recent`), então não fica parada num servidor calmo. Em um hub mostra também os eventos de cada peer. A posição de cada servidor vem de `--location`.
|
||||
|
||||
<p align="center"><img src="../img/live-globe-dark-pt.png" width="900" alt="Página Ao vivo no globo 3D"><br><sub>Ao vivo: globo 3D.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/replay-dark-pt.png" width="900" alt="Página Replay: um período reproduzido no mapa, com a lista ordenada de eventos e a linha do tempo de incidentes"><br><sub>Replay: um período reproduzido, com os incidentes na linha do tempo.</sub></p>
|
||||
- **Tráfego:** web analytics amigável à privacidade para o tráfego legítimo, construído do mesmo log do Traefik: visitantes únicos, páginas, referrers, países, navegadores, sistemas operacionais, dispositivos, latência de resposta (p50 e p95), bytes enviados e um mapa-múndi dos países dos visitantes, por domínio. Visitantes únicos são contados por um hash com sal diário; o IP de um visitante legítimo nunca é gravado. Veja o [SECURITY.pt-BR.md](../../SECURITY.pt-BR.md).
|
||||
|
||||
<p align="center"><img src="../img/traffic-dark-pt.png" width="900" alt="Página Tráfego: web analytics dos visitantes legítimos"><br><sub>Tráfego: web analytics amigável à privacidade.</sub></p>
|
||||
- **IPs:** uma tabela com pontuação, nível (`hostile`, `suspicious`, `low`), categorias, hosts, DNS reverso, país, cidade e ASN, último evento e estado de ban, com busca (IP ou DNS reverso), filtro de nível, filtro "só banidos", ordenação e paginação. O painel de detalhe mostra primeiro e último evento, contagem por categoria, caminhos de exemplo, User-Agents (interpretados em navegador, SO, dispositivo, bot ou ferramenta de ataque), domínios, usuários e jails.
|
||||
|
||||
<p align="center"><img src="../img/ips-dark-pt.png" width="900" alt="Página IPs: tabela de endereços com pontuação, nível, origem e estado de ban"><br><sub>IPs: cada endereço com pontuação e nível.</sub></p>
|
||||
<p align="center"><img src="../img/ip-analysis-dark-pt.png" width="900" alt="Página de análise de IP de um atacante"><br><sub>Análise de IP: veredito, evidências e ações recomendadas.</sub></p>
|
||||
- **Análise de IP** (`#/ip/<ip>`, aberta a partir de qualquer IP): o veredito com suas razões, ações recomendadas, famílias de ataque e técnicas MITRE ATT&CK, tipo de rede, cadência, sessões com seu estágio, campanhas, exposição, o histórico de eventos e um download STIX 2.1.
|
||||
- **Replay** (`#/replay`): um período reproduzido no mapa com a lista ordenada de eventos e a linha do tempo do incidente, a partir do registro de eventos.
|
||||
- **Fontes e hosts:** cada instância com seu estado (online, latência, versão), cada fonte de log com seu estado (`following`, `waiting`, `backfill`, `error`), linhas lidas, linhas malformadas e último evento (os caminhos dos arquivos não são mostrados), e a **blocklist**: escolha uma pontuação mínima (padrão 50), copie ou baixe. Ela só lista endereços hostis e globalmente roteáveis (nunca faixas de `--ignore` ou `--trusted`, nunca um IP com login SSH bem-sucedido); o IPv6 aparece como o /64, escrito `x:x:x:x::/64`.
|
||||
|
||||
<p align="center"><img src="../img/sources-dark-pt.png" width="900" alt="Página Fontes e hosts: instâncias, fontes de log e blocklist"><br><sub>Fontes e hosts.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/sessions-dark-pt.png" width="900" alt="Página: Sessões"><br><sub>Sessões: as etapas de cada atacante, com link para o replay.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/campaigns-dark-pt.png" width="900" alt="Página: Campanhas"><br><sub>Campanhas: grupos coordenados de endereços (Gantt e similaridade).</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/campaign-detail-dark-pt.png" width="900" alt="Página: Detalhe da campanha"><br><sub>Detalhe da campanha: membros, linha do tempo e traços em comum.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/search-dark-pt.png" width="900" alt="Página: Busca"><br><sub>Busca: filtre o registro de eventos por IP, caminho, família e status.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/mitre-dark-pt.png" width="900" alt="Página: MITRE ATT&CK"><br><sub>MITRE ATT&CK: técnicas observadas, por tática.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/defense-dark-pt.png" width="900" alt="Página: Defesa, com o segundo firewall"><br><sub>Defesa: cobertura do fail2ban do host e do segundo firewall (modo observe).</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/egress-dark-pt.png" width="900" alt="Página: Tráfego de saída"><br><sub>Saída: conexões de saída do host e dos contêineres, com rajadas de varredura, beacons e mineração.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/evolution-dark-pt.png" width="900" alt="Página: Evolução"><br><sub>Evolução: como os ataques mudam ao longo do tempo.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/concentration-dark-pt.png" width="900" alt="Página: Concentração"><br><sub>Concentração: quanto da hostilidade poucas fontes ou redes explicam.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/survival-dark-pt.png" width="900" alt="Página: Sobrevivência"><br><sub>Sobrevivência: por quanto tempo os atacantes continuam voltando.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/errors-dark-pt.png" width="900" alt="Página: Erros"><br><sub>Erros: classes de resposta, alvos e hosts.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/slo-dark-pt.png" width="900" alt="Página: Serviços"><br><sub>Serviços: disponibilidade e latência de cada serviço.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/protocol-dark-pt.png" width="900" alt="Página: Protocolos e TLS"><br><sub>Protocolos e TLS: versões de HTTP e TLS por classe.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/integrity-dark-pt.png" width="900" alt="Página: Integridade"><br><sub>Integridade: saúde das fontes de log e do registro.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/reports-dark-pt.png" width="900" alt="Página: Relatórios"><br><sub>Relatórios: o relatório exportável.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/overview-light.png" width="620" alt="Visão geral no tema claro"> <img src="../img/overview-mobile.png" height="420" alt="Visão geral no celular"><br><sub>O tema claro no desktop e o layout de celular (uma barra de abas substitui a lateral).</sub></p>
|
||||
|
||||
## Grupos de páginas
|
||||
|
||||
A barra lateral agrupa as páginas:
|
||||
| Grupo | Páginas |
|
||||
|---|---|
|
||||
| **Monitorar** | Visão geral, Ao vivo, Serviços |
|
||||
| **Investigar** | IPs, Sessões, Campanhas, Replay, Busca de eventos, Incidentes, Tráfego de saída |
|
||||
| **Analisar** | Ameaças, MITRE ATT&CK, Geografia, Evolução, Concentração, Sobrevivência, Tráfego, De onde vêm os erros, Protocolos e TLS |
|
||||
| **Operar** | Defesa, Fontes e hosts, Integridade |
|
||||
| **Relatórios** | Relatórios |
|
||||
|
||||
- **Monitorar:** Visão geral, Ao vivo, Serviços (SLO por serviço, orçamento de erro, burn rate e Apdex; `#/slo`).
|
||||
- **Investigar:** IPs, Sessões (o funil de recon até acesso), Campanhas (e uma página por campanha), Replay e Busca de eventos.
|
||||
- **Analisar:** Ameaças, MITRE ATT&CK (técnicas vistas e quando foram vistas pela primeira vez), Geografia, Evolução (mudança ao longo do tempo), Concentração (quanto vem de poucos IPs ou ASNs), Sobrevivência (tempo até o ban, Kaplan-Meier), Tráfego, De onde vêm os erros (classes `app`, `proxy`, `blocked`, `attack`, `bot`, `client`, `unknown`) e Protocolos e TLS (versões de HTTP e de TLS em uso).
|
||||
- **Operar:** Defesa (cobertura e vazamentos de ban e blocklist), Fontes e hosts, Integridade (saúde dos dados: fontes, registro, snapshot).
|
||||
- **Relatórios:** um resumo de um período, de `GET /api/v1/report`.
|
||||
## Páginas
|
||||
|
||||
### Monitorar
|
||||
|
||||
**Visão geral** (`#/overview`): os números principais (requisições, eventos maliciosos, IPs hostis e suspeitos, bans, o contador "monitoring" de requisições benignas de monitores, fora dos números de tráfego), a linha do tempo e os principais IPs.
|
||||
|
||||
<p align="center"><img src="../img/overview-dark-pt.png" width="900" alt="Página Visão geral"><br><sub>Visão geral (dados de demonstração).</sub></p>
|
||||
|
||||
**Ao vivo** (`#/live`): ataques desenhados como arcos animados da origem até o servidor que os viu, num mapa plano ou num globo 3D, com a taxa, categorias, servidores, origens recentes, uma coluna de métricas e os últimos eventos, filtros, pausa e tela cheia. Abre reproduzindo os últimos eventos (`/api/v1/live/recent`), então não fica parada num servidor tranquilo. Num hub mostra também os eventos de todos os peers. A posição de cada servidor vem de `--location`.
|
||||
|
||||
<p align="center"><img src="../img/live-flat-dark-pt.png" width="900" alt="Página Ao vivo no mapa plano"><br><sub>Ao vivo: mapa plano.</sub></p>
|
||||
<p align="center"><img src="../img/live-globe-dark-pt.png" width="900" alt="Página Ao vivo no globo 3D"><br><sub>Ao vivo: globo 3D.</sub></p>
|
||||
|
||||
**Serviços** (`#/slo`): um veredito em linguagem simples, KPIs com sparklines e os serviços do pior ao melhor, com disponibilidade contra o SLO de 99,5%, orçamento de erro restante, burn rate (1 h e 6 h), Apdex e latência. O detalhe de um serviço mostra requisições e erros, como as requisições foram respondidas, p95 por hora e rotas que falham separadas em erros do serviço, ataques bloqueados e erros do cliente. Os serviços vêm dos nomes de router e service do Traefik.
|
||||
|
||||
<p align="center"><img src="../img/slo-dark-pt.png" width="900" alt="Página: Serviços"><br><sub>Serviços: disponibilidade e latência de cada serviço.</sub></p>
|
||||
|
||||
### Investigar
|
||||
|
||||
**IPs** (`#/ips`): uma tabela com pontuação, nível (`hostile`, `suspicious`, `low`), categorias, hosts, DNS reverso, país, cidade e ASN, último visto e estado de ban, com caixa de busca (IP ou DNS reverso), filtro de nível, filtro "só banidos", ordenação e paginação. O painel de detalhe mostra primeiro e último visto, contagens por categoria, caminhos de exemplo, User-Agents (decompostos em navegador, SO, dispositivo, bot ou ferramenta de ataque), domínios, usuários e jails. Endereços banidos têm um botão **Desbanir** (veja Defesa).
|
||||
|
||||
<p align="center"><img src="../img/ips-dark-pt.png" width="900" alt="Página IPs: tabela de endereços com pontuação, nível, origem e estado de ban"><br><sub>IPs: cada endereço com pontuação e nível.</sub></p>
|
||||
|
||||
**Análise de IP** (`#/ip/<ip>`, aberta a partir de qualquer IP): o veredito com seus motivos, ações recomendadas, famílias de ataque e técnicas MITRE ATT&CK, tipo de rede (VPN, hospedagem, móvel, residencial, Tor, scanner de pesquisa), cadência (automatizada, humana, mista), sessões com seu estágio, campanhas, exposição, o histórico de eventos, um botão Desbanir e um download STIX 2.1.
|
||||
|
||||
<p align="center"><img src="../img/ip-analysis-dark-pt.png" width="900" alt="Página de análise de IP de um atacante"><br><sub>Análise de IP: veredito, evidências e ações recomendadas.</sub></p>
|
||||
|
||||
**Sessões** (`#/sessions`): os estágios de cada atacante (reconhecimento, sondagem, exploração, acesso, banido) como funil e lista, com link para o replay.
|
||||
|
||||
<p align="center"><img src="../img/sessions-dark-pt.png" width="900" alt="Página: Sessões"><br><sub>Sessões: os estágios de cada atacante, com link para o replay.</sub></p>
|
||||
|
||||
**Campanhas** (`#/campaigns`, e `#/campaigns/<id>` para uma): grupos coordenados de endereços fazendo a mesma coisa, com Gantt e similaridade; a página de detalhe mostra membros, linha do tempo e traços em comum.
|
||||
|
||||
<p align="center"><img src="../img/campaigns-dark-pt.png" width="900" alt="Página: Campanhas"><br><sub>Campanhas: grupos coordenados de endereços (Gantt e similaridade).</sub></p>
|
||||
<p align="center"><img src="../img/campaign-detail-dark-pt.png" width="900" alt="Página: Detalhe da campanha"><br><sub>Detalhe da campanha: membros, linha do tempo e traços em comum.</sub></p>
|
||||
|
||||
**Replay** (`#/replay`): um período reproduzido no mapa com a lista ordenada de eventos e a linha do tempo de incidentes, a partir do registro de eventos.
|
||||
|
||||
<p align="center"><img src="../img/replay-dark-pt.png" width="900" alt="Página Replay: um período reproduzido no mapa com a lista ordenada de eventos e a linha do tempo de incidentes"><br><sub>Replay: um período reproduzido, com incidentes na linha do tempo.</sub></p>
|
||||
|
||||
**Busca de eventos** (`#/search`): filtre o registro de eventos por IP, caminho, família e status, paginado por cursor.
|
||||
|
||||
<p align="center"><img src="../img/search-dark-pt.png" width="900" alt="Página: Busca"><br><sub>Busca: filtre o registro de eventos por IP, caminho, família e status.</sub></p>
|
||||
|
||||
**Incidentes** (`#/incidents`, `#/incidents/<id>`): todo achado de tráfego de saída com severidade acima de info vira um chamado `INC-<n>`, com chave `host|kind|workload|dst|dport|proto`. A lista é uma tabela densa com abas de status (`open`, `investigating`, `true_positive`, `false_positive`, `benign`, `resolved`), filtros, ordenação (atualizado, severidade, última vez), paginação e exportação CSV; `?status=` no link abre já filtrada. A página do chamado tem cabeçalho fixo com ações rápidas, um resumo com linha do tempo unificada de comentários e mudanças, e uma barra lateral com propriedades salvas na hora (severidade, responsável, tags, conclusão) e dados técnicos compactos. Um chamado em `false_positive` ou `benign` pode suprimir os achados com exatamente a sua chave, que então somem da página Tráfego de saída. Um chamado resolvido reabre quando o achado reaparece; também dá para abrir um chamado à mão. Fica em `<data-dir>/incidents.json`.
|
||||
|
||||
<p align="center"><img src="../img/incidents-dark-pt.png" width="900" alt="Página: Incidentes"><br><sub>Incidentes: chamados para achados do tráfego de saída.</sub></p>
|
||||
<p align="center"><img src="../img/incident-detail-dark-pt.png" width="900" alt="Página: Chamado de incidente"><br><sub>Chamado de incidente: resumo, linha do tempo de atividade e propriedades.</sub></p>
|
||||
|
||||
**Tráfego de saída** (`#/egress`, exige `URUTAU_EGRESS` e o kit de host em `deploy/host`): as novas conexões de saída do host e dos contêineres, registradas pelo nftables, analisadas quanto a beaconing (conversas regulares com um destino, com o histograma de intervalos), mineração, portas de IRC e SMTP, contato com endereços que atacaram o servidor ou relays Tor, DNS fora dos resolvers permitidos, varreduras de saída não autorizadas e países novos. Mostra um veredito em linguagem simples, cartões de evidência, mapa de destinos, atividade por hora, workloads compactos (por nome de rede ou contêiner, `URUTAU_EGRESS_WORKLOADS`; um workload `scanner` tem só o tráfego em forma de varredura resumido) e a linha do tempo das varreduras autorizadas. Os próprios servidores, peers e o provedor do host nunca geram achados; conexões regulares a grandes CDNs e nuvens têm severidade baixa.
|
||||
|
||||
<p align="center"><img src="../img/egress-dark-pt.png" width="900" alt="Página: Tráfego de saída"><br><sub>Tráfego de saída: rajadas de varredura, beacons e mineração em contêineres.</sub></p>
|
||||
|
||||
### Analisar
|
||||
|
||||
**Ameaças** (`#/threats`): contadores empilhados por categoria, o feed ao vivo dos últimos eventos (campos dos logs são mostrados como texto, nunca como marcação) e os principais caminhos atacados, domínios, User-Agents e usuários visados.
|
||||
|
||||
<p align="center"><img src="../img/threats-dark-pt.png" width="900" alt="Página Ameaças"><br><sub>Ameaças: categorias ao longo do tempo, KPIs e os últimos eventos.</sub></p>
|
||||
|
||||
**MITRE ATT&CK** (`#/mitre`): as técnicas vistas, por tática, e quando cada uma apareceu pela primeira vez. Sondagens de portas sem serviço, reportadas pelo kit de host, viram `port-scan` (T1046).
|
||||
|
||||
<p align="center"><img src="../img/mitre-dark-pt.png" width="900" alt="Página: MITRE ATT&CK"><br><sub>MITRE ATT&CK: técnicas observadas, por tática.</sub></p>
|
||||
|
||||
**Geografia** (`#/geo`): um mapa-múndi por país do atacante. Selecione um país para ver seus estados ou regiões e suas cidades (desenhadas como círculos no país ampliado), as categorias e os principais IPs; selecione uma região para restringir cidades e IPs. A visão é `#/geo/<CC>/<região>`.
|
||||
|
||||
<p align="center"><img src="../img/geo-world-dark-pt.png" width="900" alt="Página Geografia: mapa-múndi por país do atacante"><br><sub>Geografia: o mundo por país do atacante.</sub></p>
|
||||
<p align="center"><img src="../img/geo-brazil-dark-pt.png" width="900" alt="Página Geografia ampliada no Brasil, por estado"><br><sub>Geografia: um país, por estado e cidade.</sub></p>
|
||||
<p align="center"><img src="../img/geo-pernambuco-dark-pt.png" width="900" alt="Página Geografia ampliada em Pernambuco, com sua cidade"><br><sub>Geografia: uma região, com suas cidades e principais IPs.</sub></p>
|
||||
|
||||
**Evolução** (`#/evolution`): como os ataques mudam ao longo do tempo.
|
||||
|
||||
<p align="center"><img src="../img/evolution-dark-pt.png" width="900" alt="Página: Evolução"><br><sub>Evolução: como os ataques mudam ao longo do tempo.</sub></p>
|
||||
|
||||
**Concentração** (`#/concentration`): quanto da hostilidade poucos IPs ou ASNs respondem.
|
||||
|
||||
<p align="center"><img src="../img/concentration-dark-pt.png" width="900" alt="Página: Concentração"><br><sub>Concentração: quanto da hostilidade poucas fontes ou redes respondem.</sub></p>
|
||||
|
||||
**Sobrevivência** (`#/survival`): tempo até o ban e curvas de sobrevivência de Kaplan-Meier sobre episódios de ataque, com quem bloqueou e com que rapidez (as jails do fail2ban do host à parte do segundo firewall do Urutau).
|
||||
|
||||
<p align="center"><img src="../img/survival-dark-pt.png" width="900" alt="Página: Sobrevivência"><br><sub>Sobrevivência: por quanto tempo os atacantes continuam voltando.</sub></p>
|
||||
|
||||
**Tráfego** (`#/traffic`): web analytics amigável à privacidade do tráfego legítimo, feito a partir do mesmo log do Traefik: visitantes únicos, páginas, referrers, países, navegadores, sistemas operacionais, dispositivos, latência de resposta (p50 e p95), bytes enviados e um mapa-múndi dos países dos visitantes, por domínio. Um visitante único é uma pessoa com navegador real (um GET bem-sucedido de um documento por um User-Agent de navegador, um por IP por dia, deduplicado globalmente); bots, ferramentas e clientes desconhecidos são contados à parte como "clientes não humanos". Visitantes são contados por um hash com sal diário; o IP de um visitante legítimo nunca é guardado. Veja [SECURITY.pt-BR.md](../../SECURITY.pt-BR.md).
|
||||
|
||||
<p align="center"><img src="../img/traffic-dark-pt.png" width="900" alt="Página Tráfego: web analytics dos visitantes legítimos"><br><sub>Tráfego: web analytics amigável à privacidade.</sub></p>
|
||||
|
||||
**De onde vêm os erros** (`#/errors`): erros separados nas classes `app`, `proxy`, `blocked`, `attack`, `bot`, `client` e `unknown`, para distinguir um 5xx do seu app de um link quebrado ou de um scanner; classes de resposta, alvos e hosts.
|
||||
|
||||
<p align="center"><img src="../img/errors-dark-pt.png" width="900" alt="Página: Erros"><br><sub>Erros: classes de resposta, alvos e hosts.</sub></p>
|
||||
|
||||
**Protocolos e TLS** (`#/protocol`): versões de HTTP, versões de TLS e suítes de cifras em uso, com os métodos e o detalhamento por classe.
|
||||
|
||||
<p align="center"><img src="../img/protocol-dark-pt.png" width="900" alt="Página: Protocolos e TLS"><br><sub>Protocolos e TLS: versões de HTTP e TLS por classe.</sub></p>
|
||||
|
||||
### Operar
|
||||
|
||||
**Defesa** (`#/defense`): cobertura e vazamentos de bans e da blocklist. Um atacante conta como protegido quando está listado ou banido por qualquer jail; a API também separa atacantes de uma só vez dos reincidentes (`one_shot`, `repeat_ips`). Traz ainda a seção do **segundo firewall** (`URUTAU_ENFORCE=off|observe|on`): o modo, as decisões recentes com o motivo (por exemplo `known-attacker`, `port-scan`, `neighbor-campaign`), a cobertura e as liberações do operador. O Urutau só decide e escreve as decisões num arquivo; o fail2ban do host (jail `urutau`) as aplica, e no modo `observe` ele mostra o que seria bloqueado. Nunca bloqueia endereços confiáveis, faixas privadas, faixas de CDN e de resolvers públicos, peers, o próprio servidor nem crawlers verificados por DNS reverso confirmado (Googlebot, Bingbot, Applebot). Um botão **Desbanir** nas decisões recentes e na página do endereço pede ao host que levante o bloqueio (por `unban.log` ao lado de `--enforce-log`) e pode impedir o segundo firewall de banir o endereço de novo por 1 h, 24 h ou 7 dias. Com `URUTAU_ENFORCE_SHARE` um hub e seus peers trocam decisões, cada lado aplicando as próprias exclusões.
|
||||
|
||||
<p align="center"><img src="../img/defense-dark-pt.png" width="900" alt="Página: Defesa, com o segundo firewall"><br><sub>Defesa: cobertura do fail2ban do host e do segundo firewall (modo observe).</sub></p>
|
||||
|
||||
**Fontes e hosts** (`#/sources`): cada instância com seu estado (online, latência, versão), cada fonte de log com seu estado (`following`, `waiting`, `backfill`, `error`, e degradada quando mais de 20% das últimas 1000 linhas são ilegíveis), linhas lidas, linhas malformadas e último evento (caminhos de arquivo não são mostrados), e a **blocklist**: escolha uma pontuação mínima (padrão 50), copie ou baixe. Só lista endereços hostis e globalmente roteáveis (nunca faixas de `--ignore` ou `--trusted`, nunca um IP com login SSH bem-sucedido, nunca um endereço cuja única evidência é um ban das jails `urutau` ou `recidive`); IPv6 aparece como seu /64, escrito `x:x:x:x::/64`.
|
||||
|
||||
<p align="center"><img src="../img/sources-dark-pt.png" width="900" alt="Página Fontes e hosts: instâncias, fontes de log e blocklist"><br><sub>Fontes e hosts.</sub></p>
|
||||
|
||||
**Integridade** (`#/integrity`): saúde dos dados: fontes de log, registro de eventos e snapshot.
|
||||
|
||||
<p align="center"><img src="../img/integrity-dark-pt.png" width="900" alt="Página: Integridade"><br><sub>Integridade: saúde das fontes de log e do registro.</sub></p>
|
||||
|
||||
### Relatórios
|
||||
|
||||
**Relatórios** (`#/reports`): uma prévia do próprio relatório HTML (`GET /api/v1/report?format=html`), sempre uma folha A4 ajustada à tela, só com Baixar e Imprimir; idioma, período e servidor vêm do cabeçalho. O relatório tem capa, resumo executivo em linguagem simples, recomendações por regras, ameaças, geografia, erros e saúde, visitantes, defesa, segundo firewall e tráfego de saída, imprimível em A4.
|
||||
|
||||
<p align="center"><img src="../img/reports-dark-pt.png" width="900" alt="Página: Relatórios"><br><sub>Relatórios: o relatório exportável.</sub></p>
|
||||
|
||||
## Temas e celular
|
||||
|
||||
<p align="center"><img src="../img/overview-light.png" width="620" alt="Visão geral no tema claro"> <img src="../img/overview-mobile.png" height="420" alt="Visão geral no celular"><br><sub>O tema claro no desktop e o layout de celular (uma barra de abas substitui a lateral).</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/defense-light.png" width="620" alt="Defesa no tema claro"> <img src="../img/defense-mobile.png" height="420" alt="Defesa no celular"><br><sub>Defesa no tema claro e no celular.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/egress-light.png" width="620" alt="Tráfego de saída no tema claro"> <img src="../img/egress-mobile.png" height="420" alt="Tráfego de saída no celular"><br><sub>Tráfego de saída no tema claro e no celular.</sub></p>
|
||||
|
||||
No celular, tabelas de dados simples (ranking de concentração, rotas de erro, técnicas MITRE, Defesa, fontes da Integridade) viram cartões empilhados com o nome da coluna como rótulo, e nada rola para o lado.
|
||||
|
||||
## Glossário e dicas
|
||||
|
||||
Um pequeno botão **"?"** fica ao lado de métricas, categorias e títulos de coluna. Ele recebe foco pelo teclado e abre uma explicação curta (o que o número significa) e uma linha "o que fazer", em inglês ou português. O texto vem de um glossário central, então o mesmo termo aparece igual em todas as páginas.
|
||||
Um pequeno botão **"?"** fica ao lado de métricas, categorias e títulos de coluna. Ele recebe foco pelo teclado e abre uma explicação curta (o que o número significa) e uma linha "o que fazer", em inglês ou português. O texto vem de um glossário central, então o mesmo termo lê igual em todas as páginas.
|
||||
|
||||
## Atribuição
|
||||
|
||||
@@ -127,7 +190,7 @@ Os limites de estados e cidades da página Geografia são do [Natural Earth](htt
|
||||
| `GET /api/v1/defense` | sessão ou bearer | cobertura e vazamentos de ban e blocklist |
|
||||
| `GET /api/v1/errors` | sessão ou bearer | erros por classe (`app`, `proxy`, `blocked`, `attack`, `bot`, `client`, `unknown`) |
|
||||
| `GET /api/v1/integrity` | sessão ou bearer | saúde dos dados: fontes, registro, snapshot |
|
||||
| `GET /api/v1/report` | sessão ou bearer | resumo de um período (requisições, ataques, IPs hostis, bans, visitantes, clientes não humanos, páginas vistas, principais IPs) |
|
||||
| `GET /api/v1/report` | sessão ou bearer | resumo de um período (`format=html` devolve o relatório A4 imprimível, com `lang`; requisições, ataques, IPs hostis, bans, visitantes, clientes não humanos, páginas vistas, principais IPs) |
|
||||
| `GET /api/v1/services`, `/api/v1/services/{svc}` | sessão ou bearer | SLI, SLO, orçamento de erro, burn rate e Apdex por serviço |
|
||||
| `GET /api/v1/protocols` | sessão ou bearer | versões de HTTP e TLS em uso |
|
||||
| `GET /api/v1/ips` | sessão ou bearer | tabela de IPs. Query: `range`, `host`, `min_score`, `level`, `q`, `banned=1`, `sort` (`score`, `last`, `first`, `events`, `ip`), `order=asc`, `per` (1 a 200, padrão 50), `page` |
|
||||
@@ -141,11 +204,14 @@ Os limites de estados e cidades da página Geografia são do [Natural Earth](htt
|
||||
| `POST /api/v1/incidents` | sessão ou bearer | abre um chamado manual `{title,detail,severity,host,tags,author}` (corpo até 64 KiB, campos desconhecidos recusados; cross-site recusado) |
|
||||
| `PATCH /api/v1/incidents/{id}` | sessão ou bearer | atualização parcial `{status,severity,assignee,tags,title,verdict,suppress,author}`; cada mudança vira uma entrada no histórico. `suppress` só em `false_positive` ou `benign`, e esconde de `/api/v1/egress` os achados com exatamente a mesma chave (use `suppressed=1` para vê-los) |
|
||||
| `POST /api/v1/incidents/{id}/comments` | sessão ou bearer | adiciona um comentário `{text,author}` |
|
||||
| `GET /api/v1/egress` | sessão ou bearer | análise do tráfego de saída: veredito, achados (com `samples`, `ticket_id`, `ticket_status`, `suppressed`), workloads, `by_country`, `suppressed_count`. Query: `range`, `host`, `suppressed=1` |
|
||||
| `GET /api/v1/enforce` | sessão ou bearer | segundo firewall: modo, decisões recentes, cobertura e liberações do operador (`allows`) |
|
||||
| `POST /api/v1/enforce/unban` | sessão ou bearer | pede ao host que levante um bloqueio e, opcionalmente, impede novo ban do endereço por 1 h, 24 h ou 7 dias (cross-site recusado) |
|
||||
| `DELETE /api/v1/enforce/allow` | sessão ou bearer | encerra uma liberação do operador |
|
||||
| `GET /api/v1/peer/egress`, `GET`/`POST /api/v1/peer/decisions`, `POST /api/v1/peer/unban` | só token de peer | federação: o relatório de saída que um hub mescla e a troca de decisões do segundo firewall e de desbans |
|
||||
|
||||
Um `range` ou período inválido responde 400, e `range` nas respostas é um objeto `{name,from,to,step,clipped}` (`step` é a granularidade da linha do tempo em segundos).
|
||||
|
||||
Clientes da API enviam `Authorization: Bearer <URUTAU_TOKEN>`. O token de peer só é aceito por `/api/v1/peer/export`, `/api/v1/peer/stream` e `/api/v1/peer/period`; todas as outras rotas respondem 403 a ele.
|
||||
Clientes da API enviam `Authorization: Bearer <URUTAU_TOKEN>`. O token de peer só é aceito pelas rotas `/api/v1/peer/*` (`export`, `stream`, `period`, `egress`, `decisions`, `unban`); todas as outras rotas respondem 403 a ele.
|
||||
|
||||
<p align="center"><img src="../img/defense-light.png" width="620" alt="Defense"> <img src="../img/defense-mobile.png" height="420" alt="Defense"><br><sub>Defesa, saída e campanhas no tema claro e no celular.</sub></p>
|
||||
|
||||
<p align="center"><img src="../img/egress-light.png" width="620" alt="Egress"> <img src="../img/egress-mobile.png" height="420" alt="Egress"></p>
|
||||
@@ -43,4 +43,9 @@ Não inclua detalhes de exploração numa issue pública. Siga o [SECURITY.pt-BR
|
||||
| O login responde 429 | Falhas demais daquele endereço; espere a janela (10 minutos) ou tente depois, o token correto ainda entra após 1 segundo de atraso |
|
||||
| A fonte do Traefik fica em `waiting` no Coolify | O Traefik não está gravando `/traefik/logs/access.log`; veja a seção do Coolify em [docker.md](docker.md) |
|
||||
| Um peer aparece offline | URL ou `URUTAU_PEER_TOKEN` errados, ou o peer não é alcançável pelo hub; o erro aparece no cartão do host |
|
||||
| A fonte de sondagem ou de egress fica em `waiting` | O kit do host não está instalado ou grava em outro lugar: rode `sudo sh deploy/host/install.sh` e confira que `/var/log/urutau/probe.log` e `egress.log` estão montados em `/logs/host`; o egress com `URUTAU_EGRESS=auto` só liga se o `egress.log` existir quando o Urutau inicia |
|
||||
| `urutau doctor` mostra `enforce` como `fail` | `URUTAU_ENFORCE=on` mas o arquivo de decisões não é gravável: monte `/var/log/urutau-enforce:/logs/enforce` com leitura e escrita, dono uid 10001 (`install.sh --enforce` faz isso) |
|
||||
| Aparecem decisões mas nada é banido | A jail `urutau` do fail2ban não está ativa: rode `install.sh --enforce` e depois `fail2ban-client status urutau`; o modo `observe` nunca grava o arquivo |
|
||||
| `urutau doctor` mostra `enforce-cdn` | O Traefik registra endereços da Cloudflare como clientes: defina `forwardedHeaders.trustedIPs` com as faixas da Cloudflare para enxergar o atacante real |
|
||||
| O container sai com `--enforce=on needs --enforce-log` ou `must be between` | Um valor de enforce, retenção ou egress está fora da faixa ou é desconhecido; rode `urutau doctor` e leia a linha `config` |
|
||||
| `--insecure-no-auth` é recusado | Só funciona em bind loopback; use um token |
|
||||