fix(egress): container map refreshed on start; no new_geo for anycast CDNs (2.2.2)
CI / Format and vet (pull_request) Successful in 1m43s
CI / Dependency audit (pull_request) Successful in 39s
CI / Tests (Linux, race detector) (pull_request) Successful in 2m37s

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:
Lucas RayanandClaude Opus 5.5 committed 2026-11-19 15:25:23 -03:00
1 parent 87178dbc94
commit 65015158dc
17 files changed
+81 -14

No files matched your search

+6 -3
View File
@@ -35,9 +35,10 @@ done
[ "$(id -u)" = 0 ] || { echo "run as root" >&2; exit 1; }
if [ "$remove" = 1 ]; then
systemctl disable --now urutau-egress.service urutau-containers-map.timer urutau-logrotate.timer urutau-unban.path 2>/dev/null || true
systemctl disable --now urutau-egress.service urutau-containers-watch.service urutau-containers-map.timer urutau-logrotate.timer urutau-unban.path 2>/dev/null || true
rm -f /etc/systemd/system/urutau-egress.service /etc/systemd/system/urutau-containers-map.service \
/etc/systemd/system/urutau-containers-map.timer /usr/local/sbin/urutau-containers-map \
/etc/systemd/system/urutau-containers-watch.service /usr/local/sbin/urutau-containers-watch \
/etc/rsyslog.d/41-urutau-egress.conf /etc/logrotate.d/urutau-egress \
/etc/fail2ban/jail.d/urutau.local /etc/fail2ban/filter.d/urutau.conf /etc/fail2ban/action.d/urutau-allports.conf \
/etc/systemd/system/urutau-logrotate.service /etc/systemd/system/urutau-logrotate.timer \
@@ -62,14 +63,16 @@ nft -c -f /etc/urutau/egress.nft
install -m 0644 "$here/41-urutau-egress.conf" /etc/rsyslog.d/41-urutau-egress.conf
install -m 0644 "$here/urutau.logrotate" /etc/logrotate.d/urutau-egress
install -m 0755 "$here/urutau-containers-map" /usr/local/sbin/urutau-containers-map
install -m 0755 "$here/urutau-containers-watch" /usr/local/sbin/urutau-containers-watch
install -m 0644 "$here/urutau-egress.service" "$here/urutau-containers-map.service" \
"$here/urutau-containers-map.timer" "$here/urutau-logrotate.service" "$here/urutau-logrotate.timer" /etc/systemd/system/
"$here/urutau-containers-map.timer" "$here/urutau-containers-watch.service" "$here/urutau-logrotate.service" "$here/urutau-logrotate.timer" /etc/systemd/system/
systemctl daemon-reload
systemctl restart rsyslog
systemctl enable urutau-egress.service urutau-containers-map.timer urutau-logrotate.timer >/dev/null
systemctl enable urutau-egress.service urutau-containers-map.timer urutau-containers-watch.service urutau-logrotate.timer >/dev/null
systemctl start urutau-logrotate.timer
systemctl restart urutau-egress.service
systemctl start urutau-containers-map.service urutau-containers-map.timer
systemctl restart urutau-containers-watch.service
echo "egress logging on $wan: /var/log/urutau/egress.log, map: /var/log/urutau/containers.map"
if [ "$probe" = 1 ] && [ "$enforce" = 0 ]; then
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# Urutau: rewrites containers.map as soon as Docker attaches a container to a
# network, so a redeploy that swaps addresses between containers is not judged
# with the old names until the next minute of the timer.
set -u
docker events --filter type=network --filter event=connect --filter type=container --filter event=start --format '{{.Type}}' |
while read -r _; do
/usr/local/sbin/urutau-containers-map || true
# a stack redeploy fires dozens of events: drain the burst, then refresh once more
n=0
while read -r -t 1 _; do n=$((n + 1)); done
[ "$n" -gt 0 ] && { /usr/local/sbin/urutau-containers-map || true; }
done
@@ -0,0 +1,12 @@
[Unit]
Description=Urutau: refresh the container map when containers start
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/local/sbin/urutau-containers-watch
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target