Commit graph

10 commits

Author SHA1 Message Date
8598a1a48f warm: self-heal wedged dnsmasq, run after deploy, shared state dir
All checks were successful
Deploy DNS Configuration / deploy (push) Successful in 1h15m4s
dnsmasq adds IPs to an nft set only on a fresh upstream reply; a cache
hit never refreshes the set. On Archie the :5350 instance also wedged:
TCP child processes first, then the main process, logged
'nftset ... netlink: Error: cache initialization failed: Protocol error'
on every add and stopped filling bbrkn_v4/v6 until restarted.

warm-nftset.sh now counts those errors for the main PID during the run
(journalctl _PID=) and, if any, restarts the service and warms again;
exit 1 if it still fails. The state dir defaults to /var/lib/bbrkn so the
root cron job and the deploy share one lock (LOCK_WAIT lets deploy wait).

deploy-to-gateway.sh runs the warmer right after flushing the sets,
since clients keep old IPs cached and would bypass the tunnel until the
next fresh resolve. A warm failure only warns; it does not roll back.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DR7zpSsdX28T4Kn6v4jPSS
2026-10-13 21:26:49 +03:00
a5ee057c59 deploy: keep config backups out of dnsmasq conf dirs, cap at 10
Backups were written as <conf>.backup.<ts> next to the live file. Both
dnsmasq instances load every file in their conf dir (the host excludes
only .dpkg-*), so each backup was parsed as live config, resurrecting
removed domains and piling up one stale copy per deploy.

Write them to BACKUP_DIR (/var/backups/bbrkn) instead and keep the
newest BACKUP_KEEP (10) per file.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DR7zpSsdX28T4Kn6v4jPSS
2026-10-13 20:54:19 +03:00
d81a4ab3b2 Migrate bbrkn from legacy ipset to nftables sets
The gateway (Archie) routes bbrkn domains via nft sets bbrkn_v4/bbrkn_v6
(inet filter), not the legacy ipset. bbrkn was still emitting dead
`ipset=/domain/bbrkn` directives (no such ipset exists) plus a 92-resolve
pointing at 8.8.8.8, both overridden by hand-maintained files on the host.
This makes bbrkn the generator of record for the real scheme.

generate-configs.sh:
- emit `nftset=/domain/$NFTSET_SPEC` (default 4#inet#filter#bbrkn_v4,
  6#inet#filter#bbrkn_v6) into 90-nftset.conf instead of ipset= into
  91-ipset-bbrkn.conf
- DNS_SERVER default 8.8.8.8 -> 127.0.0.1#5350 (host dnsmasq pihole
  delegates bbrkn domains to for VPN resolution + nftset capture)

deploy-to-gateway.sh: two targets, two instances
- 90-nftset.conf -> host /etc/dnsmasq.d (:5350), 92-resolve -> pihole
- full restart of both (dnsmasq SIGHUP does NOT re-read nftset=/server=)
- flush nft sets bbrkn_v4/bbrkn_v6 instead of `ipset flush bbrkn`
- add end-to-end nftset-capture health check via :5350
- rollback restores both files and restarts both instances

Makefile/workflow: rename IPSET_CONF->NFTSET_CONF, add NFTSET_TARGET_DIR
and HOST_DNSMASQ_SVC, DNS_SERVER=127.0.0.1#5350 (escaped `\#` in Make,
quoted in YAML), note runner is ephemeral (cold gekata crawl).

Docs: README + new CLAUDE.md describe the two-dnsmasq / nft-set model;
exit-node DPI failover (10.77.1.2/10.77.2.2) documented as external
(wg-ha.service), not owned by bbrkn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 23:55:16 +03:00
1990114627 dns healthcheck 2026-03-21 10:57:59 +03:00
537ae61f63 Рефакторинг 2026-03-21 09:46:15 +03:00
379124a3a8 Update scripts/deploy-to-gateway.sh
All checks were successful
Deploy DNS Configuration / deploy (push) Successful in 32m23s
2026-01-21 21:28:32 +03:00
c183c59b30 Add flushing of ipset after config generation
All checks were successful
Deploy DNS Configuration / deploy (push) Successful in 1m42s
2025-11-15 13:29:22 +03:00
Kirill Kodanev
5f0e287b98 Remove a lot of TG domainsm, rewrite scripts
All checks were successful
Deploy DNS Configuration / deploy (push) Successful in 2m15s
2025-09-12 15:30:31 +03:00
Kirill Kodanev
31d07d4484 Rewrite logic, use env variables, and add comments to the following code to make it more readable and maintainable. 2025-09-11 19:49:28 +03:00
Kirill Kodanev
0e03de0178 First commit to bbrkn project 2025-09-09 21:21:38 +03:00