fix(egress): container map refreshed on start; no new_geo for anycast CDNs (2.2.2)
A LambdaMail redeploy swapped rspamd and clamav addresses and the hub judged the next minute with the stale containers.map, filing SURBL/DNS traffic under clamav and freshclam under dns. The host kit now runs urutau-containers-watch (docker events -> map rewrite) and the probe polls the file every 2 s. new_geo is skipped for large CDNs/clouds: anycast addresses carry a meaningless database country (1.1.1.1 in AU, Cloudflare edges in CA). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
87178dbc94
commit
65015158dc
17 files changed
+81
-14
No files matched your search
@@ -96,7 +96,7 @@ The probe has only these variables (flags in [cli.md](cli.md#urutau-probe)). A p
|
||||
| `URUTAU_FAIL2BAN_LOG` | `/logs/host/fail2ban.log` | fail2ban log |
|
||||
| `URUTAU_PROBE_LOG` | `/logs/host/probe.log` | kernel log of connections to unserved ports, written by the host kit (see [Probes](#probes-port-scans)) |
|
||||
| `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; sent whole when it changes |
|
||||
| `URUTAU_EGRESS_CONTAINERS` | `/logs/host/containers.map` | `"<ip> <container>"` map written by the host kit when a container starts (and every minute), so workloads keep their name when the address changes on a redeploy; sent whole when it changes |
|
||||
| `URUTAU_RESOLV` | `/etc/resolv.conf` of the host (mounted) | resolvers of the host, sent whole when it changes |
|
||||
| `URUTAU_ENFORCE_LOG` | `/logs/enforce/decisions.log` | file where the ban decisions of the hub are appended, read by the host jail; empty ignores ban commands and counts them as errors |
|
||||
| `URUTAU_ENFORCE_UNBAN_LOG` | `/logs/enforce/unban.log` | file where unban requests are appended, read by the host; empty ignores them |
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ It is idempotent. `URUTAU_WAN` overrides the detected uplink interface and `URUT
|
||||
|---|---|
|
||||
| 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) |
|
||||
| container map | `urutau-containers-map`, run by its timer (every minute) and by `urutau-containers-watch` (on every container start or network attach, so a redeploy that swaps addresses is named right within seconds), writes `/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 probe compose file already mounts at `/logs/host`, so the probe 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:
|
||||
|
||||
+1
-1
@@ -81,7 +81,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/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` on a probe): 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, probes and the host's own provider never raise findings; regular connections to large CDNs and clouds are low severity.
|
||||
**Outbound traffic** (`#/egress`, needs `URUTAU_EGRESS` and the host kit in `deploy/host` on a probe): 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, probes and the host's own provider never raise findings; regular connections to large CDNs and clouds are low severity, and they never raise a new country (anycast).
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ A sonda usa só estas variáveis (flags em [cli.md](cli.md#urutau-probe)). Um ca
|
||||
| `URUTAU_FAIL2BAN_LOG` | `/logs/host/fail2ban.log` | log do fail2ban |
|
||||
| `URUTAU_PROBE_LOG` | `/logs/host/probe.log` | log do kernel de conexões a portas que ninguém serve, gravado pelo kit do host (veja [Sondagens](#sondagens-varreduras-de-portas)) |
|
||||
| `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; enviado inteiro quando muda |
|
||||
| `URUTAU_EGRESS_CONTAINERS` | `/logs/host/containers.map` | mapa `"<ip> <container>"` gravado pelo kit do host quando um contêiner sobe (e a cada minuto), para que as cargas mantenham o nome quando o endereço muda num redeploy; enviado inteiro quando muda |
|
||||
| `URUTAU_RESOLV` | `/etc/resolv.conf` do host (montado) | resolvedores do host, enviados inteiros quando mudam |
|
||||
| `URUTAU_ENFORCE_LOG` | `/logs/enforce/decisions.log` | arquivo onde as decisões de ban do hub são acrescentadas, lido pela jail do host; vazio ignora comandos de ban e os conta como erro |
|
||||
| `URUTAU_ENFORCE_UNBAN_LOG` | `/logs/enforce/unban.log` | arquivo onde os pedidos de desban são acrescentados, lido pelo host; vazio os ignora |
|
||||
|
||||
@@ -179,7 +179,7 @@ sudo sh deploy/host/install.sh --remove # desfaz tudo (os logs são mantidos)
|
||||
|---|---|
|
||||
| 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) |
|
||||
| mapa de containers | `urutau-containers-map`, executado pelo timer (a cada minuto) e pelo `urutau-containers-watch` (a cada contêiner que sobe ou entra numa rede, para que um redeploy que troca endereços seja nomeado certo em segundos), grava `/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 a sonda 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:
|
||||
|
||||
@@ -81,7 +81,7 @@ Uma barra lateral (barra de abas no celular, com um menu "Mais" que rola quando
|
||||
<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` numa sonda): 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, sondas e o provedor do host nunca geram achados; conexões regulares a grandes CDNs e nuvens têm severidade baixa.
|
||||
**Tráfego de saída** (`#/egress`, exige `URUTAU_EGRESS` e o kit de host em `deploy/host` numa sonda): 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, sondas e o provedor do host nunca geram achados; conexões regulares a grandes CDNs e nuvens têm severidade baixa e nunca geram país novo (anycast).
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
Reference in new issue
Block a user