Commit 7b45258cb5 for bind

commit 7b45258cb52c04ad04d0066b0cb5c455cefdacf2
Author: Štěpán Balážik <stepan@isc.org>
Date:   Mon Oct 26 13:10:43 2026 +0100

    Sign the f007 zones with isctest.zone

    The selfloop module generated the keys, wrote both zone files and signed
    them by hand, and ns3 named the files in its configuration.  The zones
    now come from templates, isctest.zone signs them and hands ns3 its zone
    list.  The child's template is written by hand, an SOA and an NS naming
    the parent's server, so that its apex NSEC still points at itself and
    its SOA passes check-names.  Its generated files join the directory's
    artifact list in common.py.

    Assisted-by: Claude:claude-fable-5-1

diff --git a/bin/tests/system/nsec_synthesis/common.py b/bin/tests/system/nsec_synthesis/common.py
index a44ce149e4..21c23cff7d 100644
--- a/bin/tests/system/nsec_synthesis/common.py
+++ b/bin/tests/system/nsec_synthesis/common.py
@@ -19,17 +19,18 @@ import isctest.mark
 import isctest.template
 import isctest.zone

-SIGNED_ZONE_MARKS = [
-    isctest.mark.with_ecdsa_deterministic,
-    pytest.mark.extra_artifacts(
-        [
-            "ans*/dsset-*",
-            "ans*/zones/*.db",
-            "ans*/zones/*.db.signed",
-        ]
-    ),
-]
+ARTIFACTS = pytest.mark.extra_artifacts(
+    [
+        "ans*/dsset-*",
+        "ans*/zones/*.db",
+        "ans*/zones/*.db.signed",
+        "ns3/dsset-*",
+        "ns3/zones/*.db",
+        "ns3/zones/*.db.signed",
+    ]
+)

+SIGNED_ZONE_MARKS = [isctest.mark.with_ecdsa_deterministic, ARTIFACTS]

 F004_ZONE = "f004.test."
 F004_VICTIM = f"victim.{F004_ZONE}"
diff --git a/bin/tests/system/nsec_synthesis/ns3/named.conf.j2 b/bin/tests/system/nsec_synthesis/ns3/named.conf.j2
index fcf00e8855..e54ebfcbb0 100644
--- a/bin/tests/system/nsec_synthesis/ns3/named.conf.j2
+++ b/bin/tests/system/nsec_synthesis/ns3/named.conf.j2
@@ -9,13 +9,4 @@ options {

 {% include "_common/root.hint.conf" %}

-zone "f007.test" {
-	type primary;
-	file "f007.test.db.signed";
-};
-
-zone "!.f007.test" {
-	type primary;
-	file "child.f007.test.db.signed";
-};
-
+{% include "_common/zones.conf.j2" %}
diff --git a/bin/tests/system/nsec_synthesis/ns3/zones/!.f007.test.db.j2.manual b/bin/tests/system/nsec_synthesis/ns3/zones/!.f007.test.db.j2.manual
new file mode 100644
index 0000000000..ae9a878d32
--- /dev/null
+++ b/bin/tests/system/nsec_synthesis/ns3/zones/!.f007.test.db.j2.manual
@@ -0,0 +1,4 @@
+$ORIGIN @zone.name@.
+$TTL 300
+@zone.name@.	SOA	ns3.f007.test. . 1 20 20 1814400 3600
+@zone.name@.	NS	ns3.f007.test.
diff --git a/bin/tests/system/nsec_synthesis/ns3/zones/f007.test.db.j2.manual b/bin/tests/system/nsec_synthesis/ns3/zones/f007.test.db.j2.manual
new file mode 100644
index 0000000000..ea1585698b
--- /dev/null
+++ b/bin/tests/system/nsec_synthesis/ns3/zones/f007.test.db.j2.manual
@@ -0,0 +1,5 @@
+{% include "_common/zones/soa.partial.db.j2" %}
+{% include "_common/zones/ns.partial.db.j2" %}
+
+victim	A	203.0.113.7
+!	NS	ns3.f007.test.
diff --git a/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py b/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
index b253336563..957da73dd1 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
@@ -9,15 +9,11 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.

-from pathlib import Path
-
-import pytest
-
-from isctest.run import EnvCmd
-from isctest.template import TrustAnchor
-from nsec_synthesis.common import check_nsec, get_nsec, has_a
+from nsec_synthesis.common import ARTIFACTS, check_nsec, get_nsec, has_a

 import isctest
+import isctest.template
+import isctest.zone

 PARENT = "f007.test."
 CHILD = "!.f007.test."
@@ -27,61 +23,19 @@ VICTIM_A = "203.0.113.7"
 AUTH = "10.53.0.3"
 RESOLVER = "10.53.0.2"

-pytestmark = pytest.mark.extra_artifacts(
-    [
-        "ns3/K*",
-        "ns3/child.f007.test.db",
-        "ns3/child.f007.test.db.signed",
-        "ns3/dsset-*",
-        "ns3/f007.test.db",
-        "ns3/f007.test.db.signed",
-    ]
-)
-
-
-def _write_zone(path, text):
-    Path(path).write_text(text, encoding="ascii")
+pytestmark = ARTIFACTS


 def bootstrap():
-    keygen = EnvCmd("KEYGEN", "-a ECDSA256 -q")
-    dsfromkey = EnvCmd("DSFROMKEY", "-2")
-    signer = EnvCmd("SIGNER", "-S -g")
-
-    parent_ksk = keygen(f"-f KSK {PARENT}", cwd="ns3").out.strip()
-    keygen(PARENT, cwd="ns3")
-    child_ksk = keygen(f"-f KSK {CHILD}", cwd="ns3").out.strip()
-    keygen(CHILD, cwd="ns3")
-
-    child_ds = dsfromkey(f"{child_ksk}.key", cwd="ns3").out
-
-    _write_zone(
-        "ns3/child.f007.test.db",
-        f"""$TTL 300
-$ORIGIN {CHILD}
-@ SOA ns.f007.test. hostmaster.f007.test. 1 3600 600 86400 300
-@ NS ns.f007.test.
-""",
-    )
-    _write_zone(
-        "ns3/f007.test.db",
-        f"""$TTL 300
-$ORIGIN {PARENT}
-@ SOA ns hostmaster 1 3600 600 86400 300
-@ NS ns
-ns A 10.53.0.3
-victim A {VICTIM_A}
-! NS ns.f007.test.
-{child_ds}""",
-    )
-
-    signer(f"-o {CHILD} -f child.f007.test.db.signed child.f007.test.db", cwd="ns3")
-    signer(f"-o {PARENT} -f f007.test.db.signed f007.test.db", cwd="ns3")
-
-    dnskey = str(isctest.kasp.Key(parent_ksk, keydir="ns3").dnskey).split()
-    contents = f'{" ".join(dnskey[4:7])} "{"".join(dnskey[7:])}"'
-
-    return {"trust_anchors": [TrustAnchor(PARENT, "static-key", contents)]}
+    child = isctest.zone.Zone(CHILD, isctest.template.NS3, signed=True)
+    child.configure(csk=True)
+    parent = isctest.zone.Zone(PARENT, isctest.template.NS3, signed=True)
+    parent.delegations = [child]
+    parent.configure(csk=True)
+    return {
+        "trust_anchors": parent.trust_anchors(),
+        "zones": isctest.template.zones([parent, child]),
+    }


 def test_direct_child_self_loop_nsec_fixture():