mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
fix(diagnostics): let the in-zone probes read the drop-in that holds the zone
d14354e892 added both probes reading only /etc/dnsmasq.conf, but svc-net-tor writes its onion zone to /etc/dnsmasq.d/tor-onion.conf and leaves the main file with nothing but a conf-dir pointer. Every Tor host of run 33698844864 therefore captured resolve-inzone.txt as '[no output, exit 2]' and all 471 sampler lines as inzone=unconfigured: during the resolver outage that ended Gitea#0, nobody ever asked dnsmasq for an onion name, and two investigations went without the one measurement that would have settled them.
Both probes now follow the conf-dir pointer, main file first so a lab node with its zone in the main config answers as before. Each is exercised by a test that runs it against real files rather than comparing its text, which the rescue constant had no test for at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
11c98825aa
commit
56b8f1716b
4 files changed
+72
-2
No files matched your search
@@ -11,6 +11,7 @@ from __future__ import annotations
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from utils.cache.files import PROJECT_ROOT
|
||||
|
||||
@@ -113,6 +114,33 @@ class ZoneProbeNameTests(unittest.TestCase):
|
||||
def test_a_config_without_a_zone_yields_nothing(self):
|
||||
self.assertEqual(self._zone("no-resolv\nserver=192.0.2.1\n"), "")
|
||||
|
||||
def test_a_zone_declared_in_a_drop_in_is_found(self):
|
||||
"""svc-net-tor writes the onion zone to /etc/dnsmasq.d/tor-onion.conf
|
||||
and leaves only a conf-dir pointer in the main file, so a probe that
|
||||
reads the main file alone reports no zone on every Tor host."""
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
drop_in_dir = Path(tmp) / "dnsmasq.d"
|
||||
drop_in_dir.mkdir()
|
||||
(drop_in_dir / "tor-onion.conf").write_text(
|
||||
"address=/abc123.onion/127.0.0.1\n", encoding="utf-8"
|
||||
)
|
||||
main = Path(tmp) / "dnsmasq.conf"
|
||||
main.write_text(f"conf-dir={drop_in_dir},*.conf\n", encoding="utf-8")
|
||||
proc = subprocess.run(
|
||||
[
|
||||
"sh",
|
||||
"-c",
|
||||
'DNS53_SAMPLER_LIB=1 . "$1" && zone_probe_name "$2"',
|
||||
"sh",
|
||||
str(SAMPLER),
|
||||
str(main),
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True,
|
||||
)
|
||||
self.assertEqual(proc.stdout, "rescue-probe.abc123.onion")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user