]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: switch to new config keyword for bind9 >= 9.21
authorLuca Boccassi <luca.boccassi@gmail.com>
Mon, 7 Apr 2025 19:55:41 +0000 (20:55 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 17 May 2025 11:43:20 +0000 (12:43 +0100)
bind9 9.21 removed the deprecated 'managed-keys', swap it with
'trust-anchors' if the version is 9.21 or newer

[   20.654086] TEST-75-RESOLVED.sh[1217]: + delv -a /etc/bind.keys @ns1.unsigned.test signed.test
[   20.654425] TEST-75-RESOLVED.sh[1218]: + tee /tmp/tmp.D4LNomAKqY
[   20.672599] TEST-75-RESOLVED.sh[1218]: ;; /etc/bind.keys:1: option 'managed-keys' no longer exists

(cherry picked from commit 5f8e5297b4699922aa003353ac1db6559805301f)
(cherry picked from commit 85df0981b27c59649fa75916ba1efb4fe820a4dd)

test/units/TEST-75-RESOLVED.sh

index 5dfd741a59fd222ae2ee8dd3010d1707af941fb6..e8832f190a3981a884ba629a114164749b3b3447 100755 (executable)
@@ -154,10 +154,13 @@ EOF
     # Create a trust anchor for resolved with our root zone
     keymgr . ds | sed 's/ DS/ IN DS/g' >/etc/dnssec-trust-anchors.d/root.positive
     # Create a bind-compatible trust anchor (for delv)
-    # Note: the trust-anchors directive is relatively new, so use the original
-    #       managed-keys one until it's widespread enough
+    # Note: managed-keys was removed in version 9.21, use the newer trust-anchors directive
     {
-        echo 'managed-keys {'
+        if systemd-analyze compare-versions "$(delv -v | awk '{print $2}')" ge 9.21; then
+            echo 'trust-anchors {'
+        else
+            echo 'managed-keys {'
+        fi
         keymgr . dnskey | sed -r 's/^\. DNSKEY ([0-9]+ [0-9]+ [0-9]+) (.+)$/. static-key \1 "\2";/g'
         echo '};'
     } >/etc/bind.keys