feat: record own and trusted web traffic in its own classes instead of dropping it
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4143bf599e
commit
3511a7141c
18 files changed
+434
-17
No files matched your search
@@ -315,7 +315,7 @@ The user routes under `/api/v1/*` need `URUTAU_TOKEN` (bearer) or a session cook
|
||||
|---|---|
|
||||
| `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/summary` (also `own`: web requests of `--trusted` and `--ignore` origins, counted apart; `totals.trusted`, `totals.internal` and `totals.requests_all` = `requests` + both; `totals.counts.trusted` and `.internal`), `/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 |
|
||||
|
||||
@@ -38,8 +38,8 @@ Settings are split by role. The **hub** (`urutau serve`) takes the variables in
|
||||
|
||||
| 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_TRUSTED` | empty | trusted CIDRs or IPs, comma separated; their web requests are counted as own traffic (class `trusted`) and never analysed: no score, threat, visitor or ban. 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 (class `internal`), 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 |
|
||||
@@ -109,7 +109,7 @@ The probe image defaults to the paths above because the compose file in `deploy/
|
||||
## Noise and monitoring
|
||||
|
||||
- **Traefik headers.** Log `Sec-Fetch-Site`, `Sec-Fetch-Dest` and `Referer` so Urutau can tell a page framing your site from a real visit: `--accesslog.fields.headers.names.Sec-Fetch-Site=keep`, `--accesslog.fields.headers.names.Sec-Fetch-Dest=keep` and `--accesslog.fields.headers.names.Referer=keep`. A request framed by another page (`Sec-Fetch-Site` of `cross-site` or `same-site`, or a sub-resource `Sec-Fetch-Dest` such as `image` or `script`) appears in the timeline and creates an IP record like any other, but weighs 0.25 per event, with at most 30 points per IP coming from such requests (below the hostile threshold), and never counts as a strong signal. With an attack-tool User-Agent the headers are ignored.
|
||||
- **Trusted origins** (`URUTAU_TRUSTED`): your own network, offices, monitors and other servers. `URUTAU_IGNORE` already drops loopback and the private ranges by default, so internal traffic never scores. Add your public monitor IPs. If your proxy reports the Docker gateway as the client, that address is private and already dropped; fix the proxy to pass the real client address instead.
|
||||
- **Trusted origins** (`URUTAU_TRUSTED`): your own network, offices, monitors and other servers. `URUTAU_IGNORE` already covers loopback and the private ranges by default, so internal traffic never scores. Nothing is silently dropped: web requests from these origins are counted in aggregates only (not as one event record each) and shown in the Traffic page under "Own infrastructure and trusted origins"; they stay out of `totals.requests`, scores, threats, maps, visitors and the blocklist. SSH, fail2ban and network-probe lines from these origins are still ignored. Add your public monitor IPs. If your proxy reports the Docker gateway as the client, that address is private and counted as `internal` own traffic; fix the proxy to pass the real client address instead.
|
||||
- **Monitoring User-Agent** (`URUTAU_MONITOR_UA`): a Go regular expression. A request that matches and is benign is counted as "monitoring" instead of traffic. If the request is a `scanner`, `exploit` or `bruteforce` it counts as an attack: a User-Agent is trivial to forge, so it never grants immunity.
|
||||
- **Where monitors come from** (`URUTAU_MONITOR_FROM`): CIDRs of your monitors. When set, the monitoring User-Agent is honored only from those networks and benign requests (`ok` or `notfound`) are filtered. When empty, only `ok` answers are filtered: a `notfound` carrying a monitor User-Agent still counts, because anyone can send that header.
|
||||
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ A side rail (a tab bar on phones, with a "More" menu that scrolls when it is tal
|
||||
|
||||
<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).
|
||||
**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). A section at the bottom, "Own infrastructure and trusted origins", shows the web requests of `--trusted` and private (`--ignore`) origins (your servers, probes, CI runners, the Docker gateway) that are kept out of every other number: totals per class, a timeline, status classes, a table by origin (address, class, requests), and top domains and paths. They never score an IP or enter threats, maps, visitors or the blocklist.
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ As rotas de usuário em `/api/v1/*` exigem `URUTAU_TOKEN` (bearer) ou um cookie
|
||||
|---|---|
|
||||
| `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/summary` (também `own`: requisições web de origens `--trusted` e `--ignore`, contadas à parte; `totals.trusted`, `totals.internal` e `totals.requests_all` = `requests` + ambas; `totals.counts.trusted` e `.internal`), `/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 |
|
||||
|
||||
@@ -38,8 +38,8 @@ Os ajustes se dividem por papel. O **hub** (`urutau serve`) usa as variáveis da
|
||||
|
||||
| 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_TRUSTED` | vazio | CIDRs ou IPs confiáveis, separados por vírgula; as requisições web deles são contadas como tráfego próprio (classe `trusted`) e nunca analisadas: sem pontuação, ameaça, visitante ou banimento. 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 (classe `internal`), 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 |
|
||||
@@ -109,7 +109,7 @@ A imagem da sonda usa os caminhos acima como padrão porque o compose em `deploy
|
||||
## Ruído e monitoramento
|
||||
|
||||
- **Cabeçalhos do Traefik.** Registre `Sec-Fetch-Site`, `Sec-Fetch-Dest` e `Referer` para o Urutau distinguir uma página que embute seu site de uma visita real: `--accesslog.fields.headers.names.Sec-Fetch-Site=keep`, `--accesslog.fields.headers.names.Sec-Fetch-Dest=keep` e `--accesslog.fields.headers.names.Referer=keep`. Uma requisição enquadrada por outra página (`Sec-Fetch-Site` `cross-site` ou `same-site`, ou `Sec-Fetch-Dest` 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.
|
||||
- **Origens confiáveis** (`URUTAU_TRUSTED`): sua própria rede, escritórios, monitores e outros servidores. `URUTAU_IGNORE` já descarta loopback e as faixas privadas por padrão, então o tráfego interno nunca pontua. Acrescente os IPs públicos dos seus monitores. Se o proxy informa o gateway do Docker como cliente, esse endereço é privado e já é descartado; corrija o proxy para repassar o endereço real do cliente.
|
||||
- **Origens confiáveis** (`URUTAU_TRUSTED`): sua própria rede, escritórios, monitores e outros servidores. `URUTAU_IGNORE` já cobre loopback e as faixas privadas por padrão, então o tráfego interno nunca pontua. Nada é descartado em silêncio: as requisições web dessas origens são contadas só em agregados (não como um registro de evento cada) e aparecem na página Tráfego em "Infraestrutura própria e origens confiáveis"; ficam fora de `totals.requests`, pontuação, ameaças, mapas, visitantes e lista de bloqueio. Linhas de SSH, fail2ban e sondas de rede dessas origens continuam ignoradas. Acrescente os IPs públicos dos seus monitores. Se o proxy informa o gateway do Docker como cliente, esse endereço é privado e contado como tráfego próprio `internal`; corrija o proxy para repassar o endereço real do cliente.
|
||||
- **User-Agent de monitoramento** (`URUTAU_MONITOR_UA`): uma expressão regular do Go. Uma requisição que casa e é benigna é contada como "monitoring" em vez de tráfego. Se a requisição for `scanner`, `exploit` ou `bruteforce`, conta como ataque: um User-Agent é trivial de forjar, então nunca concede imunidade.
|
||||
- **De onde vêm os monitores** (`URUTAU_MONITOR_FROM`): CIDRs dos seus monitores. Quando definido, o User-Agent de monitoramento só vale vindo dessas redes e requisições benignas (`ok` ou `notfound`) são filtradas. Quando vazio, só respostas `ok` são filtradas: um `notfound` com User-Agent de monitor ainda conta, porque qualquer um pode enviar esse cabeçalho.
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ Uma barra lateral (barra de abas no celular, com um menu "Mais" que rola quando
|
||||
|
||||
<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).
|
||||
**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). Uma seção no fim, "Infraestrutura própria e origens confiáveis", mostra as requisições web de origens `--trusted` e privadas (`--ignore`) (seus servidores, sondas, runners de CI, o gateway do Docker) que ficam fora de todos os outros números: totais por classe, linha do tempo, classes de status, tabela por origem (endereço, classe, requisições) e os domínios e caminhos mais pedidos. Elas nunca pontuam um IP nem entram em ameaças, mapas, visitantes ou na lista de bloqueio.
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
Reference in new issue
Block a user