From a9c20d95edf3d5ff9d9acb5a37972590ef029e13 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 14 May 2025 14:39:42 +0000 Subject: [PATCH] import UBI bind-9.18.33-3.el10 --- .bind.metadata | 2 - .gitignore | 3 +- SOURCES/README.sdb_pgsql | 79 - SOURCES/bind-9.10-dist-native-pkcs11.patch | 614 --- SOURCES/bind-9.10-sdb.patch | 310 -- SOURCES/bind-9.10-use-of-strlcat.patch | 18 - SOURCES/bind-9.11-CVE-2021-25220-test.patch | 1171 ----- SOURCES/bind-9.11-CVE-2021-25220.patch | 254 -- SOURCES/bind-9.11-CVE-2022-2795.patch | 61 - SOURCES/bind-9.11-CVE-2023-2828-fixup.patch | 46 - SOURCES/bind-9.11-CVE-2023-2828.patch | 193 - SOURCES/bind-9.11-CVE-2023-4408.patch | 3154 -------------- SOURCES/bind-9.11-CVE-2023-50387-fixup.patch | 64 - SOURCES/bind-9.11-CVE-2023-50387.patch | 737 ---- .../bind-9.11-CVE-2024-1737-runtime-env.patch | 133 - SOURCES/bind-9.11-CVE-2024-1737.patch | 317 -- SOURCES/bind-9.11-CVE-2024-1975.patch | 322 -- SOURCES/bind-9.11-dhcp-time-monotonic.patch | 171 - SOURCES/bind-9.11-engine-pkcs11.patch | 27 - SOURCES/bind-9.11-export-suffix.patch | 39 - SOURCES/bind-9.11-fips-code-includes.patch | 39 - SOURCES/bind-9.11-fips-code.patch | 1459 ------- SOURCES/bind-9.11-fips-disable.patch | 121 - SOURCES/bind-9.11-fips-tests.patch | 1397 ------ SOURCES/bind-9.11-host-idn-disable.patch | 92 - SOURCES/bind-9.11-json-c.patch | 50 - SOURCES/bind-9.11-kyua-pkcs11.patch | 192 - SOURCES/bind-9.11-oot-manual.patch | 256 -- SOURCES/bind-9.11-pk11.patch | 27 - SOURCES/bind-9.11-rh1205168.patch | 120 - SOURCES/bind-9.11-rh1410433.patch | 16 - SOURCES/bind-9.11-rh1668682.patch | 37 - SOURCES/bind-9.11-rh1980757.patch | 32 - SOURCES/bind-9.11-rh2101712.patch | 232 - SOURCES/bind-9.11-rh2133889.patch | 26 - SOURCES/bind-9.11-rt31459.patch | 2122 --------- SOURCES/bind-9.11-rt46047.patch | 780 ---- SOURCES/bind-9.11-serve-stale.patch | 3862 ----------------- SOURCES/bind-9.11-stale-cache.patch | 65 - SOURCES/bind-9.11-unit-disable-random.patch | 30 - SOURCES/bind-9.11-zone2ldap.patch | 195 - SOURCES/bind-9.15-resolver-ntasks.patch | 58 - SOURCES/bind-9.16-CVE-2022-3094-1.patch | 240 - SOURCES/bind-9.16-CVE-2022-3094-2.patch | 136 - SOURCES/bind-9.16-CVE-2022-3094-3.patch | 553 --- SOURCES/bind-9.16-CVE-2022-3094-test.patch | 266 -- SOURCES/bind-9.16-CVE-2022-38177.patch | 27 - SOURCES/bind-9.16-CVE-2022-38178.patch | 27 - SOURCES/bind-9.16-CVE-2023-3341.patch | 166 - .../bind-9.16-update-b.root-servers.net.patch | 31 - .../bind-9.18-CVE-2024-11187-pre-test.patch | 85 - SOURCES/bind-9.18-CVE-2024-11187.patch | 151 - SOURCES/bind-9.3.1rc1-sdb_tools-Makefile.in | 63 - SOURCES/bind-9.3.2-redhat_doc.patch | 98 - SOURCES/bind-9.3.2b1-fix_sdb_ldap.patch | 511 --- SOURCES/bind-9.3.2b2-sdbsrc.patch | 230 - SOURCES/bind-9.5-PIE.patch | 27 - SOURCES/bind-9.5-dlz-64bit.patch | 53 - SOURCES/bind-9.9.1-P2-dlz-libdb.patch | 31 - SOURCES/bind-9.9.1-P2-multlib-conflict.patch | 54 - SOURCES/bind-95-rh452060.patch | 42 - SOURCES/bind-96-old-api.patch | 23 - SOURCES/bind93-rh490837.patch | 81 - SOURCES/bind97-rh478718.patch | 51 - SOURCES/bind97-rh645544.patch | 31 - SOURCES/bind97-rh669163.patch | 14 - SOURCES/bind99-rh640538.patch | 44 - SOURCES/dnszone.schema | 148 - SOURCES/ldap2zone.1 | 41 - SOURCES/ldap2zone.c | 411 -- SOURCES/named-pkcs11.service | 26 - SOURCES/named-sdb-chroot-setup.service | 12 - SOURCES/named-sdb-chroot.service | 30 - SOURCES/named-sdb.8 | 1 - SOURCES/named-sdb.service | 26 - SOURCES/named.root | 56 - SOURCES/setup-named-softhsm.sh | 55 - SOURCES/zone2sqlite.1 | 53 - SOURCES/zonetodb.1 | 53 - bind-9.16-redhat_doc.patch | 66 + bind-9.18-unittest-netmgr-unstable.patch | 75 + bind-9.18.33.tar.xz.asc | 16 + bind-9.20-nsupdate-tls-doc.patch | 114 + bind-9.20-nsupdate-tls-test.patch | 1630 +++++++ bind-9.20-nsupdate-tls.patch | 1604 +++++++ bind-9.5-PIE.patch | 28 + SPECS/bind.spec => bind.spec | 2001 ++++----- SOURCES/bind.tmpfiles.d => bind.tmpfiles.d | 0 ...nerate-rndc-key.sh => generate-rndc-key.sh | 19 +- isc-keyblock.asc | 175 + ...etup.service => named-chroot-setup.service | 0 .../named-chroot.files => named-chroot.files | 0 ...med-chroot.service => named-chroot.service | 3 +- ...p-rndc.service => named-setup-rndc.service | 0 SOURCES/named.conf => named.conf | 2 +- .../named.conf.sample => named.conf.sample | 59 +- SOURCES/named.empty => named.empty | 0 SOURCES/named.localhost => named.localhost | 0 SOURCES/named.logrotate => named.logrotate | 0 SOURCES/named.loopback => named.loopback | 0 ...named.rfc1912.zones => named.rfc1912.zones | 10 +- named.root | 92 + SOURCES/named.root.key => named.root.key | 10 +- SOURCES/named.rwtab => named.rwtab | 0 SOURCES/named.service => named.service | 3 +- SOURCES/named.sysconfig => named.sysconfig | 0 named.sysusers | 3 + ...p-named-chroot.sh => setup-named-chroot.sh | 0 setup-named-softhsm.sh | 124 + sources | 1 + SOURCES/trusted-key.key => trusted-key.key | 0 111 files changed, 4749 insertions(+), 24156 deletions(-) delete mode 100644 .bind.metadata delete mode 100644 SOURCES/README.sdb_pgsql delete mode 100644 SOURCES/bind-9.10-dist-native-pkcs11.patch delete mode 100644 SOURCES/bind-9.10-sdb.patch delete mode 100644 SOURCES/bind-9.10-use-of-strlcat.patch delete mode 100644 SOURCES/bind-9.11-CVE-2021-25220-test.patch delete mode 100644 SOURCES/bind-9.11-CVE-2021-25220.patch delete mode 100644 SOURCES/bind-9.11-CVE-2022-2795.patch delete mode 100644 SOURCES/bind-9.11-CVE-2023-2828-fixup.patch delete mode 100644 SOURCES/bind-9.11-CVE-2023-2828.patch delete mode 100644 SOURCES/bind-9.11-CVE-2023-4408.patch delete mode 100644 SOURCES/bind-9.11-CVE-2023-50387-fixup.patch delete mode 100644 SOURCES/bind-9.11-CVE-2023-50387.patch delete mode 100644 SOURCES/bind-9.11-CVE-2024-1737-runtime-env.patch delete mode 100644 SOURCES/bind-9.11-CVE-2024-1737.patch delete mode 100644 SOURCES/bind-9.11-CVE-2024-1975.patch delete mode 100644 SOURCES/bind-9.11-dhcp-time-monotonic.patch delete mode 100644 SOURCES/bind-9.11-engine-pkcs11.patch delete mode 100644 SOURCES/bind-9.11-export-suffix.patch delete mode 100644 SOURCES/bind-9.11-fips-code-includes.patch delete mode 100644 SOURCES/bind-9.11-fips-code.patch delete mode 100644 SOURCES/bind-9.11-fips-disable.patch delete mode 100644 SOURCES/bind-9.11-fips-tests.patch delete mode 100644 SOURCES/bind-9.11-host-idn-disable.patch delete mode 100644 SOURCES/bind-9.11-json-c.patch delete mode 100644 SOURCES/bind-9.11-kyua-pkcs11.patch delete mode 100644 SOURCES/bind-9.11-oot-manual.patch delete mode 100644 SOURCES/bind-9.11-pk11.patch delete mode 100644 SOURCES/bind-9.11-rh1205168.patch delete mode 100644 SOURCES/bind-9.11-rh1410433.patch delete mode 100644 SOURCES/bind-9.11-rh1668682.patch delete mode 100644 SOURCES/bind-9.11-rh1980757.patch delete mode 100644 SOURCES/bind-9.11-rh2101712.patch delete mode 100644 SOURCES/bind-9.11-rh2133889.patch delete mode 100644 SOURCES/bind-9.11-rt31459.patch delete mode 100644 SOURCES/bind-9.11-rt46047.patch delete mode 100644 SOURCES/bind-9.11-serve-stale.patch delete mode 100644 SOURCES/bind-9.11-stale-cache.patch delete mode 100644 SOURCES/bind-9.11-unit-disable-random.patch delete mode 100644 SOURCES/bind-9.11-zone2ldap.patch delete mode 100644 SOURCES/bind-9.15-resolver-ntasks.patch delete mode 100644 SOURCES/bind-9.16-CVE-2022-3094-1.patch delete mode 100644 SOURCES/bind-9.16-CVE-2022-3094-2.patch delete mode 100644 SOURCES/bind-9.16-CVE-2022-3094-3.patch delete mode 100644 SOURCES/bind-9.16-CVE-2022-3094-test.patch delete mode 100644 SOURCES/bind-9.16-CVE-2022-38177.patch delete mode 100644 SOURCES/bind-9.16-CVE-2022-38178.patch delete mode 100644 SOURCES/bind-9.16-CVE-2023-3341.patch delete mode 100644 SOURCES/bind-9.16-update-b.root-servers.net.patch delete mode 100644 SOURCES/bind-9.18-CVE-2024-11187-pre-test.patch delete mode 100644 SOURCES/bind-9.18-CVE-2024-11187.patch delete mode 100644 SOURCES/bind-9.3.1rc1-sdb_tools-Makefile.in delete mode 100644 SOURCES/bind-9.3.2-redhat_doc.patch delete mode 100644 SOURCES/bind-9.3.2b1-fix_sdb_ldap.patch delete mode 100644 SOURCES/bind-9.3.2b2-sdbsrc.patch delete mode 100644 SOURCES/bind-9.5-PIE.patch delete mode 100644 SOURCES/bind-9.5-dlz-64bit.patch delete mode 100644 SOURCES/bind-9.9.1-P2-dlz-libdb.patch delete mode 100644 SOURCES/bind-9.9.1-P2-multlib-conflict.patch delete mode 100644 SOURCES/bind-95-rh452060.patch delete mode 100644 SOURCES/bind-96-old-api.patch delete mode 100644 SOURCES/bind93-rh490837.patch delete mode 100644 SOURCES/bind97-rh478718.patch delete mode 100644 SOURCES/bind97-rh645544.patch delete mode 100644 SOURCES/bind97-rh669163.patch delete mode 100644 SOURCES/bind99-rh640538.patch delete mode 100644 SOURCES/dnszone.schema delete mode 100644 SOURCES/ldap2zone.1 delete mode 100644 SOURCES/ldap2zone.c delete mode 100644 SOURCES/named-pkcs11.service delete mode 100644 SOURCES/named-sdb-chroot-setup.service delete mode 100644 SOURCES/named-sdb-chroot.service delete mode 100644 SOURCES/named-sdb.8 delete mode 100644 SOURCES/named-sdb.service delete mode 100644 SOURCES/named.root delete mode 100755 SOURCES/setup-named-softhsm.sh delete mode 100644 SOURCES/zone2sqlite.1 delete mode 100644 SOURCES/zonetodb.1 create mode 100644 bind-9.16-redhat_doc.patch create mode 100644 bind-9.18-unittest-netmgr-unstable.patch create mode 100644 bind-9.18.33.tar.xz.asc create mode 100644 bind-9.20-nsupdate-tls-doc.patch create mode 100644 bind-9.20-nsupdate-tls-test.patch create mode 100644 bind-9.20-nsupdate-tls.patch create mode 100644 bind-9.5-PIE.patch rename SPECS/bind.spec => bind.spec (73%) rename SOURCES/bind.tmpfiles.d => bind.tmpfiles.d (100%) rename SOURCES/generate-rndc-key.sh => generate-rndc-key.sh (56%) create mode 100644 isc-keyblock.asc rename SOURCES/named-chroot-setup.service => named-chroot-setup.service (100%) rename SOURCES/named-chroot.files => named-chroot.files (100%) rename SOURCES/named-chroot.service => named-chroot.service (87%) rename SOURCES/named-setup-rndc.service => named-setup-rndc.service (100%) rename SOURCES/named.conf => named.conf (97%) rename SOURCES/named.conf.sample => named.conf.sample (77%) rename SOURCES/named.empty => named.empty (100%) rename SOURCES/named.localhost => named.localhost (100%) rename SOURCES/named.logrotate => named.logrotate (100%) rename SOURCES/named.loopback => named.loopback (100%) rename SOURCES/named.rfc1912.zones => named.rfc1912.zones (92%) create mode 100644 named.root rename SOURCES/named.root.key => named.root.key (53%) rename SOURCES/named.rwtab => named.rwtab (100%) rename SOURCES/named.service => named.service (85%) rename SOURCES/named.sysconfig => named.sysconfig (100%) create mode 100644 named.sysusers rename SOURCES/setup-named-chroot.sh => setup-named-chroot.sh (100%) create mode 100755 setup-named-softhsm.sh create mode 100644 sources rename SOURCES/trusted-key.key => trusted-key.key (100%) diff --git a/.bind.metadata b/.bind.metadata deleted file mode 100644 index 456b24a..0000000 --- a/.bind.metadata +++ /dev/null @@ -1,2 +0,0 @@ -4b45d15edc1e3b7902129ce27baec58a50d76b5c SOURCES/bind-9.11.36.tar.gz -a164fcad1d64d6b5fab5034928cb7260f1fa8fdd SOURCES/random.data diff --git a/.gitignore b/.gitignore index 539e8e3..47e521d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -SOURCES/bind-9.11.36.tar.gz -SOURCES/random.data +bind-9.18.33.tar.xz diff --git a/SOURCES/README.sdb_pgsql b/SOURCES/README.sdb_pgsql deleted file mode 100644 index c10c294..0000000 --- a/SOURCES/README.sdb_pgsql +++ /dev/null @@ -1,79 +0,0 @@ - PGSQL BIND SDB driver - -The postgresql BIND SDB driver is of experimental status and should not be -used for production systems. - -Usage: - -o Use the named_sdb process ( put ENABLE_SDB=yes in /etc/sysconfig/named ) - -o Edit your named.conf to contain a database zone, eg. : - -zone "pgdb.net." IN { - type master; - database "pgsql bind pgdb localhost pguser pgpasswd"; - # ^- DB name ^-Table ^-host ^-user ^-password -}; - -o Create the database zone table - The table must contain the columns "name", "rdtype", and "rdata", and - is expected to contain a properly constructed zone. The program "zonetodb" - creates such a table. - - zonetodb usage: - - zonetodb origin file dbname dbtable - - where - origin : zone origin, eg "pgdb.net." - file : master zone database file, eg. pgdb.net.db - dbname : name of postgresql database - dbtable: name of table in database - - Eg. to import this zone in the file 'pgdb.net.db' into the 'bind' database - 'pgdb' table: - ---- -#pgdb.net.db: -$TTL 1H -@ SOA localhost. root.localhost. ( 1 - 3H - 1H - 1W - 1H ) - NS localhost. -host1 A 192.168.2.1 -host2 A 192.168.2.2 -host3 A 192.168.2.3 -host4 A 192.168.2.4 -host5 A 192.168.2.5 -host6 A 192.168.2.6 -host7 A 192.168.2.7 ---- - -Issue this command as the pgsql user authorized to update the bind database: - -# zonetodb pgdb.net. pgdb.net.db bind pgdb - -will create / update the pgdb table in the 'bind' db: - -$ psql -dbind -c 'select * from pgdb;' - name | ttl | rdtype | rdata -----------------+------+--------+----------------------------------------------------- - pgdb.net | 3600 | SOA | localhost. root.localhost. 1 10800 3600 604800 3600 - pgdb.net | 3600 | NS | localhost. - host1.pgdb.net | 3600 | A | 192.168.2.1 - host2.pgdb.net | 3600 | A | 192.168.2.2 - host3.pgdb.net | 3600 | A | 192.168.2.3 - host4.pgdb.net | 3600 | A | 192.168.2.4 - host5.pgdb.net | 3600 | A | 192.168.2.5 - host6.pgdb.net | 3600 | A | 192.168.2.6 - host7.pgdb.net | 3600 | A | 192.168.2.7 -(9 rows) - -I've tested exactly the above configuration with bind-sdb-9.3.1+ and it works OK. - -NOTE: If you use pgsqldb SDB, ensure the postgresql service is started before the named - service . - -USE AT YOUR OWN RISK! diff --git a/SOURCES/bind-9.10-dist-native-pkcs11.patch b/SOURCES/bind-9.10-dist-native-pkcs11.patch deleted file mode 100644 index 583050c..0000000 --- a/SOURCES/bind-9.10-dist-native-pkcs11.patch +++ /dev/null @@ -1,614 +0,0 @@ -diff --git a/bin/Makefile.in b/bin/Makefile.in -index a18b222..26a7e4e 100644 ---- a/bin/Makefile.in -+++ b/bin/Makefile.in -@@ -11,8 +11,8 @@ srcdir = @srcdir@ - VPATH = @srcdir@ - top_srcdir = @top_srcdir@ - --SUBDIRS = named rndc dig delv dnssec tools nsupdate check confgen \ -- @NZD_TOOLS@ @PYTHON_TOOLS@ @PKCS11_TOOLS@ tests -+SUBDIRS = named named-pkcs11 rndc dig delv dnssec dnssec-pkcs11 tools nsupdate \ -+ check confgen @NZD_TOOLS@ @PYTHON_TOOLS@ @PKCS11_TOOLS@ tests - TARGETS = - - @BIND9_MAKE_RULES@ -diff --git a/bin/dnssec-pkcs11/Makefile.in b/bin/dnssec-pkcs11/Makefile.in -index 390aa0c..e59a118 100644 ---- a/bin/dnssec-pkcs11/Makefile.in -+++ b/bin/dnssec-pkcs11/Makefile.in -@@ -15,18 +15,18 @@ VERSION=@BIND9_VERSION@ - - @BIND9_MAKE_INCLUDES@ - --CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@ -+CINCLUDES = ${DNS_PKCS11_INCLUDES} ${ISC_PKCS11_INCLUDES} - --CDEFINES = -DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \ -- @CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\" -+CDEFINES = -DVERSION=\"${VERSION}\" @PKCS11_ENGINE@ \ -+ @CRYPTO_PK11@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\" - CWARNINGS = - --DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ --ISCLIBS = ../../lib/isc/libisc.@A@ --ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ -+DNSLIBS = ../../lib/dns-pkcs11/libdns-pkcs11.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ -+ISCLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ -+ISCNOSYMLIBS = ../../lib/isc-pkcs11/libisc-pkcs11-nosymtbl.@A@ - --DNSDEPLIBS = ../../lib/dns/libdns.@A@ --ISCDEPLIBS = ../../lib/isc/libisc.@A@ -+DNSDEPLIBS = ../../lib/dns-pkcs11/libdns-pkcs11.@A@ -+ISCDEPLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ - - DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS} - -@@ -35,10 +35,10 @@ LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@ - NOSYMLIBS = ${DNSLIBS} ${ISCNOSYMLIBS} @LIBS@ - - # Alphabetically --TARGETS = dnssec-keygen@EXEEXT@ dnssec-signzone@EXEEXT@ \ -- dnssec-keyfromlabel@EXEEXT@ dnssec-dsfromkey@EXEEXT@ \ -- dnssec-revoke@EXEEXT@ dnssec-settime@EXEEXT@ \ -- dnssec-verify@EXEEXT@ dnssec-importkey@EXEEXT@ -+TARGETS = dnssec-keygen-pkcs11@EXEEXT@ dnssec-signzone-pkcs11@EXEEXT@ \ -+ dnssec-keyfromlabel-pkcs11@EXEEXT@ dnssec-dsfromkey-pkcs11@EXEEXT@ \ -+ dnssec-revoke-pkcs11@EXEEXT@ dnssec-settime-pkcs11@EXEEXT@ \ -+ dnssec-verify-pkcs11@EXEEXT@ dnssec-importkey-pkcs11@EXEEXT@ - - OBJS = dnssectool.@O@ - -@@ -59,15 +59,15 @@ MANOBJS = ${MANPAGES} ${HTMLPAGES} - - @BIND9_MAKE_RULES@ - --dnssec-dsfromkey@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS} -+dnssec-dsfromkey-pkcs11@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS} - export BASEOBJS="dnssec-dsfromkey.@O@ ${OBJS}"; \ - ${FINALBUILDCMD} - --dnssec-keyfromlabel@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS} -+dnssec-keyfromlabel-pkcs11@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS} - export BASEOBJS="dnssec-keyfromlabel.@O@ ${OBJS}"; \ - ${FINALBUILDCMD} - --dnssec-keygen@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS} -+dnssec-keygen-pkcs11@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS} - export BASEOBJS="dnssec-keygen.@O@ ${OBJS}"; \ - ${FINALBUILDCMD} - -@@ -75,7 +75,7 @@ dnssec-signzone.@O@: dnssec-signzone.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \ - -c ${srcdir}/dnssec-signzone.c - --dnssec-signzone@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS} -+dnssec-signzone-pkcs11@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS} - export BASEOBJS="dnssec-signzone.@O@ ${OBJS}"; \ - ${FINALBUILDCMD} - -@@ -83,19 +83,19 @@ dnssec-verify.@O@: dnssec-verify.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \ - -c ${srcdir}/dnssec-verify.c - --dnssec-verify@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS} -+dnssec-verify-pkcs11@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS} - export BASEOBJS="dnssec-verify.@O@ ${OBJS}"; \ - ${FINALBUILDCMD} - --dnssec-revoke@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS} -+dnssec-revoke-pkcs11@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - dnssec-revoke.@O@ ${OBJS} ${LIBS} - --dnssec-settime@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS} -+dnssec-settime-pkcs11@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - dnssec-settime.@O@ ${OBJS} ${LIBS} - --dnssec-importkey@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS} -+dnssec-importkey-pkcs11@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - dnssec-importkey.@O@ ${OBJS} ${LIBS} - -@@ -106,16 +106,14 @@ docclean manclean maintainer-clean:: - - installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} -- $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - - install-man8: ${MANPAGES} - ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 - --install:: ${TARGETS} installdirs install-man8 -+install:: ${TARGETS} installdirs - for t in ${TARGETS}; do ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} $$t ${DESTDIR}${sbindir} || exit 1; done - - uninstall:: -- for m in ${MANPAGES}; do rm -f ${DESTDIR}${mandir}/man8/$$m || exit 1; done - for t in ${TARGETS}; do ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/$$t || exit 1; done - - clean distclean:: -diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in -index 390aa0c..851a008 100644 ---- a/bin/dnssec/Makefile.in -+++ b/bin/dnssec/Makefile.in -@@ -17,7 +17,7 @@ VERSION=@BIND9_VERSION@ - - CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@ - --CDEFINES = -DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \ -+CDEFINES = -DVERSION=\"${VERSION}\" \ - @CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\" - CWARNINGS = - -diff --git a/bin/named-pkcs11/Makefile.in b/bin/named-pkcs11/Makefile.in -index 277a0f5..52a6375 100644 ---- a/bin/named-pkcs11/Makefile.in -+++ b/bin/named-pkcs11/Makefile.in -@@ -43,27 +43,27 @@ DLZDRIVER_INCLUDES = @DLZ_DRIVER_INCLUDES@ - DLZDRIVER_LIBS = @DLZ_DRIVER_LIBS@ - - CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ -- ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \ -- ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \ -+ ${LWRES_INCLUDES} ${DNS_PKCS11_INCLUDES} ${BIND9_INCLUDES} \ -+ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_PKCS11_INCLUDES} \ - ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \ - @DST_OPENSSL_INC@ - --CDEFINES = @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@ -+CDEFINES = @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO_PK11@ @USE_GSSAPI@ - - CWARNINGS = - --DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ -+DNSLIBS = ../../lib/dns-pkcs11/libdns-pkcs11.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ - ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ - ISCCCLIBS = ../../lib/isccc/libisccc.@A@ --ISCLIBS = ../../lib/isc/libisc.@A@ --ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ -+ISCLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ -+ISCNOSYMLIBS = ../../lib/isc-pkcs11/libisc-pkcs11-nosymtbl.@A@ - LWRESLIBS = ../../lib/lwres/liblwres.@A@ - BIND9LIBS = ../../lib/bind9/libbind9.@A@ - --DNSDEPLIBS = ../../lib/dns/libdns.@A@ -+DNSDEPLIBS = ../../lib/dns-pkcs11/libdns-pkcs11.@A@ - ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ - ISCCCDEPLIBS = ../../lib/isccc/libisccc.@A@ --ISCDEPLIBS = ../../lib/isc/libisc.@A@ -+ISCDEPLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ - LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@ - BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@ - -@@ -72,15 +72,15 @@ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \ - - LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \ -- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@ -+ @LIBS@ - - NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \ -- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@ -+ @LIBS@ - - SUBDIRS = unix - --TARGETS = named@EXEEXT@ lwresd@EXEEXT@ -+TARGETS = named-pkcs11@EXEEXT@ - - GEOIPLINKOBJS = geoip.@O@ - GEOIP2LINKOBJS = geoip.@O@ -@@ -94,8 +94,7 @@ OBJS = builtin.@O@ client.@O@ config.@O@ control.@O@ \ - tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \ - zoneconf.@O@ \ - lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \ -- lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \ -- ${DLZDRIVER_OBJS} ${DBDRIVER_OBJS} -+ lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ - - UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@ - -@@ -113,8 +112,7 @@ SRCS = builtin.c client.c config.c control.c \ - tkeyconf.c tsigconf.c update.c xfrout.c \ - zoneconf.c \ - lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \ -- lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \ -- ${DLZDRIVER_SRCS} ${DBDRIVER_SRCS} -+ lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c - - MANPAGES = named.8 lwresd.8 named.conf.5 - -@@ -154,14 +152,14 @@ server.@O@: server.c - -DPRODUCT=\"${PRODUCT}\" \ - -DVERSION=\"${VERSION}\" -c ${srcdir}/server.c - --named@EXEEXT@: ${OBJS} ${DEPLIBS} -+named-pkcs11@EXEEXT@: ${OBJS} ${DEPLIBS} - export MAKE_SYMTABLE="yes"; \ - export BASEOBJS="${OBJS} ${UOBJS}"; \ - ${FINALBUILDCMD} - --lwresd@EXEEXT@: named@EXEEXT@ -+lwresd@EXEEXT@: named-pkcs11@EXEEXT@ - rm -f lwresd@EXEEXT@ -- @LN@ named@EXEEXT@ lwresd@EXEEXT@ -+ @LN@ named-pkcs11@EXEEXT@ lwresd@EXEEXT@ - - doc man:: ${MANOBJS} - -@@ -192,16 +190,11 @@ install-man8: named.8 lwresd.8 - - install-man: install-man5 install-man8 - --install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs install-man -- ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named@EXEEXT@ ${DESTDIR}${sbindir} -- (cd ${DESTDIR}${sbindir}; rm -f lwresd@EXEEXT@; @LN@ named@EXEEXT@ lwresd@EXEEXT@) -+install:: named-pkcs11@EXEEXT@ installdirs -+ ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-pkcs11@EXEEXT@ ${DESTDIR}${sbindir} - - uninstall:: -- rm -f ${DESTDIR}${mandir}/man5/named.conf.5 -- rm -f ${DESTDIR}${mandir}/man8/lwresd.8 -- rm -f ${DESTDIR}${mandir}/man8/named.8 -- rm -f ${DESTDIR}${sbindir}/lwresd@EXEEXT@ -- ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named@EXEEXT@ -+ ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named-pkcs11@EXEEXT@ - - @DLZ_DRIVER_RULES@ - -diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in -index 277a0f5..0e00885 100644 ---- a/bin/named/Makefile.in -+++ b/bin/named/Makefile.in -@@ -48,7 +48,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ - ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \ - @DST_OPENSSL_INC@ - --CDEFINES = @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@ -+CDEFINES = @CONTRIB_DLZ@ @USE_GSSAPI@ @CRYPTO@ - - CWARNINGS = - -diff --git a/bin/pkcs11/Makefile.in b/bin/pkcs11/Makefile.in -index 2c19e7e..8223d5e 100644 ---- a/bin/pkcs11/Makefile.in -+++ b/bin/pkcs11/Makefile.in -@@ -13,13 +13,13 @@ top_srcdir = @top_srcdir@ - - @BIND9_MAKE_INCLUDES@ - --CINCLUDES = ${ISC_INCLUDES} -+CINCLUDES = ${ISC_PKCS11_INCLUDES} - - CDEFINES = - --ISCLIBS = ../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ -+ISCLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ @ISC_OPENSSL_LIBS@ - --ISCDEPLIBS = ../../lib/isc/libisc.@A@ -+ISCDEPLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ - - DEPLIBS = ${ISCDEPLIBS} - -diff --git a/configure.ac b/configure.ac -index 83cad4a..e1e1a32 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1178,12 +1178,14 @@ AC_SUBST(USE_GSSAPI) - AC_SUBST(DST_GSSAPI_INC) - AC_SUBST(DNS_GSSAPI_LIBS) - DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS" -+DNS_CRYPTO_PK11_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_PK11_LIBS" - - # - # Applications linking with libdns also need to link with these libraries. - # - - AC_SUBST(DNS_CRYPTO_LIBS) -+AC_SUBST(DNS_CRYPTO_PK11_LIBS) - - # - # was --with-randomdev specified? -@@ -1556,12 +1558,12 @@ AC_ARG_ENABLE(openssl-hash, - AC_MSG_CHECKING(for OpenSSL library) - OPENSSL_WARNING= - openssldirs="/usr /usr/local /usr/local/ssl /opt/local /usr/pkg /usr/sfw" --if test "yes" = "$want_native_pkcs11" --then -- use_openssl="native_pkcs11" -- want_openssl_hash="no" -- AC_MSG_RESULT(use of native PKCS11 instead) --fi -+#if test "yes" = "$want_native_pkcs11" -+#then -+# use_openssl="native_pkcs11" -+# want_openssl_hash="no" -+# AC_MSG_RESULT(use of native PKCS11 instead) -+#fi - - if test "auto" = "$use_openssl" - then -@@ -1574,6 +1576,7 @@ then - fi - done - fi -+CRYPTO_PK11="" - OPENSSL_ECDSA="" - OPENSSL_GOST="" - OPENSSL_ED25519="" -@@ -1595,11 +1598,10 @@ case "$with_gost" in - ;; - esac - --case "$use_openssl" in -- native_pkcs11) -- AC_MSG_RESULT(disabled because of native PKCS11) -+if test "$want_native_pkcs11" = "yes" -+then - DST_OPENSSL_INC="" -- CRYPTO="-DPKCS11CRYPTO" -+ CRYPTO_PK11="-DPKCS11CRYPTO" - CRYPTOLIB="pkcs11" - OPENSSLECDSALINKOBJS="" - OPENSSLECDSALINKSRCS="" -@@ -1609,7 +1611,9 @@ case "$use_openssl" in - OPENSSLGOSTLINKSRCS="" - OPENSSLLINKOBJS="" - OPENSSLLINKSRCS="" -- ;; -+fi -+ -+case "$use_openssl" in - no) - AC_MSG_RESULT(no) - DST_OPENSSL_INC="" -@@ -1641,7 +1645,7 @@ case "$use_openssl" in - If you do not want OpenSSL, use --without-openssl]) - ;; - *) -- if test "yes" = "$want_native_pkcs11" -+ if false # test "yes" = "$want_native_pkcs11" - then - AC_MSG_RESULT() - AC_MSG_ERROR([OpenSSL and native PKCS11 cannot be used together.]) -@@ -2077,6 +2081,7 @@ AC_SUBST(OPENSSL_ED25519) - AC_SUBST(OPENSSL_GOST) - - DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DST_OPENSSL_LIBS" -+DNS_CRYPTO_PK11_LIBS="$DNS_CRYPTO_LIBS" - - ISC_PLATFORM_WANTAES="#undef ISC_PLATFORM_WANTAES" - if test "yes" = "$with_aes" -@@ -2363,6 +2368,7 @@ esac - AC_SUBST(PKCS11LINKOBJS) - AC_SUBST(PKCS11LINKSRCS) - AC_SUBST(CRYPTO) -+AC_SUBST(CRYPTO_PK11) - AC_SUBST(PKCS11_ECDSA) - AC_SUBST(PKCS11_GOST) - AC_SUBST(PKCS11_ED25519) -@@ -5491,8 +5497,11 @@ AC_CONFIG_FILES([ - bin/delv/Makefile - bin/dig/Makefile - bin/dnssec/Makefile -+ bin/dnssec-pkcs11/Makefile - bin/named/Makefile - bin/named/unix/Makefile -+ bin/named-pkcs11/Makefile -+ bin/named-pkcs11/unix/Makefile - bin/nsupdate/Makefile - bin/pkcs11/Makefile - bin/python/Makefile -@@ -5565,6 +5574,10 @@ AC_CONFIG_FILES([ - lib/dns/include/dns/Makefile - lib/dns/include/dst/Makefile - lib/dns/tests/Makefile -+ lib/dns-pkcs11/Makefile -+ lib/dns-pkcs11/include/Makefile -+ lib/dns-pkcs11/include/dns/Makefile -+ lib/dns-pkcs11/include/dst/Makefile - lib/irs/Makefile - lib/irs/include/Makefile - lib/irs/include/irs/Makefile -@@ -5589,6 +5602,24 @@ AC_CONFIG_FILES([ - lib/isc/unix/include/Makefile - lib/isc/unix/include/isc/Makefile - lib/isc/unix/include/pkcs11/Makefile -+ lib/isc-pkcs11/$arch/Makefile -+ lib/isc-pkcs11/$arch/include/Makefile -+ lib/isc-pkcs11/$arch/include/isc/Makefile -+ lib/isc-pkcs11/$thread_dir/Makefile -+ lib/isc-pkcs11/$thread_dir/include/Makefile -+ lib/isc-pkcs11/$thread_dir/include/isc/Makefile -+ lib/isc-pkcs11/Makefile -+ lib/isc-pkcs11/include/Makefile -+ lib/isc-pkcs11/include/isc/Makefile -+ lib/isc-pkcs11/include/isc/platform.h -+ lib/isc-pkcs11/include/pk11/Makefile -+ lib/isc-pkcs11/include/pkcs11/Makefile -+ lib/isc-pkcs11/tests/Makefile -+ lib/isc-pkcs11/nls/Makefile -+ lib/isc-pkcs11/unix/Makefile -+ lib/isc-pkcs11/unix/include/Makefile -+ lib/isc-pkcs11/unix/include/isc/Makefile -+ lib/isc-pkcs11/unix/include/pkcs11/Makefile - lib/isccc/Makefile - lib/isccc/include/Makefile - lib/isccc/include/isccc/Makefile -diff --git a/lib/Makefile.in b/lib/Makefile.in -index f089bea..3ed939b 100644 ---- a/lib/Makefile.in -+++ b/lib/Makefile.in -@@ -15,7 +15,7 @@ top_srcdir = @top_srcdir@ - # Attempt to disable parallel processing. - .NOTPARALLEL: - .NO_PARALLEL: --SUBDIRS = isc isccc dns isccfg bind9 lwres irs samples -+SUBDIRS = isc isc-pkcs11 isccc dns dns-pkcs11 isccfg bind9 lwres irs samples - TARGETS = - - @BIND9_MAKE_RULES@ -diff --git a/lib/dns-pkcs11/Makefile.in b/lib/dns-pkcs11/Makefile.in -index 1d0f5df..98c9ba0 100644 ---- a/lib/dns-pkcs11/Makefile.in -+++ b/lib/dns-pkcs11/Makefile.in -@@ -24,17 +24,17 @@ VERSION=@BIND9_VERSION@ - - @BIND9_MAKE_INCLUDES@ - --CINCLUDES = -I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \ -- ${ISC_INCLUDES} ${MAXMINDDB_CFLAGS} \ -+CINCLUDES = -I. -I${top_srcdir}/lib/dns-pkcs11 -Iinclude ${DNS_PKCS11_INCLUDES} \ -+ ${ISC_PKCS11_INCLUDES} ${MAXMINDDB_CFLAGS} \ - @DST_OPENSSL_INC@ @DST_GSSAPI_INC@ - --CDEFINES = -DUSE_MD5 @CRYPTO@ @USE_GSSAPI@ -+CDEFINES = -DUSE_MD5 @CRYPTO_PK11@ @USE_GSSAPI@ - - CWARNINGS = - --ISCLIBS = ../../lib/isc/libisc.@A@ -+ISCLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ - --ISCDEPLIBS = ../../lib/isc/libisc.@A@ -+ISCDEPLIBS = ../../lib/isc-pkcs11/libisc-pkcs11.@A@ - - LIBS = ${MAXMINDDB_LIBS} @LIBS@ - -@@ -148,15 +148,15 @@ version.@O@: version.c - -DLIBAGE=${LIBAGE} \ - -c ${srcdir}/version.c - --libdns.@SA@: ${OBJS} -+libdns-pkcs11.@SA@: ${OBJS} - ${AR} ${ARFLAGS} $@ ${OBJS} - ${RANLIB} $@ - --libdns.la: ${OBJS} -+libdns-pkcs11.la: ${OBJS} - ${LIBTOOL_MODE_LINK} \ -- ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns.la -rpath ${libdir} \ -+ ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns-pkcs11.la -rpath ${libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ -- ${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS} -+ ${OBJS} ${ISCLIBS} @DNS_CRYPTO_PK11_LIBS@ ${LIBS} - - include: gen - ${MAKE} include/dns/enumtype.h -@@ -187,22 +187,22 @@ gen: gen.c - ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c \ - ${BUILD_LIBS} ${LFS_LIBS} - --timestamp: include libdns.@A@ -+timestamp: include libdns-pkcs11.@A@ - touch timestamp - --testdirs: libdns.@A@ -+testdirs: libdns-pkcs11.@A@ - - installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} - - install:: timestamp installdirs -- ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns.@A@ ${DESTDIR}${libdir} -+ ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns-pkcs11.@A@ ${DESTDIR}${libdir} - - uninstall:: -- ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libdns.@A@ -+ ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libdns-pkcs11.@A@ - - clean distclean:: -- rm -f libdns.@A@ timestamp -+ rm -f libdns-pkcs11.@A@ timestamp - rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h - rm -f include/dns/rdatastruct.h - rm -f dnstap.pb-c.c dnstap.pb-c.h -diff --git a/lib/isc-pkcs11/Makefile.in b/lib/isc-pkcs11/Makefile.in -index 7e3e9ce..58d7466 100644 ---- a/lib/isc-pkcs11/Makefile.in -+++ b/lib/isc-pkcs11/Makefile.in -@@ -23,8 +23,8 @@ CINCLUDES = -I${srcdir}/unix/include \ - -I${srcdir}/@ISC_THREAD_DIR@/include \ - -I${srcdir}/@ISC_ARCH_DIR@/include \ - -I./include \ -- -I${srcdir}/include ${DNS_INCLUDES} @ISC_OPENSSL_INC@ --CDEFINES = @CRYPTO@ -DPK11_LIB_LOCATION=\"${PROVIDER}\" -+ -I${srcdir}/include ${DNS_PKCS11_INCLUDES} -+CDEFINES = @CRYPTO_PK11@ -DPK11_LIB_LOCATION=\"${PROVIDER}\" - CWARNINGS = - - # Alphabetically -@@ -107,40 +107,40 @@ version.@O@: version.c - -DLIBAGE=${LIBAGE} \ - -c ${srcdir}/version.c - --libisc.@SA@: ${OBJS} ${SYMTBLOBJS} -+libisc-pkcs11.@SA@: ${OBJS} ${SYMTBLOBJS} - ${AR} ${ARFLAGS} $@ ${OBJS} ${SYMTBLOBJS} - ${RANLIB} $@ - --libisc-nosymtbl.@SA@: ${OBJS} -+libisc-pkcs11-nosymtbl.@SA@: ${OBJS} - ${AR} ${ARFLAGS} $@ ${OBJS} - ${RANLIB} $@ - --libisc.la: ${OBJS} ${SYMTBLOBJS} -+libisc-pkcs11.la: ${OBJS} ${SYMTBLOBJS} - ${LIBTOOL_MODE_LINK} \ -- ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc.la -rpath ${libdir} \ -+ ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-pkcs11.la -rpath ${libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ - ${OBJS} ${SYMTBLOBJS} ${LIBS} - --libisc-nosymtbl.la: ${OBJS} -+libisc-pkcs11-nosymtbl.la: ${OBJS} - ${LIBTOOL_MODE_LINK} \ -- ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-nosymtbl.la -rpath ${libdir} \ -+ ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-pkcs11-nosymtbl.la -rpath ${libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ - ${OBJS} ${LIBS} - --timestamp: libisc.@A@ libisc-nosymtbl.@A@ -+timestamp: libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@ - touch timestamp - --testdirs: libisc.@A@ libisc-nosymtbl.@A@ -+testdirs: libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@ - - installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} - - install:: timestamp installdirs -- ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libisc.@A@ ${DESTDIR}${libdir} -+ ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libisc-pkcs11.@A@ ${DESTDIR}${libdir} - - uninstall:: -- ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libisc.@A@ -+ ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libisc-pkcs11.@A@ - - clean distclean:: -- rm -f libisc.@A@ libisc-nosymtbl.@A@ libisc.la \ -- libisc-nosymtbl.la timestamp -+ rm -f libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@ libisc-pkcs11.la \ -+ libisc-pkcs11-nosymtbl.la timestamp -diff --git a/make/includes.in b/make/includes.in -index 66efe68..966671f 100644 ---- a/make/includes.in -+++ b/make/includes.in -@@ -41,3 +41,13 @@ BIND9_INCLUDES = @BIND9_BIND9_BUILDINCLUDE@ \ - - TEST_INCLUDES = \ - -I${top_srcdir}/lib/tests/include -+ -+ISC_PKCS11_INCLUDES = @BIND9_ISC_BUILDINCLUDE@ \ -+ -I${top_srcdir}/lib/isc-pkcs11 \ -+ -I${top_srcdir}/lib/isc-pkcs11/include \ -+ -I${top_srcdir}/lib/isc-pkcs11/unix/include \ -+ -I${top_srcdir}/lib/isc-pkcs11/@ISC_THREAD_DIR@/include \ -+ -I${top_srcdir}/lib/isc-pkcs11/@ISC_ARCH_DIR@/include -+ -+DNS_PKCS11_INCLUDES = @BIND9_DNS_BUILDINCLUDE@ \ -+ -I${top_srcdir}/lib/dns-pkcs11/include diff --git a/SOURCES/bind-9.10-sdb.patch b/SOURCES/bind-9.10-sdb.patch deleted file mode 100644 index f36e156..0000000 --- a/SOURCES/bind-9.10-sdb.patch +++ /dev/null @@ -1,310 +0,0 @@ -diff --git a/bin/Makefile.in b/bin/Makefile.in -index ce7a2da..4e6a824 100644 ---- a/bin/Makefile.in -+++ b/bin/Makefile.in -@@ -11,8 +11,8 @@ srcdir = @srcdir@ - VPATH = @srcdir@ - top_srcdir = @top_srcdir@ - --SUBDIRS = named named-pkcs11 rndc dig delv dnssec dnssec-pkcs11 tools nsupdate \ -- check confgen @NZD_TOOLS@ @PYTHON_TOOLS@ @PKCS11_TOOLS@ tests -+SUBDIRS = named named-sdb named-pkcs11 rndc dig delv dnssec dnssec-pkcs11 tools nsupdate \ -+ check confgen @NZD_TOOLS@ @PYTHON_TOOLS@ @PKCS11_TOOLS@ sdb_tools tests - TARGETS = - - @BIND9_MAKE_RULES@ -diff --git a/bin/named-sdb/Makefile.in b/bin/named-sdb/Makefile.in -index 03a72d5..4c1cb6d 100644 ---- a/bin/named-sdb/Makefile.in -+++ b/bin/named-sdb/Makefile.in -@@ -30,10 +30,10 @@ VERSION=@BIND9_VERSION@ - # - # Add database drivers here. - # --DBDRIVER_OBJS = --DBDRIVER_SRCS = -+DBDRIVER_OBJS = ldapdb.@O@ pgsqldb.@O@ sqlitedb.@O@ dirdb.@O@ -+DBDRIVER_SRCS = ldapdb.c pgsqldb.c sqlitedb.c dirdb.c - DBDRIVER_INCLUDES = --DBDRIVER_LIBS = -+DBDRIVER_LIBS = -lldap -llber -lsqlite3 -lpq - - DLZ_DRIVER_DIR = ${top_srcdir}/contrib/dlz/drivers - -@@ -80,7 +80,7 @@ NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - - SUBDIRS = unix - --TARGETS = named@EXEEXT@ lwresd@EXEEXT@ -+TARGETS = named-sdb@EXEEXT@ - - GEOIPLINKOBJS = geoip.@O@ - GEOIP2LINKOBJS = geoip.@O@ -@@ -154,7 +154,7 @@ server.@O@: server.c - -DPRODUCT=\"${PRODUCT}\" \ - -DVERSION=\"${VERSION}\" -c ${srcdir}/server.c - --named@EXEEXT@: ${OBJS} ${DEPLIBS} -+named-sdb@EXEEXT@: ${OBJS} ${DEPLIBS} - export MAKE_SYMTABLE="yes"; \ - export BASEOBJS="${OBJS} ${UOBJS}"; \ - ${FINALBUILDCMD} -@@ -181,8 +181,6 @@ statschannel.@O@: bind9.xsl.h - - installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} -- $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man5 -- $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - - install-man5: named.conf.5 - ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man5 -@@ -192,16 +190,11 @@ install-man8: named.8 lwresd.8 - - install-man: install-man5 install-man8 - --install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs install-man -- ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named@EXEEXT@ ${DESTDIR}${sbindir} -- (cd ${DESTDIR}${sbindir}; rm -f lwresd@EXEEXT@; @LN@ named@EXEEXT@ lwresd@EXEEXT@) -+install:: ${TARGETS} installdirs -+ ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-sdb@EXEEXT@ ${DESTDIR}${sbindir} - - uninstall:: -- rm -f ${DESTDIR}${mandir}/man5/named.conf.5 -- rm -f ${DESTDIR}${mandir}/man8/lwresd.8 -- rm -f ${DESTDIR}${mandir}/man8/named.8 -- rm -f ${DESTDIR}${sbindir}/lwresd@EXEEXT@ -- ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named@EXEEXT@ -+ ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named-sdb@EXEEXT@ - - @DLZ_DRIVER_RULES@ - -diff --git a/bin/named-sdb/main.c b/bin/named-sdb/main.c -index c9fc3cc..148ebb3 100644 ---- a/bin/named-sdb/main.c -+++ b/bin/named-sdb/main.c -@@ -97,6 +97,10 @@ - * Include header files for database drivers here. - */ - /* #include "xxdb.h" */ -+#include "ldapdb.h" -+#include "pgsqldb.h" -+#include "sqlitedb.h" -+#include "dirdb.h" - - #ifdef CONTRIB_DLZ - /* -@@ -1134,6 +1138,11 @@ setup(void) { - ns_main_earlyfatal("isc_app_start() failed: %s", - isc_result_totext(result)); - -+ ldapdb_clear(); -+ pgsqldb_clear(); -+ dirdb_clear(); -+ sqlitedb_clear(); -+ - isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, - ISC_LOG_NOTICE, "starting %s %s%s%s ", - ns_g_product, ns_g_version, -@@ -1334,6 +1343,75 @@ setup(void) { - isc_result_totext(result)); - #endif - -+ result = ldapdb_init(); -+ if (result != ISC_R_SUCCESS) -+ { -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB ldap module initialisation failed: %s.", -+ isc_result_totext(result) -+ ); -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB ldap zone database will be unavailable." -+ ); -+ }else -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_NOTICE, "SDB ldap zone database module loaded." -+ ); -+ -+ result = pgsqldb_init(); -+ if (result != ISC_R_SUCCESS) -+ { -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB pgsql module initialisation failed: %s.", -+ isc_result_totext(result) -+ ); -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB pgsql zone database will be unavailable." -+ ); -+ }else -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_NOTICE, "SDB postgreSQL DB zone database module loaded." -+ ); -+ -+ result = sqlitedb_init(); -+ if (result != ISC_R_SUCCESS) -+ { -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB sqlite3 module initialisation failed: %s.", -+ isc_result_totext(result) -+ ); -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB sqlite3 zone database will be unavailable." -+ ); -+ }else -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_NOTICE, "SDB sqlite3 DB zone database module loaded." -+ ); -+ -+ result = dirdb_init(); -+ if (result != ISC_R_SUCCESS) -+ { -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB directory DB module initialisation failed: %s.", -+ isc_result_totext(result) -+ ); -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_ERROR, -+ "SDB directory DB zone database will be unavailable." -+ ); -+ }else -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, -+ ISC_LOG_NOTICE, "SDB directory DB zone database module loaded." -+ ); -+ -+ - ns_server_create(ns_g_mctx, &ns_g_server); - - #ifdef HAVE_LIBSECCOMP -@@ -1376,6 +1454,11 @@ cleanup(void) { - - dns_name_destroy(); - -+ ldapdb_clear(); -+ pgsqldb_clear(); -+ sqlitedb_clear(); -+ dirdb_clear(); -+ - isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, - ISC_LOG_NOTICE, "exiting"); - ns_log_shutdown(); -diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in -index 03a72d5..47cc046 100644 ---- a/bin/named/Makefile.in -+++ b/bin/named/Makefile.in -@@ -45,10 +45,10 @@ DLZDRIVER_LIBS = @DLZ_DRIVER_LIBS@ - CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ - ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \ - ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \ -- ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \ -+ ${MAXMINDDB_CFLAGS} \ - @DST_OPENSSL_INC@ - --CDEFINES = @CONTRIB_DLZ@ @USE_GSSAPI@ @CRYPTO@ -+CDEFINES = @USE_GSSAPI@ @CRYPTO@ - - CWARNINGS = - -@@ -72,11 +72,11 @@ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \ - - LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \ -- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@ -+ @LIBS@ - - NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \ -- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@ -+ @LIBS@ - - SUBDIRS = unix - -@@ -94,8 +94,7 @@ OBJS = builtin.@O@ client.@O@ config.@O@ control.@O@ \ - tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \ - zoneconf.@O@ \ - lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \ -- lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \ -- ${DLZDRIVER_OBJS} ${DBDRIVER_OBJS} -+ lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ - - UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@ - -@@ -113,8 +112,7 @@ SRCS = builtin.c client.c config.c control.c \ - tkeyconf.c tsigconf.c update.c xfrout.c \ - zoneconf.c \ - lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \ -- lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \ -- ${DLZDRIVER_SRCS} ${DBDRIVER_SRCS} -+ lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c - - MANPAGES = named.8 lwresd.8 named.conf.5 - -@@ -203,7 +201,5 @@ uninstall:: - rm -f ${DESTDIR}${sbindir}/lwresd@EXEEXT@ - ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named@EXEEXT@ - --@DLZ_DRIVER_RULES@ -- - named-symtbl.@O@: named-symtbl.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c named-symtbl.c -diff --git a/bin/sdb_tools/Makefile.in b/bin/sdb_tools/Makefile.in -index c7e0868..95ab742 100644 ---- a/bin/sdb_tools/Makefile.in -+++ b/bin/sdb_tools/Makefile.in -@@ -32,11 +32,11 @@ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \ - LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} ${DBDRIVER_LIBS} @LIBS@ - --TARGETS = zone2ldap@EXEEXT@ zonetodb@EXEEXT@ -+TARGETS = zone2ldap@EXEEXT@ zonetodb@EXEEXT@ zone2sqlite@EXEEXT@ - --OBJS = zone2ldap.@O@ zonetodb.@O@ -+OBJS = zone2ldap.@O@ zonetodb.@O@ zone2sqlite.@O@ - --SRCS = zone2ldap.c zonetodb.c -+SRCS = zone2ldap.c zonetodb.c zone2sqlite.c - - MANPAGES = zone2ldap.1 - -@@ -50,6 +50,9 @@ zone2ldap@EXEEXT@: zone2ldap.@O@ ${DEPLIBS} - zonetodb@EXEEXT@: zonetodb.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ zonetodb.@O@ -lpq ${LIBS} - -+zone2sqlite@EXEEXT@: zone2sqlite.@O@ ${DEPLIBS} -+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ zone2sqlite.@O@ -lsqlite3 -lssl ${LIBS} -+ - clean distclean manclean maintainer-clean:: - rm -f ${TARGETS} ${OBJS} - -@@ -60,4 +63,5 @@ installdirs: - install:: ${TARGETS} installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zone2ldap@EXEEXT@ ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zonetodb@EXEEXT@ ${DESTDIR}${sbindir} -+ ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zone2sqlite@EXEEXT@ ${DESTDIR}${sbindir} - ${INSTALL_DATA} ${srcdir}/zone2ldap.1 ${DESTDIR}${mandir}/man1/zone2ldap.1 -diff --git a/configure.ac b/configure.ac -index f85f45f..7d28c52 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -5400,6 +5400,8 @@ AC_CONFIG_FILES([ - bin/named/unix/Makefile - bin/named-pkcs11/Makefile - bin/named-pkcs11/unix/Makefile -+ bin/named-sdb/Makefile -+ bin/named-sdb/unix/Makefile - bin/nsupdate/Makefile - bin/pkcs11/Makefile - bin/python/Makefile -@@ -5424,6 +5426,7 @@ AC_CONFIG_FILES([ - bin/python/isc/tests/policy_test.py - bin/python/isc/utils.py - bin/rndc/Makefile -+ bin/sdb_tools/Makefile - bin/tests/Makefile - bin/tests/headerdep_test.sh - bin/tests/optional/Makefile diff --git a/SOURCES/bind-9.10-use-of-strlcat.patch b/SOURCES/bind-9.10-use-of-strlcat.patch deleted file mode 100644 index 2a39916..0000000 --- a/SOURCES/bind-9.10-use-of-strlcat.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/bin/sdb_tools/zone2ldap.c b/bin/sdb_tools/zone2ldap.c -index d56bc56..99c3314 100644 ---- a/bin/sdb_tools/zone2ldap.c -+++ b/bin/sdb_tools/zone2ldap.c -@@ -817,11 +817,11 @@ build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag, char *zone) - } - - -- strlcat (dn, tmp, sizeof (dn)); -+ strncat (dn, tmp, sizeof (dn) - strlen (dn)); - } - - sprintf (tmp, "dc=%s", dc_list[0]); -- strlcat (dn, tmp, sizeof (dn)); -+ strncat (dn, tmp, sizeof (dn) - strlen (dn)); - - fflush(NULL); - return dn; diff --git a/SOURCES/bind-9.11-CVE-2021-25220-test.patch b/SOURCES/bind-9.11-CVE-2021-25220-test.patch deleted file mode 100644 index a13f81a..0000000 --- a/SOURCES/bind-9.11-CVE-2021-25220-test.patch +++ /dev/null @@ -1,1171 +0,0 @@ -From 800ef75553881527e2406f22887e976bb1ba3bfe Mon Sep 17 00:00:00 2001 -From: Mark Andrews -Date: Tue, 18 Jan 2022 00:19:47 +1100 -Subject: [PATCH] Add tests for forwarder cache poisoning scenarios - -- Check that an NS in an authority section returned from a forwarder - which is above the name in a configured "forward first" or "forward - only" zone (i.e., net/NS in a response from a forwarder configured for - local.net) is not cached. -- Test that a DNAME for a parent domain will not be cached when sent - in a response from a forwarder configured to answer for a child. -- Check that glue is rejected if its name falls below that of zone - configured locally. -- Check that an extra out-of-bailiwick data in the answer section is - not cached (this was already working correctly, but was not explicitly - tested before). - -- v9_11 backport: Revert primary/secondary to master/slave, - backport rndc helper, backport ns8 config. - -(cherry picked from commit bf3fffff67e1de78e9387a93674d471bf4291604) -(cherry picked from commit 29f08170f05c2c96fb67f3b561b46aa0bae356f7) ---- - bin/tests/system/forward/ans11/ans.py | 136 ++++++++++++++++++ - bin/tests/system/forward/clean.sh | 2 + - bin/tests/system/forward/ns1/diditwork.net.db | 20 +++ - bin/tests/system/forward/ns1/named.conf.in | 20 +++ - bin/tests/system/forward/ns1/net.example.lll | 13 ++ - bin/tests/system/forward/ns1/spoofed.net.db | 20 +++ - bin/tests/system/forward/ns1/sub.local.net.db | 20 +++ - bin/tests/system/forward/ns10/fakenet.zone | 15 ++ - bin/tests/system/forward/ns10/fakenet2.zone | 13 ++ - .../system/forward/ns10/fakesublocalnet.zone | 13 ++ - .../system/forward/ns10/fakesublocaltld.zone | 13 ++ - bin/tests/system/forward/ns10/named.conf.in | 51 +++++++ - bin/tests/system/forward/ns10/net.example.lll | 13 ++ - bin/tests/system/forward/ns10/spoofednet.zone | 14 ++ - bin/tests/system/forward/ns4/named.conf.in | 5 + - bin/tests/system/forward/ns4/sibling.tld.db | 20 +++ - bin/tests/system/forward/ns8/named.conf.in | 33 +++++ - bin/tests/system/forward/ns8/root.db | 11 ++ - bin/tests/system/forward/ns8/sub.local.tld.db | 13 ++ - bin/tests/system/forward/ns9/local.net.db | 14 ++ - bin/tests/system/forward/ns9/local.tld.db | 13 ++ - bin/tests/system/forward/ns9/named1.conf.in | 65 +++++++++ - bin/tests/system/forward/ns9/named2.conf.in | 68 +++++++++ - bin/tests/system/forward/ns9/named3.conf.in | 48 +++++++ - bin/tests/system/forward/ns9/named4.conf.in | 45 ++++++ - bin/tests/system/forward/ns9/root.db | 11 ++ - bin/tests/system/forward/prereq.sh | 14 ++ - bin/tests/system/forward/setup.sh | 3 + - bin/tests/system/forward/tests.sh | 126 ++++++++++++++++ - bin/tests/system/ifconfig.sh | 8 +- - 30 files changed, 856 insertions(+), 4 deletions(-) - create mode 100644 bin/tests/system/forward/ans11/ans.py - create mode 100644 bin/tests/system/forward/ns1/diditwork.net.db - create mode 100644 bin/tests/system/forward/ns1/net.example.lll - create mode 100644 bin/tests/system/forward/ns1/spoofed.net.db - create mode 100644 bin/tests/system/forward/ns1/sub.local.net.db - create mode 100644 bin/tests/system/forward/ns10/fakenet.zone - create mode 100644 bin/tests/system/forward/ns10/fakenet2.zone - create mode 100644 bin/tests/system/forward/ns10/fakesublocalnet.zone - create mode 100644 bin/tests/system/forward/ns10/fakesublocaltld.zone - create mode 100644 bin/tests/system/forward/ns10/named.conf.in - create mode 100644 bin/tests/system/forward/ns10/net.example.lll - create mode 100644 bin/tests/system/forward/ns10/spoofednet.zone - create mode 100644 bin/tests/system/forward/ns4/sibling.tld.db - create mode 100644 bin/tests/system/forward/ns8/named.conf.in - create mode 100644 bin/tests/system/forward/ns8/root.db - create mode 100644 bin/tests/system/forward/ns8/sub.local.tld.db - create mode 100644 bin/tests/system/forward/ns9/local.net.db - create mode 100644 bin/tests/system/forward/ns9/local.tld.db - create mode 100644 bin/tests/system/forward/ns9/named1.conf.in - create mode 100644 bin/tests/system/forward/ns9/named2.conf.in - create mode 100644 bin/tests/system/forward/ns9/named3.conf.in - create mode 100644 bin/tests/system/forward/ns9/named4.conf.in - create mode 100644 bin/tests/system/forward/ns9/root.db - -diff --git a/bin/tests/system/forward/ans11/ans.py b/bin/tests/system/forward/ans11/ans.py -new file mode 100644 -index 0000000000..2956cf6eff ---- /dev/null -+++ b/bin/tests/system/forward/ans11/ans.py -@@ -0,0 +1,136 @@ -+############################################################################ -+# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+# -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, you can obtain one at https://mozilla.org/MPL/2.0/. -+# -+# See the COPYRIGHT file distributed with this work for additional -+# information regarding copyright ownership. -+############################################################################ -+ -+from __future__ import print_function -+import os -+import sys -+import signal -+import socket -+import select -+from datetime import datetime, timedelta -+import time -+import functools -+ -+import dns, dns.message, dns.query, dns.flags -+from dns.rdatatype import * -+from dns.rdataclass import * -+from dns.rcode import * -+from dns.name import * -+ -+# Log query to file -+def logquery(type, qname): -+ with open("qlog", "a") as f: -+ f.write("%s %s\n", type, qname) -+ -+############################################################################ -+# Respond to a DNS query. -+############################################################################ -+def create_response(msg): -+ m = dns.message.from_wire(msg) -+ qname = m.question[0].name.to_text() -+ rrtype = m.question[0].rdtype -+ typename = dns.rdatatype.to_text(rrtype) -+ -+ with open("query.log", "a") as f: -+ f.write("%s %s\n" % (typename, qname)) -+ print("%s %s" % (typename, qname), end=" ") -+ -+ r = dns.message.make_response(m) -+ r.set_rcode(NOERROR) -+ if rrtype == A: -+ tld=qname.split('.')[-2] + '.' -+ ns="local." + tld -+ r.answer.append(dns.rrset.from_text(qname, 300, IN, A, "10.53.0.11")) -+ r.answer.append(dns.rrset.from_text(tld, 300, IN, NS, "local." + tld)) -+ r.additional.append(dns.rrset.from_text(ns, 300, IN, A, "10.53.0.11")) -+ elif rrtype == NS: -+ r.answer.append(dns.rrset.from_text(qname, 300, IN, NS, ".")) -+ elif rrtype == SOA: -+ r.answer.append(dns.rrset.from_text(qname, 300, IN, SOA, ". . 0 0 0 0 0")) -+ else: -+ r.authority.append(dns.rrset.from_text(qname, 300, IN, SOA, ". . 0 0 0 0 0")) -+ r.flags |= dns.flags.AA -+ return r -+ -+def sigterm(signum, frame): -+ print ("Shutting down now...") -+ os.remove('ans.pid') -+ running = False -+ sys.exit(0) -+ -+############################################################################ -+# Main -+# -+# Set up responder and control channel, open the pid file, and start -+# the main loop, listening for queries on the query channel or commands -+# on the control channel and acting on them. -+############################################################################ -+ip4 = "10.53.0.11" -+ip6 = "fd92:7065:b8e:ffff::11" -+ -+try: port=int(os.environ['PORT']) -+except: port=5300 -+ -+query4_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -+query4_socket.bind((ip4, port)) -+havev6 = True -+try: -+ query6_socket = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) -+ try: -+ query6_socket.bind((ip6, port)) -+ except: -+ query6_socket.close() -+ havev6 = False -+except: -+ havev6 = False -+signal.signal(signal.SIGTERM, sigterm) -+ -+f = open('ans.pid', 'w') -+pid = os.getpid() -+print (pid, file=f) -+f.close() -+ -+running = True -+ -+print ("Listening on %s port %d" % (ip4, port)) -+if havev6: -+ print ("Listening on %s port %d" % (ip6, port)) -+print ("Ctrl-c to quit") -+ -+if havev6: -+ input = [query4_socket, query6_socket] -+else: -+ input = [query4_socket] -+ -+while running: -+ try: -+ inputready, outputready, exceptready = select.select(input, [], []) -+ except select.error as e: -+ break -+ except socket.error as e: -+ break -+ except KeyboardInterrupt: -+ break -+ -+ for s in inputready: -+ if s == query4_socket or s == query6_socket: -+ print ("Query received on %s" % -+ (ip4 if s == query4_socket else ip6), end=" ") -+ # Handle incoming queries -+ msg = s.recvfrom(65535) -+ rsp = create_response(msg[0]) -+ if rsp: -+ print(dns.rcode.to_text(rsp.rcode())) -+ s.sendto(rsp.to_wire(), msg[1]) -+ else: -+ print("NO RESPONSE") -+ if not running: -+ break -diff --git a/bin/tests/system/forward/clean.sh b/bin/tests/system/forward/clean.sh -index 26e4e76db6..26a550db49 100644 ---- a/bin/tests/system/forward/clean.sh -+++ b/bin/tests/system/forward/clean.sh -@@ -10,8 +10,10 @@ - # - # Clean up after forward tests. - # -+rm -f ./ans11/query.log - rm -f ./dig.out.* - rm -f ./*/named.conf - rm -f ./*/named.memstats - rm -f ./*/named.run ./*/named.run.prev -+rm -f ./*/named_dump.db - rm -f ./ns*/named.lock -diff --git a/bin/tests/system/forward/ns1/diditwork.net.db b/bin/tests/system/forward/ns1/diditwork.net.db -new file mode 100644 -index 0000000000..be9a7f72bc ---- /dev/null -+++ b/bin/tests/system/forward/ns1/diditwork.net.db -@@ -0,0 +1,20 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 300 ; 5 minutes -+@ IN SOA ns root ( -+ 2000082401 ; serial -+ 1800 ; refresh (30 minutes) -+ 1800 ; retry (30 minutes) -+ 1814400 ; expire (3 weeks) -+ 3600 ; minimum (1 hour) -+ ) -+ NS ns -+ TXT "recursed" -+ns A 10.53.0.1 -diff --git a/bin/tests/system/forward/ns1/named.conf.in b/bin/tests/system/forward/ns1/named.conf.in -index 9904f37ef5..1c31d84608 100644 ---- a/bin/tests/system/forward/ns1/named.conf.in -+++ b/bin/tests/system/forward/ns1/named.conf.in -@@ -54,3 +54,23 @@ zone "example5." { - zone "example6" { - type forward; - }; -+ -+zone "diditwork.net" { -+ type master; -+ file "diditwork.net.db"; -+}; -+ -+zone "spoofed.net" { -+ type master; -+ file "spoofed.net.db"; -+}; -+ -+zone "sub.local.net" { -+ type master; -+ file "sub.local.net.db"; -+}; -+ -+zone "net.example.lll" { -+ type master; -+ file "net.example.lll"; -+}; -diff --git a/bin/tests/system/forward/ns1/net.example.lll b/bin/tests/system/forward/ns1/net.example.lll -new file mode 100644 -index 0000000000..d179853fa5 ---- /dev/null -+++ b/bin/tests/system/forward/ns1/net.example.lll -@@ -0,0 +1,13 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 86400 -+net.example.lll. SOA . . 0 0 0 0 0 -+net.example.lll. NS attackSecureDomain.net. -+didItWork.net.example.lll. TXT "if you can see this record the attack worked" -diff --git a/bin/tests/system/forward/ns1/spoofed.net.db b/bin/tests/system/forward/ns1/spoofed.net.db -new file mode 100644 -index 0000000000..d498d5fa0d ---- /dev/null -+++ b/bin/tests/system/forward/ns1/spoofed.net.db -@@ -0,0 +1,20 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 300 ; 5 minutes -+@ IN SOA ns root ( -+ 2000082401 ; serial -+ 1800 ; refresh (30 minutes) -+ 1800 ; retry (30 minutes) -+ 1814400 ; expire (3 weeks) -+ 3600 ; minimum (1 hour) -+ ) -+ NS ns -+ns A 10.53.0.1 -+sub TXT "recursed" -diff --git a/bin/tests/system/forward/ns1/sub.local.net.db b/bin/tests/system/forward/ns1/sub.local.net.db -new file mode 100644 -index 0000000000..be9a7f72bc ---- /dev/null -+++ b/bin/tests/system/forward/ns1/sub.local.net.db -@@ -0,0 +1,20 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 300 ; 5 minutes -+@ IN SOA ns root ( -+ 2000082401 ; serial -+ 1800 ; refresh (30 minutes) -+ 1800 ; retry (30 minutes) -+ 1814400 ; expire (3 weeks) -+ 3600 ; minimum (1 hour) -+ ) -+ NS ns -+ TXT "recursed" -+ns A 10.53.0.1 -diff --git a/bin/tests/system/forward/ns10/fakenet.zone b/bin/tests/system/forward/ns10/fakenet.zone -new file mode 100644 -index 0000000000..14e5c777cb ---- /dev/null -+++ b/bin/tests/system/forward/ns10/fakenet.zone -@@ -0,0 +1,15 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 86400 -+net. SOA . . 0 0 0 0 0 -+net. NS attackSecureDomain.net. -+attackSecureDomain.net. A 10.53.0.10 -+didItWork.net. TXT "if you can see this record the attack worked" -+ns.spoofed.net. A 10.53.0.10 -diff --git a/bin/tests/system/forward/ns10/fakenet2.zone b/bin/tests/system/forward/ns10/fakenet2.zone -new file mode 100644 -index 0000000000..7ca28a934e ---- /dev/null -+++ b/bin/tests/system/forward/ns10/fakenet2.zone -@@ -0,0 +1,13 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 86400 -+net2. SOA . . 0 0 0 0 0 -+net2. NS attackSecureDomain.net. -+net2. DNAME net.example.lll. -diff --git a/bin/tests/system/forward/ns10/fakesublocalnet.zone b/bin/tests/system/forward/ns10/fakesublocalnet.zone -new file mode 100644 -index 0000000000..6caa071891 ---- /dev/null -+++ b/bin/tests/system/forward/ns10/fakesublocalnet.zone -@@ -0,0 +1,13 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 86400 -+sub.local.net. SOA . . 0 0 0 0 0 -+sub.local.net. NS ns.spoofed.net. -+sub.local.net. TXT "if you see this attacker overrode local delegation" -diff --git a/bin/tests/system/forward/ns10/fakesublocaltld.zone b/bin/tests/system/forward/ns10/fakesublocaltld.zone -new file mode 100644 -index 0000000000..6a431de47f ---- /dev/null -+++ b/bin/tests/system/forward/ns10/fakesublocaltld.zone -@@ -0,0 +1,13 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+sub.local.tld. 3600 IN SOA . . 0 0 0 0 0 -+sub.local.tld. 3600 IN NS ns.sub.local.tld. -+sub.local.tld. 3600 IN TXT bad -+ns.sub.local.tld. 3600 IN A 10.53.0.8 -diff --git a/bin/tests/system/forward/ns10/named.conf.in b/bin/tests/system/forward/ns10/named.conf.in -new file mode 100644 -index 0000000000..025c108418 ---- /dev/null -+++ b/bin/tests/system/forward/ns10/named.conf.in -@@ -0,0 +1,51 @@ -+/* -+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, you can obtain one at https://mozilla.org/MPL/2.0/. -+ * -+ * See the COPYRIGHT file distributed with this work for additional -+ * information regarding copyright ownership. -+ */ -+ -+options { -+ query-source address 10.53.0.10; -+ notify-source 10.53.0.10; -+ transfer-source 10.53.0.10; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.10; }; -+ listen-on-v6 { none; }; -+ minimal-responses no; -+}; -+ -+zone "net." { -+ type master; -+ file "fakenet.zone"; -+}; -+ -+zone "spoofed.net." { -+ type master; -+ file "spoofednet.zone"; -+}; -+ -+zone "sub.local.net." { -+ type master; -+ file "fakesublocalnet.zone"; -+}; -+ -+zone "net2" { -+ type master; -+ file "fakenet2.zone"; -+}; -+ -+zone "net.example.lll" { -+ type master; -+ file "net.example.lll"; -+}; -+ -+zone "sub.local.tld." { -+ type master; -+ file "fakesublocaltld.zone"; -+}; -diff --git a/bin/tests/system/forward/ns10/net.example.lll b/bin/tests/system/forward/ns10/net.example.lll -new file mode 100644 -index 0000000000..d179853fa5 ---- /dev/null -+++ b/bin/tests/system/forward/ns10/net.example.lll -@@ -0,0 +1,13 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 86400 -+net.example.lll. SOA . . 0 0 0 0 0 -+net.example.lll. NS attackSecureDomain.net. -+didItWork.net.example.lll. TXT "if you can see this record the attack worked" -diff --git a/bin/tests/system/forward/ns10/spoofednet.zone b/bin/tests/system/forward/ns10/spoofednet.zone -new file mode 100644 -index 0000000000..13921a08cd ---- /dev/null -+++ b/bin/tests/system/forward/ns10/spoofednet.zone -@@ -0,0 +1,14 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 86400 -+spoofed.net. SOA . . 0 0 0 0 0 -+spoofed.net. NS ns.spoofed.net. -+ns.spoofed.net. A 10.53.0.10 -+spoofed.net. TXT "this record is clearly spoofed" -diff --git a/bin/tests/system/forward/ns4/named.conf.in b/bin/tests/system/forward/ns4/named.conf.in -index d42a9eb797..6db65e71bc 100644 ---- a/bin/tests/system/forward/ns4/named.conf.in -+++ b/bin/tests/system/forward/ns4/named.conf.in -@@ -60,3 +60,8 @@ zone "malicious." { - type master; - file "malicious.db"; - }; -+ -+zone "sibling.tld" { -+ type master; -+ file "sibling.tld.db"; -+}; -diff --git a/bin/tests/system/forward/ns4/sibling.tld.db b/bin/tests/system/forward/ns4/sibling.tld.db -new file mode 100644 -index 0000000000..58037d093b ---- /dev/null -+++ b/bin/tests/system/forward/ns4/sibling.tld.db -@@ -0,0 +1,20 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+$TTL 86400 -+@ IN SOA malicious. admin.malicious. ( -+ 1 ; Serial -+ 604800 ; Refresh -+ 86400 ; Retry -+ 2419200 ; Expire -+ 86400 ) ; Negative Cache TTL -+ -+@ IN NS ns -+ -+ns IN A 10.53.0.4 -diff --git a/bin/tests/system/forward/ns8/named.conf.in b/bin/tests/system/forward/ns8/named.conf.in -new file mode 100644 -index 0000000000..9260f69ded ---- /dev/null -+++ b/bin/tests/system/forward/ns8/named.conf.in -@@ -0,0 +1,33 @@ -+/* -+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, you can obtain one at https://mozilla.org/MPL/2.0/. -+ * -+ * See the COPYRIGHT file distributed with this work for additional -+ * information regarding copyright ownership. -+ */ -+ -+options { -+ query-source address 10.53.0.8; -+ notify-source 10.53.0.8; -+ transfer-source 10.53.0.8; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.8; }; -+ listen-on-v6 { none; }; -+ forwarders { 10.53.0.2; }; // returns referrals -+ forward first; -+ dnssec-validation yes; -+}; -+ -+zone "." { -+ type hint; -+ file "root.db"; -+}; -+ -+zone "sub.local.tld" { -+ type master; -+ file "sub.local.tld.db"; -+}; -diff --git a/bin/tests/system/forward/ns8/root.db b/bin/tests/system/forward/ns8/root.db -new file mode 100644 -index 0000000000..4f30322270 ---- /dev/null -+++ b/bin/tests/system/forward/ns8/root.db -@@ -0,0 +1,11 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+. NS a.root-servers.nil. -+a.root-servers.nil. A 10.53.0.1 -diff --git a/bin/tests/system/forward/ns8/sub.local.tld.db b/bin/tests/system/forward/ns8/sub.local.tld.db -new file mode 100644 -index 0000000000..eb20683ae9 ---- /dev/null -+++ b/bin/tests/system/forward/ns8/sub.local.tld.db -@@ -0,0 +1,13 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+sub.local.tld. 3600 IN SOA . . 0 0 0 0 0 -+sub.local.tld. 3600 IN NS ns.sub.local.tld. -+sub.local.tld. 3600 IN TXT good -+ns.sub.local.tld. 3600 IN A 10.53.0.8 -diff --git a/bin/tests/system/forward/ns9/local.net.db b/bin/tests/system/forward/ns9/local.net.db -new file mode 100644 -index 0000000000..2c971e1e93 ---- /dev/null -+++ b/bin/tests/system/forward/ns9/local.net.db -@@ -0,0 +1,14 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+local.net. 3600 IN SOA . . 0 0 0 0 0 -+local.net. 3600 IN NS localhost. -+ns.local.net. 3600 IN A 10.53.0.9 -+txt.local.net. 3600 IN TXT "something in the local auth zone" -+sub.local.net. 3600 IN NS ns.spoofed.net. ; attacker will try to override this -diff --git a/bin/tests/system/forward/ns9/local.tld.db b/bin/tests/system/forward/ns9/local.tld.db -new file mode 100644 -index 0000000000..59403915fb ---- /dev/null -+++ b/bin/tests/system/forward/ns9/local.tld.db -@@ -0,0 +1,13 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+local.tld. 3600 IN SOA . . 0 0 0 0 0 -+local.tld. 3600 IN NS localhost. -+sub.local.tld. 3600 IN NS ns.sub.local.tld. -+ns.sub.local.tld. 3600 IN A 10.53.0.8 -diff --git a/bin/tests/system/forward/ns9/named1.conf.in b/bin/tests/system/forward/ns9/named1.conf.in -new file mode 100644 -index 0000000000..943e037d09 ---- /dev/null -+++ b/bin/tests/system/forward/ns9/named1.conf.in -@@ -0,0 +1,65 @@ -+/* -+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, you can obtain one at https://mozilla.org/MPL/2.0/. -+ * -+ * See the COPYRIGHT file distributed with this work for additional -+ * information regarding copyright ownership. -+ */ -+ -+options { -+ query-source address 10.53.0.9; -+ notify-source 10.53.0.9; -+ transfer-source 10.53.0.9; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.9; }; -+ listen-on-v6 { none; }; -+ dnssec-validation no; -+ edns-udp-size 1232; -+}; -+ -+key rndc_key { -+ secret "1234abcd8765"; -+ algorithm hmac-sha256; -+}; -+ -+controls { -+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; -+}; -+ -+server 10.53.0.10 { -+ edns no; -+}; -+ -+server 10.53.0.11 { -+ edns no; -+}; -+ -+zone "." { -+ type hint; -+ file "root.db"; -+}; -+ -+zone "attacksecuredomain.net." { -+ type forward; -+ forwarders { 10.53.0.10; }; -+}; -+ -+zone "attacksecuredomain.net2." { -+ type forward; -+ forwarders { 10.53.0.10; }; -+}; -+ -+zone "attacksecuredomain.net3." { -+ type forward; -+ forwarders { 10.53.0.11; }; -+}; -+ -+zone "local.net." { -+ type master; -+ file "local.net.db"; -+ forwarders {}; -+}; -diff --git a/bin/tests/system/forward/ns9/named2.conf.in b/bin/tests/system/forward/ns9/named2.conf.in -new file mode 100644 -index 0000000000..5a17d1998a ---- /dev/null -+++ b/bin/tests/system/forward/ns9/named2.conf.in -@@ -0,0 +1,68 @@ -+/* -+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, you can obtain one at https://mozilla.org/MPL/2.0/. -+ * -+ * See the COPYRIGHT file distributed with this work for additional -+ * information regarding copyright ownership. -+ */ -+ -+options { -+ query-source address 10.53.0.9; -+ notify-source 10.53.0.9; -+ transfer-source 10.53.0.9; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.9; }; -+ listen-on-v6 { none; }; -+ dnssec-validation no; -+ edns-udp-size 1232; -+}; -+ -+key rndc_key { -+ secret "1234abcd8765"; -+ algorithm hmac-sha256; -+}; -+ -+controls { -+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; -+}; -+ -+server 10.53.0.10 { -+ edns no; -+}; -+ -+server 10.53.0.11 { -+ edns no; -+}; -+ -+zone "." { -+ type hint; -+ file "root.db"; -+}; -+ -+zone "attacksecuredomain.net." { -+ type forward; -+ forward only; -+ forwarders { 10.53.0.10; }; -+}; -+ -+zone "attacksecuredomain.net2." { -+ type forward; -+ forward only; -+ forwarders { 10.53.0.10; }; -+}; -+ -+zone "attacksecuredomain.net3." { -+ type forward; -+ forward only; -+ forwarders { 10.53.0.11; }; -+}; -+ -+zone "local.net." { -+ type master; -+ file "local.net.db"; -+ forwarders {}; -+}; -diff --git a/bin/tests/system/forward/ns9/named3.conf.in b/bin/tests/system/forward/ns9/named3.conf.in -new file mode 100644 -index 0000000000..1e70d1ae51 ---- /dev/null -+++ b/bin/tests/system/forward/ns9/named3.conf.in -@@ -0,0 +1,48 @@ -+/* -+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, you can obtain one at https://mozilla.org/MPL/2.0/. -+ * -+ * See the COPYRIGHT file distributed with this work for additional -+ * information regarding copyright ownership. -+ */ -+ -+options { -+ query-source address 10.53.0.9; -+ notify-source 10.53.0.9; -+ transfer-source 10.53.0.9; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.9; }; -+ listen-on-v6 { none; }; -+ dnssec-validation no; -+ edns-udp-size 1232; -+ forward only; -+ forwarders { 10.53.0.10; }; -+}; -+ -+key rndc_key { -+ secret "1234abcd8765"; -+ algorithm hmac-sha256; -+}; -+ -+controls { -+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; -+}; -+ -+server 10.53.0.10 { -+ edns no; -+}; -+ -+zone "." { -+ type hint; -+ file "root.db"; -+}; -+ -+zone "local.net." { -+ type master; -+ file "local.net.db"; -+ forwarders {}; -+}; -diff --git a/bin/tests/system/forward/ns9/named4.conf.in b/bin/tests/system/forward/ns9/named4.conf.in -new file mode 100644 -index 0000000000..6f7b1075b5 ---- /dev/null -+++ b/bin/tests/system/forward/ns9/named4.conf.in -@@ -0,0 +1,45 @@ -+/* -+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, you can obtain one at https://mozilla.org/MPL/2.0/. -+ * -+ * See the COPYRIGHT file distributed with this work for additional -+ * information regarding copyright ownership. -+ */ -+ -+options { -+ query-source address 10.53.0.9; -+ notify-source 10.53.0.9; -+ transfer-source 10.53.0.9; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.9; }; -+ listen-on-v6 { none; }; -+ dnssec-validation no; -+ edns-udp-size 1232; -+}; -+ -+key rndc_key { -+ secret "1234abcd8765"; -+ algorithm hmac-sha256; -+}; -+ -+controls { -+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; -+}; -+ -+server 10.53.0.10 { -+ edns no; -+}; -+ -+zone "." { -+ type hint; -+ file "root.db"; -+}; -+ -+zone "local.tld." { -+ type master; -+ file "local.tld.db"; -+}; -diff --git a/bin/tests/system/forward/ns9/root.db b/bin/tests/system/forward/ns9/root.db -new file mode 100644 -index 0000000000..4f30322270 ---- /dev/null -+++ b/bin/tests/system/forward/ns9/root.db -@@ -0,0 +1,11 @@ -+; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+; -+; This Source Code Form is subject to the terms of the Mozilla Public -+; License, v. 2.0. If a copy of the MPL was not distributed with this -+; file, you can obtain one at https://mozilla.org/MPL/2.0/. -+; -+; See the COPYRIGHT file distributed with this work for additional -+; information regarding copyright ownership. -+ -+. NS a.root-servers.nil. -+a.root-servers.nil. A 10.53.0.1 -diff --git a/bin/tests/system/forward/prereq.sh b/bin/tests/system/forward/prereq.sh -index d2ca8fc2bf..53fb5817df 100644 ---- a/bin/tests/system/forward/prereq.sh -+++ b/bin/tests/system/forward/prereq.sh -@@ -12,6 +12,20 @@ - SYSTEMTESTTOP=.. - . $SYSTEMTESTTOP/conf.sh - -+if test -n "$PYTHON" -+then -+ if $PYTHON -c "import dns" 2> /dev/null -+ then -+ : -+ else -+ echo_i "This test requires the dnspython module." >&2 -+ exit 1 -+ fi -+else -+ echo_i "This test requires Python and the dnspython module." >&2 -+ exit 1 -+fi -+ - if $PERL -e 'use Net::DNS;' 2>/dev/null - then - : -diff --git a/bin/tests/system/forward/setup.sh b/bin/tests/system/forward/setup.sh -index 87452b9a88..18e81d277d 100644 ---- a/bin/tests/system/forward/setup.sh -+++ b/bin/tests/system/forward/setup.sh -@@ -18,3 +18,6 @@ copy_setports ns3/named.conf.in ns3/named.conf - copy_setports ns4/named.conf.in ns4/named.conf - copy_setports ns5/named.conf.in ns5/named.conf - copy_setports ns7/named.conf.in ns7/named.conf -+copy_setports ns8/named.conf.in ns8/named.conf -+copy_setports ns9/named1.conf.in ns9/named.conf -+copy_setports ns10/named.conf.in ns10/named.conf -diff --git a/bin/tests/system/forward/tests.sh b/bin/tests/system/forward/tests.sh -index e3549c5bc7..ce9b309a27 100644 ---- a/bin/tests/system/forward/tests.sh -+++ b/bin/tests/system/forward/tests.sh -@@ -19,6 +19,10 @@ sendcmd() ( - "$PERL" ../send.pl 10.53.0.6 "$EXTRAPORT1" - ) - -+rndccmd() { -+ "$RNDC" -c ../common/rndc.conf -p "$CONTROLPORT" -s "$@" -+} -+ - root=10.53.0.1 - hidden=10.53.0.2 - f1=10.53.0.3 -@@ -223,5 +227,127 @@ if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status+ret)) - - -+# -+# Check various spoofed response scenarios. The same tests will be -+# run twice, with "forward first" and "forward only" configurations. -+# -+run_spooftests () { -+ n=$((n+1)) -+ echo_i "checking spoofed response scenario 1 - out of bailiwick NS ($n)" -+ ret=0 -+ # prime -+ dig_with_opts @10.53.0.9 attackSecureDomain.net > dig.out.$n.prime || ret=1 -+ # check 'net' is not poisoned. -+ dig_with_opts @10.53.0.9 diditwork.net. TXT > dig.out.$n.net || ret=1 -+ grep '^diditwork\.net\..*TXT.*"recursed"' dig.out.$n.net > /dev/null || ret=1 -+ # check 'sub.local.net' is not poisoned. -+ dig_with_opts @10.53.0.9 sub.local.net TXT > dig.out.$n.sub || ret=1 -+ grep '^sub\.local\.net\..*TXT.*"recursed"' dig.out.$n.sub > /dev/null || ret=1 -+ if [ $ret != 0 ]; then echo_i "failed"; fi -+ status=$((status+ret)) -+ -+ n=$((n+1)) -+ echo_i "checking spoofed response scenario 2 - inject DNAME/net2. ($n)" -+ ret=0 -+ # prime -+ dig_with_opts @10.53.0.9 attackSecureDomain.net2 > dig.out.$n.prime || ret=1 -+ # check that net2/DNAME is not cached -+ dig_with_opts @10.53.0.9 net2. DNAME > dig.out.$n.net2 || ret=1 -+ grep "ANSWER: 0," dig.out.$n.net2 > /dev/null || ret=1 -+ grep "status: NXDOMAIN" dig.out.$n.net2 > /dev/null || ret=1 -+ if [ $ret != 0 ]; then echo_i "failed"; fi -+ status=$((status+ret)) -+ -+ n=$((n+1)) -+ echo_i "checking spoofed response scenario 3 - extra answer ($n)" -+ ret=0 -+ # prime -+ dig_with_opts @10.53.0.9 attackSecureDomain.net3 > dig.out.$n.prime || ret=1 -+ # check extra net3 records are not cached -+ rndccmd 10.53.0.9 dumpdb -cache 2>&1 | sed 's/^/ns9 /' | cat_i -+ for try in 1 2 3 4 5; do -+ lines=$(grep "net3" ns9/named_dump.db | wc -l) -+ if [ ${lines} -eq 0 ]; then -+ sleep 1 -+ continue -+ fi -+ [ ${lines} -eq 1 ] || ret=1 -+ grep -q '^attackSecureDomain.net3' ns9/named_dump.db || ret=1 -+ grep -q '^local.net3' ns9/named_dump.db && ret=1 -+ done -+ if [ $ret != 0 ]; then echo_i "failed"; fi -+ status=$((status+ret)) -+} -+ -+echo_i "checking spoofed response scenarios with forward first zones" -+run_spooftests -+ -+copy_setports ns9/named2.conf.in ns9/named.conf -+rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i -+rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i -+sleep 1 -+ -+echo_i "rechecking spoofed response scenarios with forward only zones" -+run_spooftests -+ -+# -+# This scenario expects the spoofed response to succeed. The tests are -+# similar to the ones above, but not identical. -+# -+echo_i "rechecking spoofed response scenarios with 'forward only' set globally" -+copy_setports ns9/named3.conf.in ns9/named.conf -+rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i -+rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i -+sleep 1 -+ -+n=$((n+1)) -+echo_i "checking spoofed response scenario 1 - out of bailiwick NS ($n)" -+ret=0 -+# prime -+dig_with_opts @10.53.0.9 attackSecureDomain.net > dig.out.$n.prime || ret=1 -+# check 'net' is poisoned. -+dig_with_opts @10.53.0.9 diditwork.net. TXT > dig.out.$n.net || ret=1 -+grep '^didItWork\.net\..*TXT.*"if you can see this record the attack worked"' dig.out.$n.net > /dev/null || ret=1 -+# check 'sub.local.net' is poisoned. -+dig_with_opts @10.53.0.9 sub.local.net TXT > dig.out.$n.sub || ret=1 -+grep '^sub\.local\.net\..*TXT.*"if you see this attacker overrode local delegation"' dig.out.$n.sub > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo_i "failed"; fi -+status=$((status+ret)) -+ -+n=$((n+1)) -+echo_i "checking spoofed response scenario 2 - inject DNAME/net2. ($n)" -+ret=0 -+# prime -+dig_with_opts @10.53.0.9 attackSecureDomain.net2 > dig.out.$n.prime || ret=1 -+# check that net2/DNAME is cached -+dig_with_opts @10.53.0.9 net2. DNAME > dig.out.$n.net2 || ret=1 -+grep "ANSWER: 1," dig.out.$n.net2 > /dev/null || ret=1 -+grep "net2\..*IN.DNAME.net\.example\.lll\." dig.out.$n.net2 > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo_i "failed"; fi -+status=$((status+ret)) -+ -+# -+# This test doesn't use any forwarder clauses but is here because it -+# is similar to forwarders, as the set of servers that can populate -+# the namespace is defined by the zone content. -+# -+echo_i "rechecking spoofed response scenarios glue below local zone" -+copy_setports ns9/named4.conf.in ns9/named.conf -+rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i -+rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i -+sleep 1 -+ -+n=$((n+1)) -+echo_i "checking sibling glue below zone ($n)" -+ret=0 -+# prime -+dig_with_opts @10.53.0.9 sibling.tld > dig.out.$n.prime || ret=1 -+# check for glue A record for sub.local.tld is not used -+dig_with_opts @10.53.0.9 sub.local.tld TXT > dig.out.$n.sub || ret=1 -+grep "ANSWER: 1," dig.out.$n.sub > /dev/null || ret=1 -+grep 'sub\.local\.tld\..*IN.TXT."good"$' dig.out.$n.sub > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo_i "failed"; fi -+status=$((status+ret)) -+ - echo_i "exit status: $status" - [ $status -eq 0 ] || exit 1 -diff --git a/bin/tests/system/ifconfig.sh b/bin/tests/system/ifconfig.sh -index d0eb9fa61d..8b9212c3e0 100755 ---- a/bin/tests/system/ifconfig.sh -+++ b/bin/tests/system/ifconfig.sh -@@ -12,10 +12,10 @@ - # - # Set up interface aliases for bind9 system tests. - # --# IPv4: 10.53.0.{1..10} RFC 1918 -+# IPv4: 10.53.0.{1..11} RFC 1918 - # 10.53.1.{1..2} - # 10.53.2.{1..2} --# IPv6: fd92:7065:b8e:ffff::{1..10} ULA -+# IPv6: fd92:7065:b8e:ffff::{1..11} ULA - # fd92:7065:b8e:99ff::{1..2} - # fd92:7065:b8e:ff::{1..2} - # -@@ -65,7 +65,7 @@ case "$1" in - 2) ipv6="00" ;; - *) ipv6="" ;; - esac -- for ns in 1 2 3 4 5 6 7 8 9 10 -+ for ns in 1 2 3 4 5 6 7 8 9 10 11 - do - [ $i -gt 0 -a $ns -gt 2 ] && break - int=`expr $i \* 10 + $ns` -@@ -165,7 +165,7 @@ case "$1" in - 2) ipv6="00" ;; - *) ipv6="" ;; - esac -- for ns in 10 9 8 7 6 5 4 3 2 1 -+ for ns in 11 10 9 8 7 6 5 4 3 2 1 - do - [ $i -gt 0 -a $ns -gt 2 ] && continue - int=`expr $i \* 10 + $ns - 1` --- -2.34.1 - diff --git a/SOURCES/bind-9.11-CVE-2021-25220.patch b/SOURCES/bind-9.11-CVE-2021-25220.patch deleted file mode 100644 index 37f3c41..0000000 --- a/SOURCES/bind-9.11-CVE-2021-25220.patch +++ /dev/null @@ -1,254 +0,0 @@ -From 1f5cb247ecd20ba57c472138f94856aa83caf042 Mon Sep 17 00:00:00 2001 -From: Mark Andrews -Date: Tue, 1 Mar 2022 09:48:05 +1100 -Subject: [PATCH] Add additional name checks when using a forwarder - -When using a forwarder, check that the owner name of response -records are within the bailiwick of the forwarded name space. - -(cherry picked from commit e8df2802ac62016ea68585893eb4310fc3329028) - -Check that the forward declaration is unchanged and not overridden - -If we are using a fowarder, in addition to checking that names to -be cached are subdomains of the forwarded namespace, we must also -check that there are no subsidiary forwarded namespaces which would -take precedence. To be safe, we don't cache any responses if the -forwarding configuration has changed since the query was sent. - -(cherry picked from commit 590f8698fc876d6d72f75cf35359e7546c3af972) - -Check cached names for possible "forward only" clause - -When caching additional and glue data *not* from a forwarder, we must -check that there is no "forward only" clause covering the owner name -that would take precedence. Such names would normally be allowed by -baliwick rules, but a "forward only" zone introduces a new baliwick -scope. - -(cherry picked from commit 4a144fae16e70517be894a971cef1d085ee68ebe) - -Look for zones deeper than the current domain or forward name - -When caching glue, we need to ensure that there is no closer -source of truth for the name. If the owner name for the glue -record would be answered by a locally configured zone, do not -cache. - -(cherry picked from commit 42f8c538d3fb9d075b98d82688aeb71621798754) - -Avoid use of compound literals - -Compound literals are not used in BIND 9.11, in order to ensure backward -compatibility with ancient compilers. Rework the relevant parts of the -BIND 9.11 backport of the CVE-2021-25220 fix so that compound literals -are not used. - -(cherry picked from commit d4b1efbcbd4dfb8c6ef303968992440c5bdeed15) ---- - lib/dns/resolver.c | 130 +++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 125 insertions(+), 5 deletions(-) - -diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c -index c912f3aea8..2c68973899 100644 ---- a/lib/dns/resolver.c -+++ b/lib/dns/resolver.c -@@ -63,6 +63,7 @@ - #include - #include - #include -+#include - - #ifdef WANT_QUERYTRACE - #define RTRACE(m) isc_log_write(dns_lctx, \ -@@ -312,6 +313,8 @@ struct fetchctx { - bool ns_ttl_ok; - uint32_t ns_ttl; - isc_counter_t * qc; -+ dns_fixedname_t fwdfname; -+ dns_name_t *fwdname; - - /*% - * The number of events we're waiting for. -@@ -3393,6 +3396,7 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) { - if (result == ISC_R_SUCCESS) { - fwd = ISC_LIST_HEAD(forwarders->fwdrs); - fctx->fwdpolicy = forwarders->fwdpolicy; -+ dns_name_copy(domain, fctx->fwdname, NULL); - if (fctx->fwdpolicy == dns_fwdpolicy_only && - isstrictsubdomain(domain, &fctx->domain)) { - fcount_decr(fctx); -@@ -4422,6 +4426,9 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, - fctx->restarts = 0; - fctx->querysent = 0; - fctx->referrals = 0; -+ -+ fctx->fwdname = dns_fixedname_initname(&fctx->fwdfname); -+ - TIME_NOW(&fctx->start); - fctx->timeouts = 0; - fctx->lamecount = 0; -@@ -4480,8 +4487,10 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, - domain = dns_fixedname_initname(&fixed); - result = dns_fwdtable_find2(fctx->res->view->fwdtable, fwdname, - domain, &forwarders); -- if (result == ISC_R_SUCCESS) -+ if (result == ISC_R_SUCCESS) { - fctx->fwdpolicy = forwarders->fwdpolicy; -+ dns_name_copy(domain, fctx->fwdname, NULL); -+ } - - if (fctx->fwdpolicy != dns_fwdpolicy_only) { - /* -@@ -6231,6 +6240,112 @@ mark_related(dns_name_t *name, dns_rdataset_t *rdataset, - rdataset->attributes |= DNS_RDATASETATTR_EXTERNAL; - } - -+/* -+ * Returns true if 'name' is external to the namespace for which -+ * the server being queried can answer, either because it's not a -+ * subdomain or because it's below a forward declaration or a -+ * locally served zone. -+ */ -+static inline bool -+name_external(dns_name_t *name, dns_rdatatype_t type, fetchctx_t *fctx) { -+ isc_result_t result; -+ dns_forwarders_t *forwarders = NULL; -+ dns_fixedname_t fixed, zfixed; -+ dns_name_t *fname = dns_fixedname_initname(&fixed); -+ dns_name_t *zfname = dns_fixedname_initname(&zfixed); -+ dns_name_t *apex = NULL; -+ dns_name_t suffix; -+ dns_zone_t *zone = NULL; -+ unsigned int labels; -+ dns_namereln_t rel; -+ /* -+ * The following two variables do not influence code flow; they are -+ * only necessary for calling dns_name_fullcompare(). -+ */ -+ int _orderp = 0; -+ unsigned int _nlabelsp = 0; -+ -+ apex = ISFORWARDER(fctx->addrinfo) ? fctx->fwdname : &fctx->domain; -+ -+ /* -+ * The name is outside the queried namespace. -+ */ -+ rel = dns_name_fullcompare(name, apex, &_orderp, &_nlabelsp); -+ if (rel != dns_namereln_subdomain && rel != dns_namereln_equal) { -+ return (true); -+ } -+ -+ /* -+ * If the record lives in the parent zone, adjust the name so we -+ * look for the correct zone or forward clause. -+ */ -+ labels = dns_name_countlabels(name); -+ if (dns_rdatatype_atparent(type) && labels > 1U) { -+ dns_name_init(&suffix, NULL); -+ dns_name_getlabelsequence(name, 1, labels - 1, &suffix); -+ name = &suffix; -+ } else if (rel == dns_namereln_equal) { -+ /* If 'name' is 'apex', no further checking is needed. */ -+ return (false); -+ } -+ -+ /* -+ * If there is a locally served zone between 'apex' and 'name' -+ * then don't cache. -+ */ -+ LOCK(&fctx->res->view->lock); -+ if (fctx->res->view->zonetable != NULL) { -+ unsigned int options = DNS_ZTFIND_NOEXACT; -+ result = dns_zt_find(fctx->res->view->zonetable, name, options, -+ zfname, &zone); -+ if (zone != NULL) { -+ dns_zone_detach(&zone); -+ } -+ if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { -+ if (dns_name_fullcompare(zfname, apex, &_orderp, -+ &_nlabelsp) == -+ dns_namereln_subdomain) -+ { -+ UNLOCK(&fctx->res->view->lock); -+ return (true); -+ } -+ } -+ } -+ UNLOCK(&fctx->res->view->lock); -+ -+ /* -+ * Look for a forward declaration below 'name'. -+ */ -+ result = dns_fwdtable_find2(fctx->res->view->fwdtable, name, fname, -+ &forwarders); -+ -+ if (ISFORWARDER(fctx->addrinfo)) { -+ /* -+ * See if the forwarder declaration is better. -+ */ -+ if (result == ISC_R_SUCCESS) { -+ return (!dns_name_equal(fname, fctx->fwdname)); -+ } -+ -+ /* -+ * If the lookup failed, the configuration must have -+ * changed: play it safe and don't cache. -+ */ -+ return (true); -+ } else if (result == ISC_R_SUCCESS && -+ forwarders->fwdpolicy == dns_fwdpolicy_only && -+ !ISC_LIST_EMPTY(forwarders->fwdrs)) -+ { -+ /* -+ * If 'name' is covered by a 'forward only' clause then we -+ * can't cache this repsonse. -+ */ -+ return (true); -+ } -+ -+ return (false); -+} -+ - static isc_result_t - check_section(void *arg, dns_name_t *addname, dns_rdatatype_t type, - dns_section_t section) -@@ -6259,7 +6374,7 @@ check_section(void *arg, dns_name_t *addname, dns_rdatatype_t type, - result = dns_message_findname(rmessage, section, addname, - dns_rdatatype_any, 0, &name, NULL); - if (result == ISC_R_SUCCESS) { -- external = !dns_name_issubdomain(name, &fctx->domain); -+ external = name_external(name, type, fctx); - if (type == dns_rdatatype_a) { - for (rdataset = ISC_LIST_HEAD(name->list); - rdataset != NULL; -@@ -7141,6 +7256,13 @@ answer_response(fetchctx_t *fctx, dns_message_t *message) { - break; - - case dns_namereln_subdomain: -+ /* -+ * Don't accept DNAME from parent namespace. -+ */ -+ if (name_external(name, dns_rdatatype_dname, fctx)) { -+ continue; -+ } -+ - /* - * In-scope DNAME records must have at least - * as many labels as the domain being queried. -@@ -7376,11 +7498,9 @@ answer_response(fetchctx_t *fctx, dns_message_t *message) { - */ - result = dns_message_firstname(message, DNS_SECTION_AUTHORITY); - while (!done && result == ISC_R_SUCCESS) { -- bool external; - name = NULL; - dns_message_currentname(message, DNS_SECTION_AUTHORITY, &name); -- external = !dns_name_issubdomain(name, &fctx->domain); -- if (!external) { -+ if (!name_external(name, dns_rdatatype_ns, fctx)) { - /* - * We expect to find NS or SIG NS rdatasets, and - * nothing else. --- -2.34.1 - diff --git a/SOURCES/bind-9.11-CVE-2022-2795.patch b/SOURCES/bind-9.11-CVE-2022-2795.patch deleted file mode 100644 index 2175637..0000000 --- a/SOURCES/bind-9.11-CVE-2022-2795.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 05cdbc1006cee6daaa29e5423976d56047d22461 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= -Date: Thu, 8 Sep 2022 11:11:30 +0200 -Subject: [PATCH] Bound the amount of work performed for delegations - -Limit the amount of database lookups that can be triggered in -fctx_getaddresses() (i.e. when determining the name server addresses to -query next) by setting a hard limit on the number of NS RRs processed -for any delegation encountered. Without any limit in place, named can -be forced to perform large amounts of database lookups per each query -received, which severely impacts resolver performance. - -The limit used (20) is an arbitrary value that is considered to be big -enough for any sane DNS delegation. - -(cherry picked from commit 3a44097fd6c6c260765b628cd1d2c9cb7efb0b2a) -(cherry picked from commit bf2ea6d8525bfd96a84dad221ba9e004adb710a8) ---- - lib/dns/resolver.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c -index 8ae9a993bb..ac9a9ef5d0 100644 ---- a/lib/dns/resolver.c -+++ b/lib/dns/resolver.c -@@ -180,6 +180,12 @@ - */ - #define NS_FAIL_LIMIT 4 - #define NS_RR_LIMIT 5 -+/* -+ * IP address lookups are performed for at most NS_PROCESSING_LIMIT NS RRs in -+ * any NS RRset encountered, to avoid excessive resource use while processing -+ * large delegations. -+ */ -+#define NS_PROCESSING_LIMIT 20 - - /* Number of hash buckets for zone counters */ - #ifndef RES_DOMAIN_BUCKETS -@@ -3318,6 +3324,7 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) { - bool need_alternate = false; - bool all_spilled = true; - unsigned int no_addresses = 0; -+ unsigned int ns_processed = 0; - - FCTXTRACE5("getaddresses", "fctx->depth=", fctx->depth); - -@@ -3504,6 +3511,11 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) { - - dns_rdata_reset(&rdata); - dns_rdata_freestruct(&ns); -+ -+ if (++ns_processed >= NS_PROCESSING_LIMIT) { -+ result = ISC_R_NOMORE; -+ break; -+ } - } - if (result != ISC_R_NOMORE) { - return (result); --- -2.37.3 - diff --git a/SOURCES/bind-9.11-CVE-2023-2828-fixup.patch b/SOURCES/bind-9.11-CVE-2023-2828-fixup.patch deleted file mode 100644 index b1865ed..0000000 --- a/SOURCES/bind-9.11-CVE-2023-2828-fixup.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 6c26ede8edcb700caca12c501c6c129801989526 Mon Sep 17 00:00:00 2001 -From: Mark Andrews -Date: Fri, 23 Feb 2024 10:12:47 +1100 -Subject: [PATCH] Do not use header_prev in expire_lru_headers - -dns__cacherbt_expireheader can unlink / free header_prev underneath -it. Use ISC_LIST_TAIL after calling dns__cacherbt_expireheader -instead to get the next pointer to be processed. - -(cherry picked from commit 7ce2e86024f022decb2678963538515ca39ab4ab) -(cherry picked from commit f88f21b7d890eb80097f4bd434fedb29c2f9ff63) ---- - lib/dns/rbtdb.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c -index cc40eaec60..ee59c1b18b 100644 ---- a/lib/dns/rbtdb.c -+++ b/lib/dns/rbtdb.c -@@ -10667,19 +10667,19 @@ update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - static size_t - expire_lru_headers(dns_rbtdb_t *rbtdb, unsigned int locknum, size_t purgesize, - bool tree_locked) { -- rdatasetheader_t *header, *header_prev; -+ rdatasetheader_t *header; - size_t purged = 0; - - for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]); -- header != NULL && purged <= purgesize; header = header_prev) -+ header != NULL && purged <= purgesize; -+ header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum])) - { -- header_prev = ISC_LIST_PREV(header, link); - /* - * Unlink the entry at this point to avoid checking it - * again even if it's currently used someone else and - * cannot be purged at this moment. This entry won't be - * referenced any more (so unlinking is safe) since the -- * TTL was reset to 0. -+ * TTL will be reset to 0. - */ - ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header, link); - size_t header_size = rdataset_size(header); --- -2.43.2 - diff --git a/SOURCES/bind-9.11-CVE-2023-2828.patch b/SOURCES/bind-9.11-CVE-2023-2828.patch deleted file mode 100644 index 42c0132..0000000 --- a/SOURCES/bind-9.11-CVE-2023-2828.patch +++ /dev/null @@ -1,193 +0,0 @@ -From f3aa755ba5ae5148dd0567357f8c538072e2eabc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= -Date: Tue, 30 May 2023 08:46:17 +0200 -Subject: [PATCH] Improve RBT overmem cache cleaning - -When cache memory usage is over the configured cache size (overmem) and -we are cleaning unused entries, it might not be enough to clean just two -entries if the entries to be expired are smaller than the newly added -rdata. This could be abused by an attacker to cause a remote Denial of -Service by possibly running out of the operating system memory. - -Currently, the addrdataset() tries to do a single TTL-based cleaning -considering the serve-stale TTL and then optionally moves to overmem -cleaning if we are in that condition. Then the overmem_purge() tries to -do another single TTL based cleaning from the TTL heap and then continue -with LRU-based cleaning up to 2 entries cleaned. - -Squash the TTL-cleaning mechanism into single call from addrdataset(), -but ignore the serve-stale TTL if we are currently overmem. - -Then instead of having a fixed number of entries to clean, pass the size -of newly added rdatasetheader to the overmem_purge() function and -cleanup at least the size of the newly added data. This prevents the -cache going over the configured memory limit (`max-cache-size`). - -Additionally, refactor the overmem_purge() function to reduce for-loop -nesting for readability. ---- - lib/dns/rbtdb.c | 109 +++++++++++++++++++++++++++++------------------- - 1 file changed, 67 insertions(+), 42 deletions(-) - -diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c -index 11203e4..cc40eae 100644 ---- a/lib/dns/rbtdb.c -+++ b/lib/dns/rbtdb.c -@@ -834,7 +834,7 @@ static void update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - static void expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - bool tree_locked, expire_t reason); - static void overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, -- isc_stdtime_t now, bool tree_locked); -+ size_t purgesize, bool tree_locked); - static isc_result_t resign_insert(dns_rbtdb_t *rbtdb, int idx, - rdatasetheader_t *newheader); - static void resign_delete(dns_rbtdb_t *rbtdb, rbtdb_version_t *version, -@@ -6937,6 +6937,16 @@ addclosest(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader, - - static dns_dbmethods_t zone_methods; - -+static size_t -+rdataset_size(rdatasetheader_t *header) { -+ if (!NONEXISTENT(header)) { -+ return (dns_rdataslab_size((unsigned char *)header, -+ sizeof(*header))); -+ } -+ -+ return (sizeof(*header)); -+} -+ - static isc_result_t - addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, - isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options, -@@ -7091,7 +7101,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, - } - - if (cache_is_overmem) -- overmem_purge(rbtdb, rbtnode->locknum, now, tree_locked); -+ overmem_purge(rbtdb, rbtnode->locknum, rdataset_size(newheader), -+ tree_locked); - - NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock, - isc_rwlocktype_write); -@@ -7106,9 +7117,19 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, - cleanup_dead_nodes(rbtdb, rbtnode->locknum); - - header = isc_heap_element(rbtdb->heaps[rbtnode->locknum], 1); -- if (header && header->rdh_ttl < now - RBTDB_VIRTUAL) -- expire_header(rbtdb, header, tree_locked, -- expire_ttl); -+ if (header != NULL) { -+ dns_ttl_t rdh_ttl = header->rdh_ttl; -+ -+ /* Only account for stale TTL if cache is not overmem */ -+ if (!cache_is_overmem) { -+ rdh_ttl += rbtdb->serve_stale_ttl; -+ } -+ -+ if (rdh_ttl < now - RBTDB_VIRTUAL) { -+ expire_header(rbtdb, header, tree_locked, -+ expire_ttl); -+ } -+ } - - /* - * If we've been holding a write lock on the tree just for -@@ -10643,54 +10664,58 @@ update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - ISC_LIST_PREPEND(rbtdb->rdatasets[header->node->locknum], header, link); - } - -+static size_t -+expire_lru_headers(dns_rbtdb_t *rbtdb, unsigned int locknum, size_t purgesize, -+ bool tree_locked) { -+ rdatasetheader_t *header, *header_prev; -+ size_t purged = 0; -+ -+ for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]); -+ header != NULL && purged <= purgesize; header = header_prev) -+ { -+ header_prev = ISC_LIST_PREV(header, link); -+ /* -+ * Unlink the entry at this point to avoid checking it -+ * again even if it's currently used someone else and -+ * cannot be purged at this moment. This entry won't be -+ * referenced any more (so unlinking is safe) since the -+ * TTL was reset to 0. -+ */ -+ ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header, link); -+ size_t header_size = rdataset_size(header); -+ expire_header(rbtdb, header, tree_locked, expire_lru); -+ purged += header_size; -+ } -+ -+ return (purged); -+} -+ - /*% -- * Purge some expired and/or stale (i.e. unused for some period) cache entries -- * under an overmem condition. To recover from this condition quickly, up to -- * 2 entries will be purged. This process is triggered while adding a new -- * entry, and we specifically avoid purging entries in the same LRU bucket as -- * the one to which the new entry will belong. Otherwise, we might purge -- * entries of the same name of different RR types while adding RRsets from a -- * single response (consider the case where we're adding A and AAAA glue records -- * of the same NS name). -+ * Purge some stale (i.e. unused for some period - LRU based cleaning) cache -+ * entries under the overmem condition. To recover from this condition quickly, -+ * we cleanup entries up to the size of newly added rdata (passed as purgesize). -+ * -+ * This process is triggered while adding a new entry, and we specifically avoid -+ * purging entries in the same LRU bucket as the one to which the new entry will -+ * belong. Otherwise, we might purge entries of the same name of different RR -+ * types while adding RRsets from a single response (consider the case where -+ * we're adding A and AAAA glue records of the same NS name). - */ - static void --overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, -- isc_stdtime_t now, bool tree_locked) -+overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, size_t purgesize, -+ bool tree_locked) - { -- rdatasetheader_t *header, *header_prev; - unsigned int locknum; -- int purgecount = 2; -+ size_t purged = 0; - - for (locknum = (locknum_start + 1) % rbtdb->node_lock_count; -- locknum != locknum_start && purgecount > 0; -+ locknum != locknum_start && purged <= purgesize; - locknum = (locknum + 1) % rbtdb->node_lock_count) { - NODE_LOCK(&rbtdb->node_locks[locknum].lock, - isc_rwlocktype_write); - -- header = isc_heap_element(rbtdb->heaps[locknum], 1); -- if (header && header->rdh_ttl < now - RBTDB_VIRTUAL) { -- expire_header(rbtdb, header, tree_locked, -- expire_ttl); -- purgecount--; -- } -- -- for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]); -- header != NULL && purgecount > 0; -- header = header_prev) { -- header_prev = ISC_LIST_PREV(header, link); -- /* -- * Unlink the entry at this point to avoid checking it -- * again even if it's currently used someone else and -- * cannot be purged at this moment. This entry won't be -- * referenced any more (so unlinking is safe) since the -- * TTL was reset to 0. -- */ -- ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header, -- link); -- expire_header(rbtdb, header, tree_locked, -- expire_lru); -- purgecount--; -- } -+ purged += expire_lru_headers(rbtdb, locknum, purgesize - purged, -+ tree_locked); - - NODE_UNLOCK(&rbtdb->node_locks[locknum].lock, - isc_rwlocktype_write); --- -2.40.1 - diff --git a/SOURCES/bind-9.11-CVE-2023-4408.patch b/SOURCES/bind-9.11-CVE-2023-4408.patch deleted file mode 100644 index 74188c6..0000000 --- a/SOURCES/bind-9.11-CVE-2023-4408.patch +++ /dev/null @@ -1,3154 +0,0 @@ -From 1030b5cef8643ebd692f75a8bf671d650fbcb377 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= -Date: Mon, 11 Sep 2023 10:35:28 +0200 -Subject: [PATCH] Use hashtable when parsing a message - -When parsing messages use a hashtable instead of a linear search to reduce -the amount of work done in findname when there's more than one name in -the section. - -There are two hashtables: - -1) hashtable for owner names - that's constructed for each section when we -hit the second name in the section and destroyed right after parsing -that section; - -2) per-name hashtable - for each name in the section, we construct a new -hashtable for that name if there are more than one rdataset for that -particular name. - -(cherry picked from commit b8a96317544c7b310b4f74360825a87b6402ddc2) -(cherry picked from commit 0ceed03ebea395da1a39ad1cb39205ce75a3f768) - -Backport isc_ht API changes from BIND 9.18 - -To prevent allocating large hashtable in dns_message, we need to -backport the improvements to isc_ht API from BIND 9.18+ that includes -support for case insensitive keys and incremental rehashing of the -hashtables. - -(cherry picked from commit a4baf324159ec3764195c949cb56c861d9f173ff) -(cherry picked from commit 2fc28056b33018f7f78b625409eb44c32d5c9b11) - -fix a message parsing regression - -the fix for CVE-2023-4408 introduced a regression in the message -parser, which could cause a crash if duplicate rdatasets were found -in the question section. this commit ensures that rdatasets are -correctly disassociated and freed when this occurs. - -(cherry picked from commit 4c19d35614f8cd80d8748156a5bad361e19abc28) -(cherry picked from commit 98ab8c81cc7739dc220aa3f50efa3061774de8ba) - -fix another message parsing regression - -The fix for CVE-2023-4408 introduced a regression in the message -parser, which could cause a crash if an rdata type that can only -occur in the question was found in another section. - -(cherry picked from commit 510f1de8a6add516b842a55750366944701d3d9a) -(cherry picked from commit bbbcaf8b2ec17d2cad28841ea86078168072ae2f) - -Apply various tweaks specific to BIND 9.11 - -(cherry picked from commit c6026cbbaa9d297910af350fa6cc45788cc9f397) - -Fix case insensitive matching in isc_ht hash table implementation - -The case insensitive matching in isc_ht was basically completely broken -as only the hashvalue computation was case insensitive, but the key -comparison was always case sensitive. - -(cherry picked from commit c462d65b2fd0db362947db4a18a87df78f8d8e5d) -(cherry picked from commit 418b3793598a1e1c7e391bb317866d405cd03501) - -Add a system test for mixed-case data for the same owner - -We were missing a test where a single owner name would have multiple -types with a different case. The generated RRSIGs and NSEC records will -then have different case than the signed records and message parser have -to cope with that and treat everything as the same owner. - -(cherry picked from commit c8b623d87f0fb8f9cba8dea5c6a4b600953895e7) -(cherry picked from commit 1f9bbe1fe34b7a2c9765431e8a86b460afc9b323) - -6315. [security] Speed up parsing of DNS messages with many different - names. (CVE-2023-4408) [GL #4234] ---- - .../system/dnssec/ns3/secure.example.db.in | 5 + - bin/tests/system/dnssec/ns3/sign.sh | 321 +++++----- - bin/tests/system/dnssec/tests.sh | 15 + - lib/dns/catz.c | 50 +- - lib/dns/include/dns/message.h | 39 -- - lib/dns/include/dns/name.h | 9 +- - lib/dns/message.c | 571 +++++++++++------ - lib/dns/name.c | 1 + - lib/isc/ht.c | 600 +++++++++++++----- - lib/isc/include/isc/ht.h | 52 +- - lib/isc/tests/ht_test.c | 69 +- - 11 files changed, 1097 insertions(+), 635 deletions(-) - -diff --git a/bin/tests/system/dnssec/ns3/secure.example.db.in b/bin/tests/system/dnssec/ns3/secure.example.db.in -index a097227278..be6b3f45b1 100644 ---- a/bin/tests/system/dnssec/ns3/secure.example.db.in -+++ b/bin/tests/system/dnssec/ns3/secure.example.db.in -@@ -44,3 +44,8 @@ rrsigonly A 10.0.0.29 - cnameandkey CNAME @ - cnamenokey CNAME @ - dnameandkey DNAME @ -+ -+mixedcase A 10.0.0.30 -+mixedCASE TXT "mixed case" -+MIXEDcase AAAA 2002:: -+mIxEdCaSe LOC 37 52 56.788 N 121 54 55.02 W 1120m 10m 100m 10m -diff --git a/bin/tests/system/dnssec/ns3/sign.sh b/bin/tests/system/dnssec/ns3/sign.sh -index 7caf29c3b2..9af0ca5a47 100644 ---- a/bin/tests/system/dnssec/ns3/sign.sh -+++ b/bin/tests/system/dnssec/ns3/sign.sh -@@ -15,39 +15,38 @@ SYSTEMTESTTOP=../.. - echo_i "ns3/sign.sh" - - infile=key.db.in --for tld in managed trusted --do -+for tld in managed trusted; do - # A secure zone to test. - zone=secure.${tld} - zonefile=${zone}.db - -- keyname1=`$KEYGEN -f KSK -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -- cat $infile $keyname1.key > $zonefile -- $SIGNER -z -P -3 - -o $zone -r $RANDFILE -O full -f ${zonefile}.signed $zonefile > /dev/null 2>&1 -- DSFILE=dsset-`echo ${zone} |sed -e "s/\.$//g"`$TP -- $DSFROMKEY -A -f ${zonefile}.signed $zone > $DSFILE -+ keyname1=$($KEYGEN -f KSK -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) -+ cat $infile $keyname1.key >$zonefile -+ $SIGNER -z -P -3 - -o $zone -r $RANDFILE -O full -f ${zonefile}.signed $zonefile >/dev/null 2>&1 -+ DSFILE=dsset-$(echo ${zone} | sed -e "s/\.$//g")$TP -+ $DSFROMKEY -A -f ${zonefile}.signed $zone >$DSFILE - - # Zone to test trust anchor with unsupported algorithm. - zone=unsupported.${tld} - zonefile=${zone}.db - -- keyname2=`$KEYGEN -f KSK -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -- cat $infile $keyname2.key > $zonefile -- $SIGNER -z -P -3 - -o $zone -r $RANDFILE -O full -f ${zonefile}.tmp $zonefile > /dev/null 2>&1 -- awk '$4 == "DNSKEY" { $7 = 255 } $4 == "RRSIG" { $6 = 255 } { print }' ${zonefile}.tmp > ${zonefile}.signed -- DSFILE=dsset-`echo ${zone} |sed -e "s/\.$//g"`$TP -- $DSFROMKEY -A -f ${zonefile}.signed $zone > $DSFILE -+ keyname2=$($KEYGEN -f KSK -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) -+ cat $infile $keyname2.key >$zonefile -+ $SIGNER -z -P -3 - -o $zone -r $RANDFILE -O full -f ${zonefile}.tmp $zonefile >/dev/null 2>&1 -+ awk '$4 == "DNSKEY" { $7 = 255 } $4 == "RRSIG" { $6 = 255 } { print }' ${zonefile}.tmp >${zonefile}.signed -+ DSFILE=dsset-$(echo ${zone} | sed -e "s/\.$//g")$TP -+ $DSFROMKEY -A -f ${zonefile}.signed $zone >$DSFILE - - # Make trusted-keys and managed keys conf sections for ns8. - mv ${keyname2}.key ${keyname2}.tmp -- awk '$1 == "unsupported.'"${tld}"'." { $6 = 255 } { print }' ${keyname2}.tmp > ${keyname2}.key -+ awk '$1 == "unsupported.'"${tld}"'." { $6 = 255 } { print }' ${keyname2}.tmp >${keyname2}.key - - case $tld in - "managed") -- keyfile_to_managed_keys $keyname1 $keyname2 > ../ns8/managed.conf -+ keyfile_to_managed_keys $keyname1 $keyname2 >../ns8/managed.conf - ;; - "trusted") -- keyfile_to_trusted_keys $keyname1 $keyname2 > ../ns8/trusted.conf -+ keyfile_to_trusted_keys $keyname1 $keyname2 >../ns8/trusted.conf - ;; - esac - done -@@ -58,49 +57,51 @@ zone=secure.example. - infile=secure.example.db.in - zonefile=secure.example.db - --cnameandkey=`$KEYGEN -T KEY -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n host cnameandkey.$zone` --dnameandkey=`$KEYGEN -T KEY -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n host dnameandkey.$zone` --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+cnameandkey=$($KEYGEN -T KEY -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n host cnameandkey.$zone) -+dnameandkey=$($KEYGEN -T KEY -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n host dnameandkey.$zone) -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $cnameandkey.key $dnameandkey.key $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -D -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 -+cat "$zonefile" "$zonefile".signed >"$zonefile".tmp -+mv "$zonefile".tmp "$zonefile".signed - - zone=bogus.example. - infile=bogus.example.db.in - zonefile=bogus.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - zone=dynamic.example. - infile=dynamic.example.db.in - zonefile=dynamic.example.db - --keyname1=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` --keyname2=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b 1024 -n zone -f KSK $zone` -+keyname1=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) -+keyname2=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b 1024 -n zone -f KSK $zone) - - cat $infile $keyname1.key $keyname2.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - zone=keyless.example. - infile=generic.example.db.in - zonefile=keyless.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # Change the signer field of the a.b.keyless.example SIG A - # to point to a provably nonexistent KEY record. - mv $zonefile.signed $zonefile.tmp --<$zonefile.tmp $PERL -p -e 's/ keyless.example/ b.keyless.example/ -+$PERL <$zonefile.tmp -p -e 's/ keyless.example/ b.keyless.example/ - if /^a.b.keyless.example/../NXT/;' >$zonefile.signed - rm -f $zonefile.tmp - -@@ -111,11 +112,11 @@ zone=secure.nsec3.example. - infile=secure.nsec3.example.db.in - zonefile=secure.nsec3.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # NSEC3/NSEC3 test zone -@@ -124,11 +125,11 @@ zone=nsec3.nsec3.example. - infile=nsec3.nsec3.example.db.in - zonefile=nsec3.nsec3.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # OPTOUT/NSEC3 test zone -@@ -137,11 +138,11 @@ zone=optout.nsec3.example. - infile=optout.nsec3.example.db.in - zonefile=optout.nsec3.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -A -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -A -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A nsec3 zone (non-optout). -@@ -150,11 +151,11 @@ zone=nsec3.example. - infile=nsec3.example.db.in - zonefile=nsec3.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -g -3 - -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -g -3 - -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # OPTOUT/NSEC test zone -@@ -163,11 +164,11 @@ zone=secure.optout.example. - infile=secure.optout.example.db.in - zonefile=secure.optout.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # OPTOUT/NSEC3 test zone -@@ -176,11 +177,11 @@ zone=nsec3.optout.example. - infile=nsec3.optout.example.db.in - zonefile=nsec3.optout.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # OPTOUT/OPTOUT test zone -@@ -189,11 +190,11 @@ zone=optout.optout.example. - infile=optout.optout.example.db.in - zonefile=optout.optout.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -A -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -A -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A optout nsec3 zone. -@@ -202,11 +203,11 @@ zone=optout.example. - infile=optout.example.db.in - zonefile=optout.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -g -3 - -A -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -g -3 - -A -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A nsec3 zone (non-optout) with unknown nsec3 hash algorithm (-U). -@@ -215,11 +216,11 @@ zone=nsec3-unknown.example. - infile=nsec3-unknown.example.db.in - zonefile=nsec3-unknown.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -U -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -U -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A optout nsec3 zone with a unknown nsec3 hash algorithm (-U). -@@ -228,11 +229,11 @@ zone=optout-unknown.example. - infile=optout-unknown.example.db.in - zonefile=optout-unknown.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -U -A -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -U -A -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A zone that is signed with an unknown DNSKEY algorithm. -@@ -242,16 +243,16 @@ zone=dnskey-unknown.example - infile=dnskey-unknown.example.db.in - zonefile=dnskey-unknown.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -r $RANDFILE -o $zone -O full -f ${zonefile}.tmp $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone -O full -f ${zonefile}.tmp $zonefile >/dev/null 2>&1 - --awk '$4 == "DNSKEY" { $7 = 100 } $4 == "RRSIG" { $6 = 100 } { print }' ${zonefile}.tmp > ${zonefile}.signed -+awk '$4 == "DNSKEY" { $7 = 100 } $4 == "RRSIG" { $6 = 100 } { print }' ${zonefile}.tmp >${zonefile}.signed - - DSFILE=dsset-${zone}${TP} --$DSFROMKEY -A -f ${zonefile}.signed $zone > $DSFILE -+$DSFROMKEY -A -f ${zonefile}.signed $zone >$DSFILE - - # - # A zone that is signed with an unsupported DNSKEY algorithm (3). -@@ -261,16 +262,16 @@ zone=dnskey-unsupported.example - infile=dnskey-unsupported.example.db.in - zonefile=dnskey-unsupported.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - --cat $infile $keyname.key > $zonefile -+cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -r $RANDFILE -o $zone -O full -f ${zonefile}.tmp $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone -O full -f ${zonefile}.tmp $zonefile >/dev/null 2>&1 - --awk '$4 == "DNSKEY" { $7 = 255 } $4 == "RRSIG" { $6 = 255 } { print }' ${zonefile}.tmp > ${zonefile}.signed -+awk '$4 == "DNSKEY" { $7 = 255 } $4 == "RRSIG" { $6 = 255 } { print }' ${zonefile}.tmp >${zonefile}.signed - - DSFILE="dsset-${zone}${TP}" --$DSFROMKEY -A -f ${zonefile}.signed $zone > $DSFILE -+$DSFROMKEY -A -f ${zonefile}.signed $zone >$DSFILE - - # - # A zone with a published unsupported DNSKEY algorithm (Reserved). -@@ -280,12 +281,12 @@ zone=dnskey-unsupported-2.example - infile=dnskey-unsupported-2.example.db.in - zonefile=dnskey-unsupported-2.example.db - --ksk=`$KEYGEN -f KSK -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` --zsk=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+ksk=$($KEYGEN -f KSK -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) -+zsk=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - --cat $infile $ksk.key $zsk.key unsupported-algorithm.key > $zonefile -+cat $infile $ksk.key $zsk.key unsupported-algorithm.key >$zonefile - --$SIGNER -P -3 - -r $RANDFILE -o $zone -f ${zonefile}.signed $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone -f ${zonefile}.signed $zonefile >/dev/null 2>&1 - - # - # A zone with a unknown DNSKEY algorithm + unknown NSEC3 hash algorithm (-U). -@@ -295,16 +296,16 @@ zone=dnskey-nsec3-unknown.example - infile=dnskey-nsec3-unknown.example.db.in - zonefile=dnskey-nsec3-unknown.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -3 - -r $RANDFILE -o $zone -U -O full -f ${zonefile}.tmp $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone -U -O full -f ${zonefile}.tmp $zonefile >/dev/null 2>&1 - --awk '$4 == "DNSKEY" { $7 = 100; print } $4 == "RRSIG" { $6 = 100; print } { print }' ${zonefile}.tmp > ${zonefile}.signed -+awk '$4 == "DNSKEY" { $7 = 100; print } $4 == "RRSIG" { $6 = 100; print } { print }' ${zonefile}.tmp >${zonefile}.signed - - DSFILE=dsset-${zone}${TP} --$DSFROMKEY -A -f ${zonefile}.signed $zone > $DSFILE -+$DSFROMKEY -A -f ${zonefile}.signed $zone >$DSFILE - - # - # A multiple parameter nsec3 zone. -@@ -313,21 +314,21 @@ zone=multiple.example. - infile=multiple.example.db.in - zonefile=multiple.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - mv $zonefile.signed $zonefile --$SIGNER -P -u3 - -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -u3 - -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - mv $zonefile.signed $zonefile --$SIGNER -P -u3 AAAA -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -u3 AAAA -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - mv $zonefile.signed $zonefile --$SIGNER -P -u3 BBBB -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -u3 BBBB -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - mv $zonefile.signed $zonefile --$SIGNER -P -u3 CCCC -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -u3 CCCC -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - mv $zonefile.signed $zonefile --$SIGNER -P -u3 DDDD -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -u3 DDDD -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A RSASHA256 zone. -@@ -336,11 +337,11 @@ zone=rsasha256.example. - infile=rsasha256.example.db.in - zonefile=rsasha256.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a RSASHA256 -b 1024 -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a RSASHA256 -b 1024 -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A RSASHA512 zone. -@@ -349,11 +350,11 @@ zone=rsasha512.example. - infile=rsasha512.example.db.in - zonefile=rsasha512.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a RSASHA512 -b 1024 -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a RSASHA512 -b 1024 -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A zone with the DNSKEY set only signed by the KSK -@@ -362,10 +363,10 @@ zone=kskonly.example. - infile=kskonly.example.db.in - zonefile=kskonly.example.db - --kskname=`$KEYGEN -q -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -r $RANDFILE $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -x -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -x -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A zone with the expired signatures -@@ -374,10 +375,10 @@ zone=expired.example. - infile=expired.example.db.in - zonefile=expired.example.db - --kskname=`$KEYGEN -q -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -r $RANDFILE $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -P -r $RANDFILE -o $zone -s -1d -e +1h $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone -s -1d -e +1h $zonefile >/dev/null 2>&1 - rm -f $kskname.* $zskname.* - - # -@@ -387,10 +388,10 @@ zone=update-nsec3.example. - infile=update-nsec3.example.db.in - zonefile=update-nsec3.example.db - --kskname=`$KEYGEN -q -3 -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -3 -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -3 -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -3 -r $RANDFILE $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A NSEC signed zone that will have auto-dnssec enabled and -@@ -400,12 +401,12 @@ zone=auto-nsec.example. - infile=auto-nsec.example.db.in - zonefile=auto-nsec.example.db - --kskname=`$KEYGEN -q -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -r $RANDFILE $zone` --kskname=`$KEYGEN -q -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -r $RANDFILE $zone) -+kskname=$($KEYGEN -q -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -r $RANDFILE $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A NSEC3 signed zone that will have auto-dnssec enabled and -@@ -415,12 +416,12 @@ zone=auto-nsec3.example. - infile=auto-nsec3.example.db.in - zonefile=auto-nsec3.example.db - --kskname=`$KEYGEN -q -3 -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -3 -r $RANDFILE $zone` --kskname=`$KEYGEN -q -3 -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -3 -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -3 -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -3 -r $RANDFILE $zone) -+kskname=$($KEYGEN -q -3 -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -3 -r $RANDFILE $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # Secure below cname test zone. -@@ -428,9 +429,9 @@ $SIGNER -P -3 - -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 - zone=secure.below-cname.example. - infile=secure.below-cname.example.db.in - zonefile=secure.below-cname.example.db --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - cat $infile $keyname.key >$zonefile --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # Patched TTL test zone. -@@ -441,12 +442,12 @@ zonefile=ttlpatch.example.db - signedfile=ttlpatch.example.db.signed - patchedfile=ttlpatch.example.db.patched - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -f $signedfile -o $zone $zonefile > /dev/null 2>&1 --$CHECKZONE -D -s full $zone $signedfile 2> /dev/null | \ -- awk '{$2 = "3600"; print}' > $patchedfile -+$SIGNER -P -r $RANDFILE -f $signedfile -o $zone $zonefile >/dev/null 2>&1 -+$CHECKZONE -D -s full $zone $signedfile 2>/dev/null | -+ awk '{$2 = "3600"; print}' >$patchedfile - - # - # Separate DNSSEC records. -@@ -456,11 +457,11 @@ infile=split-dnssec.example.db.in - zonefile=split-dnssec.example.db - signedfile=split-dnssec.example.db.signed - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - cat $infile $keyname.key >$zonefile --echo '$INCLUDE "'"$signedfile"'"' >> $zonefile --: > $signedfile --$SIGNER -P -r $RANDFILE -D -o $zone $zonefile > /dev/null 2>&1 -+echo '$INCLUDE "'"$signedfile"'"' >>$zonefile -+: >$signedfile -+$SIGNER -P -r $RANDFILE -D -o $zone $zonefile >/dev/null 2>&1 - - # - # Separate DNSSEC records smart signing. -@@ -470,11 +471,11 @@ infile=split-smart.example.db.in - zonefile=split-smart.example.db - signedfile=split-smart.example.db.signed - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - cp $infile $zonefile --echo '$INCLUDE "'"$signedfile"'"' >> $zonefile --: > $signedfile --$SIGNER -P -S -r $RANDFILE -D -o $zone $zonefile > /dev/null 2>&1 -+echo '$INCLUDE "'"$signedfile"'"' >>$zonefile -+: >$signedfile -+$SIGNER -P -S -r $RANDFILE -D -o $zone $zonefile >/dev/null 2>&1 - - # - # Zone with signatures about to expire, but no private key to replace them -@@ -483,10 +484,10 @@ zone="expiring.example." - infile="expiring.example.db.in" - zonefile="expiring.example.db" - signedfile="expiring.example.db.signed" --kskname=`$KEYGEN -q -r $RANDFILE $zone` --zskname=`$KEYGEN -q -r $RANDFILE -f KSK $zone` -+kskname=$($KEYGEN -q -r $RANDFILE $zone) -+zskname=$($KEYGEN -q -r $RANDFILE -f KSK $zone) - cp $infile $zonefile --$SIGNER -S -r $RANDFILE -e now+1mi -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -S -r $RANDFILE -e now+1mi -o $zone $zonefile >/dev/null 2>&1 - mv -f ${zskname}.private ${zskname}.private.moved - mv -f ${kskname}.private ${kskname}.private.moved - -@@ -498,12 +499,12 @@ infile="upper.example.db.in" - zonefile="upper.example.db" - lower="upper.example.db.lower" - signedfile="upper.example.db.signed" --kskname=`$KEYGEN -q -r $RANDFILE $zone` --zskname=`$KEYGEN -q -r $RANDFILE -f KSK $zone` -+kskname=$($KEYGEN -q -r $RANDFILE $zone) -+zskname=$($KEYGEN -q -r $RANDFILE -f KSK $zone) - cp $infile $zonefile --$SIGNER -P -S -r $RANDFILE -o $zone -f $lower $zonefile > /dev/null 2>/dev/null --$CHECKZONE -D upper.example $lower 2>/dev/null | \ -- sed '/RRSIG/s/ upper.example. / UPPER.EXAMPLE. /' > $signedfile -+$SIGNER -P -S -r $RANDFILE -o $zone -f $lower $zonefile >/dev/null 2>/dev/null -+$CHECKZONE -D upper.example $lower 2>/dev/null | -+ sed '/RRSIG/s/ upper.example. / UPPER.EXAMPLE. /' >$signedfile - - # - # Check that the signer's name is in lower case when zone name is in -@@ -513,10 +514,10 @@ zone="LOWER.EXAMPLE." - infile="lower.example.db.in" - zonefile="lower.example.db" - signedfile="lower.example.db.signed" --kskname=`$KEYGEN -q -r $RANDFILE $zone` --zskname=`$KEYGEN -q -r $RANDFILE -f KSK $zone` -+kskname=$($KEYGEN -q -r $RANDFILE $zone) -+zskname=$($KEYGEN -q -r $RANDFILE -f KSK $zone) - cp $infile $zonefile --$SIGNER -P -S -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -S -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # Zone with signatures about to expire, and dynamic, but configured -@@ -526,21 +527,21 @@ zone="nosign.example." - infile="nosign.example.db.in" - zonefile="nosign.example.db" - signedfile="nosign.example.db.signed" --kskname=`$KEYGEN -q -r $RANDFILE $zone` --zskname=`$KEYGEN -q -r $RANDFILE -f KSK $zone` -+kskname=$($KEYGEN -q -r $RANDFILE $zone) -+zskname=$($KEYGEN -q -r $RANDFILE -f KSK $zone) - cp $infile $zonefile --$SIGNER -S -r $RANDFILE -e now+1mi -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -S -r $RANDFILE -e now+1mi -o $zone $zonefile >/dev/null 2>&1 - # preserve a normalized copy of the NS RRSIG for comparison later --$CHECKZONE -D nosign.example nosign.example.db.signed 2>/dev/null | \ -- awk '$4 == "RRSIG" && $5 == "NS" {$2 = ""; print}' | \ -- sed 's/[ ][ ]*/ /g'> ../nosign.before -+$CHECKZONE -D nosign.example nosign.example.db.signed 2>/dev/null | -+ awk '$4 == "RRSIG" && $5 == "NS" {$2 = ""; print}' | -+ sed 's/[ ][ ]*/ /g' >../nosign.before - - # - # An inline signing zone - # - zone=inline.example. --kskname=`$KEYGEN -q -3 -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -3 -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -3 -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -3 -r $RANDFILE $zone) - - # - # publish a new key while deactivating another key at the same time. -@@ -548,13 +549,13 @@ zskname=`$KEYGEN -q -3 -r $RANDFILE $zone` - zone=publish-inactive.example - infile=publish-inactive.example.db.in - zonefile=publish-inactive.example.db --now=`date -u +%Y%m%d%H%M%S` --kskname=`$KEYGEN -q -r $RANDFILE -f KSK $zone` --kskname=`$KEYGEN -P $now+90s -A $now+3600s -q -r $RANDFILE -f KSK $zone` --kskname=`$KEYGEN -I $now+90s -q -r $RANDFILE -f KSK $zone` --zskname=`$KEYGEN -q -r $RANDFILE $zone` -+now=$(date -u +%Y%m%d%H%M%S) -+kskname=$($KEYGEN -q -r $RANDFILE -f KSK $zone) -+kskname=$($KEYGEN -P $now+90s -A $now+3600s -q -r $RANDFILE -f KSK $zone) -+kskname=$($KEYGEN -I $now+90s -q -r $RANDFILE -f KSK $zone) -+zskname=$($KEYGEN -q -r $RANDFILE $zone) - cp $infile $zonefile --$SIGNER -S -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -S -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A zone which will change its sig-validity-interval -@@ -562,8 +563,8 @@ $SIGNER -S -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 - zone=siginterval.example - infile=siginterval.example.db.in - zonefile=siginterval.example.db --kskname=`$KEYGEN -q -3 -r $RANDFILE -fk $zone` --zskname=`$KEYGEN -q -3 -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -3 -r $RANDFILE -fk $zone) -+zskname=$($KEYGEN -q -3 -r $RANDFILE $zone) - cp $infile $zonefile - - # -@@ -574,12 +575,12 @@ zone=badds.example. - infile=bogus.example.db.in - zonefile=badds.example.db - --keyname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone` -+keyname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n zone $zone) - - cat $infile $keyname.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 --sed -e 's/bogus/badds/g' < dsset-bogus.example$TP > dsset-badds.example$TP -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 -+sed -e 's/bogus/badds/g' dsset-badds.example$TP - - # - # A zone with future signatures. -@@ -587,10 +588,10 @@ sed -e 's/bogus/badds/g' < dsset-bogus.example$TP > dsset-badds.example$TP - zone=future.example - infile=future.example.db.in - zonefile=future.example.db --kskname=`$KEYGEN -q -r $RANDFILE -f KSK $zone` --zskname=`$KEYGEN -q -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -r $RANDFILE -f KSK $zone) -+zskname=$($KEYGEN -q -r $RANDFILE $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -P -s +3600 -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -s +3600 -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - cp -f $kskname.key trusted-future.key - - # -@@ -599,10 +600,10 @@ cp -f $kskname.key trusted-future.key - zone=managed-future.example - infile=managed-future.example.db.in - zonefile=managed-future.example.db --kskname=`$KEYGEN -q -r $RANDFILE -f KSK $zone` --zskname=`$KEYGEN -q -r $RANDFILE $zone` -+kskname=$($KEYGEN -q -r $RANDFILE -f KSK $zone) -+zskname=$($KEYGEN -q -r $RANDFILE $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -P -s +3600 -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -s +3600 -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # A zone with a revoked key -@@ -611,14 +612,14 @@ zone=revkey.example. - infile=generic.example.db.in - zonefile=revkey.example.db - --ksk1=`$KEYGEN -q -r $RANDFILE -3fk $zone` --ksk1=`$REVOKE $ksk1` --ksk2=`$KEYGEN -q -r $RANDFILE -3fk $zone` --zsk1=`$KEYGEN -q -r $RANDFILE -3 $zone` -+ksk1=$($KEYGEN -q -r $RANDFILE -3fk $zone) -+ksk1=$($REVOKE $ksk1) -+ksk2=$($KEYGEN -q -r $RANDFILE -3fk $zone) -+zsk1=$($KEYGEN -q -r $RANDFILE -3 $zone) - - cat $infile ${ksk1}.key ${ksk2}.key ${zsk1}.key >$zonefile - --$SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -o $zone $zonefile >/dev/null 2>&1 - - # - # Check that NSEC3 are correctly signed and returned from below a DNAME -@@ -626,10 +627,10 @@ $SIGNER -P -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1 - zone=dname-at-apex-nsec3.example - infile=dname-at-apex-nsec3.example.db.in - zonefile=dname-at-apex-nsec3.example.db --kskname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -3fk $zone` --zskname=`$KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -3 $zone` -+kskname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -3fk $zone) -+zskname=$($KEYGEN -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -3 $zone) - cat $infile $kskname.key $zskname.key >$zonefile --$SIGNER -P -r $RANDFILE -3 - -o $zone $zonefile > /dev/null 2>&1 -+$SIGNER -P -r $RANDFILE -3 - -o $zone $zonefile >/dev/null 2>&1 - - # - # A NSEC zone with occuded data at the delegation -@@ -637,11 +638,11 @@ $SIGNER -P -r $RANDFILE -3 - -o $zone $zonefile > /dev/null 2>&1 - zone=occluded.example - infile=occluded.example.db.in - zonefile=occluded.example.db --kskname=`"$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -fk "$zone"` --zskname=`"$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS "$zone"` --dnskeyname=`"$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -fk "delegation.$zone"` --keyname=`"$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n ENTITY -T KEY "delegation.$zone"` --$DSFROMKEY "$dnskeyname.key" > "dsset-delegation.${zone}$TP" -+kskname=$("$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -fk "$zone") -+zskname=$("$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS "$zone") -+dnskeyname=$("$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -fk "delegation.$zone") -+keyname=$("$KEYGEN" -q -r $RANDFILE -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS -n ENTITY -T KEY "delegation.$zone") -+$DSFROMKEY "$dnskeyname.key" >"dsset-delegation.${zone}$TP" - cat "$infile" "${kskname}.key" "${zskname}.key" "${keyname}.key" \ -- "${dnskeyname}.key" "dsset-delegation.${zone}$TP" >"$zonefile" --"$SIGNER" -P -r $RANDFILE -o "$zone" "$zonefile" > /dev/null 2>&1 -+ "${dnskeyname}.key" "dsset-delegation.${zone}$TP" >"$zonefile" -+"$SIGNER" -P -r $RANDFILE -o "$zone" "$zonefile" >/dev/null 2>&1 -diff --git a/bin/tests/system/dnssec/tests.sh b/bin/tests/system/dnssec/tests.sh -index 2f34b6d118..1eb97f42c5 100644 ---- a/bin/tests/system/dnssec/tests.sh -+++ b/bin/tests/system/dnssec/tests.sh -@@ -743,6 +743,21 @@ n=`expr $n + 1` - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -+echo_i "checking mixed-case positive validation ($n)" -+ret=0 -+for type in a txt aaaa loc; do -+ $DIG $DIGOPTS +noauth mixedcase.secure.example. \ -+ @10.53.0.3 $type >dig.out.$type.ns3.test$n || ret=1 -+ $DIG $DIGOPTS +noauth mixedcase.secure.example. \ -+ @10.53.0.4 $type >dig.out.$type.ns4.test$n || ret=1 -+ digcomp --lc dig.out.$type.ns3.test$n dig.out.$type.ns4.test$n || ret=1 -+ grep "status: NOERROR" dig.out.$type.ns4.test$n >/dev/null || ret=1 -+ grep "flags:.*ad.*QUERY" dig.out.$type.ns4.test$n >/dev/null || ret=1 -+done -+n=$((n + 1)) -+test "$ret" -eq 0 || echo_i "failed" -+status=$((status + ret)) -+ - echo_i "checking multi-stage positive validation NSEC/NSEC3 ($n)" - ret=0 - $DIG $DIGOPTS +noauth a.nsec3.example. \ -diff --git a/lib/dns/catz.c b/lib/dns/catz.c -index 304b038637..df101e3225 100644 ---- a/lib/dns/catz.c -+++ b/lib/dns/catz.c -@@ -398,33 +398,21 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) { - - dns_name_format(&target->name, czname, DNS_NAME_FORMATSIZE); - -- result = isc_ht_init(&toadd, target->catzs->mctx, 16); -- if (result != ISC_R_SUCCESS) -- goto cleanup; -+ isc_ht_init(&toadd, target->catzs->mctx, 16, ISC_HT_CASE_SENSITIVE); - -- result = isc_ht_init(&tomod, target->catzs->mctx, 16); -- if (result != ISC_R_SUCCESS) -- goto cleanup; -+ isc_ht_init(&tomod, target->catzs->mctx, 16, ISC_HT_CASE_SENSITIVE); - -- result = isc_ht_iter_create(newzone->entries, &iter1); -- if (result != ISC_R_SUCCESS) -- goto cleanup; -+ isc_ht_iter_create(newzone->entries, &iter1); - -- result = isc_ht_iter_create(target->entries, &iter2); -- if (result != ISC_R_SUCCESS) -- goto cleanup; -+ isc_ht_iter_create(target->entries, &iter2); - - /* - * We can create those iterators now, even though toadd and tomod are - * empty - */ -- result = isc_ht_iter_create(toadd, &iteradd); -- if (result != ISC_R_SUCCESS) -- goto cleanup; -+ isc_ht_iter_create(toadd, &iteradd); - -- result = isc_ht_iter_create(tomod, &itermod); -- if (result != ISC_R_SUCCESS) -- goto cleanup; -+ isc_ht_iter_create(tomod, &itermod); - - /* - * First - walk the new zone and find all nodes that are not in the -@@ -570,7 +558,6 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) { - - result = ISC_R_SUCCESS; - --cleanup: - if (iter1 != NULL) - isc_ht_iter_destroy(&iter1); - if (iter2 != NULL) -@@ -610,9 +597,7 @@ dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm, - if (result != ISC_R_SUCCESS) - goto cleanup_mutex; - -- result = isc_ht_init(&new_zones->zones, mctx, 4); -- if (result != ISC_R_SUCCESS) -- goto cleanup_refcount; -+ isc_ht_init(&new_zones->zones, mctx, 4, ISC_HT_CASE_SENSITIVE); - - isc_mem_attach(mctx, &new_zones->mctx); - new_zones->zmm = zmm; -@@ -629,7 +614,6 @@ dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm, - - cleanup_ht: - isc_ht_destroy(&new_zones->zones); -- cleanup_refcount: - isc_refcount_destroy(&new_zones->refs); - cleanup_mutex: - isc_mutex_destroy(&new_zones->lock); -@@ -672,9 +656,7 @@ dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep, - if (result != ISC_R_SUCCESS) - goto cleanup_newzone; - -- result = isc_ht_init(&new_zone->entries, catzs->mctx, 4); -- if (result != ISC_R_SUCCESS) -- goto cleanup_name; -+ isc_ht_init(&new_zone->entries, catzs->mctx, 4, ISC_HT_CASE_SENSITIVE); - - new_zone->updatetimer = NULL; - result = isc_timer_create(catzs->timermgr, isc_timertype_inactive, -@@ -703,7 +685,6 @@ dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep, - - cleanup_ht: - isc_ht_destroy(&new_zone->entries); -- cleanup_name: - dns_name_free(&new_zone->name, catzs->mctx); - cleanup_newzone: - isc_mem_put(catzs->mctx, new_zone, sizeof(*new_zone)); -@@ -805,8 +786,7 @@ dns_catz_zone_detach(dns_catz_zone_t **zonep) { - if (refs == 0) { - isc_mem_t *mctx = zone->catzs->mctx; - if (zone->entries != NULL) { -- result = isc_ht_iter_create(zone->entries, &iter); -- INSIST(result == ISC_R_SUCCESS); -+ isc_ht_iter_create(zone->entries, &iter); - for (result = isc_ht_iter_first(iter); - result == ISC_R_SUCCESS; - result = isc_ht_iter_delcurrent_next(iter)) -@@ -865,8 +845,7 @@ dns_catz_catzs_detach(dns_catz_zones_t **catzsp) { - catzs->magic = 0; - DESTROYLOCK(&catzs->lock); - if (catzs->zones != NULL) { -- result = isc_ht_iter_create(catzs->zones, &iter); -- INSIST(result == ISC_R_SUCCESS); -+ isc_ht_iter_create(catzs->zones, &iter); - for (result = isc_ht_iter_first(iter); - result == ISC_R_SUCCESS;) - { -@@ -1996,8 +1975,7 @@ dns_catz_prereconfig(dns_catz_zones_t *catzs) { - - REQUIRE(DNS_CATZ_ZONES_VALID(catzs)); - -- result = isc_ht_iter_create(catzs->zones, &iter); -- INSIST(result == ISC_R_SUCCESS); -+ isc_ht_iter_create(catzs->zones, &iter); - for (result = isc_ht_iter_first(iter); - result == ISC_R_SUCCESS; - result = isc_ht_iter_next(iter)) -@@ -2019,8 +1997,7 @@ dns_catz_postreconfig(dns_catz_zones_t *catzs) { - REQUIRE(DNS_CATZ_ZONES_VALID(catzs)); - - LOCK(&catzs->lock); -- result = isc_ht_iter_create(catzs->zones, &iter); -- INSIST(result == ISC_R_SUCCESS); -+ isc_ht_iter_create(catzs->zones, &iter); - for (result = isc_ht_iter_first(iter); - result == ISC_R_SUCCESS;) - { -@@ -2062,5 +2039,6 @@ dns_catz_postreconfig(dns_catz_zones_t *catzs) { - isc_result_t - dns_catz_get_iterator(dns_catz_zone_t *catz, isc_ht_iter_t **itp) { - REQUIRE(DNS_CATZ_ZONE_VALID(catz)); -- return (isc_ht_iter_create(catz->entries, itp)); -+ isc_ht_iter_create(catz->entries, itp); -+ return (ISC_R_SUCCESS); - } -diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h -index f64522b43a..96c5ef1f79 100644 ---- a/lib/dns/include/dns/message.h -+++ b/lib/dns/include/dns/message.h -@@ -758,45 +758,6 @@ dns_message_findtype(dns_name_t *name, dns_rdatatype_t type, - *\li #ISC_R_NOTFOUND -- the desired type does not exist. - */ - --isc_result_t --dns_message_find(dns_name_t *name, dns_rdataclass_t rdclass, -- dns_rdatatype_t type, dns_rdatatype_t covers, -- dns_rdataset_t **rdataset); --/*%< -- * Search the name for the specified rdclass and type. If it is found, -- * *rdataset is filled in with a pointer to that rdataset. -- * -- * Requires: -- *\li if '**rdataset' is non-NULL, *rdataset needs to be NULL. -- * -- *\li 'type' be a valid type, and NOT dns_rdatatype_any. -- * -- *\li If 'type' is dns_rdatatype_rrsig, 'covers' must be a valid type. -- * Otherwise it should be 0. -- * -- * Returns: -- *\li #ISC_R_SUCCESS -- all is well. -- *\li #ISC_R_NOTFOUND -- the desired type does not exist. -- */ -- --void --dns_message_movename(dns_message_t *msg, dns_name_t *name, -- dns_section_t fromsection, -- dns_section_t tosection); --/*%< -- * Move a name from one section to another. -- * -- * Requires: -- * -- *\li 'msg' be valid. -- * -- *\li 'name' must be a name already in 'fromsection'. -- * -- *\li 'fromsection' must be a valid section. -- * -- *\li 'tosection' must be a valid section. -- */ -- - void - dns_message_addname(dns_message_t *msg, dns_name_t *name, - dns_section_t section); -diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h -index 0ca5d47546..2b8c0390ff 100644 ---- a/lib/dns/include/dns/name.h -+++ b/lib/dns/include/dns/name.h -@@ -68,6 +68,7 @@ - #include - #include - -+#include - #include - #include - #include /* Required for storage size of dns_label_t. */ -@@ -111,6 +112,7 @@ struct dns_name { - isc_buffer_t * buffer; - ISC_LINK(dns_name_t) link; - ISC_LIST(dns_rdataset_t) list; -+ isc_ht_t *ht; - }; - - #define DNS_NAME_MAGIC ISC_MAGIC('D','N','S','n') -@@ -171,7 +173,7 @@ LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_wildcardname; - A, (sizeof(A) - 1), sizeof(B), \ - DNS_NAMEATTR_READONLY, \ - B, NULL, { (void *)-1, (void *)-1}, \ -- {NULL, NULL} \ -+ {NULL, NULL}, NULL \ - } - - #define DNS_NAME_INITABSOLUTE(A,B) { \ -@@ -179,12 +181,12 @@ LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_wildcardname; - A, sizeof(A), sizeof(B), \ - DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE, \ - B, NULL, { (void *)-1, (void *)-1}, \ -- {NULL, NULL} \ -+ {NULL, NULL}, NULL \ - } - - #define DNS_NAME_INITEMPTY { \ - DNS_NAME_MAGIC, NULL, 0, 0, 0, NULL, NULL, \ -- { (void *)-1, (void *)-1 }, { NULL, NULL } \ -+ { (void *)-1, (void *)-1 }, { NULL, NULL }, NULL \ - } - - /*% -@@ -1374,6 +1376,7 @@ do { \ - _n->buffer = NULL; \ - ISC_LINK_INIT(_n, link); \ - ISC_LIST_INIT(_n->list); \ -+ _n->ht = NULL; \ - } while (0) - - #define DNS_NAME_RESET(n) \ -diff --git a/lib/dns/message.c b/lib/dns/message.c -index 2812ab5a37..a44eb2d1e9 100644 ---- a/lib/dns/message.c -+++ b/lib/dns/message.c -@@ -21,6 +21,8 @@ - #include - - #include -+#include -+#include - #include - #include - #include -@@ -189,6 +191,9 @@ msgblock_allocate(isc_mem_t *, unsigned int, unsigned int); - #define msgblock_get(block, type) \ - ((type *)msgblock_internalget(block, sizeof(type))) - -+static void -+dns__message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **rdatasetp); -+ - static inline void * - msgblock_internalget(dns_msgblock_t *, unsigned int); - -@@ -502,7 +507,7 @@ msgresetopt(dns_message_t *msg) - } - INSIST(dns_rdataset_isassociated(msg->opt)); - dns_rdataset_disassociate(msg->opt); -- isc_mempool_put(msg->rdspool, msg->opt); -+ dns__message_puttemprdataset(msg, &msg->opt); - msg->opt = NULL; - msg->cc_ok = 0; - msg->cc_bad = 0; -@@ -523,10 +528,11 @@ msgresetsigs(dns_message_t *msg, bool replying) { - msg->querytsig = msg->tsig; - } else { - dns_rdataset_disassociate(msg->tsig); -- isc_mempool_put(msg->rdspool, msg->tsig); -+ dns__message_puttemprdataset(msg, &msg->tsig); - if (msg->querytsig != NULL) { - dns_rdataset_disassociate(msg->querytsig); -- isc_mempool_put(msg->rdspool, msg->querytsig); -+ dns__message_puttemprdataset(msg, -+ &msg->querytsig); - } - } - if (dns_name_dynamic(msg->tsigname)) -@@ -536,13 +542,10 @@ msgresetsigs(dns_message_t *msg, bool replying) { - msg->tsigname = NULL; - } else if (msg->querytsig != NULL && !replying) { - dns_rdataset_disassociate(msg->querytsig); -- isc_mempool_put(msg->rdspool, msg->querytsig); -- msg->querytsig = NULL; -+ dns__message_puttemprdataset(msg, &msg->querytsig); - } - if (msg->sig0 != NULL) { -- INSIST(dns_rdataset_isassociated(msg->sig0)); -- dns_rdataset_disassociate(msg->sig0); -- isc_mempool_put(msg->rdspool, msg->sig0); -+ dns__message_puttemprdataset(msg, &msg->sig0); - if (msg->sig0name != NULL) { - if (dns_name_dynamic(msg->sig0name)) - dns_name_free(msg->sig0name, msg->mctx); -@@ -863,6 +866,18 @@ dns_message_detach(dns_message_t **messagep) { - } - } - -+static isc_result_t -+name_hash_add(isc_ht_t *ht, dns_name_t *name, dns_name_t **foundp) { -+ isc_result_t result = isc_ht_find(ht, name->ndata, name->length, -+ (void **)foundp); -+ if (result == ISC_R_SUCCESS) { -+ return (ISC_R_EXISTS); -+ } -+ result = isc_ht_add(ht, name->ndata, name->length, (void *)name); -+ INSIST(result == ISC_R_SUCCESS); -+ return (ISC_R_SUCCESS); -+} -+ - static isc_result_t - findname(dns_name_t **foundname, dns_name_t *target, - dns_namelist_t *section) -@@ -882,28 +897,36 @@ findname(dns_name_t **foundname, dns_name_t *target, - return (ISC_R_NOTFOUND); - } - --isc_result_t --dns_message_find(dns_name_t *name, dns_rdataclass_t rdclass, -- dns_rdatatype_t type, dns_rdatatype_t covers, -- dns_rdataset_t **rdataset) --{ -- dns_rdataset_t *curr; -- -- REQUIRE(name != NULL); -- REQUIRE(rdataset == NULL || *rdataset == NULL); -+#ifdef _WIN32 -+__pragma(pack(push, 1)) -+typedef struct rds_key { -+ dns_rdataclass_t rdclass; -+ dns_rdatatype_t type; -+ dns_rdatatype_t covers; -+} rds_key_t; -+__pragma(pack(pop)) -+#else -+typedef struct __attribute__((__packed__)) rds_key { -+ dns_rdataclass_t rdclass; -+ dns_rdatatype_t type; -+ dns_rdatatype_t covers; -+} rds_key_t; -+#endif - -- for (curr = ISC_LIST_TAIL(name->list); -- curr != NULL; -- curr = ISC_LIST_PREV(curr, link)) { -- if (curr->rdclass == rdclass && -- curr->type == type && curr->covers == covers) { -- if (rdataset != NULL) -- *rdataset = curr; -- return (ISC_R_SUCCESS); -- } -+static isc_result_t -+rds_hash_add(isc_ht_t *ht, dns_rdataset_t *rds, dns_rdataset_t **foundp) { -+ rds_key_t key = { .rdclass = rds->rdclass, -+ .type = rds->type, -+ .covers = rds->covers }; -+ isc_result_t result = isc_ht_find(ht, (const unsigned char *)&key, -+ sizeof(key), (void **)foundp); -+ if (result == ISC_R_SUCCESS) { -+ return (ISC_R_EXISTS); - } -- -- return (ISC_R_NOTFOUND); -+ result = isc_ht_add(ht, (const unsigned char *)&key, sizeof(key), -+ (void *)rds); -+ INSIST(result == ISC_R_SUCCESS); -+ return (ISC_R_SUCCESS); - } - - isc_result_t -@@ -1031,6 +1054,18 @@ getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - } \ - } while (0) - -+static void -+cleanup_name_hashmaps(dns_namelist_t *section) { -+ dns_name_t *name = NULL; -+ for (name = ISC_LIST_HEAD(*section); name != NULL; -+ name = ISC_LIST_NEXT(name, link)) -+ { -+ if (name->ht != NULL) { -+ isc_ht_destroy(&name->ht); -+ } -+ } -+} -+ - static isc_result_t - getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - unsigned int options) -@@ -1042,13 +1077,15 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - dns_offsets_t *offsets; - dns_rdataset_t *rdataset; - dns_rdatalist_t *rdatalist; -- isc_result_t result; -+ isc_result_t result = ISC_R_SUCCESS; - dns_rdatatype_t rdtype; - dns_rdataclass_t rdclass; - dns_namelist_t *section; -- bool free_name; -+ bool free_name = false; - bool best_effort; - bool seen_problem; -+ isc_ht_t *name_map = NULL; -+ bool free_ht = false; - - section = &msg->sections[DNS_SECTION_QUESTION]; - -@@ -1056,9 +1093,14 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - seen_problem = false; - - name = NULL; -+ name2 = NULL; - rdataset = NULL; - rdatalist = NULL; - -+ if (msg->counts[DNS_SECTION_QUESTION] > 1) { -+ isc_ht_init(&name_map, msg->mctx, 1, ISC_HT_CASE_INSENSITIVE); -+ } -+ - for (count = 0; count < msg->counts[DNS_SECTION_QUESTION]; count++) { - name = isc_mempool_get(msg->namepool); - if (name == NULL) -@@ -1081,13 +1123,20 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - if (result != ISC_R_SUCCESS) - goto cleanup; - -+ -+ /* If there is only one QNAME, skip the duplicity checks */ -+ if (name_map == NULL) { -+ result = ISC_R_SUCCESS; -+ goto skip_name_check; -+ } -+ - /* - * Run through the section, looking to see if this name - * is already there. If it is found, put back the allocated - * name since we no longer need it, and set our name pointer - * to point to the name we found. - */ -- result = findname(&name2, name, section); -+ result = name_hash_add(name_map, name, &name2); - - /* - * If it is the first name in the section, accept it. -@@ -1099,18 +1148,25 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - * this should be legal or not. In either case we no longer - * need this name pointer. - */ -- if (result != ISC_R_SUCCESS) { -- if (!ISC_LIST_EMPTY(*section)) -+ skip_name_check: -+ switch (result) { -+ case ISC_R_SUCCESS: -+ if (!ISC_LIST_EMPTY(*section)) { - DO_ERROR(DNS_R_FORMERR); -+ } - ISC_LIST_APPEND(*section, name, link); -- free_name = false; -- } else { -- isc_mempool_put(msg->namepool, name); -+ break; -+ case ISC_R_EXISTS: -+ dns_message_puttempname(msg, &name); - name = name2; - name2 = NULL; -- free_name = false; -+ break; -+ default: -+ ISC_UNREACHABLE(); - } - -+ free_name = false; -+ - /* - * Get type and class. - */ -@@ -1138,13 +1194,6 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - if (rdtype == dns_rdatatype_tkey) - msg->tkey = 1; - -- /* -- * Can't ask the same question twice. -- */ -- result = dns_message_find(name, rdclass, rdtype, 0, NULL); -- if (result == ISC_R_SUCCESS) -- DO_ERROR(DNS_R_FORMERR); -- - /* - * Allocate a new rdatalist. - */ -@@ -1153,7 +1202,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - result = ISC_R_NOMEMORY; - goto cleanup; - } -- rdataset = isc_mempool_get(msg->rdspool); -+ dns_message_gettemprdataset(msg, &rdataset); - if (rdataset == NULL) { - result = ISC_R_NOMEMORY; - goto cleanup; -@@ -1166,32 +1215,74 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - rdatalist->type = rdtype; - rdatalist->rdclass = rdclass; - -- dns_rdataset_init(rdataset); - result = dns_rdatalist_tordataset(rdatalist, rdataset); -- if (result != ISC_R_SUCCESS) -- goto cleanup; -+ RUNTIME_CHECK(result == ISC_R_SUCCESS); - - rdataset->attributes |= DNS_RDATASETATTR_QUESTION; - -+ /* -+ * Skip the duplicity check for first rdataset -+ */ -+ if (ISC_LIST_EMPTY(name->list)) { -+ goto skip_rds_check; -+ } -+ -+ /* -+ * Can't ask the same question twice. -+ */ -+ if (name->ht == NULL) { -+ isc_ht_init(&name->ht, msg->mctx, 1, -+ ISC_HT_CASE_SENSITIVE); -+ free_ht = true; -+ -+ dns_rdataset_t *old_rdataset = NULL; -+ for (old_rdataset = ISC_LIST_HEAD(name->list); -+ old_rdataset != NULL; -+ old_rdataset = ISC_LIST_NEXT(old_rdataset, link)) -+ { -+ result = rds_hash_add(name->ht, old_rdataset, -+ NULL); -+ INSIST(result == ISC_R_SUCCESS); -+ } -+ } -+ result = rds_hash_add(name->ht, rdataset, NULL); -+ if (result == ISC_R_EXISTS) { -+ DO_ERROR(DNS_R_FORMERR); -+ } -+ -+ skip_rds_check: - ISC_LIST_APPEND(name->list, rdataset, link); -+ - rdataset = NULL; - } - -- if (seen_problem) -- return (DNS_R_RECOVERABLE); -- return (ISC_R_SUCCESS); -+ -+ if (seen_problem) { -+ result = DNS_R_RECOVERABLE; -+ } - - cleanup: - if (rdataset != NULL) { -- INSIST(!dns_rdataset_isassociated(rdataset)); -- isc_mempool_put(msg->rdspool, rdataset); -+ if (dns_rdataset_isassociated(rdataset)) { -+ dns_rdataset_disassociate(rdataset); -+ } -+ dns_message_puttemprdataset(msg, &rdataset); - } - #if 0 - if (rdatalist != NULL) - isc_mempool_put(msg->rdlpool, rdatalist); - #endif -- if (free_name) -- isc_mempool_put(msg->namepool, name); -+ if (free_name) { -+ dns_message_puttempname(msg, &name); -+ } -+ -+ if (free_ht) { -+ cleanup_name_hashmaps(section); -+ } -+ -+ if (name_map != NULL) { -+ isc_ht_destroy(&name_map); -+ } - - return (result); - } -@@ -1271,24 +1362,26 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - unsigned int count, rdatalen; - dns_name_t *name = NULL; - dns_name_t *name2 = NULL; -- dns_offsets_t *offsets; -- dns_rdataset_t *rdataset; -- dns_rdatalist_t *rdatalist; -- isc_result_t result; -+ dns_offsets_t *offsets = NULL; -+ dns_rdataset_t *rdataset = NULL; -+ dns_rdataset_t *found_rdataset = NULL; -+ dns_rdatalist_t *rdatalist = NULL; -+ isc_result_t result = ISC_R_SUCCESS; - dns_rdatatype_t rdtype, covers; - dns_rdataclass_t rdclass; -- dns_rdata_t *rdata; -+ dns_rdata_t *rdata = NULL; - dns_ttl_t ttl; -- dns_namelist_t *section; -- bool free_name = false, free_rdataset = false; -- bool preserve_order, best_effort, seen_problem; -+ dns_namelist_t *section = &msg->sections[sectionid]; -+ bool free_name = false, seen_problem = false; -+ bool free_ht = false; -+ bool preserve_order = ((options & DNS_MESSAGEPARSE_PRESERVEORDER) != 0); -+ bool best_effort = ((options & DNS_MESSAGEPARSE_BESTEFFORT) != 0); - bool isedns, issigzero, istsig; -+ isc_ht_t *name_map = NULL; - -- preserve_order = ((options & DNS_MESSAGEPARSE_PRESERVEORDER) != 0); -- best_effort = ((options & DNS_MESSAGEPARSE_BESTEFFORT) != 0); -- seen_problem = false; -- -- section = &msg->sections[sectionid]; -+ if (msg->counts[sectionid] > 1) { -+ isc_ht_init(&name_map, msg->mctx, 1, ISC_HT_CASE_INSENSITIVE); -+ } - - for (count = 0; count < msg->counts[sectionid]; count++) { - int recstart = source->current; -@@ -1296,14 +1389,15 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - - skip_name_search = false; - skip_type_search = false; -- free_rdataset = false; - isedns = false; - issigzero = false; - istsig = false; -+ found_rdataset = NULL; - - name = isc_mempool_get(msg->namepool); -- if (name == NULL) -+ if (name == NULL) { - return (ISC_R_NOMEMORY); -+ } - free_name = true; - - offsets = newoffsets(msg); -@@ -1319,8 +1413,9 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - isc_buffer_remainingregion(source, &r); - isc_buffer_setactive(source, r.length); - result = getname(name, source, msg, dctx); -- if (result != ISC_R_SUCCESS) -+ if (result != ISC_R_SUCCESS) { - goto cleanup; -+ } - - /* - * Get type, class, ttl, and rdatalen. Verify that at least -@@ -1340,9 +1435,10 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - * established a class. Do so now. - */ - if (msg->rdclass_set == 0 && -- rdtype != dns_rdatatype_opt && /* class is UDP SIZE */ -- rdtype != dns_rdatatype_tsig && /* class is ANY */ -- rdtype != dns_rdatatype_tkey) { /* class is undefined */ -+ rdtype != dns_rdatatype_opt && /* class is UDP SIZE */ -+ rdtype != dns_rdatatype_tsig && /* class is ANY */ -+ rdtype != dns_rdatatype_tkey) /* class is undefined */ -+ { - msg->rdclass = rdclass; - msg->rdclass_set = 1; - } -@@ -1351,15 +1447,17 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - * If this class is different than the one in the question - * section, bail. - */ -- if (msg->opcode != dns_opcode_update -- && rdtype != dns_rdatatype_tsig -- && rdtype != dns_rdatatype_opt -- && rdtype != dns_rdatatype_key /* in a TKEY query */ -- && rdtype != dns_rdatatype_sig /* SIG(0) */ -- && rdtype != dns_rdatatype_tkey /* Win2000 TKEY */ -- && msg->rdclass != dns_rdataclass_any -- && msg->rdclass != rdclass) -+ if (msg->opcode != dns_opcode_update && -+ rdtype != dns_rdatatype_tsig && -+ rdtype != dns_rdatatype_opt && -+ rdtype != dns_rdatatype_key && /* in a TKEY query */ -+ rdtype != dns_rdatatype_sig && /* SIG(0) */ -+ rdtype != dns_rdatatype_tkey && /* Win2000 TKEY */ -+ msg->rdclass != dns_rdataclass_any && -+ msg->rdclass != rdclass) -+ { - DO_ERROR(DNS_R_FORMERR); -+ } - - /* - * If this is not a TKEY query/response then the KEY -@@ -1369,7 +1467,9 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - rdtype == dns_rdatatype_key && - msg->rdclass != dns_rdataclass_any && - msg->rdclass != rdclass) -+ { - DO_ERROR(DNS_R_FORMERR); -+ } - - /* - * Special type handling for TSIG, OPT, and TKEY. -@@ -1381,7 +1481,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - */ - if (sectionid != DNS_SECTION_ADDITIONAL || - rdclass != dns_rdataclass_any || -- count != msg->counts[sectionid] - 1) { -+ count != msg->counts[sectionid] - 1) -+ { - DO_ERROR(DNS_R_BADTSIG); - } else { - skip_name_search = true; -@@ -1396,7 +1497,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - */ - if (!dns_name_equal(dns_rootname, name) || - sectionid != DNS_SECTION_ADDITIONAL || -- msg->opt != NULL) { -+ msg->opt != NULL) -+ { - DO_ERROR(DNS_R_FORMERR); - } else { - skip_name_search = true; -@@ -1413,13 +1515,16 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - */ - dns_section_t tkeysection; - -- if ((msg->flags & DNS_MESSAGEFLAG_QR) == 0) -+ if ((msg->flags & DNS_MESSAGEFLAG_QR) == 0) { - tkeysection = DNS_SECTION_ADDITIONAL; -- else -+ } else { - tkeysection = DNS_SECTION_ANSWER; -+ } - if (sectionid != tkeysection && - sectionid != DNS_SECTION_ANSWER) -+ { - DO_ERROR(DNS_R_FORMERR); -+ } - } - - /* -@@ -1445,7 +1550,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - goto cleanup; - } - if (msg->opcode == dns_opcode_update && -- update(sectionid, rdclass)) { -+ update(sectionid, rdclass)) -+ { - if (rdatalen != 0) { - result = DNS_R_FORMERR; - goto cleanup; -@@ -1465,26 +1571,31 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - result = ISC_R_SUCCESS; - } else if (rdclass == dns_rdataclass_none && - msg->opcode == dns_opcode_update && -- sectionid == DNS_SECTION_UPDATE) { -+ sectionid == DNS_SECTION_UPDATE) -+ { - result = getrdata(source, msg, dctx, msg->rdclass, - rdtype, rdatalen, rdata); -- } else -- result = getrdata(source, msg, dctx, rdclass, -- rdtype, rdatalen, rdata); -- if (result != ISC_R_SUCCESS) -+ } else { -+ result = getrdata(source, msg, dctx, rdclass, rdtype, -+ rdatalen, rdata); -+ } -+ if (result != ISC_R_SUCCESS) { - goto cleanup; -+ } - rdata->rdclass = rdclass; -- if (rdtype == dns_rdatatype_rrsig && -- rdata->flags == 0) { -+ if (rdtype == dns_rdatatype_rrsig && rdata->flags == 0) { - covers = dns_rdata_covers(rdata); -- if (covers == 0) -+ if (covers == 0) { - DO_ERROR(DNS_R_FORMERR); -+ } - } else if (rdtype == dns_rdatatype_sig /* SIG(0) */ && -- rdata->flags == 0) { -+ rdata->flags == 0) -+ { - covers = dns_rdata_covers(rdata); - if (covers == 0) { - if (sectionid != DNS_SECTION_ADDITIONAL || -- count != msg->counts[sectionid] - 1) { -+ count != msg->counts[sectionid] - 1) -+ { - DO_ERROR(DNS_R_BADSIG0); - } else { - skip_name_search = true; -@@ -1494,17 +1605,20 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - } else { - if (msg->rdclass != dns_rdataclass_any && - msg->rdclass != rdclass) -+ { - DO_ERROR(DNS_R_FORMERR); -+ } - } -- } else -+ } else { - covers = 0; -+ } - - /* - * Check the ownername of NSEC3 records - */ - if (rdtype == dns_rdatatype_nsec3 && -- !dns_rdata_checkowner(name, msg->rdclass, rdtype, -- false)) { -+ !dns_rdata_checkowner(name, msg->rdclass, rdtype, false)) -+ { - result = DNS_R_BADOWNERNAME; - goto cleanup; - } -@@ -1515,103 +1629,152 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - * to the end of the message. - */ - if (preserve_order || msg->opcode == dns_opcode_update || -- skip_name_search) { -+ skip_name_search) -+ { - if (!isedns && !istsig && !issigzero) { - ISC_LIST_APPEND(*section, name, link); - free_name = false; - } - } else { -+ if (name_map == NULL) { -+ result = ISC_R_SUCCESS; -+ goto skip_name_check; -+ } -+ - /* - * Run through the section, looking to see if this name - * is already there. If it is found, put back the - * allocated name since we no longer need it, and set - * our name pointer to point to the name we found. - */ -- result = findname(&name2, name, section); -+ result = name_hash_add(name_map, name, &name2); - - /* - * If it is a new name, append to the section. - */ -- if (result == ISC_R_SUCCESS) { -- isc_mempool_put(msg->namepool, name); -- name = name2; -- } else { -+ skip_name_check: -+ switch (result) { -+ case ISC_R_SUCCESS: - ISC_LIST_APPEND(*section, name, link); -+ break; -+ case ISC_R_EXISTS: -+ dns_message_puttempname(msg, &name); -+ name = name2; -+ name2 = NULL; -+ break; -+ default: -+ ISC_UNREACHABLE(); - } - free_name = false; - } - -+ dns_message_gettemprdataset(msg, &rdataset); -+ if (rdataset == NULL) { -+ result = ISC_R_NOMEMORY; -+ goto cleanup; -+ } -+ -+ rdatalist = newrdatalist(msg); -+ if (rdatalist == NULL) { -+ result = ISC_R_NOMEMORY; -+ goto cleanup; -+ } -+ -+ rdatalist->type = rdtype; -+ rdatalist->covers = covers; -+ rdatalist->rdclass = rdclass; -+ rdatalist->ttl = ttl; -+ -+ RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) == -+ ISC_R_SUCCESS); -+ dns_rdataset_setownercase(rdataset, name); -+ rdatalist = NULL; -+ - /* - * Search name for the particular type and class. - * Skip this stage if in update mode or this is a meta-type. - */ -- if (preserve_order || msg->opcode == dns_opcode_update || -- skip_type_search) -- result = ISC_R_NOTFOUND; -- else { -+ if (isedns || istsig || issigzero) { -+ /* Skip adding the rdataset to the tables */ -+ } else if (preserve_order || msg->opcode == dns_opcode_update || -+ skip_type_search) -+ { -+ result = ISC_R_SUCCESS; -+ -+ ISC_LIST_APPEND(name->list, rdataset, link); -+ } else { - /* - * If this is a type that can only occur in - * the question section, fail. - */ -- if (dns_rdatatype_questiononly(rdtype)) -+ if (dns_rdatatype_questiononly(rdtype)) { - DO_ERROR(DNS_R_FORMERR); -- -- rdataset = NULL; -- result = dns_message_find(name, rdclass, rdtype, -- covers, &rdataset); -- } -- -- /* -- * If we found an rdataset that matches, we need to -- * append this rdata to that set. If we did not, we need -- * to create a new rdatalist, store the important bits there, -- * convert it to an rdataset, and link the latter to the name. -- * Yuck. When appending, make certain that the type isn't -- * a singleton type, such as SOA or CNAME. -- * -- * Note that this check will be bypassed when preserving order, -- * the opcode is an update, or the type search is skipped. -- */ -- if (result == ISC_R_SUCCESS) { -- if (dns_rdatatype_issingleton(rdtype)) { -- dns_rdata_t *first; -- dns_rdatalist_fromrdataset(rdataset, -- &rdatalist); -- first = ISC_LIST_HEAD(rdatalist->rdata); -- INSIST(first != NULL); -- if (dns_rdata_compare(rdata, first) != 0) -- DO_ERROR(DNS_R_FORMERR); - } -- } - -- if (result == ISC_R_NOTFOUND) { -- rdataset = isc_mempool_get(msg->rdspool); -- if (rdataset == NULL) { -- result = ISC_R_NOMEMORY; -- goto cleanup; -+ if (ISC_LIST_EMPTY(name->list)) { -+ result = ISC_R_SUCCESS; -+ goto skip_rds_check; - } -- free_rdataset = true; - -- rdatalist = newrdatalist(msg); -- if (rdatalist == NULL) { -- result = ISC_R_NOMEMORY; -- goto cleanup; -- } -+ if (name->ht == NULL) { -+ isc_ht_init(&name->ht, msg->mctx, 1, -+ ISC_HT_CASE_SENSITIVE); -+ free_ht = true; - -- rdatalist->type = rdtype; -- rdatalist->covers = covers; -- rdatalist->rdclass = rdclass; -- rdatalist->ttl = ttl; -+ INSIST(ISC_LIST_HEAD(name->list) == -+ ISC_LIST_TAIL(name->list)); - -- dns_rdataset_init(rdataset); -- RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, -- rdataset) -- == ISC_R_SUCCESS); -- dns_rdataset_setownercase(rdataset, name); -+ dns_rdataset_t *old_rdataset = -+ ISC_LIST_HEAD(name->list); - -- if (!isedns && !istsig && !issigzero) { -+ result = rds_hash_add(name->ht, old_rdataset, -+ NULL); -+ -+ INSIST(result == ISC_R_SUCCESS); -+ } -+ result = rds_hash_add(name->ht, rdataset, -+ &found_rdataset); -+ -+ /* -+ * If we found an rdataset that matches, we need to -+ * append this rdata to that set. If we did not, we -+ * need to create a new rdatalist, store the important -+ * bits there, convert it to an rdataset, and link the -+ * latter to the name. Yuck. When appending, make -+ * certain that the type isn't a singleton type, such as -+ * SOA or CNAME. -+ * -+ * Note that this check will be bypassed when preserving -+ * order, the opcode is an update, or the type search is -+ * skipped. -+ */ -+ skip_rds_check: -+ switch (result) { -+ case ISC_R_EXISTS: -+ /* Free the rdataset we used as the key */ -+ dns_rdataset_disassociate(rdataset); -+ dns__message_puttemprdataset(msg, &rdataset); -+ result = ISC_R_SUCCESS; -+ rdataset = found_rdataset; -+ -+ if (!dns_rdatatype_issingleton(rdtype)) { -+ break; -+ } -+ -+ dns_rdatalist_fromrdataset(rdataset, -+ &rdatalist); -+ dns_rdata_t *first = -+ ISC_LIST_HEAD(rdatalist->rdata); -+ INSIST(first != NULL); -+ if (dns_rdata_compare(rdata, first) != 0) { -+ DO_ERROR(DNS_R_FORMERR); -+ } -+ break; -+ case ISC_R_SUCCESS: - ISC_LIST_APPEND(name->list, rdataset, link); -- free_rdataset = false; -+ break; -+ default: -+ ISC_UNREACHABLE(); - } - } - -@@ -1625,8 +1788,9 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - */ - if (ttl != rdataset->ttl) { - rdataset->attributes |= DNS_RDATASETATTR_TTLADJUSTED; -- if (ttl < rdataset->ttl) -+ if (ttl < rdataset->ttl) { - rdataset->ttl = ttl; -+ } - } - - /* Append this rdata to the rdataset. */ -@@ -1645,20 +1809,16 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - dns_rcode_t ercode; - - msg->opt = rdataset; -- rdataset = NULL; -- free_rdataset = false; - ercode = (dns_rcode_t) - ((msg->opt->ttl & DNS_MESSAGE_EDNSRCODE_MASK) - >> 20); - msg->rcode |= ercode; -- isc_mempool_put(msg->namepool, name); -+ dns_message_puttempname(msg, &name); - free_name = false; - } else if (issigzero) { - msg->sig0 = rdataset; - msg->sig0name = name; - msg->sigstart = recstart; -- rdataset = NULL; -- free_rdataset = false; - free_name = false; - } else if (istsig) { - msg->tsig = rdataset; -@@ -1668,20 +1828,17 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - * Windows doesn't like TSIG names to be compressed. - */ - msg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS; -- rdataset = NULL; -- free_rdataset = false; - free_name = false; - } -+ rdataset = NULL; - - if (seen_problem) { -- if (free_name) -- isc_mempool_put(msg->namepool, name); -- if (free_rdataset) -- isc_mempool_put(msg->rdspool, rdataset); -- free_name = free_rdataset = false; -+ if (free_name) { -+ dns_message_puttempname(msg, &name); -+ } -+ free_name = false; - } - INSIST(free_name == false); -- INSIST(free_rdataset == false); - } - - /* -@@ -1692,20 +1849,32 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, - if (sectionid == DNS_SECTION_AUTHORITY && - msg->opcode == dns_opcode_query && - ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) && -- ((msg->flags & DNS_MESSAGEFLAG_TC) == 0) && -- !preserve_order && -+ ((msg->flags & DNS_MESSAGEFLAG_TC) == 0) && !preserve_order && - !auth_signed(section)) -+ { - DO_ERROR(DNS_R_FORMERR); -+ } - -- if (seen_problem) -- return (DNS_R_RECOVERABLE); -- return (ISC_R_SUCCESS); -+ if (seen_problem) { -+ result = DNS_R_RECOVERABLE; -+ } - -- cleanup: -- if (free_name) -- isc_mempool_put(msg->namepool, name); -- if (free_rdataset) -+cleanup: -+ if (rdataset != NULL && rdataset != found_rdataset) { -+ dns_rdataset_disassociate(rdataset); - isc_mempool_put(msg->rdspool, rdataset); -+ } -+ if (free_name) { -+ dns_message_puttempname(msg, &name); -+ } -+ -+ if (free_ht) { -+ cleanup_name_hashmaps(section); -+ } -+ -+ if (name_map != NULL) { -+ isc_ht_destroy(&name_map); -+ } - - return (result); - } -@@ -2438,11 +2607,11 @@ dns_message_renderreset(dns_message_t *msg) { - dns_message_puttempname(msg, &msg->tsigname); - if (msg->tsig != NULL) { - dns_rdataset_disassociate(msg->tsig); -- dns_message_puttemprdataset(msg, &msg->tsig); -+ dns__message_puttemprdataset(msg, &msg->tsig); - } - if (msg->sig0 != NULL) { - dns_rdataset_disassociate(msg->sig0); -- dns_message_puttemprdataset(msg, &msg->sig0); -+ dns__message_puttemprdataset(msg, &msg->sig0); - } - } - -@@ -2535,24 +2704,6 @@ dns_message_findname(dns_message_t *msg, dns_section_t section, - return (result); - } - --void --dns_message_movename(dns_message_t *msg, dns_name_t *name, -- dns_section_t fromsection, -- dns_section_t tosection) --{ -- REQUIRE(msg != NULL); -- REQUIRE(msg->from_to_wire == DNS_MESSAGE_INTENTRENDER); -- REQUIRE(name != NULL); -- REQUIRE(VALID_NAMED_SECTION(fromsection)); -- REQUIRE(VALID_NAMED_SECTION(tosection)); -- -- /* -- * Unlink the name from the old section -- */ -- ISC_LIST_UNLINK(msg->sections[fromsection], name, link); -- ISC_LIST_APPEND(msg->sections[tosection], name, link); --} -- - void - dns_message_addname(dns_message_t *msg, dns_name_t *name, - dns_section_t section) -@@ -2645,6 +2796,9 @@ dns_message_puttempname(dns_message_t *msg, dns_name_t **item) { - REQUIRE(DNS_MESSAGE_VALID(msg)); - REQUIRE(item != NULL && *item != NULL); - -+ if ((*item)->ht != NULL) { -+ isc_ht_destroy(&(*item)->ht); -+ } - if (dns_name_dynamic(*item)) - dns_name_free(*item, msg->mctx); - isc_mempool_put(msg->namepool, *item); -@@ -2660,14 +2814,19 @@ dns_message_puttemprdata(dns_message_t *msg, dns_rdata_t **item) { - *item = NULL; - } - -+static void -+dns__message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item) { -+ isc_mempool_put(msg->rdspool, *item); -+ *item = NULL; -+} -+ - void - dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item) { - REQUIRE(DNS_MESSAGE_VALID(msg)); - REQUIRE(item != NULL && *item != NULL); - - REQUIRE(!dns_rdataset_isassociated(*item)); -- isc_mempool_put(msg->rdspool, *item); -- *item = NULL; -+ dns__message_puttemprdataset(msg, item); - } - - void -@@ -2832,7 +2991,7 @@ dns_message_setopt(dns_message_t *msg, dns_rdataset_t *opt) { - - cleanup: - dns_rdataset_disassociate(opt); -- dns_message_puttemprdataset(msg, &opt); -+ dns__message_puttemprdataset(msg, &opt); - return (result); - } - -diff --git a/lib/dns/name.c b/lib/dns/name.c -index 9713cf5f4e..a0a53b26d6 100644 ---- a/lib/dns/name.c -+++ b/lib/dns/name.c -@@ -215,6 +215,7 @@ dns_name_invalidate(dns_name_t *name) { - name->offsets = NULL; - name->buffer = NULL; - ISC_LINK_INIT(name, link); -+ INSIST(name->ht == NULL); - } - - bool -diff --git a/lib/isc/ht.c b/lib/isc/ht.c -index 3234ea8029..19f0b2c0b9 100644 ---- a/lib/isc/ht.c -+++ b/lib/isc/ht.c -@@ -1,6 +1,8 @@ - /* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * -+ * SPDX-License-Identifier: MPL-2.0 -+ * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. -@@ -10,208 +12,483 @@ - */ - - #include -- - #include - #include - - #include - #include --#include - #include - #include - #include -+#include - #include - -- - typedef struct isc_ht_node isc_ht_node_t; - --#define ISC_HT_MAGIC ISC_MAGIC('H', 'T', 'a', 'b') --#define ISC_HT_VALID(ht) ISC_MAGIC_VALID(ht, ISC_HT_MAGIC) -+#define ISC_HT_MAGIC ISC_MAGIC('H', 'T', 'a', 'b') -+#define ISC_HT_VALID(ht) ISC_MAGIC_VALID(ht, ISC_HT_MAGIC) -+ -+#define HT_NO_BITS 0 -+#define HT_MIN_BITS 1 -+#define HT_MAX_BITS 32 -+#define HT_OVERCOMMIT 3 -+ -+#define HT_NEXTTABLE(idx) ((idx == 0) ? 1 : 0) -+#define TRY_NEXTTABLE(idx, ht) (idx == ht->hindex && rehashing_in_progress(ht)) -+ -+#define GOLDEN_RATIO_32 0x61C88647 -+ -+#define HASHSIZE(bits) (UINT64_C(1) << (bits)) - - struct isc_ht_node { - void *value; - isc_ht_node_t *next; -+ uint32_t hashval; - size_t keysize; -- unsigned char key[FLEXIBLE_ARRAY_MEMBER]; -+ unsigned char key[]; - }; - - struct isc_ht { - unsigned int magic; - isc_mem_t *mctx; -- size_t size; -- size_t mask; -- unsigned int count; -- isc_ht_node_t **table; -+ size_t count; -+ bool case_sensitive; -+ size_t size[2]; -+ uint8_t hashbits[2]; -+ isc_ht_node_t **table[2]; -+ uint8_t hindex; -+ uint32_t hiter; /* rehashing iterator */ - }; - - struct isc_ht_iter { - isc_ht_t *ht; - size_t i; -+ uint8_t hindex; - isc_ht_node_t *cur; - }; - --isc_result_t --isc_ht_init(isc_ht_t **htp, isc_mem_t *mctx, uint8_t bits) { -- isc_ht_t *ht = NULL; -- size_t i; -+static isc_ht_node_t * -+isc__ht_find(const isc_ht_t *ht, const unsigned char *key, -+ const uint32_t keysize, const uint32_t hashval, const uint8_t idx); -+static void -+isc__ht_add(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize, -+ const uint32_t hashval, const uint8_t idx, void *value); -+static isc_result_t -+isc__ht_delete(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize, -+ const uint32_t hashval, const uint8_t idx); -+ -+static uint32_t -+rehash_bits(isc_ht_t *ht, size_t newcount); -+ -+static void -+hashtable_new(isc_ht_t *ht, const uint8_t idx, const uint8_t bits); -+static void -+hashtable_free(isc_ht_t *ht, const uint8_t idx); -+static void -+hashtable_rehash(isc_ht_t *ht, uint32_t newbits); -+static void -+hashtable_rehash_one(isc_ht_t *ht); -+static void -+maybe_rehash(isc_ht_t *ht, size_t newcount); -+ -+static isc_result_t -+isc__ht_iter_next(isc_ht_iter_t *it); -+ -+static uint8_t maptolower[] = { -+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, -+ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, -+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, -+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, -+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, -+ 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, -+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, -+ 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, -+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, -+ 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, -+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, -+ 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, -+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, -+ 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, -+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, -+ 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, -+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, -+ 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, -+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, -+ 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, -+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, -+ 0xfc, 0xfd, 0xfe, 0xff -+}; - -- REQUIRE(htp != NULL && *htp == NULL); -- REQUIRE(mctx != NULL); -- REQUIRE(bits >= 1 && bits <= (sizeof(size_t)*8 - 1)); -+static int -+memcasecmp(const void *vs1, const void *vs2, size_t len) { -+ uint8_t const *s1 = vs1; -+ uint8_t const *s2 = vs2; -+ for (size_t i = 0; i < len; i++) { -+ uint8_t u1 = s1[i]; -+ uint8_t u2 = s2[i]; -+ int U1 = maptolower[u1]; -+ int U2 = maptolower[u2]; -+ int diff = U1 - U2; -+ if (diff) { -+ return diff; -+ } -+ } -+ return 0; -+} - -- ht = isc_mem_get(mctx, sizeof(struct isc_ht)); -- if (ht == NULL) { -- return (ISC_R_NOMEMORY); -+static bool -+isc__ht_node_match(isc_ht_node_t *node, const uint32_t hashval, -+ const uint8_t *key, uint32_t keysize, bool case_sensitive) { -+ return (node->hashval == hashval && node->keysize == keysize && -+ (case_sensitive ? (memcmp(node->key, key, keysize) == 0) -+ : (memcasecmp(node->key, key, keysize) == 0))); -+} -+ -+static uint32_t -+hash_32(uint32_t val, unsigned int bits) { -+ REQUIRE(bits <= HT_MAX_BITS); -+ /* High bits are more random. */ -+ return (val * GOLDEN_RATIO_32 >> (32 - bits)); -+} -+ -+static bool -+rehashing_in_progress(const isc_ht_t *ht) { -+ return (ht->table[HT_NEXTTABLE(ht->hindex)] != NULL); -+} -+ -+static bool -+hashtable_is_overcommited(isc_ht_t *ht) { -+ return (ht->count >= (ht->size[ht->hindex] * HT_OVERCOMMIT)); -+} -+ -+static uint32_t -+rehash_bits(isc_ht_t *ht, size_t newcount) { -+ uint32_t newbits = ht->hashbits[ht->hindex]; -+ -+ while (newcount >= HASHSIZE(newbits) && newbits <= HT_MAX_BITS) { -+ newbits += 1; - } - -- ht->mctx = NULL; -- isc_mem_attach(mctx, &ht->mctx); -+ return (newbits); -+} -+ -+/* -+ * Rebuild the hashtable to reduce the load factor -+ */ -+static void -+hashtable_rehash(isc_ht_t *ht, uint32_t newbits) { -+ uint8_t oldindex = ht->hindex; -+ uint32_t oldbits = ht->hashbits[oldindex]; -+ uint8_t newindex = HT_NEXTTABLE(oldindex); - -- ht->size = ((size_t)1<mask = ((size_t)1<count = 0; -+ REQUIRE(ht->hashbits[oldindex] >= HT_MIN_BITS); -+ REQUIRE(ht->hashbits[oldindex] <= HT_MAX_BITS); -+ REQUIRE(ht->table[oldindex] != NULL); -+ -+ REQUIRE(newbits <= HT_MAX_BITS); -+ REQUIRE(ht->hashbits[newindex] == HT_NO_BITS); -+ REQUIRE(ht->table[newindex] == NULL); -+ -+ REQUIRE(newbits > oldbits); -+ -+ hashtable_new(ht, newindex, newbits); -+ -+ ht->hindex = newindex; -+ -+ hashtable_rehash_one(ht); -+} -+ -+static void -+hashtable_rehash_one(isc_ht_t *ht) { -+ isc_ht_node_t **newtable = ht->table[ht->hindex]; -+ uint32_t oldsize = ht->size[HT_NEXTTABLE(ht->hindex)]; -+ isc_ht_node_t **oldtable = ht->table[HT_NEXTTABLE(ht->hindex)]; -+ isc_ht_node_t *node = NULL; -+ isc_ht_node_t *nextnode; -+ -+ /* Find first non-empty node */ -+ while (ht->hiter < oldsize && oldtable[ht->hiter] == NULL) { -+ ht->hiter++; -+ } - -- ht->table = isc_mem_get(ht->mctx, ht->size * sizeof(isc_ht_node_t*)); -- if (ht->table == NULL) { -- isc_mem_putanddetach(&ht->mctx, ht, sizeof(struct isc_ht)); -- return (ISC_R_NOMEMORY); -+ /* Rehashing complete */ -+ if (ht->hiter == oldsize) { -+ hashtable_free(ht, HT_NEXTTABLE(ht->hindex)); -+ ht->hiter = 0; -+ return; - } - -- for (i = 0; i < ht->size; i++) { -- ht->table[i] = NULL; -+ /* Move the first non-empty node from old hashtable to new hashtable */ -+ for (node = oldtable[ht->hiter]; node != NULL; node = nextnode) { -+ uint32_t hash = hash_32(node->hashval, -+ ht->hashbits[ht->hindex]); -+ nextnode = node->next; -+ node->next = newtable[hash]; -+ newtable[hash] = node; - } - -+ oldtable[ht->hiter] = NULL; -+ -+ ht->hiter++; -+} -+ -+static void -+maybe_rehash(isc_ht_t *ht, size_t newcount) { -+ uint32_t newbits = rehash_bits(ht, newcount); -+ -+ if (ht->hashbits[ht->hindex] < newbits && newbits <= HT_MAX_BITS) { -+ hashtable_rehash(ht, newbits); -+ } -+} -+ -+static void -+hashtable_new(isc_ht_t *ht, const uint8_t idx, const uint8_t bits) { -+ size_t size; -+ REQUIRE(ht->hashbits[idx] == HT_NO_BITS); -+ REQUIRE(ht->table[idx] == NULL); -+ REQUIRE(bits >= HT_MIN_BITS); -+ REQUIRE(bits <= HT_MAX_BITS); -+ -+ ht->hashbits[idx] = bits; -+ ht->size[idx] = HASHSIZE(ht->hashbits[idx]); -+ -+ size = ht->size[idx] * sizeof(isc_ht_node_t *); -+ -+ ht->table[idx] = isc_mem_get(ht->mctx, size); -+ INSIST(ht->table[idx] != NULL); -+ memset(ht->table[idx], 0, size); -+} -+ -+static void -+hashtable_free(isc_ht_t *ht, const uint8_t idx) { -+ size_t size = ht->size[idx] * sizeof(isc_ht_node_t *); -+ -+ for (size_t i = 0; i < ht->size[idx]; i++) { -+ isc_ht_node_t *node = ht->table[idx][i]; -+ while (node != NULL) { -+ isc_ht_node_t *next = node->next; -+ ht->count--; -+ isc_mem_put(ht->mctx, node, -+ sizeof(*node) + node->keysize); -+ node = next; -+ } -+ } -+ -+ isc_mem_put(ht->mctx, ht->table[idx], size); -+ ht->hashbits[idx] = HT_NO_BITS; -+ ht->table[idx] = NULL; -+} -+ -+void -+isc_ht_init(isc_ht_t **htp, isc_mem_t *mctx, uint8_t bits, -+ unsigned int options) { -+ isc_ht_t *ht = NULL; -+ bool case_sensitive = ((options & ISC_HT_CASE_INSENSITIVE) == 0); -+ -+ REQUIRE(htp != NULL && *htp == NULL); -+ REQUIRE(mctx != NULL); -+ REQUIRE(bits >= 1 && bits <= HT_MAX_BITS); -+ -+ ht = isc_mem_get(mctx, sizeof(*ht)); -+ INSIST(ht != NULL); -+ *ht = (isc_ht_t){ -+ .case_sensitive = case_sensitive, -+ }; -+ -+ isc_mem_attach(mctx, &ht->mctx); -+ -+ hashtable_new(ht, 0, bits); -+ - ht->magic = ISC_HT_MAGIC; - - *htp = ht; -- return (ISC_R_SUCCESS); - } - - void - isc_ht_destroy(isc_ht_t **htp) { - isc_ht_t *ht; -- size_t i; - - REQUIRE(htp != NULL); -- REQUIRE(ISC_HT_VALID((*htp))); -+ REQUIRE(ISC_HT_VALID(*htp)); - - ht = *htp; -+ *htp = NULL; - ht->magic = 0; - -- for (i = 0; i < ht->size; i++) { -- isc_ht_node_t *node = ht->table[i]; -- while (node != NULL) { -- isc_ht_node_t *next = node->next; -- ht->count--; -- isc_mem_put(ht->mctx, node, -- offsetof(isc_ht_node_t, key) + -- node->keysize); -- node = next; -+ for (size_t i = 0; i <= 1; i++) { -+ if (ht->table[i] != NULL) { -+ hashtable_free(ht, i); - } - } - - INSIST(ht->count == 0); - -- isc_mem_put(ht->mctx, ht->table, ht->size * sizeof(isc_ht_node_t*)); -- isc_mem_putanddetach(&ht->mctx, ht, sizeof(struct isc_ht)); -- -- *htp = NULL; -+ isc_mem_putanddetach(&ht->mctx, ht, sizeof(*ht)); - } - --isc_result_t --isc_ht_add(isc_ht_t *ht, const unsigned char *key, -- uint32_t keysize, void *value) --{ -+static void -+isc__ht_add(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize, -+ const uint32_t hashval, const uint8_t idx, void *value) { - isc_ht_node_t *node; - uint32_t hash; - -+ hash = hash_32(hashval, ht->hashbits[idx]); -+ -+ node = isc_mem_get(ht->mctx, sizeof(*node) + keysize); -+ INSIST(node != NULL); -+ *node = (isc_ht_node_t){ -+ .keysize = keysize, -+ .hashval = hashval, -+ .next = ht->table[idx][hash], -+ .value = value, -+ }; -+ -+ memmove(node->key, key, keysize); -+ -+ ht->count++; -+ ht->table[idx][hash] = node; -+} -+ -+isc_result_t -+isc_ht_add(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize, -+ void *value) { -+ uint32_t hashval; -+ - REQUIRE(ISC_HT_VALID(ht)); - REQUIRE(key != NULL && keysize > 0); - -- hash = isc_hash_function(key, keysize, true, NULL); -- node = ht->table[hash & ht->mask]; -- while (node != NULL) { -- if (keysize == node->keysize && -- memcmp(key, node->key, keysize) == 0) { -- return (ISC_R_EXISTS); -- } -- node = node->next; -+ if (rehashing_in_progress(ht)) { -+ /* Rehash in progress */ -+ hashtable_rehash_one(ht); -+ } else if (hashtable_is_overcommited(ht)) { -+ /* Rehash requested */ -+ maybe_rehash(ht, ht->count); - } - -- node = isc_mem_get(ht->mctx, offsetof(isc_ht_node_t, key) + keysize); -- if (node == NULL) -- return (ISC_R_NOMEMORY); -+ hashval = isc_hash_function(key, keysize, ht->case_sensitive, NULL); - -- memmove(node->key, key, keysize); -- node->keysize = keysize; -- node->next = ht->table[hash & ht->mask]; -- node->value = value; -+ if (isc__ht_find(ht, key, keysize, hashval, ht->hindex) != NULL) { -+ return (ISC_R_EXISTS); -+ } -+ -+ isc__ht_add(ht, key, keysize, hashval, ht->hindex, value); - -- ht->count++; -- ht->table[hash & ht->mask] = node; - return (ISC_R_SUCCESS); - } - -+static isc_ht_node_t * -+isc__ht_find(const isc_ht_t *ht, const unsigned char *key, -+ const uint32_t keysize, const uint32_t hashval, -+ const uint8_t idx) { -+ uint32_t hash; -+ uint8_t findex = idx; -+ -+nexttable: -+ hash = hash_32(hashval, ht->hashbits[findex]); -+ for (isc_ht_node_t *node = ht->table[findex][hash]; node != NULL; -+ node = node->next) -+ { -+ if (isc__ht_node_match(node, hashval, key, keysize, -+ ht->case_sensitive)) -+ { -+ return (node); -+ } -+ } -+ if (TRY_NEXTTABLE(findex, ht)) { -+ /* -+ * Rehashing in progress, check the other table -+ */ -+ findex = HT_NEXTTABLE(findex); -+ goto nexttable; -+ } -+ -+ return (NULL); -+} -+ - isc_result_t - isc_ht_find(const isc_ht_t *ht, const unsigned char *key, -- uint32_t keysize, void **valuep) --{ -+ const uint32_t keysize, void **valuep) { -+ uint32_t hashval; - isc_ht_node_t *node; -- uint32_t hash; - - REQUIRE(ISC_HT_VALID(ht)); - REQUIRE(key != NULL && keysize > 0); - REQUIRE(valuep == NULL || *valuep == NULL); - -- hash = isc_hash_function(key, keysize, true, NULL); -- node = ht->table[hash & ht->mask]; -- while (node != NULL) { -- if (keysize == node->keysize && -- memcmp(key, node->key, keysize) == 0) { -- if (valuep != NULL) { -- *valuep = node->value; -- } -- return (ISC_R_SUCCESS); -- } -- node = node->next; -+ hashval = isc_hash_function(key, keysize, ht->case_sensitive, NULL); -+ -+ node = isc__ht_find(ht, key, keysize, hashval, ht->hindex); -+ if (node == NULL) { -+ return (ISC_R_NOTFOUND); - } - -- return (ISC_R_NOTFOUND); -+ if (valuep != NULL) { -+ *valuep = node->value; -+ } -+ return (ISC_R_SUCCESS); - } - --isc_result_t --isc_ht_delete(isc_ht_t *ht, const unsigned char *key, uint32_t keysize) { -- isc_ht_node_t *node, *prev; -+static isc_result_t -+isc__ht_delete(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize, -+ const uint32_t hashval, const uint8_t idx) { -+ isc_ht_node_t *prev = NULL; - uint32_t hash; - -- REQUIRE(ISC_HT_VALID(ht)); -- REQUIRE(key != NULL && keysize > 0); -- -- prev = NULL; -- hash = isc_hash_function(key, keysize, true, NULL); -- node = ht->table[hash & ht->mask]; -- while (node != NULL) { -- if (keysize == node->keysize && -- memcmp(key, node->key, keysize) == 0) { -- if (prev == NULL) -- ht->table[hash & ht->mask] = node->next; -- else -+ hash = hash_32(hashval, ht->hashbits[idx]); -+ -+ for (isc_ht_node_t *node = ht->table[idx][hash]; node != NULL; -+ prev = node, node = node->next) -+ { -+ if (isc__ht_node_match(node, hashval, key, keysize, -+ ht->case_sensitive)) -+ { -+ if (prev == NULL) { -+ ht->table[idx][hash] = node->next; -+ } else { - prev->next = node->next; -+ } - isc_mem_put(ht->mctx, node, -- offsetof(isc_ht_node_t, key) + -- node->keysize); -+ sizeof(*node) + node->keysize); - ht->count--; - - return (ISC_R_SUCCESS); - } -- -- prev = node; -- node = node->next; - } -+ - return (ISC_R_NOTFOUND); - } - - isc_result_t -+isc_ht_delete(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize) { -+ uint32_t hashval; -+ uint8_t hindex; -+ isc_result_t result; -+ -+ REQUIRE(ISC_HT_VALID(ht)); -+ REQUIRE(key != NULL && keysize > 0); -+ -+ if (rehashing_in_progress(ht)) { -+ /* Rehash in progress */ -+ hashtable_rehash_one(ht); -+ } -+ -+ hindex = ht->hindex; -+ hashval = isc_hash_function(key, keysize, ht->case_sensitive, NULL); -+nexttable: -+ result = isc__ht_delete(ht, key, keysize, hashval, hindex); -+ -+ if (result == ISC_R_NOTFOUND && TRY_NEXTTABLE(hindex, ht)) { -+ /* -+ * Rehashing in progress, check the other table -+ */ -+ hindex = HT_NEXTTABLE(hindex); -+ goto nexttable; -+ } -+ -+ return (result); -+} -+ -+void - isc_ht_iter_create(isc_ht_t *ht, isc_ht_iter_t **itp) { - isc_ht_iter_t *it; - -@@ -219,16 +496,13 @@ isc_ht_iter_create(isc_ht_t *ht, isc_ht_iter_t **itp) { - REQUIRE(itp != NULL && *itp == NULL); - - it = isc_mem_get(ht->mctx, sizeof(isc_ht_iter_t)); -- if (it == NULL) -- return (ISC_R_NOMEMORY); -- -- it->ht = ht; -- it->i = 0; -- it->cur = NULL; -+ INSIST(it != NULL); -+ *it = (isc_ht_iter_t){ -+ .ht = ht, -+ .hindex = ht->hindex, -+ }; - - *itp = it; -- -- return (ISC_R_SUCCESS); - } - - void -@@ -239,26 +513,48 @@ isc_ht_iter_destroy(isc_ht_iter_t **itp) { - REQUIRE(itp != NULL && *itp != NULL); - - it = *itp; -- ht = it->ht; -- isc_mem_put(ht->mctx, it, sizeof(isc_ht_iter_t)); -- - *itp = NULL; -+ ht = it->ht; -+ isc_mem_put(ht->mctx, it, sizeof(*it)); - } - - isc_result_t - isc_ht_iter_first(isc_ht_iter_t *it) { -+ isc_ht_t *ht; -+ - REQUIRE(it != NULL); - -+ ht = it->ht; -+ -+ it->hindex = ht->hindex; - it->i = 0; -- while (it->i < it->ht->size && it->ht->table[it->i] == NULL) -+ -+ return (isc__ht_iter_next(it)); -+} -+ -+static isc_result_t -+isc__ht_iter_next(isc_ht_iter_t *it) { -+ isc_ht_t *ht = it->ht; -+ -+ while (it->i < ht->size[it->hindex] && -+ ht->table[it->hindex][it->i] == NULL) -+ { - it->i++; -+ } - -- if (it->i == it->ht->size) -- return (ISC_R_NOMORE); -+ if (it->i < ht->size[it->hindex]) { -+ it->cur = ht->table[it->hindex][it->i]; - -- it->cur = it->ht->table[it->i]; -+ return (ISC_R_SUCCESS); -+ } - -- return (ISC_R_SUCCESS); -+ if (TRY_NEXTTABLE(it->hindex, ht)) { -+ it->hindex = HT_NEXTTABLE(it->hindex); -+ it->i = 0; -+ return (isc__ht_iter_next(it)); -+ } -+ -+ return (ISC_R_NOMORE); - } - - isc_result_t -@@ -267,58 +563,36 @@ isc_ht_iter_next(isc_ht_iter_t *it) { - REQUIRE(it->cur != NULL); - - it->cur = it->cur->next; -- if (it->cur == NULL) { -- do { -- it->i++; -- } while (it->i < it->ht->size && it->ht->table[it->i] == NULL); -- if (it->i >= it->ht->size) -- return (ISC_R_NOMORE); -- it->cur = it->ht->table[it->i]; -+ -+ if (it->cur != NULL) { -+ return (ISC_R_SUCCESS); - } - -- return (ISC_R_SUCCESS); -+ it->i++; -+ -+ return (isc__ht_iter_next(it)); - } - - isc_result_t - isc_ht_iter_delcurrent_next(isc_ht_iter_t *it) { - isc_result_t result = ISC_R_SUCCESS; -- isc_ht_node_t *to_delete = NULL; -- isc_ht_node_t *prev = NULL; -- isc_ht_node_t *node = NULL; -- uint32_t hash; -+ isc_ht_node_t *dnode = NULL; -+ uint8_t dindex; - isc_ht_t *ht; -+ isc_result_t dresult; -+ - REQUIRE(it != NULL); - REQUIRE(it->cur != NULL); -- to_delete = it->cur; -- ht = it->ht; - -- it->cur = it->cur->next; -- if (it->cur == NULL) { -- do { -- it->i++; -- } while (it->i < ht->size && ht->table[it->i] == NULL); -- if (it->i >= ht->size) -- result = ISC_R_NOMORE; -- else -- it->cur = ht->table[it->i]; -- } -+ ht = it->ht; -+ dnode = it->cur; -+ dindex = it->hindex; - -- hash = isc_hash_function(to_delete->key, to_delete->keysize, true, -- NULL); -- node = ht->table[hash & ht->mask]; -- while (node != to_delete) { -- prev = node; -- node = node->next; -- INSIST(node != NULL); -- } -+ result = isc_ht_iter_next(it); - -- if (prev == NULL) -- ht->table[hash & ht->mask] = node->next; -- else -- prev->next = node->next; -- isc_mem_put(ht->mctx, node, -- offsetof(isc_ht_node_t, key) + node->keysize); -- ht->count--; -+ dresult = isc__ht_delete(ht, dnode->key, dnode->keysize, dnode->hashval, -+ dindex); -+ INSIST(dresult == ISC_R_SUCCESS); - - return (result); - } -@@ -333,8 +607,8 @@ isc_ht_iter_current(isc_ht_iter_t *it, void **valuep) { - } - - void --isc_ht_iter_currentkey(isc_ht_iter_t *it, unsigned char **key, size_t *keysize) --{ -+isc_ht_iter_currentkey(isc_ht_iter_t *it, unsigned char **key, -+ size_t *keysize) { - REQUIRE(it != NULL); - REQUIRE(it->cur != NULL); - REQUIRE(key != NULL && *key == NULL); -@@ -343,9 +617,9 @@ isc_ht_iter_currentkey(isc_ht_iter_t *it, unsigned char **key, size_t *keysize) - *keysize = it->cur->keysize; - } - --unsigned int --isc_ht_count(isc_ht_t *ht) { -+size_t -+isc_ht_count(const isc_ht_t *ht) { - REQUIRE(ISC_HT_VALID(ht)); - -- return(ht->count); -+ return (ht->count); - } -diff --git a/lib/isc/include/isc/ht.h b/lib/isc/include/isc/ht.h -index a1315b0c5a..163fbefb79 100644 ---- a/lib/isc/include/isc/ht.h -+++ b/lib/isc/include/isc/ht.h -@@ -1,6 +1,8 @@ - /* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * -+ * SPDX-License-Identifier: MPL-2.0 -+ * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. -@@ -11,32 +13,35 @@ - - /* ! \file */ - --#ifndef ISC_HT_H --#define ISC_HT_H 1 -+#pragma once - - #include - #include - --#include - #include -+#include - --typedef struct isc_ht isc_ht_t; -+typedef struct isc_ht isc_ht_t; - typedef struct isc_ht_iter isc_ht_iter_t; - -+enum { ISC_HT_CASE_SENSITIVE = 0x00, ISC_HT_CASE_INSENSITIVE = 0x01 }; -+ - /*% - * Initialize hashtable at *htp, using memory context and size of (1<=1 and 'bits' <=32 - * -- * Returns: -- *\li #ISC_R_NOMEMORY -- not enough memory to create pool -- *\li #ISC_R_SUCCESS -- all is well. - */ --isc_result_t --isc_ht_init(isc_ht_t **htp, isc_mem_t *mctx, uint8_t bits); -+void -+isc_ht_init(isc_ht_t **htp, isc_mem_t *mctx, uint8_t bits, -+ unsigned int options); - - /*% - * Destroy hashtable, freeing everything -@@ -53,6 +58,7 @@ isc_ht_destroy(isc_ht_t **htp); - * - * Requires: - *\li 'ht' is a valid hashtable -+ *\li write-lock - * - * Returns: - *\li #ISC_R_NOMEMORY -- not enough memory to create pool -@@ -60,15 +66,18 @@ isc_ht_destroy(isc_ht_t **htp); - *\li #ISC_R_SUCCESS -- all is well. - */ - isc_result_t --isc_ht_add(isc_ht_t *ht, const unsigned char *key, uint32_t keysize, -- void *value); -+isc_ht_add(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize, -+ void *value); - - /*% - * Find a node matching 'key'/'keysize' in hashtable 'ht'; -- * if found, set 'value' to its value -+ * if found, set '*valuep' to its value. (If 'valuep' is NULL, -+ * then simply return SUCCESS or NOTFOUND to indicate whether the -+ * key exists in the hashtable.) - * - * Requires: - * \li 'ht' is a valid hashtable -+ * \li read-lock - * - * Returns: - * \li #ISC_R_SUCCESS -- success -@@ -76,20 +85,21 @@ isc_ht_add(isc_ht_t *ht, const unsigned char *key, uint32_t keysize, - */ - isc_result_t - isc_ht_find(const isc_ht_t *ht, const unsigned char *key, -- uint32_t keysize, void **valuep); -+ const uint32_t keysize, void **valuep); - - /*% - * Delete node from hashtable - * - * Requires: - *\li ht is a valid hashtable -+ *\li write-lock - * - * Returns: - *\li #ISC_R_NOTFOUND -- key not found - *\li #ISC_R_SUCCESS -- all is well - */ - isc_result_t --isc_ht_delete(isc_ht_t *ht, const unsigned char *key, uint32_t keysize); -+isc_ht_delete(isc_ht_t *ht, const unsigned char *key, const uint32_t keysize); - - /*% - * Create an iterator for the hashtable; point '*itp' to it. -@@ -98,7 +108,7 @@ isc_ht_delete(isc_ht_t *ht, const unsigned char *key, uint32_t keysize); - *\li 'ht' is a valid hashtable - *\li 'itp' is non NULL and '*itp' is NULL. - */ --isc_result_t -+void - isc_ht_iter_create(isc_ht_t *ht, isc_ht_iter_t **itp); - - /*% -@@ -117,7 +127,7 @@ isc_ht_iter_destroy(isc_ht_iter_t **itp); - *\li 'it' is non NULL. - * - * Returns: -- * \li #ISC_R_SUCCESS -- success -+ * \li #ISC_R_SUCCESS -- success - * \li #ISC_R_NOMORE -- no data in the hashtable - */ - isc_result_t -@@ -130,7 +140,7 @@ isc_ht_iter_first(isc_ht_iter_t *it); - *\li 'it' is non NULL. - * - * Returns: -- * \li #ISC_R_SUCCESS -- success -+ * \li #ISC_R_SUCCESS -- success - * \li #ISC_R_NOMORE -- end of hashtable reached - */ - isc_result_t -@@ -143,13 +153,12 @@ isc_ht_iter_next(isc_ht_iter_t *it); - *\li 'it' is non NULL. - * - * Returns: -- * \li #ISC_R_SUCCESS -- success -+ * \li #ISC_R_SUCCESS -- success - * \li #ISC_R_NOMORE -- end of hashtable reached - */ - isc_result_t - isc_ht_iter_delcurrent_next(isc_ht_iter_t *it); - -- - /*% - * Set 'value' to the current value under the iterator - * -@@ -178,6 +187,5 @@ isc_ht_iter_currentkey(isc_ht_iter_t *it, unsigned char **key, size_t *keysize); - * Requires: - *\li 'ht' is a valid hashtable - */ --unsigned int --isc_ht_count(isc_ht_t *ht); --#endif -+size_t -+isc_ht_count(const isc_ht_t *ht); -diff --git a/lib/isc/tests/ht_test.c b/lib/isc/tests/ht_test.c -index 79e4260c2b..144d859639 100644 ---- a/lib/isc/tests/ht_test.c -+++ b/lib/isc/tests/ht_test.c -@@ -60,8 +60,7 @@ test_ht_full(int bits, uintptr_t count) { - NULL, &mctx, 0); - assert_int_equal(result, ISC_R_SUCCESS); - -- result = isc_ht_init(&ht, mctx, bits); -- assert_int_equal(result, ISC_R_SUCCESS); -+ isc_ht_init(&ht, mctx, bits, ISC_HT_CASE_SENSITIVE); - assert_non_null(ht); - - for (i = 1; i < count; i++) { -@@ -214,8 +213,7 @@ test_ht_iterator() { - NULL, &mctx, 0); - assert_int_equal(result, ISC_R_SUCCESS); - -- result = isc_ht_init(&ht, mctx, 16); -- assert_int_equal(result, ISC_R_SUCCESS); -+ isc_ht_init(&ht, mctx, 16, ISC_HT_CASE_SENSITIVE); - assert_non_null(ht); - for (i = 1; i <= count; i++) { - /* -@@ -229,8 +227,7 @@ test_ht_iterator() { - } - - walked = 0; -- result = isc_ht_iter_create(ht, &iter); -- assert_int_equal(result, ISC_R_SUCCESS); -+ isc_ht_iter_create(ht, &iter); - - for (result = isc_ht_iter_first(iter); - result == ISC_R_SUCCESS; -@@ -348,9 +345,69 @@ isc_ht_iterator_test(void **state) { - test_ht_iterator(); - } - -+static void -+isc_ht_case(void **state) { -+ UNUSED(state); -+ -+ isc_ht_t *ht = NULL; -+ void *f = NULL; -+ isc_result_t result = ISC_R_UNSET; -+ isc_mem_t *mctx = NULL; -+ -+ result = isc_mem_createx2(0, 0, default_memalloc, default_memfree, -+ NULL, &mctx, 0); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ unsigned char lower[16] = { "test case" }; -+ unsigned char same[16] = { "test case" }; -+ unsigned char upper[16] = { "TEST CASE" }; -+ unsigned char mixed[16] = { "tEsT CaSe" }; -+ -+ isc_ht_init(&ht, mctx, 8, ISC_HT_CASE_SENSITIVE); -+ assert_non_null(ht); -+ -+ result = isc_ht_add(ht, lower, 16, (void *)lower); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ result = isc_ht_add(ht, same, 16, (void *)same); -+ assert_int_equal(result, ISC_R_EXISTS); -+ -+ result = isc_ht_add(ht, upper, 16, (void *)upper); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ result = isc_ht_find(ht, mixed, 16, &f); -+ assert_int_equal(result, ISC_R_NOTFOUND); -+ assert_null(f); -+ -+ isc_ht_destroy(&ht); -+ assert_null(ht); -+ -+ isc_ht_init(&ht, mctx, 8, ISC_HT_CASE_INSENSITIVE); -+ assert_non_null(ht); -+ -+ result = isc_ht_add(ht, lower, 16, (void *)lower); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ result = isc_ht_add(ht, same, 16, (void *)same); -+ assert_int_equal(result, ISC_R_EXISTS); -+ -+ result = isc_ht_add(ht, upper, 16, (void *)upper); -+ assert_int_equal(result, ISC_R_EXISTS); -+ -+ result = isc_ht_find(ht, mixed, 16, &f); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ assert_ptr_equal(f, &lower); -+ -+ isc_ht_destroy(&ht); -+ assert_null(ht); -+ -+ isc_mem_detach(&mctx); -+} -+ - int - main(void) { - const struct CMUnitTest tests[] = { -+ cmocka_unit_test(isc_ht_case), - cmocka_unit_test(isc_ht_20), - cmocka_unit_test(isc_ht_8), - cmocka_unit_test(isc_ht_1), --- -2.43.2 - diff --git a/SOURCES/bind-9.11-CVE-2023-50387-fixup.patch b/SOURCES/bind-9.11-CVE-2023-50387-fixup.patch deleted file mode 100644 index 42b8287..0000000 --- a/SOURCES/bind-9.11-CVE-2023-50387-fixup.patch +++ /dev/null @@ -1,64 +0,0 @@ -From f0fc9d7999a94da3d471c4e0a35b1f447f25eea6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Mon, 26 Feb 2024 21:08:42 +0100 -Subject: [PATCH] Add normal task queue also to non-thread version - -Non-thread builds are used by us for dhcp package. Make it working -again. - -Related to [GL #4424] and [GL #4459]. ---- - lib/isc/task.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/lib/isc/task.c b/lib/isc/task.c -index cc83269..5315b51 100644 ---- a/lib/isc/task.c -+++ b/lib/isc/task.c -@@ -1115,7 +1115,7 @@ dispatch(isc__taskmgr_t *manager, isc_taskqueue_t qid) { - } - #else /* USE_WORKER_THREADS */ - if (total_dispatch_count >= DEFAULT_TASKMGR_QUANTUM || -- empty_readyq(manager)) -+ empty_readyq(manager, qid)) - break; - #endif /* USE_WORKER_THREADS */ - XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TASK, -@@ -1318,11 +1318,11 @@ dispatch(isc__taskmgr_t *manager, isc_taskqueue_t qid) { - } - - #ifndef USE_WORKER_THREADS -- ISC_LIST_APPENDLIST(manager->ready_tasks, new_ready_tasks, ready_link); -- ISC_LIST_APPENDLIST(manager->ready_priority_tasks, new_priority_tasks, -+ ISC_LIST_APPENDLIST(manager->ready_tasks[qid], new_ready_tasks, ready_link); -+ ISC_LIST_APPENDLIST(manager->ready_priority_tasks[qid], new_priority_tasks, - ready_priority_link); - manager->tasks_ready += tasks_ready; -- if (empty_readyq(manager)) -+ if (empty_readyq(manager, qid)) - manager->mode = isc_taskmgrmode_normal; - #endif - -@@ -1713,7 +1713,8 @@ isc__taskmgr_ready(isc_taskmgr_t *manager0) { - return (false); - - LOCK(&manager->lock); -- is_ready = !empty_readyq(manager); -+ is_ready = !empty_readyq(manager, isc_taskqueue_normal) || -+ !empty_readyq(manager, isc_taskqueue_slow); - UNLOCK(&manager->lock); - - return (is_ready); -@@ -1730,7 +1731,8 @@ isc__taskmgr_dispatch(isc_taskmgr_t *manager0) { - if (manager == NULL) - return (ISC_R_NOTFOUND); - -- dispatch(manager); -+ dispatch(manager, isc_taskqueue_normal); -+ dispatch(manager, isc_taskqueue_slow); - - return (ISC_R_SUCCESS); - } --- -2.43.2 - diff --git a/SOURCES/bind-9.11-CVE-2023-50387.patch b/SOURCES/bind-9.11-CVE-2023-50387.patch deleted file mode 100644 index 2f90d65..0000000 --- a/SOURCES/bind-9.11-CVE-2023-50387.patch +++ /dev/null @@ -1,737 +0,0 @@ -From 4c20ab54ec503f65d8ee0b863cbf41103d95130a Mon Sep 17 00:00:00 2001 -From: Mark Andrews -Date: Wed, 22 Nov 2023 16:59:03 +1100 -Subject: [PATCH] Fail the DNSSEC validation on the first failure - -Be more strict when encountering DNSSEC validation failures - fail on -the first failure. This will break domains that have DNSSEC signing -keys with duplicate key ids, but this is something that's much easier -to fix on the authoritative side, so we are just going to be strict -on the resolver side where it is causing performance problems. - -(cherry picked from commit 8b7ecba9885e163c07c2dd3e1ceab79b2ba89e34) - -Add normal and slow task queues - -Split the task manager queues into normal and slow task queues, so we -can move the tasks that blocks processing for a long time (like DNSSEC -validation) into the slow queue which doesn't block fast -operations (like responding from the cache). This mitigates the whole -class of KeyTrap-like issues. - -(cherry picked from commit db083a21726300916fa0b9fd8a433a796fedf636) - -Don't iterate from start every time we select new signing key - -Improve the selecting of the new signing key by remembering where -we stopped the iteration and just continue from that place instead -of iterating from the start over and over again each time. - -(cherry picked from commit 75faeefcab47e4f1e12b358525190b4be90f97de) - -Optimize selecting the signing key - -Don't parse the crypto data before parsing and matching the id and the -algorithm. - -(cherry picked from commit b38552cca7200a72658e482f8407f57516efc5db) - -6322. [security] Specific DNS answers could cause a denial-of-service - condition due to DNS validation taking a long time. - (CVE-2023-50387) [GL #4424] - - The same code change also addresses another problem: - preparing NSEC3 closest encloser proofs could exhaust - available CPU resources. (CVE-2023-50868) [GL #4459] ---- - lib/dns/dst_api.c | 25 ++++-- - lib/dns/include/dns/validator.h | 1 + - lib/dns/include/dst/dst.h | 4 + - lib/dns/resolver.c | 2 +- - lib/dns/validator.c | 97 +++++++++----------- - lib/dns/win32/libdns.def.in | 1 + - lib/isc/include/isc/task.h | 11 ++- - lib/isc/task.c | 153 ++++++++++++++++++++++---------- - 8 files changed, 186 insertions(+), 108 deletions(-) - -diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c -index 2156384ec1..6bcd99796c 100644 ---- a/lib/dns/dst_api.c -+++ b/lib/dns/dst_api.c -@@ -105,6 +105,7 @@ static isc_result_t frombuffer(dns_name_t *name, - dns_rdataclass_t rdclass, - isc_buffer_t *source, - isc_mem_t *mctx, -+ bool no_rdata, - dst_key_t **keyp); - - static isc_result_t algorithm_status(unsigned int alg); -@@ -764,6 +765,13 @@ isc_result_t - dst_key_fromdns(dns_name_t *name, dns_rdataclass_t rdclass, - isc_buffer_t *source, isc_mem_t *mctx, dst_key_t **keyp) - { -+ return (dst_key_fromdns_ex(name, rdclass, source, mctx, false, keyp)); -+} -+ -+isc_result_t -+dst_key_fromdns_ex(dns_name_t *name, dns_rdataclass_t rdclass, -+ isc_buffer_t *source, isc_mem_t *mctx, bool no_rdata, -+ dst_key_t **keyp) { - uint8_t alg, proto; - uint32_t flags, extflags; - dst_key_t *key = NULL; -@@ -792,7 +800,7 @@ dst_key_fromdns(dns_name_t *name, dns_rdataclass_t rdclass, - } - - result = frombuffer(name, alg, flags, proto, rdclass, source, -- mctx, &key); -+ mctx, no_rdata, &key); - if (result != ISC_R_SUCCESS) - return (result); - key->key_id = id; -@@ -814,7 +822,7 @@ dst_key_frombuffer(dns_name_t *name, unsigned int alg, - REQUIRE(dst_initialized); - - result = frombuffer(name, alg, flags, protocol, rdclass, source, -- mctx, &key); -+ mctx, false, &key); - if (result != ISC_R_SUCCESS) - return (result); - -@@ -1915,7 +1923,8 @@ computeid(dst_key_t *key) { - static isc_result_t - frombuffer(dns_name_t *name, unsigned int alg, unsigned int flags, - unsigned int protocol, dns_rdataclass_t rdclass, -- isc_buffer_t *source, isc_mem_t *mctx, dst_key_t **keyp) -+ isc_buffer_t *source, isc_mem_t *mctx, bool no_rdata, -+ dst_key_t **keyp) - { - dst_key_t *key; - isc_result_t ret; -@@ -1940,10 +1949,12 @@ frombuffer(dns_name_t *name, unsigned int alg, unsigned int flags, - return (DST_R_UNSUPPORTEDALG); - } - -- ret = key->func->fromdns(key, source); -- if (ret != ISC_R_SUCCESS) { -- dst_key_free(&key); -- return (ret); -+ if (!no_rdata) { -+ ret = key->func->fromdns(key, source); -+ if (ret != ISC_R_SUCCESS) { -+ dst_key_free(&key); -+ return (ret); -+ } - } - } - -diff --git a/lib/dns/include/dns/validator.h b/lib/dns/include/dns/validator.h -index cc4478d6d4..b4bf8f29db 100644 ---- a/lib/dns/include/dns/validator.h -+++ b/lib/dns/include/dns/validator.h -@@ -160,6 +160,7 @@ struct dns_validator { - unsigned int depth; - unsigned int authcount; - unsigned int authfail; -+ bool failed; - isc_stdtime_t start; - }; - -diff --git a/lib/dns/include/dst/dst.h b/lib/dns/include/dst/dst.h -index 180c841307..a8be2daf67 100644 ---- a/lib/dns/include/dst/dst.h -+++ b/lib/dns/include/dst/dst.h -@@ -435,6 +435,10 @@ dst_key_tofile(const dst_key_t *key, int type, const char *directory); - */ - - isc_result_t -+dst_key_fromdns_ex(dns_name_t *name, dns_rdataclass_t rdclass, -+ isc_buffer_t *source, isc_mem_t *mctx, bool no_rdata, -+ dst_key_t **keyp); -+isc_result_t - dst_key_fromdns(dns_name_t *name, dns_rdataclass_t rdclass, - isc_buffer_t *source, isc_mem_t *mctx, dst_key_t **keyp); - /*%< -diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c -index 4f71f48039..487107614c 100644 ---- a/lib/dns/resolver.c -+++ b/lib/dns/resolver.c -@@ -9267,7 +9267,7 @@ dns_resolver_create(dns_view_t *view, - if (result != ISC_R_SUCCESS) - goto cleanup_buckets; - res->buckets[i].task = NULL; -- result = isc_task_create(taskmgr, 0, &res->buckets[i].task); -+ result = isc_task_create(taskmgr, ISC_TASK_QUANTUM_SLOW, &res->buckets[i].task); - if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&res->buckets[i].lock); - goto cleanup_buckets; -diff --git a/lib/dns/validator.c b/lib/dns/validator.c -index 2a5c3caa6a..0b257fe874 100644 ---- a/lib/dns/validator.c -+++ b/lib/dns/validator.c -@@ -1207,6 +1207,12 @@ create_validator(dns_validator_t *val, dns_name_t *name, dns_rdatatype_t type, - * val->key at it. - * - * If val->key is non-NULL, this returns the next matching key. -+ * If val->key is already non-NULL, start searching from the next position in -+ * 'rdataset' to find the *next* key that could have signed 'siginfo', then -+ * set val->key to that. -+ * -+ * Returns ISC_R_SUCCESS if a possible matching key has been found, -+ * ISC_R_NOTFOUND if not. Any other value indicates error. - */ - static isc_result_t - get_dst_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo, -@@ -1216,54 +1222,59 @@ get_dst_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo, - isc_buffer_t b; - dns_rdata_t rdata = DNS_RDATA_INIT; - dst_key_t *oldkey = val->key; -- bool foundold; -+ bool no_rdata = false; - -- if (oldkey == NULL) -- foundold = true; -- else { -- foundold = false; -+ if (oldkey == NULL) { -+ result = dns_rdataset_first(rdataset); -+ } else { -+ dst_key_free(&oldkey); - val->key = NULL; -+ result = dns_rdataset_next(rdataset); -+ } -+ -+ if (result != ISC_R_SUCCESS) { -+ goto done; - } - -- result = dns_rdataset_first(rdataset); -- if (result != ISC_R_SUCCESS) -- goto failure; - do { - dns_rdataset_current(rdataset, &rdata); - - isc_buffer_init(&b, rdata.data, rdata.length); - isc_buffer_add(&b, rdata.length); - INSIST(val->key == NULL); -- result = dst_key_fromdns(&siginfo->signer, rdata.rdclass, &b, -- val->view->mctx, &val->key); -+ result = dst_key_fromdns_ex(&siginfo->signer, rdata.rdclass, &b, -+ val->view->mctx, no_rdata, -+ &val->key); - if (result == ISC_R_SUCCESS) { - if (siginfo->algorithm == - (dns_secalg_t)dst_key_alg(val->key) && - siginfo->keyid == - (dns_keytag_t)dst_key_id(val->key) && -+ (dst_key_flags(val->key) & DNS_KEYFLAG_REVOKE) == -+ 0 && - dst_key_iszonekey(val->key)) - { -- if (foundold) { -- /* -- * This is the key we're looking for. -- */ -- return (ISC_R_SUCCESS); -- } else if (dst_key_compare(oldkey, val->key)) { -- foundold = true; -- dst_key_free(&oldkey); -+ if (no_rdata) { -+ /* Retry with full key */ -+ dns_rdata_reset(&rdata); -+ dst_key_free(&val->key); -+ no_rdata = false; -+ continue; - } -+ /* This is the key we're looking for. */ -+ goto done; - } - dst_key_free(&val->key); - } - dns_rdata_reset(&rdata); - result = dns_rdataset_next(rdataset); -+ no_rdata = true; - } while (result == ISC_R_SUCCESS); -- if (result == ISC_R_NOMORE) -- result = ISC_R_NOTFOUND; - -- failure: -- if (oldkey != NULL) -- dst_key_free(&oldkey); -+done: -+ if (result == ISC_R_NOMORE) { -+ result = ISC_R_NOTFOUND; -+ } - - return (result); - } -@@ -1633,37 +1644,13 @@ validate(dns_validator_t *val, bool resume) { - continue; - } - -- do { -- vresult = verify(val, val->key, &rdata, -- val->siginfo->keyid); -- if (vresult == ISC_R_SUCCESS) -- break; -- if (val->keynode != NULL) { -- dns_keynode_t *nextnode = NULL; -- result = dns_keytable_findnextkeynode( -- val->keytable, -- val->keynode, -- &nextnode); -- dns_keytable_detachkeynode(val->keytable, -- &val->keynode); -- val->keynode = nextnode; -- if (result != ISC_R_SUCCESS) { -- val->key = NULL; -- break; -- } -- val->key = dns_keynode_key(val->keynode); -- if (val->key == NULL) -- break; -- } else { -- if (get_dst_key(val, val->siginfo, val->keyset) -- != ISC_R_SUCCESS) -- break; -- } -- } while (1); -- if (vresult != ISC_R_SUCCESS) -+ vresult = verify(val, val->key, &rdata, -+ val->siginfo->keyid); -+ if (vresult != ISC_R_SUCCESS) { -+ val->failed = true; - validator_log(val, ISC_LOG_DEBUG(3), - "failed to verify rdataset"); -- else { -+ } else { - dns_rdataset_trimttl(event->rdataset, - event->sigrdataset, - val->siginfo, val->start, -@@ -1700,9 +1687,13 @@ validate(dns_validator_t *val, bool resume) { - } else { - validator_log(val, ISC_LOG_DEBUG(3), - "verify failure: %s", -- isc_result_totext(result)); -+ isc_result_totext(vresult)); - resume = false; - } -+ if (val->failed) { -+ result = ISC_R_NOMORE; -+ break; -+ } - } - if (result != ISC_R_NOMORE) { - validator_log(val, ISC_LOG_DEBUG(3), -diff --git a/lib/dns/win32/libdns.def.in b/lib/dns/win32/libdns.def.in -index f597049493..7320653439 100644 ---- a/lib/dns/win32/libdns.def.in -+++ b/lib/dns/win32/libdns.def.in -@@ -1439,6 +1439,7 @@ dst_key_format - dst_key_free - dst_key_frombuffer - dst_key_fromdns -+dst_key_fromdns_ex - dst_key_fromfile - dst_key_fromgssapi - dst_key_fromlabel -diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h -index 28e5e25fc6..42f7763869 100644 ---- a/lib/isc/include/isc/task.h -+++ b/lib/isc/include/isc/task.h -@@ -98,8 +98,15 @@ ISC_LANG_BEGINDECLS - ***/ - - typedef enum { -- isc_taskmgrmode_normal = 0, -- isc_taskmgrmode_privileged -+ isc_taskqueue_normal = 0, -+ isc_taskqueue_slow = 1, -+} isc_taskqueue_t; -+ -+#define ISC_TASK_QUANTUM_SLOW 1024 -+ -+typedef enum { -+ isc_taskmgrmode_normal = 0, -+ isc_taskmgrmode_privileged - } isc_taskmgrmode_t; - - /*% Task and task manager methods */ -diff --git a/lib/isc/task.c b/lib/isc/task.c -index 048639350b..cc83269df2 100644 ---- a/lib/isc/task.c -+++ b/lib/isc/task.c -@@ -107,6 +107,7 @@ struct isc__task { - isc_eventlist_t on_shutdown; - unsigned int nevents; - unsigned int quantum; -+ unsigned int qid; - unsigned int flags; - isc_stdtime_t now; - isc_time_t tnow; -@@ -141,11 +142,11 @@ struct isc__taskmgr { - /* Locked by task manager lock. */ - unsigned int default_quantum; - LIST(isc__task_t) tasks; -- isc__tasklist_t ready_tasks; -- isc__tasklist_t ready_priority_tasks; -+ isc__tasklist_t ready_tasks[2]; -+ isc__tasklist_t ready_priority_tasks[2]; - isc_taskmgrmode_t mode; - #ifdef ISC_PLATFORM_USETHREADS -- isc_condition_t work_available; -+ isc_condition_t work_available[2]; - isc_condition_t exclusive_granted; - isc_condition_t paused; - #endif /* ISC_PLATFORM_USETHREADS */ -@@ -247,13 +248,13 @@ isc_taskmgrmode_t - isc__taskmgr_mode(isc_taskmgr_t *manager0); - - static inline bool --empty_readyq(isc__taskmgr_t *manager); -+empty_readyq(isc__taskmgr_t *manager, isc_taskqueue_t qid); - - static inline isc__task_t * --pop_readyq(isc__taskmgr_t *manager); -+pop_readyq(isc__taskmgr_t *manager, isc_taskqueue_t qid); - - static inline void --push_readyq(isc__taskmgr_t *manager, isc__task_t *task); -+push_readyq(isc__taskmgr_t *manager, isc__task_t *task, isc_taskqueue_t qid); - - static struct isc__taskmethods { - isc_taskmethods_t methods; -@@ -324,7 +325,8 @@ task_finished(isc__task_t *task) { - * any idle worker threads so they - * can exit. - */ -- BROADCAST(&manager->work_available); -+ BROADCAST(&manager->work_available[isc_taskqueue_normal]); -+ BROADCAST(&manager->work_available[isc_taskqueue_slow]); - } - #endif /* USE_WORKER_THREADS */ - UNLOCK(&manager->lock); -@@ -364,7 +366,13 @@ isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum, - INIT_LIST(task->events); - INIT_LIST(task->on_shutdown); - task->nevents = 0; -- task->quantum = quantum; -+ if (quantum >= ISC_TASK_QUANTUM_SLOW) { -+ task->qid = isc_taskqueue_slow; -+ task->quantum = quantum - ISC_TASK_QUANTUM_SLOW; -+ } else { -+ task->qid = isc_taskqueue_normal; -+ task->quantum = quantum; -+ } - task->flags = 0; - task->now = 0; - isc_time_settoepoch(&task->tnow); -@@ -476,11 +484,11 @@ task_ready(isc__task_t *task) { - - LOCK(&manager->lock); - LOCK(&task->lock); -- push_readyq(manager, task); -+ push_readyq(manager, task, task->qid); - UNLOCK(&task->lock); - #ifdef USE_WORKER_THREADS - if (manager->mode == isc_taskmgrmode_normal || has_privilege) -- SIGNAL(&manager->work_available); -+ SIGNAL(&manager->work_available[task->qid]); - #endif /* USE_WORKER_THREADS */ - UNLOCK(&manager->lock); - } -@@ -961,13 +969,13 @@ isc__task_getcurrenttimex(isc_task_t *task0, isc_time_t *t) { - * Caller must hold the task manager lock. - */ - static inline bool --empty_readyq(isc__taskmgr_t *manager) { -+empty_readyq(isc__taskmgr_t *manager, isc_taskqueue_t qid) { - isc__tasklist_t queue; - - if (manager->mode == isc_taskmgrmode_normal) -- queue = manager->ready_tasks; -+ queue = manager->ready_tasks[qid]; - else -- queue = manager->ready_priority_tasks; -+ queue = manager->ready_priority_tasks[qid]; - - return (EMPTY(queue)); - } -@@ -981,18 +989,18 @@ empty_readyq(isc__taskmgr_t *manager) { - * Caller must hold the task manager lock. - */ - static inline isc__task_t * --pop_readyq(isc__taskmgr_t *manager) { -+pop_readyq(isc__taskmgr_t *manager, isc_taskqueue_t qid) { - isc__task_t *task; - - if (manager->mode == isc_taskmgrmode_normal) -- task = HEAD(manager->ready_tasks); -+ task = HEAD(manager->ready_tasks[qid]); - else -- task = HEAD(manager->ready_priority_tasks); -+ task = HEAD(manager->ready_priority_tasks[qid]); - - if (task != NULL) { -- DEQUEUE(manager->ready_tasks, task, ready_link); -+ DEQUEUE(manager->ready_tasks[qid], task, ready_link); - if (ISC_LINK_LINKED(task, ready_priority_link)) -- DEQUEUE(manager->ready_priority_tasks, task, -+ DEQUEUE(manager->ready_priority_tasks[qid], task, - ready_priority_link); - } - -@@ -1006,16 +1014,16 @@ pop_readyq(isc__taskmgr_t *manager) { - * Caller must hold the task manager lock. - */ - static inline void --push_readyq(isc__taskmgr_t *manager, isc__task_t *task) { -- ENQUEUE(manager->ready_tasks, task, ready_link); -+push_readyq(isc__taskmgr_t *manager, isc__task_t *task, isc_taskqueue_t qid) { -+ ENQUEUE(manager->ready_tasks[qid], task, ready_link); - if ((task->flags & TASK_F_PRIVILEGED) != 0) -- ENQUEUE(manager->ready_priority_tasks, task, -+ ENQUEUE(manager->ready_priority_tasks[qid], task, - ready_priority_link); - manager->tasks_ready++; - } - - static void --dispatch(isc__taskmgr_t *manager) { -+dispatch(isc__taskmgr_t *manager, isc_taskqueue_t qid) { - isc__task_t *task; - #ifndef USE_WORKER_THREADS - unsigned int total_dispatch_count = 0; -@@ -1094,13 +1102,13 @@ dispatch(isc__taskmgr_t *manager) { - * If a pause has been requested, don't do any work - * until it's been released. - */ -- while ((empty_readyq(manager) || manager->pause_requested || -+ while ((empty_readyq(manager, qid) || manager->pause_requested || - manager->exclusive_requested) && !FINISHED(manager)) - { - XTHREADTRACE(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_WAIT, "wait")); -- WAIT(&manager->work_available, &manager->lock); -+ WAIT(&manager->work_available[qid], &manager->lock); - XTHREADTRACE(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TASK, - ISC_MSG_AWAKE, "awake")); -@@ -1113,7 +1121,7 @@ dispatch(isc__taskmgr_t *manager) { - XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TASK, - ISC_MSG_WORKING, "working")); - -- task = pop_readyq(manager); -+ task = pop_readyq(manager, qid); - if (task != NULL) { - unsigned int dispatch_count = 0; - bool done = false; -@@ -1278,7 +1286,7 @@ dispatch(isc__taskmgr_t *manager) { - */ - #ifdef USE_WORKER_THREADS - LOCK(&task->lock); -- push_readyq(manager, task); -+ push_readyq(manager, task, qid); - UNLOCK(&task->lock); - #else - ENQUEUE(new_ready_tasks, task, ready_link); -@@ -1297,10 +1305,14 @@ dispatch(isc__taskmgr_t *manager) { - * we're stuck. Automatically drop privileges at that - * point and continue with the regular ready queue. - */ -- if (manager->tasks_running == 0 && empty_readyq(manager)) { -+ if (manager->tasks_running == 0 && empty_readyq(manager, isc_taskqueue_normal) && empty_readyq(manager, isc_taskqueue_slow)) { - manager->mode = isc_taskmgrmode_normal; -- if (!empty_readyq(manager)) -- BROADCAST(&manager->work_available); -+ if (!empty_readyq(manager, isc_taskqueue_normal)) { -+ BROADCAST(&manager->work_available[isc_taskqueue_normal]); -+ } -+ if (!empty_readyq(manager, isc_taskqueue_slow)) { -+ BROADCAST(&manager->work_available[isc_taskqueue_slow]); -+ } - } - #endif - } -@@ -1322,13 +1334,37 @@ static isc_threadresult_t - #ifdef _WIN32 - WINAPI - #endif --run(void *uap) { -+run_normal(void *uap) { - isc__taskmgr_t *manager = uap; - - XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_STARTING, "starting")); - -- dispatch(manager); -+ dispatch(manager, isc_taskqueue_normal); -+ -+ XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, -+ ISC_MSG_EXITING, "exiting")); -+ -+#ifdef OPENSSL_LEAKS -+ ERR_remove_state(0); -+#endif -+ -+ return ((isc_threadresult_t)0); -+} -+#endif /* USE_WORKER_THREADS */ -+ -+#ifdef USE_WORKER_THREADS -+static isc_threadresult_t -+#ifdef _WIN32 -+WINAPI -+#endif -+run_slow(void *uap) { -+ isc__taskmgr_t *manager = uap; -+ -+ XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, -+ ISC_MSG_STARTING, "starting")); -+ -+ dispatch(manager, isc_taskqueue_slow); - - XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_EXITING, "exiting")); -@@ -1347,7 +1383,8 @@ manager_free(isc__taskmgr_t *manager) { - - #ifdef USE_WORKER_THREADS - (void)isc_condition_destroy(&manager->exclusive_granted); -- (void)isc_condition_destroy(&manager->work_available); -+ (void)isc_condition_destroy(&manager->work_available[isc_taskqueue_normal]); -+ (void)isc_condition_destroy(&manager->work_available[isc_taskqueue_slow]); - (void)isc_condition_destroy(&manager->paused); - isc_mem_free(manager->mctx, manager->threads); - #endif /* USE_WORKER_THREADS */ -@@ -1414,12 +1451,20 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, - #ifdef USE_WORKER_THREADS - manager->workers = 0; - manager->threads = isc_mem_allocate(mctx, -- workers * sizeof(isc_thread_t)); -+ 2 * workers * sizeof(isc_thread_t)); - if (manager->threads == NULL) { - result = ISC_R_NOMEMORY; - goto cleanup_lock; - } -- if (isc_condition_init(&manager->work_available) != ISC_R_SUCCESS) { -+ if (isc_condition_init(&manager->work_available[isc_taskqueue_normal]) != ISC_R_SUCCESS) { -+ UNEXPECTED_ERROR(__FILE__, __LINE__, -+ "isc_condition_init() %s", -+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, -+ ISC_MSG_FAILED, "failed")); -+ result = ISC_R_UNEXPECTED; -+ goto cleanup_threads; -+ } -+ if (isc_condition_init(&manager->work_available[isc_taskqueue_slow]) != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_condition_init() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, -@@ -1448,8 +1493,10 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, - default_quantum = DEFAULT_DEFAULT_QUANTUM; - manager->default_quantum = default_quantum; - INIT_LIST(manager->tasks); -- INIT_LIST(manager->ready_tasks); -- INIT_LIST(manager->ready_priority_tasks); -+ INIT_LIST(manager->ready_tasks[isc_taskqueue_normal]); -+ INIT_LIST(manager->ready_tasks[isc_taskqueue_slow]); -+ INIT_LIST(manager->ready_priority_tasks[isc_taskqueue_normal]); -+ INIT_LIST(manager->ready_priority_tasks[isc_taskqueue_slow]); - manager->tasks_running = 0; - manager->tasks_ready = 0; - manager->exclusive_requested = false; -@@ -1465,7 +1512,19 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, - * Start workers. - */ - for (i = 0; i < workers; i++) { -- if (isc_thread_create(run, manager, -+ if (isc_thread_create(run_normal, manager, -+ &manager->threads[manager->workers]) == -+ ISC_R_SUCCESS) { -+ char name[21]; /* thread name limit on Linux */ -+ snprintf(name, sizeof(name), "isc-worker%04u", i); -+ isc_thread_setname(manager->threads[manager->workers], -+ name); -+ manager->workers++; -+ started++; -+ } -+ } -+ for (; i < workers * 2; i++) { -+ if (isc_thread_create(run_slow, manager, - &manager->threads[manager->workers]) == - ISC_R_SUCCESS) { - char name[21]; /* thread name limit on Linux */ -@@ -1482,7 +1541,7 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, - manager_free(manager); - return (ISC_R_NOTHREADS); - } -- isc_thread_setconcurrency(workers); -+ isc_thread_setconcurrency(workers * 2); - #endif /* USE_WORKER_THREADS */ - #ifdef USE_SHARED_MANAGER - manager->refs = 1; -@@ -1497,7 +1556,8 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, - cleanup_exclusivegranted: - (void)isc_condition_destroy(&manager->exclusive_granted); - cleanup_workavailable: -- (void)isc_condition_destroy(&manager->work_available); -+ (void)isc_condition_destroy(&manager->work_available[isc_taskqueue_slow]); -+ (void)isc_condition_destroy(&manager->work_available[isc_taskqueue_normal]); - cleanup_threads: - isc_mem_free(mctx, manager->threads); - cleanup_lock: -@@ -1582,7 +1642,7 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) { - task = NEXT(task, link)) { - LOCK(&task->lock); - if (task_shutdown(task)) -- push_readyq(manager, task); -+ push_readyq(manager, task, task->qid); - UNLOCK(&task->lock); - } - #ifdef USE_WORKER_THREADS -@@ -1591,7 +1651,8 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) { - * there's work left to do, and if there are already no tasks left - * it will cause the workers to see manager->exiting. - */ -- BROADCAST(&manager->work_available); -+ BROADCAST(&manager->work_available[isc_taskqueue_normal]); -+ BROADCAST(&manager->work_available[isc_taskqueue_slow]); - UNLOCK(&manager->lock); - - /* -@@ -1693,7 +1754,8 @@ isc__taskmgr_resume(isc_taskmgr_t *manager0) { - LOCK(&manager->lock); - if (manager->pause_requested) { - manager->pause_requested = false; -- BROADCAST(&manager->work_available); -+ BROADCAST(&manager->work_available[isc_taskqueue_normal]); -+ BROADCAST(&manager->work_available[isc_taskqueue_slow]); - } - UNLOCK(&manager->lock); - } -@@ -1778,7 +1840,8 @@ isc__task_endexclusive(isc_task_t *task0) { - LOCK(&manager->lock); - REQUIRE(manager->exclusive_requested); - manager->exclusive_requested = false; -- BROADCAST(&manager->work_available); -+ BROADCAST(&manager->work_available[isc_taskqueue_normal]); -+ BROADCAST(&manager->work_available[isc_taskqueue_slow]); - UNLOCK(&manager->lock); - #else - UNUSED(task0); -@@ -1804,10 +1867,10 @@ isc__task_setprivilege(isc_task_t *task0, bool priv) { - - LOCK(&manager->lock); - if (priv && ISC_LINK_LINKED(task, ready_link)) -- ENQUEUE(manager->ready_priority_tasks, task, -+ ENQUEUE(manager->ready_priority_tasks[task->qid], task, - ready_priority_link); - else if (!priv && ISC_LINK_LINKED(task, ready_priority_link)) -- DEQUEUE(manager->ready_priority_tasks, task, -+ DEQUEUE(manager->ready_priority_tasks[task->qid], task, - ready_priority_link); - UNLOCK(&manager->lock); - } --- -2.43.2 - diff --git a/SOURCES/bind-9.11-CVE-2024-1737-runtime-env.patch b/SOURCES/bind-9.11-CVE-2024-1737-runtime-env.patch deleted file mode 100644 index 422ff9f..0000000 --- a/SOURCES/bind-9.11-CVE-2024-1737-runtime-env.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 0a7909045f9e1bf74c1f0fd561a8ef5f55481e8f Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Mon, 29 Jul 2024 16:20:50 +0200 -Subject: [PATCH] Allow global runtime definition by DNS_RBTDB_MAX_RTYPES - -Modify rbtdb to not set it only at runtime, but allow setting that also -in runtime via environment variable. It is still possible to modify -default during the build define. In addition to it allows runtime change -also. Can be positive number to set limit, 0 disabled the check. - -Similarly add also DNS_RDATASET_MAX_RECORDS to set maximum number of -records for a single name. This must be positive number, 0 is no accepted. - -These replaces max-records-per-type and max-types-per-name in later -versions. But can be configured only by environment and can be -configured only globally, not in each view or zone. ---- - lib/dns/rbtdb.c | 21 +++++++++++++++++++-- - lib/dns/rdataslab.c | 24 ++++++++++++++++++++++-- - 2 files changed, 41 insertions(+), 4 deletions(-) - -diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c -index a3cb8dc871..0104c3ee36 100644 ---- a/lib/dns/rbtdb.c -+++ b/lib/dns/rbtdb.c -@@ -6320,15 +6320,29 @@ update_recordsandbytes(bool add, rbtdb_version_t *rbtversion, - #define DNS_RBTDB_MAX_RTYPES 100 - #endif /* DNS_RBTDB_MAX_RTYPES */ - -+static uint32_t dns_g_rbtdb_max_rtypes = DNS_RBTDB_MAX_RTYPES; -+ -+static void -+init_max_rtypes(void) { -+ /* Red Hat change, allow setting different max value by environment. */ -+ const char *max = getenv("DNS_RBTDB_MAX_RTYPES"); -+ if (max) { -+ char *endp = NULL; -+ long l = strtol(max, &endp, 10); -+ if (max != endp && endp && !*endp && l >= 0) -+ dns_g_rbtdb_max_rtypes = l; -+ } -+} -+ - static bool - overmaxtype(dns_rbtdb_t *rbtdb, uint32_t ntypes) { - UNUSED(rbtdb); - -- if (DNS_RBTDB_MAX_RTYPES == 0) { -+ if (dns_g_rbtdb_max_rtypes == 0) { - return (false); - } - -- return (ntypes >= DNS_RBTDB_MAX_RTYPES); -+ return (ntypes >= dns_g_rbtdb_max_rtypes); - } - - static bool -@@ -8831,6 +8845,8 @@ static dns_dbmethods_t cache_methods = { - getservestalettl - }; - -+static isc_once_t once_db = ISC_ONCE_INIT; -+ - isc_result_t - #ifdef DNS_RBTDB_VERSION64 - dns_rbtdb64_create -@@ -8850,6 +8866,7 @@ dns_rbtdb_create - - /* Keep the compiler happy. */ - UNUSED(driverarg); -+ RUNTIME_CHECK(isc_once_do(&once_db, init_max_rtypes) == ISC_R_SUCCESS); - - rbtdb = isc_mem_get(mctx, sizeof(*rbtdb)); - if (rbtdb == NULL) -diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c -index 347b7d2ce8..9566f79671 100644 ---- a/lib/dns/rdataslab.c -+++ b/lib/dns/rdataslab.c -@@ -17,6 +17,7 @@ - #include - - #include -+#include - #include - #include /* Required for HP/UX (and others?) */ - #include -@@ -119,6 +120,23 @@ fillin_offsets(unsigned char *offsetbase, unsigned int *offsettable, - #define DNS_RDATASET_MAX_RECORDS 100 - #endif /* DNS_RDATASET_MAX_RECORDS */ - -+static unsigned int dns_g_rdataset_max_records = DNS_RDATASET_MAX_RECORDS; -+static isc_once_t once = ISC_ONCE_INIT; -+ -+static void -+init_max_records(void) { -+ /* Red Hat change, allow setting different max value by environment. */ -+ const char *max = getenv("DNS_RDATASET_MAX_RECORDS"); -+ if (max) { -+ char *endp = NULL; -+ long l = strtol(max, &endp, 10); -+ if (max != endp && endp && !*endp && l > 0) -+ dns_g_rdataset_max_records = l; -+ } -+} -+ -+ -+ - isc_result_t - dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, - isc_region_t *region, unsigned int reservelen) -@@ -165,7 +183,9 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, - return (ISC_R_SUCCESS); - } - -- if (nitems > DNS_RDATASET_MAX_RECORDS) { -+ RUNTIME_CHECK(isc_once_do(&once, init_max_records) == ISC_R_SUCCESS); -+ -+ if (nitems > dns_g_rdataset_max_records) { - return (DNS_R_TOOMANYRECORDS); - } - -@@ -662,7 +682,7 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, - #endif - INSIST(ocount > 0 && ncount > 0); - -- if (ocount + ncount > DNS_RDATASET_MAX_RECORDS) { -+ if (ocount + ncount > dns_g_rdataset_max_records) { - return (DNS_R_TOOMANYRECORDS); - } - --- -2.45.2 - diff --git a/SOURCES/bind-9.11-CVE-2024-1737.patch b/SOURCES/bind-9.11-CVE-2024-1737.patch deleted file mode 100644 index ba9e032..0000000 --- a/SOURCES/bind-9.11-CVE-2024-1737.patch +++ /dev/null @@ -1,317 +0,0 @@ -From 71df06e2bf3da31c5d542fb33dbda67b21537322 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= -Date: Fri, 1 Mar 2024 08:26:07 +0100 -Subject: [PATCH] [9.11][CVE-2024-1737] Add a limit to the number of RRs in - RRSets - -Add a limit to the number of RRs in RRSets - -Previously, the number of RRs in the RRSets were internally unlimited. -As the data structure that holds the RRs is just a linked list, and -there are places where we just walk through all of the RRs, adding an -RRSet with huge number of RRs inside would slow down processing of said -RRSets. - -The fix for end-of-life branches make the limit compile-time only for -simplicity and the limit can be changed at the compile time by adding -following define to CFLAGS: - - -DDNS_RDATASET_MAX_RECORDS= - -(cherry picked from commit c5c4d00c38530390c9e1ae4c98b65fbbadfe9e5e) -(cherry picked from commit 7f705778af729ada7fec36ac4b456c73329bd996) -(cherry picked from commit b9b5485b22c364fb88c27aa04bad4c8f616da3fa) - -Add a limit to the number of RR types for single name - -Previously, the number of RR types for a single owner name was limited -only by the maximum number of the types (64k). As the data structure -that holds the RR types for the database node is just a linked list, and -there are places where we just walk through the whole list (again and -again), adding a large number of RR types for a single owner named with -would slow down processing of such name (database node). - -Add a hard-coded limit (100) to cap the number of the RR types for a single -owner. The limit can be changed at the compile time by adding following -define to CFLAGS: - - -DDNS_RBTDB_MAX_RTYPES= - -(cherry picked from commit 538b843d84f49ba5125ff545e3d0cf1c8434a8f2) -(cherry picked from commit 3f10d6eff035702796ba82cd28b9f7cf9836e743) - -Optimize the slabheader placement for certain RRTypes - -Mark the infrastructure RRTypes as "priority" types and place them at -the beginning of the rdataslab header data graph. The non-priority -types either go right after the priority types (if any). - -(cherry picked from commit 3ac482be7fd058d284e89873021339579fad0615) -(cherry picked from commit 23a4652346fb2877d6246b1eebaa967969dbde16) - -[9.11][CVE-2024-1737 (part 2)] Be smarter about refusing to add many RR types to the database - -Expand the list of the priority types - -Add HTTPS, SVCB, SRV, PTR, NAPTR, DNSKEY and TXT records to the list of -the priority types that are put at the beginning of the slabheader list -for faster access and to avoid eviction when there are more types than -the max-types-per-name limit. - -(cherry picked from commit b27c6bcce894786a8e082eafd59eccbf6f2731cb) -(cherry picked from commit 3e0a67e4bdb253dae3a03a45c1aa117239a3313d) - -Be smarter about refusing to add many RR types to the database - -Instead of outright refusing to add new RR types to the cache, be a bit -smarter: - -1. If the new header type is in our priority list, we always add either - positive or negative entry at the beginning of the list. - -2. If the new header type is negative entry, and we are over the limit, - we mark it as ancient immediately, so it gets evicted from the cache - as soon as possible. - -3. Otherwise add the new header after the priority headers (or at the - head of the list). - -4. If we are over the limit, evict the last entry on the normal header - list. - -(cherry picked from commit 57cd34441a1b4ecc9874a4a106c2c95b8d7a3120) -(cherry picked from commit e4d7ce686bb38428eddc7e33b40057d68eca9a6e) ---- - configure | 2 +- - configure.ac | 2 +- - lib/dns/rbtdb.c | 114 +++++++++++++++++++++++++++++++++++++++++++- - lib/dns/rdataslab.c | 12 +++++ - 4 files changed, 126 insertions(+), 4 deletions(-) - -diff --git a/configure b/configure -index e060e9d..6421c9b 100755 ---- a/configure -+++ b/configure -@@ -12189,7 +12189,7 @@ fi - XTARGETS= - case "$enable_developer" in - yes) -- STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1" -+ STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1 -DDNS_RDATASET_MAX_RECORDS=5000 -DDNS_RBTDB_MAX_RTYPES=5000" - test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes - test "${enable_querytrace+set}" = set || enable_querytrace=yes - test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes -diff --git a/configure.ac b/configure.ac -index 83cad4a..1c35ce9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -100,7 +100,7 @@ AC_ARG_ENABLE(developer, - XTARGETS= - case "$enable_developer" in - yes) -- STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1" -+ STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1 -DDNS_RDATASET_MAX_RECORDS=5000 -DDNS_RBTDB_MAX_RTYPES=5000" - test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes - test "${enable_querytrace+set}" = set || enable_querytrace=yes - test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes -diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c -index ee59c1b..a2b2df7 100644 ---- a/lib/dns/rbtdb.c -+++ b/lib/dns/rbtdb.c -@@ -1183,6 +1183,44 @@ set_ttl(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, dns_ttl_t newttl) { - isc_heap_decreased(heap, header->heap_index); - } - -+static bool -+prio_type(rbtdb_rdatatype_t type) { -+ switch (type) { -+ case dns_rdatatype_soa: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_soa): -+ case dns_rdatatype_a: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_a): -+ case dns_rdatatype_mx: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_mx): -+ case dns_rdatatype_aaaa: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_aaaa): -+ case dns_rdatatype_nsec: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec): -+ case dns_rdatatype_nsec3: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec3): -+ case dns_rdatatype_ns: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ns): -+ case dns_rdatatype_ds: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ds): -+ case dns_rdatatype_cname: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_cname): -+ case dns_rdatatype_dname: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_dname): -+ case dns_rdatatype_dnskey: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_dnskey): -+ case dns_rdatatype_srv: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_srv): -+ case dns_rdatatype_txt: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_txt): -+ case dns_rdatatype_ptr: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ptr): -+ case dns_rdatatype_naptr: -+ case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_naptr): -+ return (true); -+ } -+ return (false); -+} -+ - /*% - * These functions allow the heap code to rank the priority of each - * element. It returns true if v1 happens "sooner" than v2. -@@ -6278,6 +6316,30 @@ update_recordsandbytes(bool add, rbtdb_version_t *rbtversion, - RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_write); - } - -+#ifndef DNS_RBTDB_MAX_RTYPES -+#define DNS_RBTDB_MAX_RTYPES 100 -+#endif /* DNS_RBTDB_MAX_RTYPES */ -+ -+static bool -+overmaxtype(dns_rbtdb_t *rbtdb, uint32_t ntypes) { -+ UNUSED(rbtdb); -+ -+ if (DNS_RBTDB_MAX_RTYPES == 0) { -+ return (false); -+ } -+ -+ return (ntypes >= DNS_RBTDB_MAX_RTYPES); -+} -+ -+static bool -+prio_header(rdatasetheader_t *header) { -+ if (NEGATIVE(header) && prio_type(RBTDB_RDATATYPE_EXT(header->type))) { -+ return (true); -+ } -+ -+ return (prio_type(header->type)); -+} -+ - /* - * write lock on rbtnode must be held. - */ -@@ -6288,6 +6350,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - { - rbtdb_changed_t *changed = NULL; - rdatasetheader_t *topheader, *topheader_prev, *header, *sigheader; -+ rdatasetheader_t *prioheader = NULL, *expireheader = NULL; - unsigned char *merged; - isc_result_t result; - bool header_nx; -@@ -6297,6 +6360,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - rbtdb_rdatatype_t negtype, sigtype; - dns_trust_t trust; - int idx; -+ uint32_t ntypes = 0; - - /* - * Add an rdatasetheader_t to a node. -@@ -6429,6 +6493,15 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - for (topheader = rbtnode->data; - topheader != NULL; - topheader = topheader->next) { -+ if (IS_CACHE(rbtdb) && ACTIVE(topheader, now)) { -+ ++ntypes; -+ expireheader = topheader; -+ } else if (!IS_CACHE(rbtdb)) { -+ ++ntypes; -+ } -+ if (prio_header(topheader)) { -+ prioheader = topheader; -+ } - if (topheader->type == newheader->type || - topheader->type == negtype) - break; -@@ -6792,9 +6865,46 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - /* - * No rdatasets of the given type exist at the node. - */ -- newheader->next = rbtnode->data; -+ if (!IS_CACHE(rbtdb) && overmaxtype(rbtdb, ntypes)) { -+ free_rdataset(rbtdb, rbtdb->common.mctx, -+ newheader); -+ return (ISC_R_QUOTA); -+ } -+ - newheader->down = NULL; -- rbtnode->data = newheader; -+ -+ if (prio_header(newheader)) { -+ /* This is a priority type, prepend it */ -+ newheader->next = rbtnode->data; -+ rbtnode->data = newheader; -+ } else if (prioheader != NULL) { -+ /* Append after the priority headers */ -+ newheader->next = prioheader->next; -+ prioheader->next = newheader; -+ } else { -+ /* There were no priority headers */ -+ newheader->next = rbtnode->data; -+ rbtnode->data = newheader; -+ } -+ -+ if (IS_CACHE(rbtdb) && overmaxtype(rbtdb, ntypes)) { -+ if (expireheader == NULL) { -+ expireheader = newheader; -+ } -+ if (NEGATIVE(newheader) && -+ !prio_header(newheader)) -+ { -+ /* -+ * Add the new non-priority negative -+ * header to the database only -+ * temporarily. -+ */ -+ expireheader = newheader; -+ } -+ -+ set_ttl(rbtdb, expireheader, 0); -+ mark_header_ancient(rbtdb, expireheader); -+ } - } - } - -diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c -index b0f77b1..347b7d2 100644 ---- a/lib/dns/rdataslab.c -+++ b/lib/dns/rdataslab.c -@@ -115,6 +115,10 @@ fillin_offsets(unsigned char *offsetbase, unsigned int *offsettable, - } - #endif - -+#ifndef DNS_RDATASET_MAX_RECORDS -+#define DNS_RDATASET_MAX_RECORDS 100 -+#endif /* DNS_RDATASET_MAX_RECORDS */ -+ - isc_result_t - dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, - isc_region_t *region, unsigned int reservelen) -@@ -161,6 +165,10 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, - return (ISC_R_SUCCESS); - } - -+ if (nitems > DNS_RDATASET_MAX_RECORDS) { -+ return (DNS_R_TOOMANYRECORDS); -+ } -+ - if (nitems > 0xffff) - return (ISC_R_NOSPACE); - -@@ -654,6 +662,10 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, - #endif - INSIST(ocount > 0 && ncount > 0); - -+ if (ocount + ncount > DNS_RDATASET_MAX_RECORDS) { -+ return (DNS_R_TOOMANYRECORDS); -+ } -+ - #if DNS_RDATASET_FIXED - oncount = ncount; - #endif --- -2.45.2 - diff --git a/SOURCES/bind-9.11-CVE-2024-1975.patch b/SOURCES/bind-9.11-CVE-2024-1975.patch deleted file mode 100644 index f455871..0000000 --- a/SOURCES/bind-9.11-CVE-2024-1975.patch +++ /dev/null @@ -1,322 +0,0 @@ -From 5ff88892e43c049659a8a5aef8dfd56c3712daf0 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Tue, 16 Jul 2024 19:49:09 +0200 -Subject: [PATCH] Resolve CVE-2024-1975 - -6404. [security] Remove SIG(0) support from named as a countermeasure - for CVE-2024-1975. [GL #4480] - -Resolves: CVE-2024-1975 ---- - bin/named/client.c | 7 +++ - bin/tests/system/tsiggss/authsock.pl | 5 ++ - bin/tests/system/tsiggss/tests.sh | 12 ++-- - bin/tests/system/upforwd/tests.sh | 21 ++++--- - doc/arm/Bv9ARM-book.xml | 22 +++---- - lib/dns/message.c | 94 +++------------------------- - 6 files changed, 49 insertions(+), 112 deletions(-) - -diff --git a/bin/named/client.c b/bin/named/client.c -index 368bc94..ea121b3 100644 ---- a/bin/named/client.c -+++ b/bin/named/client.c -@@ -3013,6 +3013,13 @@ client_request(isc_task_t *task, isc_event_t *event) { - ns_client_log(client, DNS_LOGCATEGORY_SECURITY, - NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3), - "request is signed by a nonauthoritative key"); -+ } else if (result == DNS_R_NOTVERIFIEDYET && -+ client->message->sig0 != NULL) -+ { -+ ns_client_log(client, DNS_LOGCATEGORY_SECURITY, -+ NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3), -+ "request has a SIG(0) signature but its support " -+ "was removed (CVE-2024-1975)"); - } else { - char tsigrcode[64]; - isc_buffer_t b; -diff --git a/bin/tests/system/tsiggss/authsock.pl b/bin/tests/system/tsiggss/authsock.pl -index ab3833d..0b231ee 100644 ---- a/bin/tests/system/tsiggss/authsock.pl -+++ b/bin/tests/system/tsiggss/authsock.pl -@@ -31,6 +31,10 @@ if (!defined($path)) { - exit(1); - } - -+# Enable output autoflush so that it's not lost when the parent sends TERM. -+select STDOUT; -+$| = 1; -+ - unlink($path); - my $server = IO::Socket::UNIX->new(Local => $path, Type => SOCK_STREAM, Listen => 8) or - die "unable to create socket $path"; -@@ -53,6 +57,7 @@ if ($timeout != 0) { - } - - while (my $client = $server->accept()) { -+ printf("accept()\n"); - $client->recv(my $buf, 8, 0); - my ($version, $req_len) = unpack('N N', $buf); - -diff --git a/bin/tests/system/tsiggss/tests.sh b/bin/tests/system/tsiggss/tests.sh -index 456ce61..d0db388 100644 ---- a/bin/tests/system/tsiggss/tests.sh -+++ b/bin/tests/system/tsiggss/tests.sh -@@ -116,7 +116,7 @@ status=$((status+ret)) - - echo_i "testing external update policy (CNAME) with auth sock ($n)" - ret=0 --$PERL ./authsock.pl --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 > /dev/null 2>&1 & -+$PERL ./authsock.pl --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 >authsock.log 2>&1 & - sleep 1 - test_update $n testcname.example.nil. CNAME "86400 CNAME testdenied.example.nil" "testdenied" || ret=1 - n=$((n+1)) -@@ -130,17 +130,19 @@ n=$((n+1)) - if [ "$ret" -ne 0 ]; then echo_i "failed"; fi - status=$((status+ret)) - --echo_i "testing external policy with SIG(0) key ($n)" -+echo_i "testing external policy with unsupported SIG(0) key ($n)" - ret=0 --$NSUPDATE -R $RANDFILE -k ns1/Kkey.example.nil.*.private < /dev/null 2>&1 || ret=1 -+$NSUPDATE -R $RANDFILE -k ns1/Kkey.example.nil.*.private <nsupdate.out${n} 2>&1 || true -+debug - server 10.53.0.1 ${PORT} - zone example.nil - update add fred.example.nil 120 cname foo.bar. - send - END -+# update must have failed - SIG(0) signer is not supported - output=`$DIG $DIGOPTS +short cname fred.example.nil.` --[ -n "$output" ] || ret=1 --[ $ret -eq 0 ] || echo_i "failed" -+[ -n "$output" ] && ret=1 -+grep -F "signer=key.example.nil" authsock.log >/dev/null && ret=1 - n=$((n+1)) - if [ "$ret" -ne 0 ]; then echo_i "failed"; fi - status=$((status+ret)) -diff --git a/bin/tests/system/upforwd/tests.sh b/bin/tests/system/upforwd/tests.sh -index ebc9ded..f5b89d4 100644 ---- a/bin/tests/system/upforwd/tests.sh -+++ b/bin/tests/system/upforwd/tests.sh -@@ -181,19 +181,22 @@ n=`expr $n + 1` - - if test -f keyname - then -- echo_i "checking update forwarding to with sig0 ($n)" -+ echo_i "checking update forwarding to with sig0 (expected to fail) ($n)" - ret=0 - keyname=`cat keyname` -- $NSUPDATE -k $keyname.private -- - <nsupdate.out.$n 2>&1 && ret=1 - $DIG -p ${PORT} unsigned.example2 A @10.53.0.1 > dig.out.ns1.test$n -- grep "status: NOERROR" dig.out.ns1.test$n > /dev/null || ret=1 -+ grep "status: NOERROR" dig.out.ns1.test$n >/dev/null && ret=1 - if [ $ret != 0 ] ; then echo_i "failed"; fi - status=`expr $status + $ret` - n=`expr $n + 1` -diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml -index acf772b..563dced 100644 ---- a/doc/arm/Bv9ARM-book.xml -+++ b/doc/arm/Bv9ARM-book.xml -@@ -2027,7 +2027,7 @@ allow-update { !{ !localnets; any; }; key host1-host2. ;}; - The TKEY process is initiated by a client or server by sending - a query of type TKEY to a TKEY-aware server. The query must include - an appropriate KEY record in the additional section, and -- must be signed using either TSIG or SIG(0) with a previously -+ must be signed using TSIG with a previously - established key. The server's response, if successful, - contains a TKEY record in its answer section. After this transaction, - both participants have enough information to calculate a -@@ -2050,24 +2050,24 @@ allow-update { !{ !localnets; any; }; key host1-host2. ;}; -
SIG(0) - - -- BIND partially supports DNSSEC SIG(0) -+ BIND partially supported DNSSEC SIG(0) - transaction signatures as specified in RFC 2535 and RFC 2931. - SIG(0) uses public/private keys to authenticate messages. Access control -- is performed in the same manner as with TSIG keys; privileges can be -+ were performed in the same manner as with TSIG keys; privileges can be - granted or denied in ACL directives based on the key name. - - -- When a SIG(0) signed message is received, it is only -+ When a SIG(0) signed message were received, it were only - verified if the key is known and trusted by the server. The -- server does not attempt to recursively fetch or validate the -+ server did not attempt to recursively fetch or validate the - key. - - -- SIG(0) signing of multiple-message TCP streams is not supported. -+ SIG(0) signing of multiple-message TCP streams were not supported. - - -- The only tool shipped with BIND 9 that -- generates SIG(0) signed messages is nsupdate. -+ Support for SIG(0) message verification was removed -+ as part of the mitigation of CVE-2024-1975. - -
- -@@ -12655,7 +12655,7 @@ example.com. NS ns2.example.net. - either grants or denies permission for one or more - names in the zone to be updated by one or more - identities. Identity is determined by the key that -- signed the update request, using either TSIG or SIG(0). -+ signed the update request, using TSIG. - In most cases, update-policy rules - only apply to key-based identities. There is no way - to specify update permissions based on client source -@@ -12742,7 +12742,7 @@ example.com. NS ns2.example.net. - - The identity field must be set to - a fully qualified domain name. In most cases, this -- represents the name of the TSIG or SIG(0) key that must be -+ represents the name of the TSIG key that must be - used to sign the update request. If the specified name is a - wildcard, it is subject to DNS wildcard expansion, and the - rule may apply to multiple identities. When a TKEY exchange -@@ -15952,7 +15952,7 @@ HOST-127.EXAMPLE. MX 0 . - - - ACLs match clients on the basis of up to three characteristics: -- 1) The client's IP address; 2) the TSIG or SIG(0) key that was -+ 1) The client's IP address; 2) the TSIG key that was - used to sign the request, if any; and 3) an address prefix - encoded in an EDNS Client-Subnet option, if any. - -diff --git a/lib/dns/message.c b/lib/dns/message.c -index a44eb2d..9ea2b9e 100644 ---- a/lib/dns/message.c -+++ b/lib/dns/message.c -@@ -3373,103 +3373,23 @@ dns_message_dumpsig(dns_message_t *msg, char *txt1) { - - isc_result_t - dns_message_checksig(dns_message_t *msg, dns_view_t *view) { -- isc_buffer_t b, msgb; -+ isc_buffer_t msgb; - - REQUIRE(DNS_MESSAGE_VALID(msg)); - -- if (msg->tsigkey == NULL && msg->tsig == NULL && msg->sig0 == NULL) -+ if (msg->tsigkey == NULL && msg->tsig == NULL) - return (ISC_R_SUCCESS); - - INSIST(msg->saved.base != NULL); - isc_buffer_init(&msgb, msg->saved.base, msg->saved.length); - isc_buffer_add(&msgb, msg->saved.length); -- if (msg->tsigkey != NULL || msg->tsig != NULL) { - #ifdef SKAN_MSG_DEBUG -- dns_message_dumpsig(msg, "dns_message_checksig#1"); -+ dns_message_dumpsig(msg, "dns_message_checksig#1"); - #endif -- if (view != NULL) -- return (dns_view_checksig(view, &msgb, msg)); -- else -- return (dns_tsig_verify(&msgb, msg, NULL, NULL)); -- } else { -- dns_rdata_t rdata = DNS_RDATA_INIT; -- dns_rdata_sig_t sig; -- dns_rdataset_t keyset; -- isc_result_t result; -- -- result = dns_rdataset_first(msg->sig0); -- INSIST(result == ISC_R_SUCCESS); -- dns_rdataset_current(msg->sig0, &rdata); -- -- /* -- * This can occur when the message is a dynamic update, since -- * the rdata length checking is relaxed. This should not -- * happen in a well-formed message, since the SIG(0) is only -- * looked for in the additional section, and the dynamic update -- * meta-records are in the prerequisite and update sections. -- */ -- if (rdata.length == 0) -- return (ISC_R_UNEXPECTEDEND); -- -- result = dns_rdata_tostruct(&rdata, &sig, msg->mctx); -- if (result != ISC_R_SUCCESS) -- return (result); -- -- dns_rdataset_init(&keyset); -- if (view == NULL) -- return (DNS_R_KEYUNAUTHORIZED); -- result = dns_view_simplefind(view, &sig.signer, -- dns_rdatatype_key /* SIG(0) */, -- 0, 0, false, &keyset, NULL); -- -- if (result != ISC_R_SUCCESS) { -- /* XXXBEW Should possibly create a fetch here */ -- result = DNS_R_KEYUNAUTHORIZED; -- goto freesig; -- } else if (keyset.trust < dns_trust_secure) { -- /* XXXBEW Should call a validator here */ -- result = DNS_R_KEYUNAUTHORIZED; -- goto freesig; -- } -- result = dns_rdataset_first(&keyset); -- INSIST(result == ISC_R_SUCCESS); -- for (; -- result == ISC_R_SUCCESS; -- result = dns_rdataset_next(&keyset)) -- { -- dst_key_t *key = NULL; -- -- dns_rdata_reset(&rdata); -- dns_rdataset_current(&keyset, &rdata); -- isc_buffer_init(&b, rdata.data, rdata.length); -- isc_buffer_add(&b, rdata.length); -- -- result = dst_key_fromdns(&sig.signer, rdata.rdclass, -- &b, view->mctx, &key); -- if (result != ISC_R_SUCCESS) -- continue; -- if (dst_key_alg(key) != sig.algorithm || -- dst_key_id(key) != sig.keyid || -- !(dst_key_proto(key) == DNS_KEYPROTO_DNSSEC || -- dst_key_proto(key) == DNS_KEYPROTO_ANY)) -- { -- dst_key_free(&key); -- continue; -- } -- result = dns_dnssec_verifymessage(&msgb, msg, key); -- dst_key_free(&key); -- if (result == ISC_R_SUCCESS) -- break; -- } -- if (result == ISC_R_NOMORE) -- result = DNS_R_KEYUNAUTHORIZED; -- -- freesig: -- if (dns_rdataset_isassociated(&keyset)) -- dns_rdataset_disassociate(&keyset); -- dns_rdata_freestruct(&sig); -- return (result); -- } -+ if (view != NULL) -+ return (dns_view_checksig(view, &msgb, msg)); -+ else -+ return (dns_tsig_verify(&msgb, msg, NULL, NULL)); - } - - #define INDENT(sp) \ --- -2.45.2 - diff --git a/SOURCES/bind-9.11-dhcp-time-monotonic.patch b/SOURCES/bind-9.11-dhcp-time-monotonic.patch deleted file mode 100644 index 743c5cb..0000000 --- a/SOURCES/bind-9.11-dhcp-time-monotonic.patch +++ /dev/null @@ -1,171 +0,0 @@ -diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h -index 0389efa..149cde5 100644 ---- a/lib/isc/include/isc/result.h -+++ b/lib/isc/include/isc/result.h -@@ -89,7 +89,8 @@ - #define ISC_R_DISCFULL 67 /*%< disc full */ - #define ISC_R_DEFAULT 68 /*%< default */ - #define ISC_R_IPV4PREFIX 69 /*%< IPv4 prefix */ --#define ISC_R_NRESULTS 70 -+#define ISC_R_TIMESHIFTED 70 /*%< system time changed */ -+#define ISC_R_NRESULTS 71 - - ISC_LANG_BEGINDECLS - -diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h -index 973c348..cceeb5e 100644 ---- a/lib/isc/include/isc/util.h -+++ b/lib/isc/include/isc/util.h -@@ -289,6 +289,10 @@ extern void mock_assert(const int result, const char* const expression, - * Time - */ - #define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS) -+#ifdef CLOCK_BOOTTIME -+#define TIME_MONOTONIC(tp) RUNTIME_CHECK(isc_time_boottime((tp)) == ISC_R_SUCCESS) -+#endif -+ - - /*% - * Alignment -diff --git a/lib/isc/result.c b/lib/isc/result.c -index a9db132..f33fc6b 100644 ---- a/lib/isc/result.c -+++ b/lib/isc/result.c -@@ -105,6 +105,7 @@ static const char *description[ISC_R_NRESULTS] = { - "disc full", /*%< 67 */ - "default", /*%< 68 */ - "IPv4 prefix", /*%< 69 */ -+ "time changed", /*%< 70 */ - }; - - static const char *identifier[ISC_R_NRESULTS] = { -@@ -178,6 +179,7 @@ static const char *identifier[ISC_R_NRESULTS] = { - "ISC_R_DISCFULL", - "ISC_R_DEFAULT", - "ISC_R_IPV4PREFIX", -+ "ISC_R_TIMESHIFTED", - }; - - #define ISC_RESULT_RESULTSET 2 -diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c -index a6e9882..286fe95 100644 ---- a/lib/isc/unix/app.c -+++ b/lib/isc/unix/app.c -@@ -442,15 +442,47 @@ isc__app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task, - static isc_result_t - evloop(isc__appctx_t *ctx) { - isc_result_t result; -+ isc_time_t now; -+#ifdef CLOCK_BOOTTIME -+ isc_time_t monotonic; -+ isc_uint64_t diff = 0; -+#else -+ isc_time_t prev; -+ TIME_NOW(&prev); -+#endif - - while (!ctx->want_shutdown) { - int n; -- isc_time_t when, now; -+ isc_time_t when; - struct timeval tv, *tvp; - isc_socketwait_t *swait; - bool readytasks; - bool call_timer_dispatch = false; - -+ uint64_t us; -+ -+#ifdef CLOCK_BOOTTIME -+ // TBD macros for following three lines -+ TIME_NOW(&now); -+ TIME_MONOTONIC(&monotonic); -+ INSIST(now.seconds > monotonic.seconds) -+ us = isc_time_microdiff (&now, &monotonic); -+ if (us < diff){ -+ us = diff - us; -+ if (us > 1000000){ // ignoring shifts less than one second -+ return ISC_R_TIMESHIFTED; -+ }; -+ diff = isc_time_microdiff (&now, &monotonic); -+ } else { -+ diff = isc_time_microdiff (&now, &monotonic); -+ // not implemented -+ } -+#else -+ TIME_NOW(&now); -+ if (isc_time_compare (&now, &prev) < 0) -+ return ISC_R_TIMESHIFTED; -+ TIME_NOW(&prev); -+#endif - /* - * Check the reload (or suspend) case first for exiting the - * loop as fast as possible in case: -@@ -475,7 +507,6 @@ evloop(isc__appctx_t *ctx) { - if (result != ISC_R_SUCCESS) - tvp = NULL; - else { -- uint64_t us; - - TIME_NOW(&now); - us = isc_time_microdiff(&when, &now); -diff --git a/lib/isc/unix/include/isc/time.h b/lib/isc/unix/include/isc/time.h -index b864c29..5dd43c9 100644 ---- a/lib/isc/unix/include/isc/time.h -+++ b/lib/isc/unix/include/isc/time.h -@@ -132,6 +132,26 @@ isc_time_isepoch(const isc_time_t *t); - *\li 't' is a valid pointer. - */ - -+#ifdef CLOCK_BOOTTIME -+isc_result_t -+isc_time_boottime(isc_time_t *t); -+/*%< -+ * Set 't' to monotonic time from previous boot -+ * it's not affected by system time change. It also -+ * includes the time system was suspended -+ * -+ * Requires: -+ *\li 't' is a valid pointer. -+ * -+ * Returns: -+ * -+ *\li Success -+ *\li Unexpected error -+ * Getting the time from the system failed. -+ */ -+#endif /* CLOCK_BOOTTIME */ -+ -+ - isc_result_t - isc_time_now(isc_time_t *t); - /*%< -diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c -index 8edc9df..fe0bb91 100644 ---- a/lib/isc/unix/time.c -+++ b/lib/isc/unix/time.c -@@ -498,3 +498,25 @@ isc_time_formatISO8601ms(const isc_time_t *t, char *buf, unsigned int len) { - t->nanoseconds / NS_PER_MS); - } - } -+ -+ -+#ifdef CLOCK_BOOTTIME -+isc_result_t -+isc_time_boottime(isc_time_t *t) { -+ struct timespec ts; -+ -+ char strbuf[ISC_STRERRORSIZE]; -+ -+ if (clock_gettime (CLOCK_BOOTTIME, &ts) != 0){ -+ isc__strerror(errno, strbuf, sizeof(strbuf)); -+ UNEXPECTED_ERROR(__FILE__, __LINE__, "%s", strbuf); -+ return (ISC_R_UNEXPECTED); -+ } -+ -+ t->seconds = ts.tv_sec; -+ t->nanoseconds = ts.tv_nsec; -+ -+ return (ISC_R_SUCCESS); -+ -+}; -+#endif diff --git a/SOURCES/bind-9.11-engine-pkcs11.patch b/SOURCES/bind-9.11-engine-pkcs11.patch deleted file mode 100644 index 4a6290d..0000000 --- a/SOURCES/bind-9.11-engine-pkcs11.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 37f89ccfc439f8d86c401d9ae10e94e53b924961 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Tue, 27 Aug 2019 20:39:59 +0200 -Subject: [PATCH] Do not set engine for native PKCS11 - -It resets already set lib_path to pkcs11, which is invalid in native -pkcs11 crypto. Engine has to be path to PKCS#11 module. ---- - bin/named/include/named/globals.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h -index eda2214..2a611d5 100644 ---- a/bin/named/include/named/globals.h -+++ b/bin/named/include/named/globals.h -@@ -160,7 +160,7 @@ EXTERN const char * ns_g_defaultdnstap INIT(NULL); - - EXTERN const char * ns_g_username INIT(NULL); - --#if defined(USE_PKCS11) -+#if defined(USE_PKCS11) && !defined(PKCS11CRYPTO) - EXTERN const char * ns_g_engine INIT(PKCS11_ENGINE); - #else - EXTERN const char * ns_g_engine INIT(NULL); --- -2.20.1 - diff --git a/SOURCES/bind-9.11-export-suffix.patch b/SOURCES/bind-9.11-export-suffix.patch deleted file mode 100644 index 8703747..0000000 --- a/SOURCES/bind-9.11-export-suffix.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index c1bfd62..7c5ad51 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -5333,6 +5333,8 @@ AC_SUBST(BUILD_CPPFLAGS) - AC_SUBST(BUILD_LDFLAGS) - AC_SUBST(BUILD_LIBS) - -+AC_SUBST(LIBDIR_SUFFIX) -+ - # - # Commands to run at the end of config.status. - # Don't just put these into configure, it won't work right if somebody -diff --git a/isc-config.sh.in b/isc-config.sh.in -index b5e94ed..d2857e0 100644 ---- a/isc-config.sh.in -+++ b/isc-config.sh.in -@@ -13,16 +13,17 @@ prefix=@prefix@ - exec_prefix=@exec_prefix@ - exec_prefix_set= - includedir=@includedir@ -+libdir_suffix=@LIBDIR_SUFFIX@ - arch=$(uname -m) - - case $arch in - x86_64 | amd64 | sparc64 | s390x | ppc64) -- libdir=/usr/lib64 -- sec_libdir=/usr/lib -+ libdir=/usr/lib64${libdir_suffix} -+ sec_libdir=/usr/lib${libdir_suffix} - ;; - * ) -- libdir=/usr/lib -- sec_libdir=/usr/lib64 -+ libdir=/usr/lib${libdir_suffix} -+ sec_libdir=/usr/lib64${libdir_suffix} - ;; - esac - diff --git a/SOURCES/bind-9.11-fips-code-includes.patch b/SOURCES/bind-9.11-fips-code-includes.patch deleted file mode 100644 index 9ec3052..0000000 --- a/SOURCES/bind-9.11-fips-code-includes.patch +++ /dev/null @@ -1,39 +0,0 @@ -From c928591eb2a3b17c5be0cad56c8e061ebba11a95 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Thu, 20 Dec 2018 11:52:12 +0100 -Subject: [PATCH] Fix implicit declaration warning - -isc_md5_available() function is not declared before its use. Include -header providing it in files that use it. ---- - bin/tests/system/tkey/keydelete.c | 1 + - lib/dns/tsig.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/bin/tests/system/tkey/keydelete.c b/bin/tests/system/tkey/keydelete.c -index 4b5b901..a3dd450 100644 ---- a/bin/tests/system/tkey/keydelete.c -+++ b/bin/tests/system/tkey/keydelete.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c -index c37b235..7786801 100644 ---- a/lib/dns/tsig.c -+++ b/lib/dns/tsig.c -@@ -18,6 +18,7 @@ - - #include - #include -+#include - #include - #include - #include --- -2.26.2 - diff --git a/SOURCES/bind-9.11-fips-code.patch b/SOURCES/bind-9.11-fips-code.patch deleted file mode 100644 index cf00104..0000000 --- a/SOURCES/bind-9.11-fips-code.patch +++ /dev/null @@ -1,1459 +0,0 @@ -From eff6dcb62f3cea6df0a848c2220a49bc02cb4a0e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Thu, 2 Aug 2018 23:34:45 +0200 -Subject: [PATCH] FIPS code changes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Squashed commit of the following: - -commit b49f70ce0575b6b52a71b90fe0376dbf16f92c6b -Author: Petr Menšík -Date: Mon Jan 22 14:12:37 2018 +0100 - - Update system tests to detect MD5 disabled at runtime - -commit 80ceffee4860c24baf70bc9a8653d92731eda2e4 -Author: Petr Menšík -Date: Thu Aug 2 14:53:54 2018 +0200 - - Avoid warning about undefined parameters - -commit e4ad4363e3d1acaac58456117579f02761f38fdc -Author: Petr Menšík -Date: Wed Jun 20 19:31:19 2018 +0200 - - Fix rndc-confgen default algorithm, report true algorithm in usage. - -commit 7e629a351010cb75e0589ec361f720085675998c -Author: Petr Menšík -Date: Fri Feb 23 21:21:30 2018 +0100 - - Cleanup only if initialization was successful - -commit 2101b948c77cbcbe07eb4a1e60f3e693b2245ec6 -Author: Petr Menšík -Date: Mon Feb 5 12:19:28 2018 +0100 - - Ensure dst backend is initialized first even before hmac algorithms. - -commit 7567c7edde7519115a9ae7e20818c835d3eb1ffe -Author: Petr Menšík -Date: Mon Feb 5 12:17:54 2018 +0100 - - Skip initialization of MD5 based algorithms if not available. - -commit 5782137df6b45a6d900d5a1c250c1257227e917a -Author: Petr Menšík -Date: Mon Feb 5 10:21:27 2018 +0100 - - Change secalgs skipping to be more safe - -commit f2d78729898182d2d19d5064de1bec9b66817159 -Author: Petr Menšík -Date: Wed Jan 31 18:26:11 2018 +0100 - - Skip MD5 algorithm also in case of NULL name - -commit 32a2ad4abc7aaca1c257730319ad3c27405d3407 -Author: Petr Menšík -Date: Wed Jan 31 11:38:12 2018 +0100 - - Make MD5 behave like unknown algorithm in TSIG. - -commit 13cd3f704dce568fdf24a567be5802b58ac6007b -Author: Petr Menšík -Date: Tue Nov 28 20:14:37 2017 +0100 - - Select token with most supported functions, instead of demanding it must support all functions - - Initialize PKCS#11 always until successfully initialized - -commit a71df74abdca4fe63bcdf542b81a109cf1f495b4 -Author: Petr Menšík -Date: Mon Jan 22 16:17:44 2018 +0100 - - Handle MD5 unavailability from DST - -commit dd82cb263efa2753d3ee772972726ea08bcc639b -Author: Petr Menšík -Date: Mon Jan 22 14:11:16 2018 +0100 - - Check runtime flag from library and applications, fail gracefully. - -commit c7b2f87f07ecae75b821a908e29f08a42371e32e -Author: Petr Menšík -Date: Mon Jan 22 08:39:08 2018 +0100 - - Modify libraries to use isc_md5_available() if PK11_MD5_DISABLE is not - defined. - TODO: pk11.c should accept slot without MD5 support. - -commit 0b8e470ec636b9e350b5ec3203eb2b4091415fde -Author: Petr Menšík -Date: Mon Jan 22 07:21:04 2018 +0100 - - Add runtime detection whether MD5 is useable. ---- - bin/confgen/keygen.c | 10 +++- - bin/confgen/rndc-confgen.c | 32 ++++--------- - bin/dig/dig.c | 7 +-- - bin/dig/dighost.c | 14 ++++-- - bin/dnssec/dnssec-keygen.c | 14 ++++++ - bin/named/config.c | 25 +++++++++- - bin/nsupdate/nsupdate.c | 24 ++++++---- - bin/rndc/rndc.c | 3 +- - bin/tests/optional/hash_test.c | 78 ++++++++++++++++--------------- - bin/tests/system/tkey/keycreate.c | 3 ++ - bin/tests/system/tkey/keydelete.c | 17 ++++--- - lib/bind9/check.c | 10 ++++ - lib/dns/dst_api.c | 23 ++++++--- - lib/dns/dst_internal.h | 3 +- - lib/dns/dst_parse.c | 18 +++++-- - lib/dns/hmac_link.c | 18 ++----- - lib/dns/opensslrsa_link.c | 6 +++ - lib/dns/pkcs11rsa_link.c | 33 +++++++++++-- - lib/dns/rcode.c | 21 ++++++++- - lib/dns/tests/rsa_test.c | 4 ++ - lib/dns/tests/tsig_test.c | 1 + - lib/dns/tkey.c | 9 ++++ - lib/dns/tsec.c | 8 +++- - lib/dns/tsig.c | 17 ++++--- - lib/isc/include/isc/md5.h | 3 ++ - lib/isc/md5.c | 59 +++++++++++++++++++++++ - lib/isc/pk11.c | 44 +++++++++++------ - lib/isc/tests/hash_test.c | 9 ++++ - lib/isccc/cc.c | 42 +++++++++++------ - 29 files changed, 400 insertions(+), 155 deletions(-) - -diff --git a/bin/confgen/keygen.c b/bin/confgen/keygen.c -index 8931ad5..5015abb 100644 ---- a/bin/confgen/keygen.c -+++ b/bin/confgen/keygen.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -73,7 +74,7 @@ alg_fromtext(const char *name) { - p = &name[5]; - - #ifndef PK11_MD5_DISABLE -- if (strcasecmp(p, "md5") == 0) -+ if (strcasecmp(p, "md5") == 0 && isc_md5_available()) - return DST_ALG_HMACMD5; - #endif - if (strcasecmp(p, "sha1") == 0) -@@ -132,6 +133,13 @@ generate_key(isc_mem_t *mctx, const char *randomfile, dns_secalg_t alg, - switch (alg) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_HMACMD5: -+ if (!isc_md5_available()) { -+ fatal("unsupported algorithm %d\n", alg); -+ } else if (keysize < 1 || keysize > 512) { -+ fatal("keysize %d out of range (must be 1-512)\n", -+ keysize); -+ } -+ break; - #endif - case DST_ALG_HMACSHA1: - case DST_ALG_HMACSHA224: -diff --git a/bin/confgen/rndc-confgen.c b/bin/confgen/rndc-confgen.c -index 5ca3d76..6b7790a 100644 ---- a/bin/confgen/rndc-confgen.c -+++ b/bin/confgen/rndc-confgen.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -63,7 +64,7 @@ const char *progname; - - bool verbose = false; - --const char *keyfile, *keydef; -+const char *keyfile, *keydef, *algdef; - - ISC_PLATFORM_NORETURN_PRE static void - usage(int status) ISC_PLATFORM_NORETURN_POST; -@@ -71,13 +72,12 @@ usage(int status) ISC_PLATFORM_NORETURN_POST; - static void - usage(int status) { - --#ifndef PK11_MD5_DISABLE - fprintf(stderr, "\ - Usage:\n\ - %s [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] [-r randomfile] \ - [-s addr] [-t chrootdir] [-u user]\n\ - -a: generate just the key clause and write it to keyfile (%s)\n\ -- -A alg: algorithm (default hmac-md5)\n\ -+ -A alg: algorithm (default %s)\n\ - -b bits: from 1 through 512, default 256; total length of the secret\n\ - -c keyfile: specify an alternate key file (requires -a)\n\ - -k keyname: the name as it will be used in named.conf and rndc.conf\n\ -@@ -86,24 +86,7 @@ Usage:\n\ - -s addr: the address to which rndc should connect\n\ - -t chrootdir: write a keyfile in chrootdir as well (requires -a)\n\ - -u user: set the keyfile owner to \"user\" (requires -a)\n", -- progname, keydef); --#else -- fprintf(stderr, "\ --Usage:\n\ -- %s [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] [-r randomfile] \ --[-s addr] [-t chrootdir] [-u user]\n\ -- -a: generate just the key clause and write it to keyfile (%s)\n\ -- -A alg: algorithm (default hmac-sha256)\n\ -- -b bits: from 1 through 512, default 256; total length of the secret\n\ -- -c keyfile: specify an alternate key file (requires -a)\n\ -- -k keyname: the name as it will be used in named.conf and rndc.conf\n\ -- -p port: the port named will listen on and rndc will connect to\n\ -- -r randomfile: source of random data (use \"keyboard\" for key timing)\n\ -- -s addr: the address to which rndc should connect\n\ -- -t chrootdir: write a keyfile in chrootdir as well (requires -a)\n\ -- -u user: set the keyfile owner to \"user\" (requires -a)\n", -- progname, keydef); --#endif -+ progname, keydef, algdef); - - exit (status); - } -@@ -139,11 +122,12 @@ main(int argc, char **argv) { - progname = program; - - keyname = DEFAULT_KEYNAME; --#ifndef PK11_MD5_DISABLE -- alg = DST_ALG_HMACMD5; --#else - alg = DST_ALG_HMACSHA256; -+#ifndef PK11_MD5_DISABLE -+ if (isc_md5_available()) -+ alg = DST_ALG_HMACMD5; - #endif -+ algdef = alg_totext(alg); - serveraddr = DEFAULT_SERVER; - port = DEFAULT_PORT; - -diff --git a/bin/dig/dig.c b/bin/dig/dig.c -index 706299e..aaf22e7 100644 ---- a/bin/dig/dig.c -+++ b/bin/dig/dig.c -@@ -20,6 +20,7 @@ - #include - - #include -+#include - #include - #include - #include -@@ -1774,10 +1775,10 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, - ptr = ptr2; - ptr2 = ptr3; - } else { --#ifndef PK11_MD5_DISABLE -- hmacname = DNS_TSIG_HMACMD5_NAME; --#else - hmacname = DNS_TSIG_HMACSHA256_NAME; -+#ifndef PK11_MD5_DISABLE -+ if (isc_md5_available()) -+ hmacname = DNS_TSIG_HMACMD5_NAME; - #endif - digestbits = 0; - } -diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c -index 93e5b40..afd2700 100644 ---- a/bin/dig/dighost.c -+++ b/bin/dig/dighost.c -@@ -80,6 +80,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1246,9 +1247,10 @@ parse_hmac(const char *hmac) { - digestbits = 0; - - #ifndef PK11_MD5_DISABLE -- if (strcasecmp(buf, "hmac-md5") == 0) { -+ if (strcasecmp(buf, "hmac-md5") == 0 && isc_md5_available()) { - hmacname = DNS_TSIG_HMACMD5_NAME; -- } else if (strncasecmp(buf, "hmac-md5-", 9) == 0) { -+ } else if (strncasecmp(buf, "hmac-md5-", 9) == 0 && -+ isc_md5_available()) { - hmacname = DNS_TSIG_HMACMD5_NAME; - digestbits = parse_bits(&buf[9], "digest-bits [0..128]", 128); - } else -@@ -1368,7 +1370,13 @@ setup_file_key(void) { - switch (dst_key_alg(dstkey)) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_HMACMD5: -- hmacname = DNS_TSIG_HMACMD5_NAME; -+ if (isc_md5_available()) { -+ hmacname = DNS_TSIG_HMACMD5_NAME; -+ } else { -+ printf(";; Couldn't create key %s: bad algorithm\n", -+ keynametext); -+ goto failure; -+ } - break; - #endif - case DST_ALG_HMACSHA1: -diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c -index 1476d0d..f5c9316 100644 ---- a/bin/dnssec/dnssec-keygen.c -+++ b/bin/dnssec/dnssec-keygen.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -562,6 +563,19 @@ main(int argc, char **argv) { - "\"-a RSAMD5\"\n"); - INSIST(freeit == NULL); - return (1); -+ } else if (strcasecmp(algname, "HMAC-MD5") == 0) { -+ if (isc_md5_available()) { -+ alg = DST_ALG_HMACMD5; -+ } else { -+ fprintf(stderr, -+ "The use of HMAC-MD5 was disabled\n"); -+ return (1); -+ } -+ } else if (strcasecmp(algname, "RSAMD5") == 0 && -+ !isc_md5_available()) { -+ fprintf(stderr, "The use of RSAMD5 was disabled\n"); -+ INSIST(freeit == NULL); -+ return (1); - } else if (strcasecmp(algname, "HMAC-MD5") == 0) { - alg = DST_ALG_HMACMD5; - #else -diff --git a/bin/named/config.c b/bin/named/config.c -index 32c454a..dff826b 100644 ---- a/bin/named/config.c -+++ b/bin/named/config.c -@@ -18,6 +18,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -974,6 +975,21 @@ ns_config_getkeyalgorithm(const char *str, dns_name_t **name, - return (ns_config_getkeyalgorithm2(str, name, NULL, digestbits)); - } - -+static inline int -+algorithms_start() { -+#ifndef PK11_MD5_DISABLE -+ if (!isc_md5_available()) { -+ int i = 0; -+ while (algorithms[i].str != NULL && -+ algorithms[i].hmac == hmacmd5) { -+ i++; -+ } -+ return i; -+ } -+#endif -+ return 0; -+} -+ - isc_result_t - ns_config_getkeyalgorithm2(const char *str, dns_name_t **name, - unsigned int *typep, uint16_t *digestbits) -@@ -983,7 +999,7 @@ ns_config_getkeyalgorithm2(const char *str, dns_name_t **name, - uint16_t bits; - isc_result_t result; - -- for (i = 0; algorithms[i].str != NULL; i++) { -+ for (i = algorithms_start(); algorithms[i].str != NULL; i++) { - len = strlen(algorithms[i].str); - if (strncasecmp(algorithms[i].str, str, len) == 0 && - (str[len] == '\0' || -@@ -1006,7 +1022,12 @@ ns_config_getkeyalgorithm2(const char *str, dns_name_t **name, - if (name != NULL) { - switch (algorithms[i].hmac) { - #ifndef PK11_MD5_DISABLE -- case hmacmd5: *name = dns_tsig_hmacmd5_name; break; -+ case hmacmd5: -+ if (isc_md5_available()) { -+ *name = dns_tsig_hmacmd5_name; break; -+ } else { -+ return (ISC_R_NOTFOUND); -+ } - #endif - case hmacsha1: *name = dns_tsig_hmacsha1_name; break; - case hmacsha224: *name = dns_tsig_hmacsha224_name; break; -diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c -index de60313..bbb3936 100644 ---- a/bin/nsupdate/nsupdate.c -+++ b/bin/nsupdate/nsupdate.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -477,9 +478,10 @@ parse_hmac(dns_name_t **hmac, const char *hmacstr, size_t len, - strlcpy(buf, hmacstr, ISC_MIN(len + 1, sizeof(buf))); - - #ifndef PK11_MD5_DISABLE -- if (strcasecmp(buf, "hmac-md5") == 0) { -+ if (strcasecmp(buf, "hmac-md5") == 0 && isc_md5_available()) { - *hmac = DNS_TSIG_HMACMD5_NAME; -- } else if (strncasecmp(buf, "hmac-md5-", 9) == 0) { -+ } else if (strncasecmp(buf, "hmac-md5-", 9) == 0 && -+ isc_md5_available()) { - *hmac = DNS_TSIG_HMACMD5_NAME; - result = isc_parse_uint16(&digestbits, &buf[9], 10); - if (result != ISC_R_SUCCESS || digestbits > 128) { -@@ -592,10 +594,10 @@ setup_keystr(void) { - exit(1); - } - } else { --#ifndef PK11_MD5_DISABLE -- hmacname = DNS_TSIG_HMACMD5_NAME; --#else - hmacname = DNS_TSIG_HMACSHA256_NAME; -+#ifndef PK11_MD5_DISABLE -+ if (isc_md5_available()) -+ hmacname = DNS_TSIG_HMACMD5_NAME; - #endif - name = keystr; - n = s; -@@ -732,7 +734,8 @@ setup_keyfile(isc_mem_t *mctx, isc_log_t *lctx) { - switch (dst_key_alg(dstkey)) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_HMACMD5: -- hmacname = DNS_TSIG_HMACMD5_NAME; -+ if (isc_md5_available()) -+ hmacname = DNS_TSIG_HMACMD5_NAME; - break; - #endif - case DST_ALG_HMACSHA1: -@@ -1637,12 +1640,13 @@ evaluate_key(char *cmdline) { - return (STATUS_SYNTAX); - } - namestr = n + 1; -- } else --#ifndef PK11_MD5_DISABLE -- hmacname = DNS_TSIG_HMACMD5_NAME; --#else -+ } else { - hmacname = DNS_TSIG_HMACSHA256_NAME; -+#ifndef PK11_MD5_DISABLE -+ if (isc_md5_available()) -+ hmacname = DNS_TSIG_HMACMD5_NAME; - #endif -+ } - - isc_buffer_init(&b, namestr, strlen(namestr)); - isc_buffer_add(&b, strlen(namestr)); -diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c -index 9eb0ce0..8083654 100644 ---- a/bin/rndc/rndc.c -+++ b/bin/rndc/rndc.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -636,7 +637,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, - algorithmstr = cfg_obj_asstring(algorithmobj); - - #ifndef PK11_MD5_DISABLE -- if (strcasecmp(algorithmstr, "hmac-md5") == 0) -+ if (strcasecmp(algorithmstr, "hmac-md5") == 0 && isc_md5_available()) - algorithm = ISCCC_ALG_HMACMD5; - else - #endif -diff --git a/bin/tests/optional/hash_test.c b/bin/tests/optional/hash_test.c -index bf2891a..b5f0a1c 100644 ---- a/bin/tests/optional/hash_test.c -+++ b/bin/tests/optional/hash_test.c -@@ -90,43 +90,47 @@ main(int argc, char **argv) { - print_digest(s, "sha224", digest, ISC_SHA224_DIGESTLENGTH/4); - - #ifndef PK11_MD5_DISABLE -- s = "abc"; -- isc_md5_init(&md5); -- memmove(buffer, s, strlen(s)); -- isc_md5_update(&md5, buffer, strlen(s)); -- isc_md5_final(&md5, digest); -- print_digest(s, "md5", digest, 4); -- -- /* -- * The 3 HMAC-MD5 examples from RFC2104 -- */ -- s = "Hi There"; -- memset(key, 0x0b, 16); -- isc_hmacmd5_init(&hmacmd5, key, 16); -- memmove(buffer, s, strlen(s)); -- isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); -- isc_hmacmd5_sign(&hmacmd5, digest); -- print_digest(s, "hmacmd5", digest, 4); -- -- s = "what do ya want for nothing?"; -- strlcpy((char *)key, "Jefe", sizeof(key)); -- isc_hmacmd5_init(&hmacmd5, key, 4); -- memmove(buffer, s, strlen(s)); -- isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); -- isc_hmacmd5_sign(&hmacmd5, digest); -- print_digest(s, "hmacmd5", digest, 4); -- -- s = "\335\335\335\335\335\335\335\335\335\335" -- "\335\335\335\335\335\335\335\335\335\335" -- "\335\335\335\335\335\335\335\335\335\335" -- "\335\335\335\335\335\335\335\335\335\335" -- "\335\335\335\335\335\335\335\335\335\335"; -- memset(key, 0xaa, 16); -- isc_hmacmd5_init(&hmacmd5, key, 16); -- memmove(buffer, s, strlen(s)); -- isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); -- isc_hmacmd5_sign(&hmacmd5, digest); -- print_digest(s, "hmacmd5", digest, 4); -+ if (isc_md5_available()) { -+ s = "abc"; -+ isc_md5_init(&md5); -+ memmove(buffer, s, strlen(s)); -+ isc_md5_update(&md5, buffer, strlen(s)); -+ isc_md5_final(&md5, digest); -+ print_digest(s, "md5", digest, 4); -+ -+ /* -+ * The 3 HMAC-MD5 examples from RFC2104 -+ */ -+ s = "Hi There"; -+ memset(key, 0x0b, 16); -+ isc_hmacmd5_init(&hmacmd5, key, 16); -+ memmove(buffer, s, strlen(s)); -+ isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); -+ isc_hmacmd5_sign(&hmacmd5, digest); -+ print_digest(s, "hmacmd5", digest, 4); -+ -+ s = "what do ya want for nothing?"; -+ strlcpy((char *)key, "Jefe", sizeof(key)); -+ isc_hmacmd5_init(&hmacmd5, key, 4); -+ memmove(buffer, s, strlen(s)); -+ isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); -+ isc_hmacmd5_sign(&hmacmd5, digest); -+ print_digest(s, "hmacmd5", digest, 4); -+ -+ s = "\335\335\335\335\335\335\335\335\335\335" -+ "\335\335\335\335\335\335\335\335\335\335" -+ "\335\335\335\335\335\335\335\335\335\335" -+ "\335\335\335\335\335\335\335\335\335\335" -+ "\335\335\335\335\335\335\335\335\335\335"; -+ memset(key, 0xaa, 16); -+ isc_hmacmd5_init(&hmacmd5, key, 16); -+ memmove(buffer, s, strlen(s)); -+ isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); -+ isc_hmacmd5_sign(&hmacmd5, digest); -+ print_digest(s, "hmacmd5", digest, 4); -+ } else { -+ fprintf(stderr, "Skipping disabled MD5 algorithm\n"); -+ } - #endif - - /* -diff --git a/bin/tests/system/tkey/keycreate.c b/bin/tests/system/tkey/keycreate.c -index 5a00f86..653c951 100644 ---- a/bin/tests/system/tkey/keycreate.c -+++ b/bin/tests/system/tkey/keycreate.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -142,6 +143,8 @@ sendquery(isc_task_t *task, isc_event_t *event) { - static char keystr[] = "0123456789ab"; - - isc_event_free(&event); -+ if (!isc_md5_available()) -+ CHECK("MD5 was disabled", ISC_R_NOTIMPLEMENTED); - - result = ISC_R_FAILURE; - if (inet_pton(AF_INET, "10.53.0.1", &inaddr) != 1) -diff --git a/bin/tests/system/tkey/keydelete.c b/bin/tests/system/tkey/keydelete.c -index bde66a4..70a40c3 100644 ---- a/bin/tests/system/tkey/keydelete.c -+++ b/bin/tests/system/tkey/keydelete.c -@@ -225,12 +225,17 @@ main(int argc, char **argv) { - result = dst_key_fromnamedfile(keyname, NULL, type, mctx, &dstkey); - CHECK("dst_key_fromnamedfile", result); - #ifndef PK11_MD5_DISABLE -- result = dns_tsigkey_createfromkey(dst_key_name(dstkey), -- DNS_TSIG_HMACMD5_NAME, -- dstkey, true, NULL, 0, 0, -- mctx, ring, &tsigkey); -- dst_key_free(&dstkey); -- CHECK("dns_tsigkey_createfromkey", result); -+ if (isc_md5_available()) { -+ result = dns_tsigkey_createfromkey(dst_key_name(dstkey), -+ DNS_TSIG_HMACMD5_NAME, -+ dstkey, true, NULL, 0, 0, -+ mctx, ring, &tsigkey); -+ dst_key_free(&dstkey); -+ CHECK("dns_tsigkey_createfromkey", result); -+ } else { -+ dst_key_free(&dstkey); -+ CHECK("MD5 was disabled", ISC_R_NOTIMPLEMENTED); -+ } - #else - dst_key_free(&dstkey); - CHECK("MD5 was disabled", ISC_R_NOTIMPLEMENTED); -diff --git a/lib/bind9/check.c b/lib/bind9/check.c -index ec0ab6d..e0803d4 100644 ---- a/lib/bind9/check.c -+++ b/lib/bind9/check.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -2618,6 +2619,15 @@ bind9_check_key(const cfg_obj_t *key, isc_log_t *logctx) { - } - - algorithm = cfg_obj_asstring(algobj); -+#ifndef PK11_MD5_DISABLE -+ /* Skip hmac-md5* algorithms */ -+ if (!isc_md5_available() && -+ strncasecmp(algorithm, "hmac-md5", 8) == 0) { -+ cfg_obj_log(algobj, logctx, ISC_LOG_ERROR, -+ "disabled algorithm '%s'", algorithm); -+ return (ISC_R_DISABLED); -+ } -+#endif - for (i = 0; algorithms[i].name != NULL; i++) { - len = strlen(algorithms[i].name); - if (strncasecmp(algorithms[i].name, algorithm, len) == 0 && -diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c -index e3c47a9..320c0f8 100644 ---- a/lib/dns/dst_api.c -+++ b/lib/dns/dst_api.c -@@ -192,6 +192,12 @@ dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, - dst_result_register(); - - memset(dst_t_func, 0, sizeof(dst_t_func)); -+ -+#ifdef OPENSSL -+ RETERR(dst__openssl_init(engine)); -+#elif PKCS11CRYPTO -+ RETERR(dst__pkcs11_init(mctx, engine)); -+#endif - #ifndef PK11_MD5_DISABLE - RETERR(dst__hmacmd5_init(&dst_t_func[DST_ALG_HMACMD5])); - #endif -@@ -201,7 +207,6 @@ dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, - RETERR(dst__hmacsha384_init(&dst_t_func[DST_ALG_HMACSHA384])); - RETERR(dst__hmacsha512_init(&dst_t_func[DST_ALG_HMACSHA512])); - #ifdef OPENSSL -- RETERR(dst__openssl_init(engine)); - #ifndef PK11_MD5_DISABLE - RETERR(dst__opensslrsa_init(&dst_t_func[DST_ALG_RSAMD5], - DST_ALG_RSAMD5)); -@@ -235,14 +240,18 @@ dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, - RETERR(dst__openssleddsa_init(&dst_t_func[DST_ALG_ED448])); - #endif - #elif PKCS11CRYPTO -- RETERR(dst__pkcs11_init(mctx, engine)); - #ifndef PK11_MD5_DISABLE -- RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSAMD5])); -+ RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSAMD5], -+ DST_ALG_RSAMD5)); - #endif -- RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSASHA1])); -- RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_NSEC3RSASHA1])); -- RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSASHA256])); -- RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSASHA512])); -+ RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSASHA1], -+ DST_ALG_RSASHA1)); -+ RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_NSEC3RSASHA1], -+ DST_ALG_NSEC3RSASHA1)); -+ RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSASHA256], -+ DST_ALG_RSASHA256)); -+ RETERR(dst__pkcs11rsa_init(&dst_t_func[DST_ALG_RSASHA512], -+ DST_ALG_RSASHA512)); - #ifndef PK11_DSA_DISABLE - RETERR(dst__pkcs11dsa_init(&dst_t_func[DST_ALG_DSA])); - RETERR(dst__pkcs11dsa_init(&dst_t_func[DST_ALG_NSEC3DSA])); -diff --git a/lib/dns/dst_internal.h b/lib/dns/dst_internal.h -index 6ee796c..3e55d44 100644 ---- a/lib/dns/dst_internal.h -+++ b/lib/dns/dst_internal.h -@@ -250,7 +250,8 @@ isc_result_t dst__hmacsha384_init(struct dst_func **funcp); - isc_result_t dst__hmacsha512_init(struct dst_func **funcp); - isc_result_t dst__opensslrsa_init(struct dst_func **funcp, - unsigned char algorithm); --isc_result_t dst__pkcs11rsa_init(struct dst_func **funcp); -+isc_result_t dst__pkcs11rsa_init(struct dst_func **funcp, -+ unsigned char algorithm); - #ifndef PK11_DSA_DISABLE - isc_result_t dst__openssldsa_init(struct dst_func **funcp); - isc_result_t dst__pkcs11dsa_init(struct dst_func **funcp); -diff --git a/lib/dns/dst_parse.c b/lib/dns/dst_parse.c -index f31c33d..87023a6 100644 ---- a/lib/dns/dst_parse.c -+++ b/lib/dns/dst_parse.c -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -396,6 +397,10 @@ check_data(const dst_private_t *priv, const unsigned int alg, - switch (alg) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_RSAMD5: -+ if (isc_md5_available()) -+ return (check_rsa(priv, external)); -+ else -+ return (DST_R_UNSUPPORTEDALG); - #endif - case DST_ALG_RSASHA1: - case DST_ALG_NSEC3RSASHA1: -@@ -421,7 +426,10 @@ check_data(const dst_private_t *priv, const unsigned int alg, - return (check_eddsa(priv, external)); - #ifndef PK11_MD5_DISABLE - case DST_ALG_HMACMD5: -- return (check_hmac_md5(priv, old)); -+ if (isc_md5_available()) -+ return (check_hmac_md5(priv, old)); -+ else -+ return (DST_R_UNSUPPORTEDALG); - #endif - case DST_ALG_HMACSHA1: - return (check_hmac_sha(priv, HMACSHA1_NTAGS, alg)); -@@ -640,11 +648,13 @@ dst__privstruct_parse(dst_key_t *key, unsigned int alg, isc_lex_t *lex, - } - - #ifdef PK11_MD5_DISABLE -- check = check_data(priv, alg == DST_ALG_RSA ? DST_ALG_RSASHA1 : alg, -- true, external); -+ if (alg == DST_ALG_RSA) -+ alg = DST_ALG_RSASHA1; - #else -- check = check_data(priv, alg, true, external); -+ if (!isc_md5_available() && alg == DST_ALG_RSA) -+ alg = DST_ALG_RSASHA1; - #endif -+ check = check_data(priv, alg, true, external); - if (check < 0) { - ret = DST_R_INVALIDPRIVATEKEY; - goto fail; -diff --git a/lib/dns/hmac_link.c b/lib/dns/hmac_link.c -index 3b6579b..4bdce2f 100644 ---- a/lib/dns/hmac_link.c -+++ b/lib/dns/hmac_link.c -@@ -340,20 +340,10 @@ static dst_func_t hmacmd5_functions = { - - isc_result_t - dst__hmacmd5_init(dst_func_t **funcp) { --#ifdef HAVE_FIPS_MODE -- /* -- * Problems from OpenSSL are likely from FIPS mode -- */ -- int fips_mode = FIPS_mode(); -- -- if (fips_mode != 0) { -- UNEXPECTED_ERROR(__FILE__, __LINE__, -- "FIPS mode is %d: MD5 is only supported " -- "if the value is 0.\n" -- "Please disable either FIPS mode or MD5.", -- fips_mode); -- } --#endif -+ -+ /* Intentionally skip initialization */ -+ if (!isc_md5_available()) -+ return (ISC_R_SUCCESS); - - #if PK11_FLAVOR != PK11_UTIMACO_FLAVOR - /* -diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c -index ec35f50..c80fabe 100644 ---- a/lib/dns/opensslrsa_link.c -+++ b/lib/dns/opensslrsa_link.c -@@ -1812,6 +1812,12 @@ dst__opensslrsa_init(dst_func_t **funcp, unsigned char algorithm) { - - if (*funcp == NULL) { - switch (algorithm) { -+#ifndef PK11_MD5_DISABLE -+ case DST_ALG_RSAMD5: -+ if (isc_md5_available()) -+ *funcp = &opensslrsa_functions; -+ break; -+#endif - case DST_ALG_RSASHA256: - #if defined(HAVE_EVP_SHA256) || !USE_EVP - *funcp = &opensslrsa_functions; -diff --git a/lib/dns/pkcs11rsa_link.c b/lib/dns/pkcs11rsa_link.c -index 096c1a8..6c280bf 100644 ---- a/lib/dns/pkcs11rsa_link.c -+++ b/lib/dns/pkcs11rsa_link.c -@@ -96,10 +96,15 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) { - #endif - - /* -- * Reject incorrect RSA key lengths. -+ * Reject incorrect RSA key lengths or disabled algorithms. - */ - switch (dctx->key->key_alg) { - case DST_ALG_RSAMD5: -+#ifndef PK11_MD5_DISABLE -+ if (!isc_md5_available()) -+ return (ISC_R_FAILURE); -+#endif -+ /* FALLTHROUGH */ - case DST_ALG_RSASHA1: - case DST_ALG_NSEC3RSASHA1: - /* From RFC 3110 */ -@@ -641,6 +646,9 @@ pkcs11rsa_createctx(dst_key_t *key, dst_context_t *dctx) { - switch (key->key_alg) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_RSAMD5: -+ if (!isc_md5_available()) -+ return (ISC_R_FAILURE); -+ - mech.mechanism = CKM_MD5; - break; - #endif -@@ -799,6 +807,9 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) { - switch (key->key_alg) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_RSAMD5: -+ if (!isc_md5_available()) -+ return (ISC_R_FAILURE); -+ - der = md5_der; - derlen = sizeof(md5_der); - hashlen = ISC_MD5_DIGESTLENGTH; -@@ -1024,6 +1035,9 @@ pkcs11rsa_verify(dst_context_t *dctx, const isc_region_t *sig) { - switch (key->key_alg) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_RSAMD5: -+ if (!isc_md5_available()) -+ return (ISC_R_FAILURE); -+ - der = md5_der; - derlen = sizeof(md5_der); - hashlen = ISC_MD5_DIGESTLENGTH; -@@ -2231,11 +2245,22 @@ static dst_func_t pkcs11rsa_functions = { - }; - - isc_result_t --dst__pkcs11rsa_init(dst_func_t **funcp) { -+dst__pkcs11rsa_init(dst_func_t **funcp, unsigned char algorithm) { - REQUIRE(funcp != NULL); - -- if (*funcp == NULL) -- *funcp = &pkcs11rsa_functions; -+ if (*funcp == NULL) { -+ switch (algorithm) { -+#ifndef PK11_MD5_DISABLE -+ case DST_ALG_RSAMD5: -+ if (isc_md5_available()) -+ *funcp = &pkcs11rsa_functions; -+ break; -+#endif -+ default: -+ *funcp = &pkcs11rsa_functions; -+ break; -+ } -+ } - return (ISC_R_SUCCESS); - } - -diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c -index 9c42c50..f51d548 100644 ---- a/lib/dns/rcode.c -+++ b/lib/dns/rcode.c -@@ -16,6 +16,7 @@ - #include - - #include -+#include - #include - #include - #include -@@ -357,17 +358,33 @@ dns_cert_totext(dns_cert_t cert, isc_buffer_t *target) { - return (dns_mnemonic_totext(cert, target, certs)); - } - -+static inline struct tbl * -+secalgs_tbl_start() { -+ struct tbl *algs = secalgs; -+ -+#ifndef PK11_MD5_DISABLE -+ if (!isc_md5_available()) { -+ while (algs->name != NULL && -+ algs->value == DNS_KEYALG_RSAMD5) -+ ++algs; -+ } -+#endif -+ return algs; -+} -+ - isc_result_t - dns_secalg_fromtext(dns_secalg_t *secalgp, isc_textregion_t *source) { - unsigned int value; -- RETERR(dns_mnemonic_fromtext(&value, source, secalgs, 0xff)); -+ -+ RETERR(dns_mnemonic_fromtext(&value, source, -+ secalgs_tbl_start(), 0xff)); - *secalgp = value; - return (ISC_R_SUCCESS); - } - - isc_result_t - dns_secalg_totext(dns_secalg_t secalg, isc_buffer_t *target) { -- return (dns_mnemonic_totext(secalg, target, secalgs)); -+ return (dns_mnemonic_totext(secalg, target, secalgs_tbl_start())); - } - - void -diff --git a/lib/dns/tests/rsa_test.c b/lib/dns/tests/rsa_test.c -index f9ac6d0..241e17e 100644 ---- a/lib/dns/tests/rsa_test.c -+++ b/lib/dns/tests/rsa_test.c -@@ -27,6 +27,7 @@ - #define UNIT_TESTING - #include - -+#include - #include - #include - -@@ -248,6 +249,8 @@ isc_rsa_verify_test(void **state) { - /* RSAMD5 */ - - #ifndef PK11_MD5_DISABLE -+ if (isc_md5_available()) { -+ /* wrong indentation is kept for diff minimization */ - key->key_alg = DST_ALG_RSAMD5; - - ret = dst_context_create3(key, mctx, DNS_LOGCATEGORY_DNSSEC, -@@ -265,6 +268,7 @@ isc_rsa_verify_test(void **state) { - assert_int_equal(ret, ISC_R_SUCCESS); - - dst_context_destroy(&ctx); -+ } - #endif - - /* RSASHA256 */ -diff --git a/lib/dns/tests/tsig_test.c b/lib/dns/tests/tsig_test.c -index 11d011a..feb2068 100644 ---- a/lib/dns/tests/tsig_test.c -+++ b/lib/dns/tests/tsig_test.c -@@ -25,6 +25,7 @@ - #define UNIT_TESTING - #include - -+#include - #include - #include - #include -diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c -index 89cfc79..d07364a 100644 ---- a/lib/dns/tkey.c -+++ b/lib/dns/tkey.c -@@ -245,6 +245,9 @@ compute_secret(isc_buffer_t *shared, isc_region_t *queryrandomness, - unsigned char digests[32]; - unsigned int i; - -+ if (!isc_md5_available()) -+ return (ISC_R_NOTIMPLEMENTED); -+ - isc_buffer_usedregion(shared, &r); - - /* -@@ -321,6 +324,12 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, - } - - #ifndef PK11_MD5_DISABLE -+ if (!isc_md5_available()) { -+ tkey_log("process_dhtkey: MD5 was disabled"); -+ tkeyout->error = dns_tsigerror_badalg; -+ return (ISC_R_SUCCESS); -+ } -+ - if (!dns_name_equal(&tkeyin->algorithm, DNS_TSIG_HMACMD5_NAME)) { - tkey_log("process_dhtkey: algorithms other than " - "hmac-md5 are not supported"); -diff --git a/lib/dns/tsec.c b/lib/dns/tsec.c -index 9d8ead4..0c82f65 100644 ---- a/lib/dns/tsec.c -+++ b/lib/dns/tsec.c -@@ -11,6 +11,7 @@ - - #include - -+#include - #include - #include - -@@ -63,7 +64,12 @@ dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key, - switch (dst_key_alg(key)) { - #ifndef PK11_MD5_DISABLE - case DST_ALG_HMACMD5: -- algname = dns_tsig_hmacmd5_name; -+ if (isc_md5_available()) { -+ algname = dns_tsig_hmacmd5_name; -+ } else { -+ isc_mem_put(mctx, tsec, sizeof(*tsec)); -+ return (DNS_R_BADALG); -+ } - break; - #endif - case DST_ALG_HMACSHA1: -diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c -index 58c1104..00ee1e1 100644 ---- a/lib/dns/tsig.c -+++ b/lib/dns/tsig.c -@@ -273,7 +273,8 @@ dns_tsigkey_createfromkey(dns_name_t *name, dns_name_t *algorithm, - (void)dns_name_downcase(&tkey->name, &tkey->name, NULL); - - #ifndef PK11_MD5_DISABLE -- if (dns_name_equal(algorithm, DNS_TSIG_HMACMD5_NAME)) { -+ if (dns_name_equal(algorithm, DNS_TSIG_HMACMD5_NAME) && -+ isc_md5_available()) { - tkey->algorithm = DNS_TSIG_HMACMD5_NAME; - if (dstkey != NULL && dst_key_alg(dstkey) != DST_ALG_HMACMD5) { - ret = DNS_R_BADALG; -@@ -499,7 +500,8 @@ destroyring(dns_tsig_keyring_t *ring) { - static unsigned int - dst_alg_fromname(dns_name_t *algorithm) { - #ifndef PK11_MD5_DISABLE -- if (dns_name_equal(algorithm, DNS_TSIG_HMACMD5_NAME)) { -+ if (dns_name_equal(algorithm, DNS_TSIG_HMACMD5_NAME) && -+ isc_md5_available()) { - return (DST_ALG_HMACMD5); - } else - #endif -@@ -683,7 +685,8 @@ dns_tsigkey_create(dns_name_t *name, dns_name_t *algorithm, - REQUIRE(secret != NULL); - - #ifndef PK11_MD5_DISABLE -- if (dns_name_equal(algorithm, DNS_TSIG_HMACMD5_NAME)) { -+ if (dns_name_equal(algorithm, DNS_TSIG_HMACMD5_NAME) && -+ isc_md5_available()) { - if (secret != NULL) { - isc_buffer_t b; - -@@ -1291,7 +1294,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, - return (ret); - if ( - #ifndef PK11_MD5_DISABLE -- alg == DST_ALG_HMACMD5 || -+ (alg == DST_ALG_HMACMD5 && isc_md5_available()) || - #endif - alg == DST_ALG_HMACSHA1 || - alg == DST_ALG_HMACSHA224 || alg == DST_ALG_HMACSHA256 || -@@ -1460,7 +1463,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, - - if ( - #ifndef PK11_MD5_DISABLE -- alg == DST_ALG_HMACMD5 || -+ (alg == DST_ALG_HMACMD5 && isc_md5_available()) || - #endif - alg == DST_ALG_HMACSHA1 || - alg == DST_ALG_HMACSHA224 || alg == DST_ALG_HMACSHA256 || -@@ -1601,7 +1604,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { - goto cleanup_querystruct; - if ( - #ifndef PK11_MD5_DISABLE -- alg == DST_ALG_HMACMD5 || -+ (alg == DST_ALG_HMACMD5 && isc_md5_available()) || - #endif - alg == DST_ALG_HMACSHA1 || - alg == DST_ALG_HMACSHA224 || -@@ -1780,7 +1783,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { - goto cleanup_context; - if ( - #ifndef PK11_MD5_DISABLE -- alg == DST_ALG_HMACMD5 || -+ (alg == DST_ALG_HMACMD5 && isc_md5_available()) || - #endif - alg == DST_ALG_HMACSHA1 || - alg == DST_ALG_HMACSHA224 || -diff --git a/lib/isc/include/isc/md5.h b/lib/isc/include/isc/md5.h -index 4d29398..e3f5cec 100644 ---- a/lib/isc/include/isc/md5.h -+++ b/lib/isc/include/isc/md5.h -@@ -91,6 +91,9 @@ isc_md5_final(isc_md5_t *ctx, unsigned char *digest); - bool - isc_md5_check(bool testing); - -+bool -+isc_md5_available(void); -+ - ISC_LANG_ENDDECLS - - #endif /* !PK11_MD5_DISABLE */ -diff --git a/lib/isc/md5.c b/lib/isc/md5.c -index 249f3da..628a414 100644 ---- a/lib/isc/md5.c -+++ b/lib/isc/md5.c -@@ -37,6 +37,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -54,6 +55,9 @@ - #define EVP_MD_CTX_free(ptr) EVP_MD_CTX_cleanup(ptr) - #endif - -+static isc_once_t available_once = ISC_ONCE_INIT; -+static bool available = false; -+ - void - isc_md5_init(isc_md5_t *ctx) { - ctx->ctx = EVP_MD_CTX_new(); -@@ -85,8 +89,33 @@ isc_md5_final(isc_md5_t *ctx, unsigned char *digest) { - ctx->ctx = NULL; - } - -+static void -+do_detect_available() { -+ isc_md5_t local; -+ isc_md5_t *ctx = &local; -+ unsigned char digest[ISC_MD5_DIGESTLENGTH]; -+ -+ ctx->ctx = EVP_MD_CTX_new(); -+ RUNTIME_CHECK(ctx->ctx != NULL); -+ available = (EVP_DigestInit(ctx->ctx, EVP_md5()) == 1); -+ if (available) -+ (void)EVP_DigestFinal(ctx->ctx, digest, NULL); -+ EVP_MD_CTX_free(ctx->ctx); -+ ctx->ctx = NULL; -+} -+ -+bool -+isc_md5_available() { -+ RUNTIME_CHECK(isc_once_do(&available_once, do_detect_available) -+ == ISC_R_SUCCESS); -+ return available; -+} -+ - #elif PKCS11CRYPTO - -+static isc_once_t available_once = ISC_ONCE_INIT; -+static bool available = false; -+ - void - isc_md5_init(isc_md5_t *ctx) { - CK_RV rv; -@@ -129,6 +158,31 @@ isc_md5_final(isc_md5_t *ctx, unsigned char *digest) { - pk11_return_session(ctx); - } - -+static void -+do_detect_available() { -+ isc_md5_t local; -+ isc_md5_t *ctx = &local; -+ CK_RV rv; -+ CK_MECHANISM mech = { CKM_MD5, NULL, 0 }; -+ -+ if (pk11_get_session(ctx, OP_DIGEST, true, false, -+ false, NULL, 0) == ISC_R_SUCCESS) -+ { -+ rv = pkcs_C_DigestInit(ctx->session, &mech); -+ isc_md5_invalidate(ctx); -+ available = (rv == CKR_OK); -+ } else { -+ available = false; -+ } -+} -+ -+bool -+isc_md5_available() { -+ RUNTIME_CHECK(isc_once_do(&available_once, do_detect_available) -+ == ISC_R_SUCCESS); -+ return available; -+} -+ - #else - - static void -@@ -338,6 +392,11 @@ isc_md5_final(isc_md5_t *ctx, unsigned char *digest) { - memmove(digest, ctx->buf, 16); - isc_safe_memwipe(ctx, sizeof(*ctx)); /* In case it's sensitive */ - } -+ -+bool -+isc_md5_available() { -+ return true; -+} - #endif - - /* -diff --git a/lib/isc/pk11.c b/lib/isc/pk11.c -index 0d5b009..7809e7b 100644 ---- a/lib/isc/pk11.c -+++ b/lib/isc/pk11.c -@@ -197,8 +197,6 @@ pk11_initialize(isc_mem_t *mctx, const char *engine) { - UNLOCK(&alloclock); - if (initialized) { - goto unlock; -- } else { -- initialized = true; - } - - ISC_LIST_INIT(tokens); -@@ -238,6 +236,7 @@ pk11_initialize(isc_mem_t *mctx, const char *engine) { - } - #endif - #endif /* PKCS11CRYPTO */ -+ initialized = true; - unlock: - UNLOCK(&sessionlock); - return (result); -@@ -589,6 +588,8 @@ scan_slots(void) { - pk11_token_t *token; - unsigned int i; - bool bad; -+ unsigned int best_rsa_algorithms = 0; -+ unsigned int best_digest_algorithms = 0; - - slotCount = 0; - PK11_FATALCHECK(pkcs_C_GetSlotList, (CK_FALSE, NULL_PTR, &slotCount)); -@@ -601,6 +602,8 @@ scan_slots(void) { - PK11_FATALCHECK(pkcs_C_GetSlotList, (CK_FALSE, slotList, &slotCount)); - - for (i = 0; i < slotCount; i++) { -+ unsigned int rsa_algorithms = 0; -+ unsigned int digest_algorithms = 0; - slot = slotList[i]; - PK11_TRACE2("slot#%u=0x%lx\n", i, slot); - -@@ -640,11 +643,12 @@ scan_slots(void) { - if ((rv != CKR_OK) || - ((mechInfo.flags & CKF_SIGN) == 0) || - ((mechInfo.flags & CKF_VERIFY) == 0)) { --#if !defined(PK11_MD5_DISABLE) && !defined(PK11_RSA_PKCS_REPLACE) -- bad = true; --#endif - PK11_TRACEM(CKM_MD5_RSA_PKCS); - } -+#if !defined(PK11_MD5_DISABLE) && !defined(PK11_RSA_PKCS_REPLACE) -+ else -+ ++rsa_algorithms; -+#endif - rv = pkcs_C_GetMechanismInfo(slot, CKM_SHA1_RSA_PKCS, - &mechInfo); - if ((rv != CKR_OK) || -@@ -687,8 +691,14 @@ scan_slots(void) { - if (bad) - goto try_dsa; - token->operations |= 1 << OP_RSA; -- if (best_rsa_token == NULL) -+ if (best_rsa_token == NULL) { - best_rsa_token = token; -+ best_rsa_algorithms = rsa_algorithms; -+ } else if (rsa_algorithms > best_rsa_algorithms) { -+ pk11_mem_put(best_rsa_token, sizeof(*best_rsa_token)); -+ best_rsa_token = token; -+ best_rsa_algorithms = rsa_algorithms; -+ } - - try_dsa: - bad = false; -@@ -756,11 +766,12 @@ scan_slots(void) { - bad = false; - rv = pkcs_C_GetMechanismInfo(slot, CKM_MD5, &mechInfo); - if ((rv != CKR_OK) || ((mechInfo.flags & CKF_DIGEST) == 0)) { --#ifndef PK11_MD5_DISABLE -- bad = true; --#endif - PK11_TRACEM(CKM_MD5); - } -+#ifndef PK11_MD5_DISABLE -+ else -+ ++digest_algorithms; -+#endif - rv = pkcs_C_GetMechanismInfo(slot, CKM_SHA_1, &mechInfo); - if ((rv != CKR_OK) || ((mechInfo.flags & CKF_DIGEST) == 0)) { - bad = true; -@@ -788,11 +799,12 @@ scan_slots(void) { - } - rv = pkcs_C_GetMechanismInfo(slot, CKM_MD5_HMAC, &mechInfo); - if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0)) { --#if !defined(PK11_MD5_DISABLE) && !defined(PK11_MD5_HMAC_REPLACE) -- bad = true; --#endif - PK11_TRACEM(CKM_MD5_HMAC); - } -+#if !defined(PK11_MD5_DISABLE) && !defined(PK11_MD5_HMAC_REPLACE) -+ else -+ ++digest_algorithms; -+#endif - rv = pkcs_C_GetMechanismInfo(slot, CKM_SHA_1_HMAC, &mechInfo); - if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0)) { - #ifndef PK11_SHA_1_HMAC_REPLACE -@@ -830,8 +842,14 @@ scan_slots(void) { - } - if (!bad) { - token->operations |= 1 << OP_DIGEST; -- if (digest_token == NULL) -+ if (digest_token == NULL) { - digest_token = token; -+ best_digest_algorithms = digest_algorithms; -+ } else if (digest_algorithms > best_digest_algorithms) { -+ pk11_mem_put(digest_token, sizeof(*digest_token)); -+ digest_token = token; -+ best_digest_algorithms = digest_algorithms; -+ } - } - - /* ECDSA requires digest */ -diff --git a/lib/isc/tests/hash_test.c b/lib/isc/tests/hash_test.c -index 31ced94..421131e 100644 ---- a/lib/isc/tests/hash_test.c -+++ b/lib/isc/tests/hash_test.c -@@ -775,6 +775,9 @@ isc_md5_test(void **state) { - - UNUSED(state); - -+ if (!isc_md5_available()) -+ return; -+ - /* - * These are the various test vectors. All of these are passed - * through the hash function and the results are compared to the -@@ -1630,6 +1633,9 @@ isc_hmacmd5_test(void **state) { - - UNUSED(state); - -+ if (!isc_md5_available()) -+ return; -+ - /* - * These are the various test vectors. All of these are passed - * through the hash function and the results are compared to the -@@ -1940,6 +1946,9 @@ static void - md5_check_test(void **state) { - UNUSED(state); - -+ if (!isc_md5_available()) -+ return; -+ - assert_true(isc_md5_check(false)); - assert_false(isc_md5_check(true)); - -diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c -index c2740cb..c314d76 100644 ---- a/lib/isccc/cc.c -+++ b/lib/isccc/cc.c -@@ -272,11 +272,15 @@ sign(unsigned char *data, unsigned int length, unsigned char *hmac, - switch (algorithm) { - #ifndef PK11_MD5_DISABLE - case ISCCC_ALG_HMACMD5: -- isc_hmacmd5_init(&ctx.hmd5, secret->rstart, -- REGION_SIZE(*secret)); -- isc_hmacmd5_update(&ctx.hmd5, data, length); -- isc_hmacmd5_sign(&ctx.hmd5, digest); -- source.rend = digest + ISC_MD5_DIGESTLENGTH; -+ if (isc_md5_available()) { -+ isc_hmacmd5_init(&ctx.hmd5, secret->rstart, -+ REGION_SIZE(*secret)); -+ isc_hmacmd5_update(&ctx.hmd5, data, length); -+ isc_hmacmd5_sign(&ctx.hmd5, digest); -+ source.rend = digest + ISC_MD5_DIGESTLENGTH; -+ } else { -+ return (ISC_R_FAILURE); -+ } - break; - #endif - -@@ -350,14 +354,18 @@ isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer, - { - unsigned int hmac_base, signed_base; - isc_result_t result; -+ const bool md5 = (algorithm == ISCCC_ALG_HMACMD5); - - #ifndef PK11_MD5_DISABLE -+ if (md5 && !isc_md5_available()) -+ return (ISC_R_NOTIMPLEMENTED); -+ - result = isc_buffer_reserve(buffer, -- 4 + ((algorithm == ISCCC_ALG_HMACMD5) ? -+ 4 + ((md5) ? - sizeof(auth_hmd5) : - sizeof(auth_hsha))); - #else -- if (algorithm == ISCCC_ALG_HMACMD5) -+ if (md5) - return (ISC_R_NOTIMPLEMENTED); - result = isc_buffer_reserve(buffer, 4 + sizeof(auth_hsha)); - #endif -@@ -376,7 +384,7 @@ isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer, - * we know what it is. - */ - #ifndef PK11_MD5_DISABLE -- if (algorithm == ISCCC_ALG_HMACMD5) { -+ if (md5) { - hmac_base = (*buffer)->used + HMD5_OFFSET; - isc_buffer_putmem(*buffer, - auth_hmd5, sizeof(auth_hmd5)); -@@ -442,7 +450,7 @@ verify(isccc_sexpr_t *alist, unsigned char *data, unsigned int length, - if (!isccc_alist_alistp(_auth)) - return (ISC_R_FAILURE); - #ifndef PK11_MD5_DISABLE -- if (algorithm == ISCCC_ALG_HMACMD5) -+ if (algorithm == ISCCC_ALG_HMACMD5 && isc_md5_available()) - hmac = isccc_alist_lookup(_auth, "hmd5"); - else - #endif -@@ -457,12 +465,16 @@ verify(isccc_sexpr_t *alist, unsigned char *data, unsigned int length, - switch (algorithm) { - #ifndef PK11_MD5_DISABLE - case ISCCC_ALG_HMACMD5: -- isc_hmacmd5_init(&ctx.hmd5, secret->rstart, -- REGION_SIZE(*secret)); -- isc_hmacmd5_update(&ctx.hmd5, data, length); -- isc_hmacmd5_sign(&ctx.hmd5, digest); -- source.rend = digest + ISC_MD5_DIGESTLENGTH; -- break; -+ if (isc_md5_available()) { -+ isc_hmacmd5_init(&ctx.hmd5, secret->rstart, -+ REGION_SIZE(*secret)); -+ isc_hmacmd5_update(&ctx.hmd5, data, length); -+ isc_hmacmd5_sign(&ctx.hmd5, digest); -+ source.rend = digest + ISC_MD5_DIGESTLENGTH; -+ break; -+ } else { -+ return (ISC_R_FAILURE); -+ } - #endif - - case ISCCC_ALG_HMACSHA1: --- -2.20.1 - diff --git a/SOURCES/bind-9.11-fips-disable.patch b/SOURCES/bind-9.11-fips-disable.patch deleted file mode 100644 index afe9564..0000000 --- a/SOURCES/bind-9.11-fips-disable.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 83b889c238282b210f874a3ad81bb56299767495 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Mon, 5 Aug 2019 11:54:03 +0200 -Subject: [PATCH] Allow explicit disabling of autodisabled MD5 - -Default security policy might include explicitly disabled RSAMD5 -algorithm. Current FIPS code automatically disables in FIPS mode. But if -RSAMD5 is included in security policy, it fails to start, because that -algorithm is not recognized. Allow it disabled, but fail on any -other usage. ---- - bin/named/server.c | 4 ++-- - lib/bind9/check.c | 4 ++++ - lib/dns/rcode.c | 33 +++++++++++++++------------------ - 3 files changed, 21 insertions(+), 20 deletions(-) - -diff --git a/bin/named/server.c b/bin/named/server.c -index 5b57371..51702ab 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -1547,12 +1547,12 @@ disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) { - r.length = strlen(r.base); - - result = dns_secalg_fromtext(&alg, &r); -- if (result != ISC_R_SUCCESS) { -+ if (result != ISC_R_SUCCESS && result != ISC_R_DISABLED) { - uint8_t ui; - result = isc_parse_uint8(&ui, r.base, 10); - alg = ui; - } -- if (result != ISC_R_SUCCESS) { -+ if (result != ISC_R_SUCCESS && result != ISC_R_DISABLED) { - cfg_obj_log(cfg_listelt_value(element), - ns_g_lctx, ISC_LOG_ERROR, - "invalid algorithm"); -diff --git a/lib/bind9/check.c b/lib/bind9/check.c -index e0803d4..8023784 100644 ---- a/lib/bind9/check.c -+++ b/lib/bind9/check.c -@@ -302,6 +302,10 @@ disabled_algorithms(const cfg_obj_t *disabled, isc_log_t *logctx) { - r.length = strlen(r.base); - - tresult = dns_secalg_fromtext(&alg, &r); -+ if (tresult == ISC_R_DISABLED) { -+ // Recognize disabled algorithms, disable it explicitly -+ tresult = ISC_R_SUCCESS; -+ } - if (tresult != ISC_R_SUCCESS) { - cfg_obj_log(cfg_listelt_value(element), logctx, - ISC_LOG_ERROR, "invalid algorithm '%s'", -diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c -index f51d548..c49b8d1 100644 ---- a/lib/dns/rcode.c -+++ b/lib/dns/rcode.c -@@ -126,7 +126,6 @@ - #endif - - #define SECALGNAMES \ -- MD5_SECALGNAMES \ - DH_SECALGNAMES \ - DSA_SECALGNAMES \ - { DNS_KEYALG_ECC, "ECC", 0 }, \ -@@ -178,6 +177,7 @@ static struct tbl rcodes[] = { RCODENAMES ERCODENAMES }; - static struct tbl tsigrcodes[] = { RCODENAMES TSIGRCODENAMES }; - static struct tbl certs[] = { CERTNAMES }; - static struct tbl secalgs[] = { SECALGNAMES }; -+static struct tbl md5_secalgs[] = { MD5_SECALGNAMES }; - static struct tbl secprotos[] = { SECPROTONAMES }; - static struct tbl hashalgs[] = { HASHALGNAMES }; - static struct tbl dsdigests[] = { DSDIGESTNAMES }; -@@ -358,33 +358,30 @@ dns_cert_totext(dns_cert_t cert, isc_buffer_t *target) { - return (dns_mnemonic_totext(cert, target, certs)); - } - --static inline struct tbl * --secalgs_tbl_start() { -- struct tbl *algs = secalgs; -- --#ifndef PK11_MD5_DISABLE -- if (!isc_md5_available()) { -- while (algs->name != NULL && -- algs->value == DNS_KEYALG_RSAMD5) -- ++algs; -- } --#endif -- return algs; --} -- - isc_result_t - dns_secalg_fromtext(dns_secalg_t *secalgp, isc_textregion_t *source) { - unsigned int value; -+ isc_result_t result; - -- RETERR(dns_mnemonic_fromtext(&value, source, -- secalgs_tbl_start(), 0xff)); -+ result = dns_mnemonic_fromtext(&value, source, -+ secalgs, 0xff); -+ if (result != ISC_R_SUCCESS) { -+ result = dns_mnemonic_fromtext(&value, source, -+ md5_secalgs, 0xff); -+ if (result != ISC_R_SUCCESS) { -+ return (result); -+ } else if (!isc_md5_available()) { -+ *secalgp = value; -+ return (ISC_R_DISABLED); -+ } -+ } - *secalgp = value; - return (ISC_R_SUCCESS); - } - - isc_result_t - dns_secalg_totext(dns_secalg_t secalg, isc_buffer_t *target) { -- return (dns_mnemonic_totext(secalg, target, secalgs_tbl_start())); -+ return (dns_mnemonic_totext(secalg, target, secalgs)); - } - - void --- -2.20.1 - diff --git a/SOURCES/bind-9.11-fips-tests.patch b/SOURCES/bind-9.11-fips-tests.patch deleted file mode 100644 index 3203593..0000000 --- a/SOURCES/bind-9.11-fips-tests.patch +++ /dev/null @@ -1,1397 +0,0 @@ -From 1dc81c51cd5c70b783aab8b6156aec4cfedd6fe3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Thu, 2 Aug 2018 23:46:45 +0200 -Subject: [PATCH] FIPS tests changes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Squashed commit of the following: - -commit 09e5eb48698d4fef2fc1031870de86c553b6bfaa -Author: Petr Menšík -Date: Wed Mar 7 20:35:13 2018 +0100 - - Fix nsupdate test. Do not use md5 by default for rndc, skip gracefully md5 if not available. - -commit ab303db70082db76ecf36493d0b82ef3e8750cad -Author: Petr Menšík -Date: Wed Mar 7 18:11:10 2018 +0100 - - Changed root key to be RSASHA256 - - Change bad trusted key to be the same algorithm. - -commit 88ab07c0e14cc71247e1f9d11a1ea832b64c1ee8 -Author: Petr Menšík -Date: Wed Mar 7 16:56:17 2018 +0100 - - Change used key to not use hmac-md5 - - Fix upforwd test, do not use hmac-md5 - -commit aec891571626f053acfb4d0a247240cbc21a84e9 -Author: Petr Menšík -Date: Wed Mar 7 15:54:11 2018 +0100 - - Increase bitsize of DSA key to pass FIPS 140-2 mode. - -commit bca8e164fa0d9aff2f946b8b4eb0f1f7e0bf6696 -Author: Petr Menšík -Date: Wed Mar 7 15:41:08 2018 +0100 - - Fix tsig and rndc tests for disabled md5 - - Use hmac-sha256 instead of hmac-md5. - -commit 0d314c1ab6151aa13574a21ad22f28d3b7f42a67 -Author: Petr Menšík -Date: Wed Mar 7 13:21:00 2018 +0100 - - Add md5 availability detection to featuretest - -commit f389a918803e2853e4b55fed62765dc4a492e34f -Author: Petr Menšík -Date: Wed Mar 7 10:44:23 2018 +0100 - - Change tests to not use hmac-md5 algorithms if not required - - Use hmac-sha256 instead of default hmac-md5 for allow-query ---- - bin/tests/system/acl/ns2/named1.conf.in | 4 +- - bin/tests/system/acl/ns2/named2.conf.in | 4 +- - bin/tests/system/acl/ns2/named3.conf.in | 6 +- - bin/tests/system/acl/ns2/named4.conf.in | 4 +- - bin/tests/system/acl/ns2/named5.conf.in | 4 +- - bin/tests/system/acl/tests.sh | 32 ++++----- - .../system/allow-query/ns2/named10.conf.in | 2 +- - .../system/allow-query/ns2/named11.conf.in | 4 +- - .../system/allow-query/ns2/named12.conf.in | 2 +- - .../system/allow-query/ns2/named30.conf.in | 2 +- - .../system/allow-query/ns2/named31.conf.in | 4 +- - .../system/allow-query/ns2/named32.conf.in | 2 +- - .../system/allow-query/ns2/named40.conf.in | 4 +- - bin/tests/system/allow-query/tests.sh | 18 ++--- - bin/tests/system/catz/ns1/named.conf.in | 2 +- - bin/tests/system/catz/ns2/named.conf.in | 2 +- - bin/tests/system/checkconf/bad-tsig.conf | 2 +- - bin/tests/system/checkconf/good.conf | 2 +- - bin/tests/system/digdelv/ns2/example.db | 15 +++-- - bin/tests/system/digdelv/tests.sh | 20 +++--- - bin/tests/system/dlv/ns1/sign.sh | 4 +- - bin/tests/system/dlv/ns2/sign.sh | 4 +- - bin/tests/system/dlv/ns6/sign.sh | 66 ++++++++++--------- - bin/tests/system/dnssec/ns2/sign.sh | 8 +-- - bin/tests/system/dnssec/ns5/trusted.conf.bad | 2 +- - bin/tests/system/dnssec/tests.sh | 4 +- - bin/tests/system/feature-test.c | 14 ++++ - bin/tests/system/filter-aaaa/ns1/sign.sh | 4 +- - bin/tests/system/filter-aaaa/ns4/sign.sh | 4 +- - bin/tests/system/notify/ns5/named.conf.in | 6 +- - bin/tests/system/notify/tests.sh | 6 +- - bin/tests/system/nsupdate/ns1/named.conf.in | 2 +- - bin/tests/system/nsupdate/ns2/named.conf.in | 2 +- - bin/tests/system/nsupdate/setup.sh | 7 +- - bin/tests/system/nsupdate/tests.sh | 11 +++- - bin/tests/system/rndc/setup.sh | 2 +- - bin/tests/system/rndc/tests.sh | 23 ++++--- - bin/tests/system/tsig/ns1/named.conf.in | 10 +-- - bin/tests/system/tsig/ns1/rndc5.conf.in | 10 +++ - bin/tests/system/tsig/setup.sh | 5 ++ - bin/tests/system/tsig/tests.sh | 65 +++++++++++------- - bin/tests/system/tsiggss/setup.sh | 2 +- - bin/tests/system/upforwd/ns1/named.conf.in | 2 +- - bin/tests/system/upforwd/tests.sh | 2 +- - 44 files changed, 230 insertions(+), 170 deletions(-) - create mode 100644 bin/tests/system/tsig/ns1/rndc5.conf.in - -diff --git a/bin/tests/system/acl/ns2/named1.conf.in b/bin/tests/system/acl/ns2/named1.conf.in -index 9999ada..e3f8d0e 100644 ---- a/bin/tests/system/acl/ns2/named1.conf.in -+++ b/bin/tests/system/acl/ns2/named1.conf.in -@@ -33,12 +33,12 @@ options { - }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/acl/ns2/named2.conf.in b/bin/tests/system/acl/ns2/named2.conf.in -index f8ec34e..d2d6ad3 100644 ---- a/bin/tests/system/acl/ns2/named2.conf.in -+++ b/bin/tests/system/acl/ns2/named2.conf.in -@@ -33,12 +33,12 @@ options { - }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/acl/ns2/named3.conf.in b/bin/tests/system/acl/ns2/named3.conf.in -index 2acb813..6a00344 100644 ---- a/bin/tests/system/acl/ns2/named3.conf.in -+++ b/bin/tests/system/acl/ns2/named3.conf.in -@@ -33,17 +33,17 @@ options { - }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key three { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/acl/ns2/named4.conf.in b/bin/tests/system/acl/ns2/named4.conf.in -index bca3ee1..5913420 100644 ---- a/bin/tests/system/acl/ns2/named4.conf.in -+++ b/bin/tests/system/acl/ns2/named4.conf.in -@@ -33,12 +33,12 @@ options { - }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/acl/ns2/named5.conf.in b/bin/tests/system/acl/ns2/named5.conf.in -index 9ef8171..5ae8d38 100644 ---- a/bin/tests/system/acl/ns2/named5.conf.in -+++ b/bin/tests/system/acl/ns2/named5.conf.in -@@ -34,12 +34,12 @@ options { - }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/acl/tests.sh b/bin/tests/system/acl/tests.sh -index 2ee34a0..a73a54e 100644 ---- a/bin/tests/system/acl/tests.sh -+++ b/bin/tests/system/acl/tests.sh -@@ -22,14 +22,14 @@ echo_i "testing basic ACL processing" - # key "one" should fail - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - - # any other key should be fine - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - copy_setports ns2/named2.conf.in ns2/named.conf -@@ -39,18 +39,18 @@ sleep 5 - # prefix 10/8 should fail - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - # any other address should work, as long as it sends key "one" - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 127.0.0.1 axfr -y two:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - echo_i "testing nested ACL processing" -@@ -62,31 +62,31 @@ sleep 5 - # should succeed - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - # should succeed - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - # should succeed - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - # should succeed - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - # but only one or the other should fail - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - t=`expr $t + 1` -@@ -97,7 +97,7 @@ grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $tt failed" ; status=1 - # and other values? right out - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 127.0.0.1 axfr -y hmac-sha256:three:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - # now we only allow 10.53.0.1 *and* key one, or 10.53.0.2 *and* key two -@@ -108,31 +108,31 @@ sleep 5 - # should succeed - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - # should succeed - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo_i "test $t failed" ; status=1; } - - # should fail - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.2 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - # should fail - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.1 axfr -y hmac-sha256:two:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - # should fail - t=`expr $t + 1` - $DIG $DIGOPTS tsigzone. \ -- @10.53.0.2 -b 10.53.0.3 axfr -y one:1234abcd8765 > dig.out.${t} -+ @10.53.0.2 -b 10.53.0.3 axfr -y hmac-sha256:one:1234abcd8765 > dig.out.${t} - grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; } - - echo_i "testing allow-query-on ACL processing" -diff --git a/bin/tests/system/allow-query/ns2/named10.conf.in b/bin/tests/system/allow-query/ns2/named10.conf.in -index a579f32..3b8f853 100644 ---- a/bin/tests/system/allow-query/ns2/named10.conf.in -+++ b/bin/tests/system/allow-query/ns2/named10.conf.in -@@ -12,7 +12,7 @@ - controls { /* empty */ }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/allow-query/ns2/named11.conf.in b/bin/tests/system/allow-query/ns2/named11.conf.in -index 166afa1..997ece9 100644 ---- a/bin/tests/system/allow-query/ns2/named11.conf.in -+++ b/bin/tests/system/allow-query/ns2/named11.conf.in -@@ -12,12 +12,12 @@ - controls { /* empty */ }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234efgh8765"; - }; - -diff --git a/bin/tests/system/allow-query/ns2/named12.conf.in b/bin/tests/system/allow-query/ns2/named12.conf.in -index 25271a5..a9cb65d 100644 ---- a/bin/tests/system/allow-query/ns2/named12.conf.in -+++ b/bin/tests/system/allow-query/ns2/named12.conf.in -@@ -12,7 +12,7 @@ - controls { /* empty */ }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/allow-query/ns2/named30.conf.in b/bin/tests/system/allow-query/ns2/named30.conf.in -index c7c8254..f165e65 100644 ---- a/bin/tests/system/allow-query/ns2/named30.conf.in -+++ b/bin/tests/system/allow-query/ns2/named30.conf.in -@@ -12,7 +12,7 @@ - controls { /* empty */ }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/allow-query/ns2/named31.conf.in b/bin/tests/system/allow-query/ns2/named31.conf.in -index 567bbcc..4fd2035 100644 ---- a/bin/tests/system/allow-query/ns2/named31.conf.in -+++ b/bin/tests/system/allow-query/ns2/named31.conf.in -@@ -12,12 +12,12 @@ - controls { /* empty */ }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234efgh8765"; - }; - -diff --git a/bin/tests/system/allow-query/ns2/named32.conf.in b/bin/tests/system/allow-query/ns2/named32.conf.in -index b75161f..7b254e6 100644 ---- a/bin/tests/system/allow-query/ns2/named32.conf.in -+++ b/bin/tests/system/allow-query/ns2/named32.conf.in -@@ -12,7 +12,7 @@ - controls { /* empty */ }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/allow-query/ns2/named40.conf.in b/bin/tests/system/allow-query/ns2/named40.conf.in -index 9e17818..22f5001 100644 ---- a/bin/tests/system/allow-query/ns2/named40.conf.in -+++ b/bin/tests/system/allow-query/ns2/named40.conf.in -@@ -16,12 +16,12 @@ acl accept { 10.53.0.2; }; - acl badaccept { 10.53.0.1; }; - - key one { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234abcd8765"; - }; - - key two { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "1234efgh8765"; - }; - -diff --git a/bin/tests/system/allow-query/tests.sh b/bin/tests/system/allow-query/tests.sh -index 791a1a4..95cd971 100644 ---- a/bin/tests/system/allow-query/tests.sh -+++ b/bin/tests/system/allow-query/tests.sh -@@ -190,7 +190,7 @@ rndc_reload - - echo_i "test $n: key allowed - query allowed" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 - grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -203,7 +203,7 @@ rndc_reload - - echo_i "test $n: key not allowed - query refused" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1 - grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -216,7 +216,7 @@ rndc_reload - - echo_i "test $n: key disallowed - query refused" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 - grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -349,7 +349,7 @@ rndc_reload - - echo_i "test $n: views key allowed - query allowed" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 - grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -362,7 +362,7 @@ rndc_reload - - echo_i "test $n: views key not allowed - query refused" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:two:1234efgh8765 a.normal.example a > dig.out.ns2.$n || ret=1 - grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -375,7 +375,7 @@ rndc_reload - - echo_i "test $n: views key disallowed - query refused" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.normal.example a > dig.out.ns2.$n || ret=1 - grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -508,7 +508,7 @@ status=`expr $status + $ret` - n=`expr $n + 1` - echo_i "test $n: zone key allowed - query allowed" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.keyallow.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.keyallow.example a > dig.out.ns2.$n || ret=1 - grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.keyallow.example' dig.out.ns2.$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -518,7 +518,7 @@ status=`expr $status + $ret` - n=`expr $n + 1` - echo_i "test $n: zone key not allowed - query refused" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y two:1234efgh8765 a.keyallow.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:two:1234efgh8765 a.keyallow.example a > dig.out.ns2.$n || ret=1 - grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.keyallow.example' dig.out.ns2.$n > /dev/null && ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -@@ -528,7 +528,7 @@ status=`expr $status + $ret` - n=`expr $n + 1` - echo_i "test $n: zone key disallowed - query refused" - ret=0 --$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y one:1234abcd8765 a.keydisallow.example a > dig.out.ns2.$n || ret=1 -+$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 -y hmac-sha256:one:1234abcd8765 a.keydisallow.example a > dig.out.ns2.$n || ret=1 - grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1 - grep '^a.keydisallow.example' dig.out.ns2.$n > /dev/null && ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -diff --git a/bin/tests/system/catz/ns1/named.conf.in b/bin/tests/system/catz/ns1/named.conf.in -index 6856ec7..0ac1fa3 100644 ---- a/bin/tests/system/catz/ns1/named.conf.in -+++ b/bin/tests/system/catz/ns1/named.conf.in -@@ -61,5 +61,5 @@ zone "catalog4.example" { - - key tsig_key. { - secret "LSAnCU+Z"; -- algorithm hmac-md5; -+ algorithm hmac-sha256; - }; -diff --git a/bin/tests/system/catz/ns2/named.conf.in b/bin/tests/system/catz/ns2/named.conf.in -index dd3a9dc..77b8d96 100644 ---- a/bin/tests/system/catz/ns2/named.conf.in -+++ b/bin/tests/system/catz/ns2/named.conf.in -@@ -70,5 +70,5 @@ zone "catalog4.example" { - - key tsig_key. { - secret "LSAnCU+Z"; -- algorithm hmac-md5; -+ algorithm hmac-sha256; - }; -diff --git a/bin/tests/system/checkconf/bad-tsig.conf b/bin/tests/system/checkconf/bad-tsig.conf -index 338dddb..90cd424 100644 ---- a/bin/tests/system/checkconf/bad-tsig.conf -+++ b/bin/tests/system/checkconf/bad-tsig.conf -@@ -11,7 +11,7 @@ - - /* Bad secret */ - key "badtsig" { -- algorithm hmac-md5; -+ algorithm hmac-sha256; - secret "jEdD+BPKg=="; - }; - -diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf -index 2282f87..1359cf3 100644 ---- a/bin/tests/system/checkconf/good.conf -+++ b/bin/tests/system/checkconf/good.conf -@@ -159,6 +159,6 @@ dyndb "name" "library.so" { - system; - }; - key "mykey" { -- algorithm "hmac-md5"; -+ algorithm "hmac-sha256"; - secret "qwertyuiopasdfgh"; - }; -diff --git a/bin/tests/system/digdelv/ns2/example.db b/bin/tests/system/digdelv/ns2/example.db -index b66207a..359b220 100644 ---- a/bin/tests/system/digdelv/ns2/example.db -+++ b/bin/tests/system/digdelv/ns2/example.db -@@ -38,12 +38,15 @@ foo SSHFP 2 1 123456789abcdef67890123456789abcdef67890 - ;; - ;; we are not testing DNSSEC behavior, so we don't care about the semantics - ;; of the following records. --dnskey 300 DNSKEY 256 3 1 ( -- AQPTpWyReB/e9Ii6mVGnakS8hX2zkh/iUYAg -- +Ge4noWROpTWOIBvm76zeJPWs4Zfqa1IsswD -- Ix5Mqeg0zwclz59uecKsKyx5w9IhtZ8plc4R -- b9VIE5x7KNHAYTvTO5d4S8M= -- ) -+dnskey 300 DNSKEY 256 3 8 ( -+ AwEAAaWmCoDpj2K59zcpqnmnQM7IC/XbjS6jIP7uTBR4X7p1bdQJzAeo -+ EnMhnpnxPp0j+20eZm4847DB2U+HuHy79Mvqd3aozTmfBJvzjKs9qyba -+ zY/ZHn6BDYxNJiFfjSS/VJ1KuQPDbpCzhm2hbvT5s9nSOaG0WyRk+d+R -+ qEca11E7ZKkmmNiGlyzMAgfmTTBwgxWBAAhvd9nU1GqD6eQ6Z63hpTc/ -+ KDIHnFTo7pOcZ4z5urIKUMCMcFytedETlEoR5CIWGPdQq2eIEEMfn5ld -+ QqdEZRHVErD9og8aluJ2s767HZb8LzjCfYgBFoT9/n48T75oZLEKtSkG -+ /idCeeQlaLU= -+ ) - - ; TTL of 3 weeks - weeks 1814400 A 10.53.0.2 -diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh -index a3ebc31..0d9b9b8 100644 ---- a/bin/tests/system/digdelv/tests.sh -+++ b/bin/tests/system/digdelv/tests.sh -@@ -173,7 +173,7 @@ if [ -x "$DIG" ] ; then - echo_i "checking dig +rrcomments works for DNSKEY($n)" - ret=0 - $DIG $DIGOPTS +tcp @10.53.0.3 +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1 -- grep "; ZSK; alg = RSAMD5 ; key id = 30795" < dig.out.test$n > /dev/null || ret=1 -+ grep "; ZSK; alg = RSASHA256 ; key id = 36895$" < dig.out.test$n > /dev/null || ret=1 - check_ttl_range dig.out.test$n "DNSKEY" 300 || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` -@@ -182,7 +182,7 @@ if [ -x "$DIG" ] ; then - echo_i "checking dig +short +rrcomments works for DNSKEY ($n)" - ret=0 - $DIG $DIGOPTS +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1 -- grep "; ZSK; alg = RSAMD5 ; key id = 30795" < dig.out.test$n > /dev/null || ret=1 -+ grep "; ZSK; alg = RSASHA256 ; key id = 36895$" < dig.out.test$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -@@ -190,7 +190,7 @@ if [ -x "$DIG" ] ; then - echo_i "checking dig +short +nosplit works($n)" - ret=0 - $DIG $DIGOPTS +tcp @10.53.0.3 +short +nosplit DNSKEY dnskey.example > dig.out.test$n || ret=1 -- grep "Z8plc4Rb9VIE5x7KNHAYTvTO5d4S8M=$" < dig.out.test$n > /dev/null || ret=1 -+ grep "T9/n48T75oZLEKtSkG/idCeeQlaLU=$" < dig.out.test$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -@@ -198,7 +198,7 @@ if [ -x "$DIG" ] ; then - echo_i "checking dig +short +rrcomments works($n)" - ret=0 - $DIG $DIGOPTS +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1 -- grep "S8M= ; ZSK; alg = RSAMD5 ; key id = 30795$" < dig.out.test$n > /dev/null || ret=1 -+ grep "aLU= ; ZSK; alg = RSASHA256 ; key id = 36895$" < dig.out.test$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -@@ -215,7 +215,7 @@ if [ -x "$DIG" ] ; then - echo_i "checking dig +short +rrcomments works($n)" - ret=0 - $DIG $DIGOPTS +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1 -- grep "S8M= ; ZSK; alg = RSAMD5 ; key id = 30795$" < dig.out.test$n > /dev/null || ret=1 -+ grep "aLU= ; ZSK; alg = RSASHA256 ; key id = 36895$" < dig.out.test$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -@@ -846,7 +846,7 @@ if [ -x ${DELV} ] ; then - echo_i "checking delv +rrcomments works for DNSKEY($n)" - ret=0 - $DELV $DELVOPTS +tcp @10.53.0.3 +rrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1 -- grep "; ZSK; alg = RSAMD5 ; key id = 30795" < delv.out.test$n > /dev/null || ret=1 -+ grep "; ZSK; alg = RSASHA256 ; key id = 36895" < delv.out.test$n > /dev/null || ret=1 - check_ttl_range delv.out.test$n "DNSKEY" 300 || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` -@@ -855,7 +855,7 @@ if [ -x ${DELV} ] ; then - echo_i "checking delv +short +rrcomments works for DNSKEY ($n)" - ret=0 - $DELV $DELVOPTS +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1 -- grep "; ZSK; alg = RSAMD5 ; key id = 30795" < delv.out.test$n > /dev/null || ret=1 -+ grep "; ZSK; alg = RSASHA256 ; key id = 36895" < delv.out.test$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -@@ -863,7 +863,7 @@ if [ -x ${DELV} ] ; then - echo_i "checking delv +short +rrcomments works ($n)" - ret=0 - $DELV $DELVOPTS +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1 -- grep "S8M= ; ZSK; alg = RSAMD5 ; key id = 30795$" < delv.out.test$n > /dev/null || ret=1 -+ grep "aLU= ; ZSK; alg = RSASHA256 ; key id = 36895$" < delv.out.test$n > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -@@ -871,7 +871,7 @@ if [ -x ${DELV} ] ; then - echo_i "checking delv +short +nosplit works ($n)" - ret=0 - $DELV $DELVOPTS +tcp @10.53.0.3 +short +nosplit DNSKEY dnskey.example > delv.out.test$n || ret=1 -- grep "Z8plc4Rb9VIE5x7KNHAYTvTO5d4S8M=" < delv.out.test$n > /dev/null || ret=1 -+ grep "T9/n48T75oZLEKtSkG/idCeeQlaLU=" < delv.out.test$n > /dev/null || ret=1 - if test `wc -l < delv.out.test$n` != 1 ; then ret=1 ; fi - f=`awk '{print NF}' < delv.out.test$n` - test "${f:-0}" -eq 14 || ret=1 -@@ -882,7 +882,7 @@ if [ -x ${DELV} ] ; then - echo_i "checking delv +short +nosplit +norrcomments works ($n)" - ret=0 - $DELV $DELVOPTS +tcp @10.53.0.3 +short +nosplit +norrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1 -- grep "Z8plc4Rb9VIE5x7KNHAYTvTO5d4S8M=$" < delv.out.test$n > /dev/null || ret=1 -+ grep "T9/n48T75oZLEKtSkG/idCeeQlaLU=$" < delv.out.test$n > /dev/null || ret=1 - if test `wc -l < delv.out.test$n` != 1 ; then ret=1 ; fi - f=`awk '{print NF}' < delv.out.test$n` - test "${f:-0}" -eq 4 || ret=1 -diff --git a/bin/tests/system/dlv/ns1/sign.sh b/bin/tests/system/dlv/ns1/sign.sh -index 14ca5db..3f522d0 100755 ---- a/bin/tests/system/dlv/ns1/sign.sh -+++ b/bin/tests/system/dlv/ns1/sign.sh -@@ -23,8 +23,8 @@ infile=root.db.in - zonefile=root.db - outfile=root.signed - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -diff --git a/bin/tests/system/dlv/ns2/sign.sh b/bin/tests/system/dlv/ns2/sign.sh -index d870798..b0ab372 100755 ---- a/bin/tests/system/dlv/ns2/sign.sh -+++ b/bin/tests/system/dlv/ns2/sign.sh -@@ -24,8 +24,8 @@ zonefile=druz.db - outfile=druz.pre - dlvzone=utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -diff --git a/bin/tests/system/dlv/ns6/sign.sh b/bin/tests/system/dlv/ns6/sign.sh -index ba39f90..f20a2dd 100755 ---- a/bin/tests/system/dlv/ns6/sign.sh -+++ b/bin/tests/system/dlv/ns6/sign.sh -@@ -16,13 +16,15 @@ SYSTESTDIR=dlv - - echo_i "dlv/ns6/sign.sh" - -+bits=1024 -+ - zone=grand.child1.utld. - infile=child.db.in - zonefile=grand.child1.utld.db - outfile=grand.child1.signed - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -36,8 +38,8 @@ zonefile=grand.child3.utld.db - outfile=grand.child3.signed - dlvzone=dlv.utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -51,8 +53,8 @@ zonefile=grand.child4.utld.db - outfile=grand.child4.signed - dlvzone=dlv.utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -66,8 +68,8 @@ zonefile=grand.child5.utld.db - outfile=grand.child5.signed - dlvzone=dlv.utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -81,8 +83,8 @@ zonefile=grand.child7.utld.db - outfile=grand.child7.signed - dlvzone=dlv.utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -96,8 +98,8 @@ zonefile=grand.child8.utld.db - outfile=grand.child8.signed - dlvzone=dlv.utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -111,8 +113,8 @@ zonefile=grand.child9.utld.db - outfile=grand.child9.signed - dlvzone=dlv.utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -125,8 +127,8 @@ zonefile=grand.child10.utld.db - outfile=grand.child10.signed - dlvzone=dlv.utld. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -138,8 +140,8 @@ infile=child.db.in - zonefile=grand.child1.druz.db - outfile=grand.child1.druz.signed - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -153,8 +155,8 @@ zonefile=grand.child3.druz.db - outfile=grand.child3.druz.signed - dlvzone=dlv.druz. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -168,8 +170,8 @@ zonefile=grand.child4.druz.db - outfile=grand.child4.druz.signed - dlvzone=dlv.druz. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -183,8 +185,8 @@ zonefile=grand.child5.druz.db - outfile=grand.child5.druz.signed - dlvzone=dlv.druz. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -198,8 +200,8 @@ zonefile=grand.child7.druz.db - outfile=grand.child7.druz.signed - dlvzone=dlv.druz. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -213,8 +215,8 @@ zonefile=grand.child8.druz.db - outfile=grand.child8.druz.signed - dlvzone=dlv.druz. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -228,8 +230,8 @@ zonefile=grand.child9.druz.db - outfile=grand.child9.druz.signed - dlvzone=dlv.druz. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -@@ -242,8 +244,8 @@ zonefile=grand.child10.druz.db - outfile=grand.child10.druz.signed - dlvzone=dlv.druz. - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b $bits -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -diff --git a/bin/tests/system/dnssec/ns2/sign.sh b/bin/tests/system/dnssec/ns2/sign.sh -index d401823..139c7ad 100644 ---- a/bin/tests/system/dnssec/ns2/sign.sh -+++ b/bin/tests/system/dnssec/ns2/sign.sh -@@ -126,8 +126,8 @@ zone=in-addr.arpa. - infile=in-addr.arpa.db.in - zonefile=in-addr.arpa.db - --keyname1=`$KEYGEN -q -r $RANDFILE -a DSA -b 768 -n zone $zone` --keyname2=`$KEYGEN -q -r $RANDFILE -a DSA -b 768 -n zone $zone` -+keyname1=`$KEYGEN -q -r $RANDFILE -a DSA -b 1024 -n zone $zone` -+keyname2=`$KEYGEN -q -r $RANDFILE -a DSA -b 1024 -n zone $zone` - - cat $infile $keyname1.key $keyname2.key >$zonefile - $SIGNER -P -g -r $RANDFILE -o $zone -k $keyname1 $zonefile $keyname2 > /dev/null -@@ -138,7 +138,7 @@ privzone=private.secure.example - privinfile=private.secure.example.db.in - privzonefile=private.secure.example.db - --privkeyname=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $privzone` -+privkeyname=`$KEYGEN -q -r $RANDFILE -a RSASHA256 -b 1024 -n zone $privzone` - - cat $privinfile $privkeyname.key >$privzonefile - -@@ -152,7 +152,7 @@ dlvinfile=dlv.db.in - dlvzonefile=dlv.db - dlvsetfile=dlvset-${privzone}${TP} - --dlvkeyname=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $dlvzone` -+dlvkeyname=`$KEYGEN -q -r $RANDFILE -a RSASHA256 -b 1024 -n zone $dlvzone` - - cat $dlvinfile $dlvkeyname.key $dlvsetfile > $dlvzonefile - -diff --git a/bin/tests/system/dnssec/ns5/trusted.conf.bad b/bin/tests/system/dnssec/ns5/trusted.conf.bad -index 75cf699..b4d848c 100644 ---- a/bin/tests/system/dnssec/ns5/trusted.conf.bad -+++ b/bin/tests/system/dnssec/ns5/trusted.conf.bad -@@ -10,5 +10,5 @@ - */ - - trusted-keys { -- "." 256 3 1 "AQO6Cl+slAf+iuieDim9L3kujFHQD7s/IOj03ClMOpKYcTXtK4mRpuULVfvWxDi9Ew/gj0xLnnX7z9OJHIxLI+DSrAHd8Dm0XfBEAtVtJSn70GaPZgnLMw1rk5ap2DsEoWk="; -+ "." 256 3 8 "AwEAAarwAdjV4gIhpBCjXVAScRFEx3co7k8smJdxrnqoGsl5NB7EZ9jRdgvCXbJn6v8y9jlNWVHvaC8ilhfhLh0A1vLWiWv4ijd/12xcnrY7xpG7Cu3YkxUxaXJ7Jdg/Iw1+9mGgXF1v4UbCIcw/3U3cxyk7OxYg+VSb5KBAQSR0upxV"; - }; -diff --git a/bin/tests/system/dnssec/tests.sh b/bin/tests/system/dnssec/tests.sh -index 30f7fc5..2f34b6d 100644 ---- a/bin/tests/system/dnssec/tests.sh -+++ b/bin/tests/system/dnssec/tests.sh -@@ -3281,8 +3281,8 @@ do - alg=`expr $alg + 1` - continue;; - 3) size="-b 512";; -- 5) size="-b 512";; -- 6) size="-b 512";; -+ 5) size="-b 1024";; -+ 6) size="-b 1024";; - 7) size="-b 512";; - 8) size="-b 512";; - 10) size="-b 1024";; -diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c -index 5e473ab..b08692e 100644 ---- a/bin/tests/system/feature-test.c -+++ b/bin/tests/system/feature-test.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - - #ifdef WIN32 -@@ -47,6 +48,7 @@ usage() { - fprintf(stderr, "\t--have-geoip\n"); - fprintf(stderr, "\t--have-libxml2\n"); - fprintf(stderr, "\t--ipv6only=no\n"); -+ fprintf(stderr, "\t--md5\n"); - fprintf(stderr, "\t--rpz-log-qtype-qclass\n"); - fprintf(stderr, "\t--rpz-nsdname\n"); - fprintf(stderr, "\t--rpz-nsip\n"); -@@ -194,6 +196,18 @@ main(int argc, char **argv) { - #endif - } - -+ if (strcmp(argv[1], "--md5") == 0) { -+#ifdef PK11_MD5_DISABLE -+ return (1); -+#else -+ if (isc_md5_available()) { -+ return (0); -+ } else { -+ return (1); -+ } -+#endif -+ } -+ - if (strcmp(argv[1], "--rpz-nsip") == 0) { - #ifdef ENABLE_RPZ_NSIP - return (0); -diff --git a/bin/tests/system/filter-aaaa/ns1/sign.sh b/bin/tests/system/filter-aaaa/ns1/sign.sh -index 479f98c..4d4a765 100755 ---- a/bin/tests/system/filter-aaaa/ns1/sign.sh -+++ b/bin/tests/system/filter-aaaa/ns1/sign.sh -@@ -21,8 +21,8 @@ infile=signed.db.in - zonefile=signed.db.signed - outfile=signed.db.signed - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -diff --git a/bin/tests/system/filter-aaaa/ns4/sign.sh b/bin/tests/system/filter-aaaa/ns4/sign.sh -index 479f98c..4d4a765 100755 ---- a/bin/tests/system/filter-aaaa/ns4/sign.sh -+++ b/bin/tests/system/filter-aaaa/ns4/sign.sh -@@ -21,8 +21,8 @@ infile=signed.db.in - zonefile=signed.db.signed - outfile=signed.db.signed - --keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` --keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 768 -n zone $zone 2> /dev/null` -+keyname1=`$KEYGEN -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` -+keyname2=`$KEYGEN -f KSK -r $RANDFILE -a DSA -b 1024 -n zone $zone 2> /dev/null` - - cat $infile $keyname1.key $keyname2.key >$zonefile - -diff --git a/bin/tests/system/notify/ns5/named.conf.in b/bin/tests/system/notify/ns5/named.conf.in -index 157ef16..b802288 100644 ---- a/bin/tests/system/notify/ns5/named.conf.in -+++ b/bin/tests/system/notify/ns5/named.conf.in -@@ -10,17 +10,17 @@ - */ - - key "a" { -- algorithm "hmac-md5"; -+ algorithm "hmac-sha256"; - secret "aaaaaaaaaaaaaaaaaaaa"; - }; - - key "b" { -- algorithm "hmac-md5"; -+ algorithm "hmac-sha256"; - secret "bbbbbbbbbbbbbbbbbbbb"; - }; - - key "c" { -- algorithm "hmac-md5"; -+ algorithm "hmac-sha256"; - secret "cccccccccccccccccccc"; - }; - -diff --git a/bin/tests/system/notify/tests.sh b/bin/tests/system/notify/tests.sh -index f9fd3f5..916af75 100644 ---- a/bin/tests/system/notify/tests.sh -+++ b/bin/tests/system/notify/tests.sh -@@ -212,16 +212,16 @@ ret=0 - $NSUPDATE << EOF - server 10.53.0.5 ${PORT} - zone x21 --key a aaaaaaaaaaaaaaaaaaaa -+key hmac-sha256:a aaaaaaaaaaaaaaaaaaaa - update add added.x21 0 in txt "test string" - send - EOF - - for i in 1 2 3 4 5 6 7 8 9 - do -- $DIG $DIGOPTS added.x21. -y b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \ -+ $DIG $DIGOPTS added.x21. -y hmac-sha256:b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \ - txt > dig.out.b.ns5.test$n || ret=1 -- $DIG $DIGOPTS added.x21. -y c:cccccccccccccccccccc @10.53.0.5 \ -+ $DIG $DIGOPTS added.x21. -y hmac-sha256:c:cccccccccccccccccccc @10.53.0.5 \ - txt > dig.out.c.ns5.test$n || ret=1 - grep "test string" dig.out.b.ns5.test$n > /dev/null && - grep "test string" dig.out.c.ns5.test$n > /dev/null && -diff --git a/bin/tests/system/nsupdate/ns1/named.conf.in b/bin/tests/system/nsupdate/ns1/named.conf.in -index b0ded3a..cb80269 100644 ---- a/bin/tests/system/nsupdate/ns1/named.conf.in -+++ b/bin/tests/system/nsupdate/ns1/named.conf.in -@@ -32,7 +32,7 @@ controls { - }; - - key altkey { -- algorithm hmac-md5; -+ algorithm hmac-sha512; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/nsupdate/ns2/named.conf.in b/bin/tests/system/nsupdate/ns2/named.conf.in -index e6e2382..b0a94e0 100644 ---- a/bin/tests/system/nsupdate/ns2/named.conf.in -+++ b/bin/tests/system/nsupdate/ns2/named.conf.in -@@ -33,7 +33,7 @@ controls { - }; - - key altkey { -- algorithm hmac-md5; -+ algorithm hmac-sha512; - secret "1234abcd8765"; - }; - -diff --git a/bin/tests/system/nsupdate/setup.sh b/bin/tests/system/nsupdate/setup.sh -index 2b3b154..8240c42 100644 ---- a/bin/tests/system/nsupdate/setup.sh -+++ b/bin/tests/system/nsupdate/setup.sh -@@ -68,7 +68,12 @@ EOF - - $DDNSCONFGEN -q -r $RANDFILE -z example.nil > ns1/ddns.key - --$DDNSCONFGEN -q -r $RANDFILE -a hmac-md5 -k md5-key -z keytests.nil > ns1/md5.key -+if $FEATURETEST --md5; then -+ $DDNSCONFGEN -q -r $RANDFILE -a hmac-md5 -k md5-key -z keytests.nil > ns1/md5.key -+else -+ echo -n > ns1/md5.key -+fi -+ - $DDNSCONFGEN -q -r $RANDFILE -a hmac-sha1 -k sha1-key -z keytests.nil > ns1/sha1.key - $DDNSCONFGEN -q -r $RANDFILE -a hmac-sha224 -k sha224-key -z keytests.nil > ns1/sha224.key - $DDNSCONFGEN -q -r $RANDFILE -a hmac-sha256 -k sha256-key -z keytests.nil > ns1/sha256.key -diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh -index 60cf7ee..f8994ff 100755 ---- a/bin/tests/system/nsupdate/tests.sh -+++ b/bin/tests/system/nsupdate/tests.sh -@@ -804,7 +804,14 @@ fi - n=`expr $n + 1` - ret=0 - echo_i "check TSIG key algorithms ($n)" --for alg in md5 sha1 sha224 sha256 sha384 sha512; do -+if $FEATURETEST --md5 -+then -+ ALGS="md5 sha1 sha224 sha256 sha384 sha512" -+else -+ ALGS="sha1 sha224 sha256 sha384 sha512" -+ echo_i "skipping disabled md5 algorithm" -+fi -+for alg in $ALGS; do - $NSUPDATE -k ns1/${alg}.key < /dev/null || ret=1 - server 10.53.0.1 ${PORT} - update add ${alg}.keytests.nil. 600 A 10.10.10.3 -@@ -812,7 +819,7 @@ send - END - done - sleep 2 --for alg in md5 sha1 sha224 sha256 sha384 sha512; do -+for alg in $ALGS; do - $DIG $DIGOPTS +short @10.53.0.1 ${alg}.keytests.nil | grep 10.10.10.3 > /dev/null 2>&1 || ret=1 - done - if [ $ret -ne 0 ]; then -diff --git a/bin/tests/system/rndc/setup.sh b/bin/tests/system/rndc/setup.sh -index 2eb2cd5..36f5114 100644 ---- a/bin/tests/system/rndc/setup.sh -+++ b/bin/tests/system/rndc/setup.sh -@@ -35,7 +35,7 @@ make_key () { - sed 's/allow { 10.53.0.4/allow { any/' >> ns4/named.conf - } - --make_key 1 ${EXTRAPORT1} hmac-md5 -+$FEATURETEST --md5 && make_key 1 ${EXTRAPORT1} hmac-md5 - make_key 2 ${EXTRAPORT2} hmac-sha1 - make_key 3 ${EXTRAPORT3} hmac-sha224 - make_key 4 ${EXTRAPORT4} hmac-sha256 -diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh -index 4e25e51..cb8934c 100644 ---- a/bin/tests/system/rndc/tests.sh -+++ b/bin/tests/system/rndc/tests.sh -@@ -348,15 +348,20 @@ if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - - n=`expr $n + 1` --echo_i "testing rndc with hmac-md5 ($n)" --ret=0 --$RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key1.conf status > /dev/null 2>&1 || ret=1 --for i in 2 3 4 5 6 --do -- $RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1 --done --if [ $ret != 0 ]; then echo_i "failed"; fi --status=`expr $status + $ret` -+if $FEATURETEST --md5 -+then -+ echo_i "testing rndc with hmac-md5 ($n)" -+ ret=0 -+ $RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key1.conf status > /dev/null 2>&1 || ret=1 -+ for i in 2 3 4 5 6 -+ do -+ $RNDC -s 10.53.0.4 -p ${EXTRAPORT1} -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1 -+ done -+ if [ $ret != 0 ]; then echo_i "failed"; fi -+ status=`expr $status + $ret` -+else -+ echo_i "skipping rndc with hmac-md5 ($n)" -+fi - - n=`expr $n + 1` - echo_i "testing rndc with hmac-sha1 ($n)" -diff --git a/bin/tests/system/tsig/ns1/named.conf.in b/bin/tests/system/tsig/ns1/named.conf.in -index 4905ffd..958d9fb 100644 ---- a/bin/tests/system/tsig/ns1/named.conf.in -+++ b/bin/tests/system/tsig/ns1/named.conf.in -@@ -21,10 +21,7 @@ options { - notify no; - }; - --key "md5" { -- secret "97rnFx24Tfna4mHPfgnerA=="; -- algorithm hmac-md5; --}; -+# md5 key appended by setup.sh at the end - - key "sha1" { - secret "FrSt77yPTFx6hTs4i2tKLB9LmE0="; -@@ -51,10 +48,7 @@ key "sha512" { - algorithm hmac-sha512; - }; - --key "md5-trunc" { -- secret "97rnFx24Tfna4mHPfgnerA=="; -- algorithm hmac-md5-80; --}; -+# md5-trunc key appended by setup.sh at the end - - key "sha1-trunc" { - secret "FrSt77yPTFx6hTs4i2tKLB9LmE0="; -diff --git a/bin/tests/system/tsig/ns1/rndc5.conf.in b/bin/tests/system/tsig/ns1/rndc5.conf.in -new file mode 100644 -index 0000000..0682194 ---- /dev/null -+++ b/bin/tests/system/tsig/ns1/rndc5.conf.in -@@ -0,0 +1,10 @@ -+# Conditionally included when support for MD5 is available -+key "md5" { -+ secret "97rnFx24Tfna4mHPfgnerA=="; -+ algorithm hmac-md5; -+}; -+ -+key "md5-trunc" { -+ secret "97rnFx24Tfna4mHPfgnerA=="; -+ algorithm hmac-md5-80; -+}; -diff --git a/bin/tests/system/tsig/setup.sh b/bin/tests/system/tsig/setup.sh -index f42aa79..bfcf4a6 100644 ---- a/bin/tests/system/tsig/setup.sh -+++ b/bin/tests/system/tsig/setup.sh -@@ -15,3 +15,8 @@ SYSTEMTESTTOP=.. - copy_setports ns1/named.conf.in ns1/named.conf - - test -r $RANDFILE || $GENRANDOM $RANDOMSIZE $RANDFILE -+ -+if $FEATURETEST --md5 -+then -+ cat ns1/rndc5.conf.in >> ns1/named.conf -+fi -diff --git a/bin/tests/system/tsig/tests.sh b/bin/tests/system/tsig/tests.sh -index e0c2903..327fa50 100644 ---- a/bin/tests/system/tsig/tests.sh -+++ b/bin/tests/system/tsig/tests.sh -@@ -26,20 +26,25 @@ sha512="jI/Pa4qRu96t76Pns5Z/Ndxbn3QCkwcxLOgt9vgvnJw5wqTRvNyk3FtD6yIMd1dWVlqZ+Y4f - - status=0 - --echo_i "fetching using hmac-md5 (old form)" --ret=0 --$DIG $DIGOPTS example.nil. -y "md5:$md5" @10.53.0.1 soa > dig.out.md5.old || ret=1 --grep -i "md5.*TSIG.*NOERROR" dig.out.md5.old > /dev/null || ret=1 --if [ $ret -eq 1 ] ; then -- echo_i "failed"; status=1 --fi -+if $FEATURETEST --md5 -+then -+ echo_i "fetching using hmac-md5 (old form)" -+ ret=0 -+ $DIG $DIGOPTS example.nil. -y "md5:$md5" @10.53.0.1 soa > dig.out.md5.old || ret=1 -+ grep -i "md5.*TSIG.*NOERROR" dig.out.md5.old > /dev/null || ret=1 -+ if [ $ret -eq 1 ] ; then -+ echo_i "failed"; status=1 -+ fi - --echo_i "fetching using hmac-md5 (new form)" --ret=0 --$DIG $DIGOPTS example.nil. -y "hmac-md5:md5:$md5" @10.53.0.1 soa > dig.out.md5.new || ret=1 --grep -i "md5.*TSIG.*NOERROR" dig.out.md5.new > /dev/null || ret=1 --if [ $ret -eq 1 ] ; then -- echo_i "failed"; status=1 -+ echo_i "fetching using hmac-md5 (new form)" -+ ret=0 -+ $DIG $DIGOPTS example.nil. -y "hmac-md5:md5:$md5" @10.53.0.1 soa > dig.out.md5.new || ret=1 -+ grep -i "md5.*TSIG.*NOERROR" dig.out.md5.new > /dev/null || ret=1 -+ if [ $ret -eq 1 ] ; then -+ echo_i "failed"; status=1 -+ fi -+else -+ echo_i "skipping using hmac-md5" - fi - - echo_i "fetching using hmac-sha1" -@@ -87,12 +92,17 @@ fi - # Truncated TSIG - # - # --echo_i "fetching using hmac-md5 (trunc)" --ret=0 --$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5-trunc:$md5" @10.53.0.1 soa > dig.out.md5.trunc || ret=1 --grep -i "md5-trunc.*TSIG.*NOERROR" dig.out.md5.trunc > /dev/null || ret=1 --if [ $ret -eq 1 ] ; then -- echo_i "failed"; status=1 -+if $FEATURETEST --md5 -+then -+ echo_i "fetching using hmac-md5 (trunc)" -+ ret=0 -+ $DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5-trunc:$md5" @10.53.0.1 soa > dig.out.md5.trunc || ret=1 -+ grep -i "md5-trunc.*TSIG.*NOERROR" dig.out.md5.trunc > /dev/null || ret=1 -+ if [ $ret -eq 1 ] ; then -+ echo_i "failed"; status=1 -+ fi -+else -+ echo_i "skipping using hmac-md5 (trunc)" - fi - - echo_i "fetching using hmac-sha1 (trunc)" -@@ -141,12 +151,17 @@ fi - # Check for bad truncation. - # - # --echo_i "fetching using hmac-md5-80 (BADTRUNC)" --ret=0 --$DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5:$md5" @10.53.0.1 soa > dig.out.md5-80 || ret=1 --grep -i "md5.*TSIG.*BADTRUNC" dig.out.md5-80 > /dev/null || ret=1 --if [ $ret -eq 1 ] ; then -- echo_i "failed"; status=1 -+if $FEATURETEST --md5 -+then -+ echo_i "fetching using hmac-md5-80 (BADTRUNC)" -+ ret=0 -+ $DIG $DIGOPTS example.nil. -y "hmac-md5-80:md5:$md5" @10.53.0.1 soa > dig.out.md5-80 || ret=1 -+ grep -i "md5.*TSIG.*BADTRUNC" dig.out.md5-80 > /dev/null || ret=1 -+ if [ $ret -eq 1 ] ; then -+ echo_i "failed"; status=1 -+ fi -+else -+ echo_i "skipping using hmac-md5-80 (BADTRUNC)" - fi - - echo_i "fetching using hmac-sha1-80 (BADTRUNC)" -diff --git a/bin/tests/system/tsiggss/setup.sh b/bin/tests/system/tsiggss/setup.sh -index f04c907..09da5f9 100644 ---- a/bin/tests/system/tsiggss/setup.sh -+++ b/bin/tests/system/tsiggss/setup.sh -@@ -16,5 +16,5 @@ test -r $RANDFILE || $GENRANDOM $RANDOMSIZE $RANDFILE - - copy_setports ns1/named.conf.in ns1/named.conf - --key=`$KEYGEN -Cq -K ns1 -a DSA -b 512 -r $RANDFILE -n HOST -T KEY key.example.nil.` -+key=`$KEYGEN -Cq -K ns1 -a DSA -b 1024 -r $RANDFILE -n HOST -T KEY key.example.nil.` - cat ns1/example.nil.db.in ns1/${key}.key > ns1/example.nil.db -diff --git a/bin/tests/system/upforwd/ns1/named.conf.in b/bin/tests/system/upforwd/ns1/named.conf.in -index 4ddd7a4..238f52a 100644 ---- a/bin/tests/system/upforwd/ns1/named.conf.in -+++ b/bin/tests/system/upforwd/ns1/named.conf.in -@@ -10,7 +10,7 @@ - */ - - key "update.example." { -- algorithm "hmac-md5"; -+ algorithm "hmac-sha256"; - secret "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K"; - }; - -diff --git a/bin/tests/system/upforwd/tests.sh b/bin/tests/system/upforwd/tests.sh -index 1cf8d3b..f4c3216 100644 ---- a/bin/tests/system/upforwd/tests.sh -+++ b/bin/tests/system/upforwd/tests.sh -@@ -68,7 +68,7 @@ if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi - - echo_i "updating zone (signed) ($n)" - ret=0 --$NSUPDATE -y update.example:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K -- - < -Date: Tue, 25 Sep 2018 18:08:46 +0200 -Subject: [PATCH] Disable IDN from environment as documented - -Manual page of host contained instructions to disable IDN processing -when it was built with libidn2. When refactoring IDN support however, -support for disabling IDN in host and nslookup was lost. Use also -environment variable and document it for nslookup, host and dig. - -Support variable CHARSET=ASCII to disable IDN, supported in downstream -RH patch since RHEL 5. ---- - bin/dig/dig.docbook | 4 +++- - bin/dig/dighost.c | 5 +++++ - bin/dig/host.docbook | 2 +- - bin/dig/nslookup.docbook | 15 +++++++++++++++ - 4 files changed, 24 insertions(+), 2 deletions(-) - -diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook -index 5d19301..933af79 100644 ---- a/bin/dig/dig.docbook -+++ b/bin/dig/dig.docbook -@@ -1312,7 +1312,9 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr - reply from the server. - If you'd like to turn off the IDN support for some reason, use - parameters +noidnin and -- +noidnout. -+ +noidnout or define -+ the IDN_DISABLE environment variable. -+ - - - -diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c -index 5eabc1f..73aaab8 100644 ---- a/bin/dig/dighost.c -+++ b/bin/dig/dighost.c -@@ -826,6 +826,11 @@ make_empty_lookup(void) { - looknew->badcookie = true; - #ifdef WITH_IDN_SUPPORT - looknew->idnin = isatty(1)?(getenv("IDN_DISABLE") == NULL):false; -+ if (looknew->idnin) { -+ const char *charset = getenv("CHARSET"); -+ if (charset && !strcmp(charset, "ASCII")) -+ looknew->idnin = false; -+ } - #else - looknew->idnin = false; - #endif -diff --git a/bin/dig/host.docbook b/bin/dig/host.docbook -index da0f8fb..9689b5a 100644 ---- a/bin/dig/host.docbook -+++ b/bin/dig/host.docbook -@@ -379,7 +379,7 @@ - host appropriately converts character encoding of - domain name before sending a request to DNS server or displaying a - reply from the server. -- If you'd like to turn off the IDN support for some reason, defines -+ If you'd like to turn off the IDN support for some reason, define - the IDN_DISABLE environment variable. - The IDN support is disabled if the variable is set when - host runs. -diff --git a/bin/dig/nslookup.docbook b/bin/dig/nslookup.docbook -index d46fc2d..6d7d181 100644 ---- a/bin/dig/nslookup.docbook -+++ b/bin/dig/nslookup.docbook -@@ -495,6 +495,21 @@ nslookup -query=hinfo -timeout=10 - - - -+ IDN SUPPORT -+ -+ -+ If nslookup has been built with IDN (internationalized -+ domain name) support, it can accept and display non-ASCII domain names. -+ nslookup appropriately converts character encoding of -+ domain name before sending a request to DNS server or displaying a -+ reply from the server. -+ If you'd like to turn off the IDN support for some reason, define -+ the IDN_DISABLE environment variable. -+ The IDN support is disabled if the variable is set when -+ nslookup runs. -+ -+ -+ - FILES - - /etc/resolv.conf --- -2.20.1 - diff --git a/SOURCES/bind-9.11-json-c.patch b/SOURCES/bind-9.11-json-c.patch deleted file mode 100644 index 95e5597..0000000 --- a/SOURCES/bind-9.11-json-c.patch +++ /dev/null @@ -1,50 +0,0 @@ -From cb6d2019766a6c8c5516fd8859cedf0052f03293 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Thu, 25 Jul 2019 11:37:57 +0200 -Subject: [PATCH] Skip support of jsoncpp - -Bind cannot be compiled when jsoncpp-devel is installed. Remove support -for jsoncpp, use only json-c-devel. Bind 9.15 has already support for ---with-json-c, do not yet introduce it. ---- - configure.ac | 17 ++--------------- - 1 file changed, 2 insertions(+), 15 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 6d05337..5ce83b5 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -2594,15 +2594,7 @@ case "$use_libjson" in - auto|yes) - for d in /usr /usr/local /opt/local - do -- if test -f "${d}/include/json/json.h" -- then -- if test ${d} != /usr -- then -- libjson_cflags="-I ${d}/include" -- LIBS="$LIBS -L${d}/lib" -- fi -- have_libjson="yes" -- elif test -f "${d}/include/json-c/json.h" -+ if test -f "${d}/include/json-c/json.h" - then - if test ${d} != /usr - then -@@ -2615,12 +2607,7 @@ case "$use_libjson" in - done - ;; - *) -- if test -f "${use_libjson}/include/json/json.h" -- then -- libjson_cflags="-I${use_libjson}/include" -- LIBS="$LIBS -L${use_libjson}/lib" -- have_libjson="yes" -- elif test -f "${use_libjson}/include/json-c/json.h" -+ if test -f "${use_libjson}/include/json-c/json.h" - then - libjson_cflags="-I${use_libjson}/include" - LIBS="$LIBS -L${use_libjson}/lib" --- -2.20.1 - diff --git a/SOURCES/bind-9.11-kyua-pkcs11.patch b/SOURCES/bind-9.11-kyua-pkcs11.patch deleted file mode 100644 index 9cfa618..0000000 --- a/SOURCES/bind-9.11-kyua-pkcs11.patch +++ /dev/null @@ -1,192 +0,0 @@ -From a9b5785f174cf7fd74891fa64f6b69b9a9b55466 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Tue, 2 Jan 2018 18:13:07 +0100 -Subject: [PATCH] Fix pkcs11 variants atf tests - -Add dns-pkcs11 tests Makefile to configure - -Add pkcs11 Kyuafile, fix dh_test to pass in pkcs11 mode ---- - configure.ac | 1 + - lib/Kyuafile | 2 ++ - lib/dns-pkcs11/tests/Makefile.in | 10 +++++----- - lib/dns-pkcs11/tests/dh_test.c | 3 ++- - lib/isc-pkcs11/tests/Makefile.in | 6 +++--- - lib/isc-pkcs11/tests/hash_test.c | 32 +++++++++++++++++++++++++------- - 6 files changed, 38 insertions(+), 16 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 62ecf56..0940a7d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -5476,6 +5476,7 @@ AC_CONFIG_FILES([ - lib/dns-pkcs11/include/Makefile - lib/dns-pkcs11/include/dns/Makefile - lib/dns-pkcs11/include/dst/Makefile -+ lib/dns-pkcs11/tests/Makefile - lib/irs/Makefile - lib/irs/include/Makefile - lib/irs/include/irs/Makefile -diff --git a/lib/Kyuafile b/lib/Kyuafile -index 7c8bab0..eec9564 100644 ---- a/lib/Kyuafile -+++ b/lib/Kyuafile -@@ -2,8 +2,10 @@ syntax(2) - test_suite('bind9') - - include('dns/Kyuafile') -+include('dns-pkcs11/Kyuafile') - include('irs/Kyuafile') - include('isc/Kyuafile') -+include('isc-pkcs11/Kyuafile') - include('isccc/Kyuafile') - include('isccfg/Kyuafile') - include('lwres/Kyuafile') -diff --git a/lib/dns-pkcs11/tests/Makefile.in b/lib/dns-pkcs11/tests/Makefile.in -index 22a06a8..5df5b15 100644 ---- a/lib/dns-pkcs11/tests/Makefile.in -+++ b/lib/dns-pkcs11/tests/Makefile.in -@@ -17,12 +17,12 @@ VERSION=@BIND9_VERSION@ - - CINCLUDES = -I. -Iinclude ${DNS_INCLUDES} ${ISC_INCLUDES} \ - @DST_OPENSSL_INC@ ${MAXMINDDB_CFLAGS} --CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/dns/tests/\"" -+CDEFINES = @CRYPTO_PK11@ -DTESTS="\"${top_builddir}/lib/dns-pkcs11/tests/\"" - --ISCLIBS = ../../isc/libisc.@A@ --ISCDEPLIBS = ../../isc/libisc.@A@ --DNSLIBS = ../libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ --DNSDEPLIBS = ../libdns.@A@ -+ISCLIBS = ../../isc-pkcs11/libisc-pkcs11.@A@ -+ISCDEPLIBS = ../../isc-pkcs11/libisc-pkcs11.@A@ -+DNSLIBS = ../libdns-pkcs11.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ -+DNSDEPLIBS = ../libdns-pkcs11.@A@ - - LIBS = @LIBS@ @CMOCKA_LIBS@ - CFLAGS = @CFLAGS@ @CMOCKA_CFLAGS@ -diff --git a/lib/dns-pkcs11/tests/dh_test.c b/lib/dns-pkcs11/tests/dh_test.c -index a5bf46c..9ff2b76 100644 ---- a/lib/dns-pkcs11/tests/dh_test.c -+++ b/lib/dns-pkcs11/tests/dh_test.c -@@ -88,7 +88,8 @@ dh_computesecret(void **state) { - result = dst_key_computesecret(key, key, &buf); - assert_int_equal(result, DST_R_NOTPRIVATEKEY); - result = key->func->computesecret(key, key, &buf); -- assert_int_equal(result, DST_R_COMPUTESECRETFAILURE); -+ /* PKCS11 variant gives different result, accept both */ -+ assert_true(result == DST_R_COMPUTESECRETFAILURE || result == DST_R_INVALIDPRIVATEKEY); - - dst_key_free(&key); - } -diff --git a/lib/isc-pkcs11/tests/Makefile.in b/lib/isc-pkcs11/tests/Makefile.in -index 36d2207..00dfbc9 100644 ---- a/lib/isc-pkcs11/tests/Makefile.in -+++ b/lib/isc-pkcs11/tests/Makefile.in -@@ -16,10 +16,10 @@ VERSION=@BIND9_VERSION@ - @BIND9_MAKE_INCLUDES@ - - CINCLUDES = -I. -Iinclude ${ISC_INCLUDES} @ISC_OPENSSL_INC@ --CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/isc/tests/\"" -+CDEFINES = @CRYPTO_PK11@ -DTESTS="\"${top_builddir}/lib/isc-pkcs11/tests/\"" - --ISCLIBS = ../libisc.@A@ @ISC_OPENSSL_LIBS@ --ISCDEPLIBS = ../libisc.@A@ -+ISCLIBS = ../libisc-pkcs11.@A@ @ISC_OPENSSL_LIBS@ -+ISCDEPLIBS = ../libisc-pkcs11.@A@ - - LIBS = @LIBS@ @CMOCKA_LIBS@ - CFLAGS = @CFLAGS@ @CMOCKA_CFLAGS@ -diff --git a/lib/isc-pkcs11/tests/hash_test.c b/lib/isc-pkcs11/tests/hash_test.c -index 4fafc38..5eb2be2 100644 ---- a/lib/isc-pkcs11/tests/hash_test.c -+++ b/lib/isc-pkcs11/tests/hash_test.c -@@ -84,7 +84,7 @@ typedef struct hash_testcase { - - typedef struct hash_test_key { - const char *key; -- const int len; -+ const unsigned len; - } hash_test_key_t; - - /* non-hmac tests */ -@@ -955,8 +955,11 @@ isc_hmacsha1_test(void **state) { - hash_test_key_t *test_key = test_keys; - - while (testcase->input != NULL && testcase->result != NULL) { -+ int len = ISC_MAX(test_key->len, ISC_SHA1_DIGESTLENGTH); -+ -+ memset(buffer, 0, ISC_SHA1_DIGESTLENGTH); - memmove(buffer, test_key->key, test_key->len); -- isc_hmacsha1_init(&hmacsha1, buffer, test_key->len); -+ isc_hmacsha1_init(&hmacsha1, buffer, len); - isc_hmacsha1_update(&hmacsha1, - (const uint8_t *) testcase->input, - testcase->input_len); -@@ -1115,8 +1118,11 @@ isc_hmacsha224_test(void **state) { - hash_test_key_t *test_key = test_keys; - - while (testcase->input != NULL && testcase->result != NULL) { -+ int len = ISC_MAX(test_key->len, ISC_SHA224_DIGESTLENGTH); -+ -+ memset(buffer, 0, ISC_SHA224_DIGESTLENGTH); - memmove(buffer, test_key->key, test_key->len); -- isc_hmacsha224_init(&hmacsha224, buffer, test_key->len); -+ isc_hmacsha224_init(&hmacsha224, buffer, len); - isc_hmacsha224_update(&hmacsha224, - (const uint8_t *) testcase->input, - testcase->input_len); -@@ -1276,8 +1282,11 @@ isc_hmacsha256_test(void **state) { - hash_test_key_t *test_key = test_keys; - - while (testcase->input != NULL && testcase->result != NULL) { -+ int len = ISC_MAX(test_key->len, ISC_SHA256_DIGESTLENGTH); -+ -+ memset(buffer, 0, ISC_SHA256_DIGESTLENGTH); - memmove(buffer, test_key->key, test_key->len); -- isc_hmacsha256_init(&hmacsha256, buffer, test_key->len); -+ isc_hmacsha256_init(&hmacsha256, buffer, len); - isc_hmacsha256_update(&hmacsha256, - (const uint8_t *) testcase->input, - testcase->input_len); -@@ -1443,8 +1452,11 @@ isc_hmacsha384_test(void **state) { - hash_test_key_t *test_key = test_keys; - - while (testcase->input != NULL && testcase->result != NULL) { -+ int len = ISC_MAX(test_key->len, ISC_SHA384_DIGESTLENGTH); -+ -+ memset(buffer, 0, ISC_SHA384_DIGESTLENGTH); - memmove(buffer, test_key->key, test_key->len); -- isc_hmacsha384_init(&hmacsha384, buffer, test_key->len); -+ isc_hmacsha384_init(&hmacsha384, buffer, len); - isc_hmacsha384_update(&hmacsha384, - (const uint8_t *) testcase->input, - testcase->input_len); -@@ -1610,8 +1622,11 @@ isc_hmacsha512_test(void **state) { - hash_test_key_t *test_key = test_keys; - - while (testcase->input != NULL && testcase->result != NULL) { -+ int len = ISC_MAX(test_key->len, ISC_SHA512_DIGESTLENGTH); -+ -+ memset(buffer, 0, ISC_SHA512_DIGESTLENGTH); - memmove(buffer, test_key->key, test_key->len); -- isc_hmacsha512_init(&hmacsha512, buffer, test_key->len); -+ isc_hmacsha512_init(&hmacsha512, buffer, len); - isc_hmacsha512_update(&hmacsha512, - (const uint8_t *) testcase->input, - testcase->input_len); -@@ -1754,8 +1769,11 @@ isc_hmacmd5_test(void **state) { - hash_test_key_t *test_key = test_keys; - - while (testcase->input != NULL && testcase->result != NULL) { -+ int len = ISC_MAX(test_key->len, ISC_MD5_DIGESTLENGTH); -+ -+ memset(buffer, 0, ISC_MD5_DIGESTLENGTH); - memmove(buffer, test_key->key, test_key->len); -- isc_hmacmd5_init(&hmacmd5, buffer, test_key->len); -+ isc_hmacmd5_init(&hmacmd5, buffer, len); - isc_hmacmd5_update(&hmacmd5, - (const uint8_t *) testcase->input, - testcase->input_len); --- -2.21.1 - diff --git a/SOURCES/bind-9.11-oot-manual.patch b/SOURCES/bind-9.11-oot-manual.patch deleted file mode 100644 index 84e9d25..0000000 --- a/SOURCES/bind-9.11-oot-manual.patch +++ /dev/null @@ -1,256 +0,0 @@ -From 8ca95f47231822df2b9c171a4da1e93ca5b748eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Wed, 25 Jul 2018 12:24:16 +0200 -Subject: [PATCH] Use make automatic variables to install updated manuals - -Make will choose modified manual from build directory or original from source -directory automagically. Take advantage of install tool feature. -Install all files in single command instead of iterating on each of them. ---- - bin/check/Makefile.in | 8 +++++--- - bin/confgen/Makefile.in | 9 +++++---- - bin/delv/Makefile.in | 6 ++++-- - bin/dig/Makefile.in | 8 ++++---- - bin/dnssec/Makefile.in | 6 ++++-- - bin/named/Makefile.in | 13 +++++++++---- - bin/pkcs11/Makefile.in | 9 ++++----- - bin/python/Makefile.in | 8 ++++---- - bin/tools/Makefile.in | 25 +++++++++++++++---------- - 9 files changed, 54 insertions(+), 38 deletions(-) - -diff --git a/bin/check/Makefile.in b/bin/check/Makefile.in -index c124e80..1174f8d 100644 ---- a/bin/check/Makefile.in -+++ b/bin/check/Makefile.in -@@ -83,12 +83,14 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - --install:: named-checkconf@EXEEXT@ named-checkzone@EXEEXT@ installdirs -+install-man8: ${MANPAGES} -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ (cd ${DESTDIR}${mandir}/man8; rm -f named-compilezone.8; ${LINK_PROGRAM} named-checkzone.8 named-compilezone.8) -+ -+install:: named-checkconf@EXEEXT@ named-checkzone@EXEEXT@ installdirs install-man8 - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-checkconf@EXEEXT@ ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-checkzone@EXEEXT@ ${DESTDIR}${sbindir} - (cd ${DESTDIR}${sbindir}; rm -f named-compilezone@EXEEXT@; ${LINK_PROGRAM} named-checkzone@EXEEXT@ named-compilezone@EXEEXT@) -- for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8 || exit 1; done -- (cd ${DESTDIR}${mandir}/man8; rm -f named-compilezone.8; ${LINK_PROGRAM} named-checkzone.8 named-compilezone.8) - - uninstall:: - rm -f ${DESTDIR}${mandir}/man8/named-compilezone.8 -diff --git a/bin/confgen/Makefile.in b/bin/confgen/Makefile.in -index 87f13dd..7865c0c 100644 ---- a/bin/confgen/Makefile.in -+++ b/bin/confgen/Makefile.in -@@ -95,13 +95,14 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - --install:: rndc-confgen@EXEEXT@ ddns-confgen@EXEEXT@ installdirs -+install-man8: rndc-confgen.8 ddns-confgen.8 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ (cd ${DESTDIR}${mandir}/man8; rm -f tsig-keygen.8; ${LINK_PROGRAM} ddns-confgen.8 tsig-keygen.8) -+ -+install:: rndc-confgen@EXEEXT@ ddns-confgen@EXEEXT@ installdirs install-man8 - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} rndc-confgen@EXEEXT@ ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} ddns-confgen@EXEEXT@ ${DESTDIR}${sbindir} -- ${INSTALL_DATA} ${srcdir}/rndc-confgen.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/ddns-confgen.8 ${DESTDIR}${mandir}/man8 - (cd ${DESTDIR}${sbindir}; rm -f tsig-keygen@EXEEXT@; ${LINK_PROGRAM} ddns-confgen@EXEEXT@ tsig-keygen@EXEEXT@) -- (cd ${DESTDIR}${mandir}/man8; rm -f tsig-keygen.8; ${LINK_PROGRAM} ddns-confgen.8 tsig-keygen.8) - - uninstall:: - rm -f ${DESTDIR}${mandir}/man8/tsig-keygen.8 -diff --git a/bin/delv/Makefile.in b/bin/delv/Makefile.in -index e2d2802..19361a8 100644 ---- a/bin/delv/Makefile.in -+++ b/bin/delv/Makefile.in -@@ -63,10 +63,12 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${bindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1 - --install:: delv@EXEEXT@ installdirs -+install-man1: delv.1 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man1 -+ -+install:: delv@EXEEXT@ installdirs install-man1 - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} \ - delv@EXEEXT@ ${DESTDIR}${bindir} -- ${INSTALL_DATA} ${srcdir}/delv.1 ${DESTDIR}${mandir}/man1 - - uninstall:: - rm -f ${DESTDIR}${mandir}/man1/delv.1 -diff --git a/bin/dig/Makefile.in b/bin/dig/Makefile.in -index a9830a9..d7ac0b6 100644 ---- a/bin/dig/Makefile.in -+++ b/bin/dig/Makefile.in -@@ -91,16 +91,16 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${bindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1 - --install:: dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@ installdirs -+install-man1: ${MANPAGES} -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man1 -+ -+install:: dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@ installdirs install-man1 - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} \ - dig@EXEEXT@ ${DESTDIR}${bindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} \ - host@EXEEXT@ ${DESTDIR}${bindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} \ - nslookup@EXEEXT@ ${DESTDIR}${bindir} -- for m in ${MANPAGES}; do \ -- ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man1 || exit 1; \ -- done - - uninstall:: - for m in ${MANPAGES}; do \ -diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in -index 2239ad1..ce0a177 100644 ---- a/bin/dnssec/Makefile.in -+++ b/bin/dnssec/Makefile.in -@@ -110,9 +110,11 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - --install:: ${TARGETS} installdirs -+install-man8: ${MANPAGES} -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ -+install:: ${TARGETS} installdirs install-man8 - for t in ${TARGETS}; do ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} $$t ${DESTDIR}${sbindir} || exit 1; done -- for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8 || exit 1; done - - uninstall:: - for m in ${MANPAGES}; do rm -f ${DESTDIR}${mandir}/man8/$$m || exit 1; done -diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in -index e1f85a9..d92bc9a 100644 ---- a/bin/named/Makefile.in -+++ b/bin/named/Makefile.in -@@ -176,12 +176,17 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man5 - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - --install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs -+install-man5: named.conf.5 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man5 -+ -+install-man8: named.8 lwresd.8 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ -+install-man: install-man5 install-man8 -+ -+install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs install-man - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named@EXEEXT@ ${DESTDIR}${sbindir} - (cd ${DESTDIR}${sbindir}; rm -f lwresd@EXEEXT@; @LN@ named@EXEEXT@ lwresd@EXEEXT@) -- ${INSTALL_DATA} ${srcdir}/named.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/lwresd.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/named.conf.5 ${DESTDIR}${mandir}/man5 - - uninstall:: - rm -f ${DESTDIR}${mandir}/man5/named.conf.5 -diff --git a/bin/pkcs11/Makefile.in b/bin/pkcs11/Makefile.in -index ae90616..a058c91 100644 ---- a/bin/pkcs11/Makefile.in -+++ b/bin/pkcs11/Makefile.in -@@ -71,7 +71,10 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - --install:: ${TARGETS} installdirs -+install-man8: ${MANPAGES} -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ -+install:: ${TARGETS} installdirs install-man8 - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} pkcs11-list@EXEEXT@ \ - ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} pkcs11-destroy@EXEEXT@ \ -@@ -80,10 +83,6 @@ install:: ${TARGETS} installdirs - ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} pkcs11-tokens@EXEEXT@ \ - ${DESTDIR}${sbindir} -- ${INSTALL_DATA} ${srcdir}/pkcs11-list.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/pkcs11-destroy.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/pkcs11-keygen.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/pkcs11-tokens.8 ${DESTDIR}${mandir}/man8 - - uninstall:: - rm -f ${DESTDIR}${mandir}/man8/pkcs11-tokens.8 -diff --git a/bin/python/Makefile.in b/bin/python/Makefile.in -index aa678d4..064c404 100644 ---- a/bin/python/Makefile.in -+++ b/bin/python/Makefile.in -@@ -47,13 +47,13 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - --install:: ${TARGETS} installdirs -+install-man8: ${MANPAGES} -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ -+install:: ${TARGETS} installdirs install-man8 - ${INSTALL_SCRIPT} dnssec-checkds ${DESTDIR}${sbindir} - ${INSTALL_SCRIPT} dnssec-coverage ${DESTDIR}${sbindir} - ${INSTALL_SCRIPT} dnssec-keymgr ${DESTDIR}${sbindir} -- ${INSTALL_DATA} ${srcdir}/dnssec-checkds.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/dnssec-coverage.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/dnssec-keymgr.8 ${DESTDIR}${mandir}/man8 - if test -n "${PYTHON}" ; then \ - if test -n "${DESTDIR}" ; then \ - ${PYTHON} ${srcdir}/setup.py install --root=${DESTDIR} --prefix=${prefix} @PYTHON_INSTALL_LIB@ ; \ -diff --git a/bin/tools/Makefile.in b/bin/tools/Makefile.in -index 7bf2af4..c395bc7 100644 ---- a/bin/tools/Makefile.in -+++ b/bin/tools/Makefile.in -@@ -119,17 +119,27 @@ installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1 - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 - --nzd: -+nzd-man: named-nzd2nzf.8 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ -+nzd: nzd-man - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-nzd2nzf@EXEEXT@ \ - ${DESTDIR}${sbindir} -- ${INSTALL_DATA} ${srcdir}/named-nzd2nzf.8 ${DESTDIR}${mandir}/man8 - --dnstap: -+dnstap-man: dnstap-read.1 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man1 -+ -+dnstap: dnstap-man - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} dnstap-read@EXEEXT@ \ - ${DESTDIR}${bindir} -- ${INSTALL_DATA} ${srcdir}/dnstap-read.1 ${DESTDIR}${mandir}/man1 - --install:: ${TARGETS} installdirs @DNSTAP@ @NZD_TOOLS@ -+install-man1: arpaname.1 named-rrchecker.1 mdig.1 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man1 -+ -+install-man8: named-journalprint.8 nsec3hash.8 -+ ${INSTALL_DATA} $^ ${DESTDIR}${mandir}/man8 -+ -+install:: ${TARGETS} installdirs @DNSTAP@ @NZD_TOOLS@ install-man1 install-man8 - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} arpaname@EXEEXT@ \ - ${DESTDIR}${bindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-journalprint@EXEEXT@ \ -@@ -144,13 +154,8 @@ install:: ${TARGETS} installdirs @DNSTAP@ @NZD_TOOLS@ - ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} mdig@EXEEXT@ \ - ${DESTDIR}${bindir} -- ${INSTALL_DATA} ${srcdir}/arpaname.1 ${DESTDIR}${mandir}/man1 - ${INSTALL_DATA} ${srcdir}/isc-hmac-fixup.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/named-journalprint.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/named-rrchecker.1 ${DESTDIR}${mandir}/man1 -- ${INSTALL_DATA} ${srcdir}/nsec3hash.8 ${DESTDIR}${mandir}/man8 - ${INSTALL_DATA} ${srcdir}/genrandom.8 ${DESTDIR}${mandir}/man8 -- ${INSTALL_DATA} ${srcdir}/mdig.1 ${DESTDIR}${mandir}/man1 - - uninstall:: - rm -f ${DESTDIR}${mandir}/man1/mdig.1 --- -2.14.4 - diff --git a/SOURCES/bind-9.11-pk11.patch b/SOURCES/bind-9.11-pk11.patch deleted file mode 100644 index d802314..0000000 --- a/SOURCES/bind-9.11-pk11.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/lib/dns/dst_internal.h b/lib/dns/dst_internal.h -index 640519a..fc40472 100644 ---- a/lib/dns/dst_internal.h -+++ b/lib/dns/dst_internal.h -@@ -59,6 +59,9 @@ - #include - #include - #endif -+#if PKCS11CRYPTO -+#include -+#endif - - ISC_LANG_BEGINDECLS - -diff --git a/lib/isc/include/pk11/internal.h b/lib/isc/include/pk11/internal.h -index aa8907a..603712a 100644 ---- a/lib/isc/include/pk11/internal.h -+++ b/lib/isc/include/pk11/internal.h -@@ -13,6 +13,8 @@ - #ifndef PK11_INTERNAL_H - #define PK11_INTERNAL_H 1 - -+#include -+ - /*! \file pk11/internal.h */ - - ISC_LANG_BEGINDECLS diff --git a/SOURCES/bind-9.11-rh1205168.patch b/SOURCES/bind-9.11-rh1205168.patch deleted file mode 100644 index 181cec9..0000000 --- a/SOURCES/bind-9.11-rh1205168.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 90416594843a56550e40b11561807786219ce1c4 Mon Sep 17 00:00:00 2001 -From: Evan Hunt -Date: Mon, 11 Sep 2017 15:01:36 -0700 -Subject: [PATCH] remap getaddrinfo() to irs_getgetaddrinfo() - -The libirs version of getaddrinfo() cannot be called from within BIND9. - -fix prototypes ---- - lib/irs/include/irs/netdb.h.in | 94 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 94 insertions(+) - -diff --git a/lib/irs/include/irs/netdb.h.in b/lib/irs/include/irs/netdb.h.in -index 23dcd37..f36113d 100644 ---- a/lib/irs/include/irs/netdb.h.in -+++ b/lib/irs/include/irs/netdb.h.in -@@ -150,6 +150,100 @@ struct addrinfo { - #define NI_DGRAM 0x00000010 - - /* -+ * Define to map into irs_ namespace. -+ */ -+ -+#define IRS_NAMESPACE -+ -+#ifdef IRS_NAMESPACE -+ -+/* -+ * Use our versions not the ones from the C library. -+ */ -+ -+#ifdef getnameinfo -+#undef getnameinfo -+#endif -+#define getnameinfo irs_getnameinfo -+ -+#ifdef getaddrinfo -+#undef getaddrinfo -+#endif -+#define getaddrinfo irs_getaddrinfo -+ -+#ifdef freeaddrinfo -+#undef freeaddrinfo -+#endif -+#define freeaddrinfo irs_freeaddrinfo -+ -+#ifdef gai_strerror -+#undef gai_strerror -+#endif -+#define gai_strerror irs_gai_strerror -+ -+#endif -+ -+extern int getaddrinfo (const char *name, -+ const char *service, -+ const struct addrinfo *req, -+ struct addrinfo **pai); -+extern int getnameinfo (const struct sockaddr *sa, -+ socklen_t salen, char *host, -+ socklen_t hostlen, char *serv, -+ socklen_t servlen, int flags); -+extern void freeaddrinfo (struct addrinfo *ai); -+extern const char *gai_strerror (int ecode); -+ -+/* -+ * Define to map into irs_ namespace. -+ */ -+ -+#define IRS_NAMESPACE -+ -+#ifdef IRS_NAMESPACE -+ -+/* -+ * Use our versions not the ones from the C library. -+ */ -+ -+#ifdef getnameinfo -+#undef getnameinfo -+#endif -+#define getnameinfo irs_getnameinfo -+ -+#ifdef getaddrinfo -+#undef getaddrinfo -+#endif -+#define getaddrinfo irs_getaddrinfo -+ -+#ifdef freeaddrinfo -+#undef freeaddrinfo -+#endif -+#define freeaddrinfo irs_freeaddrinfo -+ -+#ifdef gai_strerror -+#undef gai_strerror -+#endif -+#define gai_strerror irs_gai_strerror -+ -+int -+getaddrinfo(const char *hostname, const char *servname, -+ const struct addrinfo *hints, struct addrinfo **res); -+ -+int -+getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen, -+ char *host, IRS_GETNAMEINFO_BUFLEN_T hostlen, -+ char *serv, IRS_GETNAMEINFO_BUFLEN_T servlen, -+ IRS_GETNAMEINFO_FLAGS_T flags); -+ -+void freeaddrinfo (struct addrinfo *ai); -+ -+IRS_GAISTRERROR_RETURN_T -+gai_strerror(int ecode); -+ -+#endif -+ -+/* - * Tell Emacs to use C mode on this file. - * Local variables: - * mode: c --- -2.9.5 - diff --git a/SOURCES/bind-9.11-rh1410433.patch b/SOURCES/bind-9.11-rh1410433.patch deleted file mode 100644 index d307620..0000000 --- a/SOURCES/bind-9.11-rh1410433.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/lib/dns/dyndb.c b/lib/dns/dyndb.c -index 15561ce..e4449b0 100644 ---- a/lib/dns/dyndb.c -+++ b/lib/dns/dyndb.c -@@ -133,8 +133,11 @@ load_library(isc_mem_t *mctx, const char *filename, const char *instname, - instname, filename); - - flags = RTLD_NOW|RTLD_LOCAL; -+#if 0 -+ /* Shared global namespace is required for dns-pkcs11 library */ - #if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ - flags |= RTLD_DEEPBIND; -+#endif - #endif - - handle = dlopen(filename, flags); diff --git a/SOURCES/bind-9.11-rh1668682.patch b/SOURCES/bind-9.11-rh1668682.patch deleted file mode 100644 index 3e268b6..0000000 --- a/SOURCES/bind-9.11-rh1668682.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 16c1bd61384e993fef13d7be88fdd34551a2b3ce Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Wed, 23 Jan 2019 20:12:51 +0100 -Subject: [PATCH] Use custom random generator only for bind build - -Do not test random entropy on startup when used by DHCP. On most cases -random entropy is not even used by DHCP. In cases it is (LDAP SSL), fail -whenever it is not available. - -Resolves: rhbz#1668682 ---- - lib/dns/openssl_link.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/lib/dns/openssl_link.c b/lib/dns/openssl_link.c -index 91e87d0..2551b0a 100644 ---- a/lib/dns/openssl_link.c -+++ b/lib/dns/openssl_link.c -@@ -289,6 +289,7 @@ dst__openssl_init(const char *engine) { - #endif - #endif /* !defined(OPENSSL_NO_ENGINE) */ - -+#ifdef ISC_PLATFORM_USETHREADS - /* Protect ourselves against unseeded PRNG */ - if (RAND_status() != 1) { - FATAL_ERROR(__FILE__, __LINE__, -@@ -296,6 +297,7 @@ dst__openssl_init(const char *engine) { - "cannot be initialized (see the `PRNG not " - "seeded' message in the OpenSSL FAQ)"); - } -+#endif /* ISC_PLATFORM_USETHREADS */ - - return (ISC_R_SUCCESS); - --- -2.20.1 - diff --git a/SOURCES/bind-9.11-rh1980757.patch b/SOURCES/bind-9.11-rh1980757.patch deleted file mode 100644 index da3581b..0000000 --- a/SOURCES/bind-9.11-rh1980757.patch +++ /dev/null @@ -1,32 +0,0 @@ -From a503519533eb375a5ce1f7566bfc153aac980d87 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Fri, 9 Jul 2021 20:52:21 +0200 -Subject: [PATCH] Use proper entropy to initialize tsig keyname - -Random names used on GSS backed nsupdate can conflict in specific -situations. That might include starting a lot of machines from -containers, where they took all similar time to start. PID and timestamp -would be similar and therefore randomness is quite low. Use entropy to -generate more random identifier and reduce chance of conflict. ---- - bin/nsupdate/nsupdate.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c -index 458aa76..d9e5a2b 100644 ---- a/bin/nsupdate/nsupdate.c -+++ b/bin/nsupdate/nsupdate.c -@@ -2941,7 +2941,9 @@ start_gssrequest(dns_name_t *master) { - - keyname = dns_fixedname_initname(&fkname); - -- isc_random_get(&val); -+ result = isc_entropy_getdata(entropy, &val, sizeof(val), NULL, 0); -+ if (result != ISC_R_SUCCESS) -+ isc_random_get(&val); - result = isc_string_printf(mykeystr, sizeof(mykeystr), "%u.sig-%s", - val, namestr); - if (result != ISC_R_SUCCESS) --- -2.31.1 - diff --git a/SOURCES/bind-9.11-rh2101712.patch b/SOURCES/bind-9.11-rh2101712.patch deleted file mode 100644 index e519e97..0000000 --- a/SOURCES/bind-9.11-rh2101712.patch +++ /dev/null @@ -1,232 +0,0 @@ -From fff2960981a3294ac641968a17558c8d7eecf74d Mon Sep 17 00:00:00 2001 -From: Mark Andrews -Date: Wed, 24 Aug 2022 12:21:50 +1000 -Subject: [PATCH] Have dns_zt_apply lock the zone table - -There where a number of places where the zone table should have -been locked, but wasn't, when dns_zt_apply was called. - -Added a isc_rwlocktype_t type parameter to dns_zt_apply and adjusted -all calls to using it. Removed locks in callers. - -Modified upstream commit for v9_11 ---- - bin/named/server.c | 11 ++++++----- - bin/named/statschannel.c | 8 ++++---- - lib/dns/include/dns/zt.h | 4 ++-- - lib/dns/tests/zt_test.c | 3 ++- - lib/dns/view.c | 3 ++- - lib/dns/zt.c | 34 +++++++++++++++++++--------------- - 6 files changed, 35 insertions(+), 28 deletions(-) - -diff --git a/bin/named/server.c b/bin/named/server.c -index 9826588e6d..0b4b309461 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -8723,8 +8723,8 @@ load_configuration(const char *filename, ns_server_t *server, - strcmp(view->name, "_bind") != 0) - { - dns_view_setviewrevert(view); -- (void)dns_zt_apply(view->zonetable, false, -- removed, view); -+ (void)dns_zt_apply(view->zonetable, isc_rwlocktype_read, -+ false, removed, view); - } - dns_view_detach(&view); - } -@@ -10090,8 +10090,8 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) { - ISC_LIST_INIT(vle->zonelist); - ISC_LIST_APPEND(dctx->viewlist, vle, link); - if (dctx->dumpzones) -- result = dns_zt_apply(view->zonetable, true, -- add_zone_tolist, dctx); -+ result = dns_zt_apply(view->zonetable, isc_rwlocktype_read, -+ true, add_zone_tolist, dctx); - return (result); - } - -@@ -11367,7 +11367,8 @@ ns_server_sync(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text) { - for (view = ISC_LIST_HEAD(server->viewlist); - view != NULL; - view = ISC_LIST_NEXT(view, link)) { -- result = dns_zt_apply(view->zonetable, false, -+ result = dns_zt_apply(view->zonetable, -+ isc_rwlocktype_none, false, - synczone, &cleanup); - if (result != ISC_R_SUCCESS && - tresult == ISC_R_SUCCESS) -diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c -index 12ab048469..9828df0f4e 100644 ---- a/bin/named/statschannel.c -+++ b/bin/named/statschannel.c -@@ -1833,8 +1833,8 @@ generatexml(ns_server_t *server, uint32_t flags, - if ((flags & STATS_XML_ZONES) != 0) { - TRY0(xmlTextWriterStartElement(writer, - ISC_XMLCHAR "zones")); -- result = dns_zt_apply(view->zonetable, true, -- zone_xmlrender, writer); -+ result = dns_zt_apply(view->zonetable, isc_rwlocktype_read, -+ true, zone_xmlrender, writer); - if (result != ISC_R_SUCCESS) - goto error; - TRY0(xmlTextWriterEndElement(writer)); /* /zones */ -@@ -2489,8 +2489,8 @@ generatejson(ns_server_t *server, size_t *msglen, - CHECKMEM(za); - - if ((flags & STATS_JSON_ZONES) != 0) { -- result = dns_zt_apply(view->zonetable, true, -- zone_jsonrender, za); -+ result = dns_zt_apply(view->zonetable, isc_rwlocktype_read, -+ true, zone_jsonrender, za); - if (result != ISC_R_SUCCESS) { - goto error; - } -diff --git a/lib/dns/include/dns/zt.h b/lib/dns/include/dns/zt.h -index e658e5bb67..94212250da 100644 ---- a/lib/dns/include/dns/zt.h -+++ b/lib/dns/include/dns/zt.h -@@ -177,11 +177,11 @@ dns_zt_freezezones(dns_zt_t *zt, bool freeze); - */ - - isc_result_t --dns_zt_apply(dns_zt_t *zt, bool stop, -+dns_zt_apply(dns_zt_t *zt, isc_rwlocktype_t lock, bool stop, - isc_result_t (*action)(dns_zone_t *, void *), void *uap); - - isc_result_t --dns_zt_apply2(dns_zt_t *zt, bool stop, isc_result_t *sub, -+dns_zt_apply2(dns_zt_t *zt, isc_rwlocktype_t lock, bool stop, isc_result_t *sub, - isc_result_t (*action)(dns_zone_t *, void *), void *uap); - /*%< - * Apply a given 'action' to all zone zones in the table. -diff --git a/lib/dns/tests/zt_test.c b/lib/dns/tests/zt_test.c -index 3f1e812d60..ee75303a50 100644 ---- a/lib/dns/tests/zt_test.c -+++ b/lib/dns/tests/zt_test.c -@@ -145,7 +145,8 @@ apply(void **state) { - assert_non_null(view->zonetable); - - assert_int_equal(nzones, 0); -- result = dns_zt_apply(view->zonetable, false, count_zone, &nzones); -+ result = dns_zt_apply2(view->zonetable, isc_rwlocktype_read, false, NULL, -+ count_zone, &nzones); - assert_int_equal(result, ISC_R_SUCCESS); - assert_int_equal(nzones, 1); - -diff --git a/lib/dns/view.c b/lib/dns/view.c -index f01b4dea0f..bd1ced2863 100644 ---- a/lib/dns/view.c -+++ b/lib/dns/view.c -@@ -676,7 +676,8 @@ dns_view_dialup(dns_view_t *view) { - REQUIRE(DNS_VIEW_VALID(view)); - REQUIRE(view->zonetable != NULL); - -- (void)dns_zt_apply(view->zonetable, false, dialup, NULL); -+ (void)dns_zt_apply2(view->zonetable, isc_rwlocktype_read, false, NULL, -+ dialup, NULL); - } - - void -diff --git a/lib/dns/zt.c b/lib/dns/zt.c -index 3f12e247e0..af65740325 100644 ---- a/lib/dns/zt.c -+++ b/lib/dns/zt.c -@@ -202,7 +202,8 @@ flush(dns_zone_t *zone, void *uap) { - static void - zt_destroy(dns_zt_t *zt) { - if (zt->flush) { -- (void)dns_zt_apply(zt, false, flush, NULL); -+ (void)dns_zt_apply(zt, isc_rwlocktype_none, -+ false, flush, NULL); - } - isc_refcount_destroy(&zt->references); - dns_rbt_destroy(&zt->table); -@@ -249,9 +250,7 @@ dns_zt_load(dns_zt_t *zt, bool stop) { - - REQUIRE(VALID_ZT(zt)); - -- RWLOCK(&zt->rwlock, isc_rwlocktype_read); -- result = dns_zt_apply(zt, stop, load, NULL); -- RWUNLOCK(&zt->rwlock, isc_rwlocktype_read); -+ result = dns_zt_apply2(zt, isc_rwlocktype_read, stop, NULL, load, NULL); - return (result); - } - -@@ -293,7 +292,7 @@ dns_zt_asyncload2(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg, - * Prevent loads_pending going to zero while kicking off the loads. - */ - zt->loads_pending++; -- result = dns_zt_apply2(zt, false, NULL, asyncload, ¶ms); -+ result = dns_zt_apply2(zt, isc_rwlocktype_none, false, NULL, asyncload, ¶ms); - pending = --zt->loads_pending; - if (pending != 0) { - zt->loaddone = alldone; -@@ -342,9 +341,7 @@ dns_zt_loadnew(dns_zt_t *zt, bool stop) { - - REQUIRE(VALID_ZT(zt)); - -- RWLOCK(&zt->rwlock, isc_rwlocktype_read); -- result = dns_zt_apply(zt, stop, loadnew, NULL); -- RWUNLOCK(&zt->rwlock, isc_rwlocktype_read); -+ result = dns_zt_apply(zt, isc_rwlocktype_read, stop, loadnew, NULL); - return (result); - } - -@@ -366,9 +363,7 @@ dns_zt_freezezones(dns_zt_t *zt, bool freeze) { - - REQUIRE(VALID_ZT(zt)); - -- RWLOCK(&zt->rwlock, isc_rwlocktype_read); -- result = dns_zt_apply2(zt, false, &tresult, freezezones, &freeze); -- RWUNLOCK(&zt->rwlock, isc_rwlocktype_read); -+ result = dns_zt_apply2(zt, isc_rwlocktype_read, false, &tresult, freezezones, &freeze); - if (tresult == ISC_R_NOTFOUND) - tresult = ISC_R_SUCCESS; - return ((result == ISC_R_SUCCESS) ? tresult : result); -@@ -490,14 +485,14 @@ dns_zt_setviewrevert(dns_zt_t *zt) { - } - - isc_result_t --dns_zt_apply(dns_zt_t *zt, bool stop, -+dns_zt_apply(dns_zt_t *zt, isc_rwlocktype_t lock, bool stop, - isc_result_t (*action)(dns_zone_t *, void *), void *uap) - { -- return (dns_zt_apply2(zt, stop, NULL, action, uap)); -+ return (dns_zt_apply2(zt, lock, stop, NULL, action, uap)); - } - - isc_result_t --dns_zt_apply2(dns_zt_t *zt, bool stop, isc_result_t *sub, -+dns_zt_apply2(dns_zt_t *zt, isc_rwlocktype_t lock, bool stop, isc_result_t *sub, - isc_result_t (*action)(dns_zone_t *, void *), void *uap) - { - dns_rbtnode_t *node; -@@ -508,6 +503,10 @@ dns_zt_apply2(dns_zt_t *zt, bool stop, isc_result_t *sub, - REQUIRE(VALID_ZT(zt)); - REQUIRE(action != NULL); - -+ if (lock != isc_rwlocktype_none) { -+ RWLOCK(&zt->rwlock, lock); -+ } -+ - dns_rbtnodechain_init(&chain, zt->mctx); - result = dns_rbtnodechain_first(&chain, zt->table, NULL, NULL); - if (result == ISC_R_NOTFOUND) { -@@ -538,8 +537,13 @@ dns_zt_apply2(dns_zt_t *zt, bool stop, isc_result_t *sub, - - cleanup: - dns_rbtnodechain_invalidate(&chain); -- if (sub != NULL) -+ if (sub != NULL) { - *sub = tresult; -+ } -+ -+ if (lock != isc_rwlocktype_none) { -+ RWUNLOCK(&zt->rwlock, lock); -+ } - - return (result); - } --- -2.37.2 - diff --git a/SOURCES/bind-9.11-rh2133889.patch b/SOURCES/bind-9.11-rh2133889.patch deleted file mode 100644 index c61d902..0000000 --- a/SOURCES/bind-9.11-rh2133889.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c8f5b31f0637315c1c45d0287f05fcad2250f40f Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Thu, 13 Oct 2022 15:35:46 +0200 -Subject: [PATCH] Add include to rwlocktype_t to dns/zt.h - -It got broken as part of bug #2101712 fix. Introduced new definition, -which passes during bind build, but breaks bind-dyndb-ldap build. ---- - lib/dns/include/dns/zt.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/lib/dns/include/dns/zt.h b/lib/dns/include/dns/zt.h -index 9421225..64c24d6 100644 ---- a/lib/dns/include/dns/zt.h -+++ b/lib/dns/include/dns/zt.h -@@ -18,6 +18,7 @@ - #include - - #include -+#include - - #include - --- -2.37.3 - diff --git a/SOURCES/bind-9.11-rt31459.patch b/SOURCES/bind-9.11-rt31459.patch deleted file mode 100644 index 1891255..0000000 --- a/SOURCES/bind-9.11-rt31459.patch +++ /dev/null @@ -1,2122 +0,0 @@ -From 346683631ae0f83ad4f09a69cfa5e5c6ea49e5d9 Mon Sep 17 00:00:00 2001 -From: Evan Hunt -Date: Tue, 12 Sep 2017 19:05:46 -0700 -Subject: [PATCH] rebased rt31459c - -[rt31459d] update the newer tools - -[rt31459d] setup entropy in dns_lib_init() - -[rt31459d] silence compiler warning - -DNS_OPENSSL_LIBS -> DST_OPENSSL_LIBS - -Include new unit test ---- - bin/confgen/keygen.c | 7 + - bin/dnssec/dnssec-dsfromkey.c | 8 +- - bin/dnssec/dnssec-importkey.c | 8 +- - bin/dnssec/dnssec-revoke.c | 8 +- - bin/dnssec/dnssec-settime.c | 8 +- - bin/dnssec/dnssec-signzone.c | 11 +- - bin/dnssec/dnssec-verify.c | 8 +- - bin/dnssec/dnssectool.c | 11 +- - bin/named/server.c | 6 + - bin/nsupdate/nsupdate.c | 14 +- - bin/tests/makejournal.c | 6 +- - bin/tests/system/pipelined/pipequeries.c | 20 +- - bin/tests/system/pipelined/tests.sh | 4 +- - bin/tests/system/rsabigexponent/bigkey.c | 4 + - bin/tests/system/tkey/keycreate.c | 26 ++- - bin/tests/system/tkey/keydelete.c | 26 ++- - bin/tests/system/tkey/tests.sh | 8 +- - bin/tools/mdig.c | 3 +- - configure | 250 +++++++++++++---------- - configure.ac | 77 ++++++- - lib/dns/dst_api.c | 21 +- - lib/dns/include/dst/dst.h | 8 + - lib/dns/lib.c | 15 +- - lib/dns/openssl_link.c | 72 ++++++- - lib/dns/pkcs11.c | 29 ++- - lib/dns/tests/Kyuafile | 1 + - lib/dns/tests/Makefile.in | 7 + - lib/dns/tests/dstrandom_test.c | 115 +++++++++++ - lib/dns/win32/libdns.def.in | 7 + - lib/isc/entropy.c | 24 +++ - lib/isc/include/isc/entropy.h | 12 ++ - lib/isc/include/isc/platform.h.in | 5 + - lib/isc/include/isc/types.h | 2 + - lib/isc/pk11.c | 12 +- - lib/isc/win32/include/isc/platform.h.in | 5 + - win32utils/Configure | 28 ++- - 36 files changed, 701 insertions(+), 175 deletions(-) - create mode 100644 lib/dns/tests/dstrandom_test.c - -diff --git a/bin/confgen/keygen.c b/bin/confgen/keygen.c -index 40cf74c..bd269e7 100644 ---- a/bin/confgen/keygen.c -+++ b/bin/confgen/keygen.c -@@ -165,6 +165,13 @@ generate_key(isc_mem_t *mctx, const char *randomfile, dns_secalg_t alg, - randomfile = NULL; - open_keyboard = ISC_ENTROPY_KEYBOARDYES; - } -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (randomfile != NULL && -+ strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -+ randomfile = NULL; -+ isc_entropy_usehook(ectx, true); -+ } -+#endif - DO("start entropy source", isc_entropy_usebestsource(ectx, - &entropy_source, - randomfile, -diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c -index 4420f2d..9cb63a8 100644 ---- a/bin/dnssec/dnssec-dsfromkey.c -+++ b/bin/dnssec/dnssec-dsfromkey.c -@@ -498,14 +498,14 @@ main(int argc, char **argv) { - - if (ectx == NULL) - setup_entropy(mctx, NULL, &ectx); -- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -- if (result != ISC_R_SUCCESS) -- fatal("could not initialize hash"); - result = dst_lib_init(mctx, ectx, - ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY); - if (result != ISC_R_SUCCESS) - fatal("could not initialize dst: %s", - isc_result_totext(result)); -+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -+ if (result != ISC_R_SUCCESS) -+ fatal("could not initialize hash"); - isc_entropy_stopcallbacksources(ectx); - - setup_logging(mctx, &log); -@@ -574,8 +574,8 @@ main(int argc, char **argv) { - if (dns_rdataset_isassociated(&rdataset)) - dns_rdataset_disassociate(&rdataset); - cleanup_logging(&log); -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - cleanup_entropy(&ectx); - dns_name_destroy(); - if (verbose > 10) -diff --git a/bin/dnssec/dnssec-importkey.c b/bin/dnssec/dnssec-importkey.c -index dc9a293..52863a1 100644 ---- a/bin/dnssec/dnssec-importkey.c -+++ b/bin/dnssec/dnssec-importkey.c -@@ -404,14 +404,14 @@ main(int argc, char **argv) { - - if (ectx == NULL) - setup_entropy(mctx, NULL, &ectx); -- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -- if (result != ISC_R_SUCCESS) -- fatal("could not initialize hash"); - result = dst_lib_init(mctx, ectx, - ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY); - if (result != ISC_R_SUCCESS) - fatal("could not initialize dst: %s", - isc_result_totext(result)); -+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -+ if (result != ISC_R_SUCCESS) -+ fatal("could not initialize hash"); - isc_entropy_stopcallbacksources(ectx); - - setup_logging(mctx, &log); -@@ -455,8 +455,8 @@ main(int argc, char **argv) { - if (dns_rdataset_isassociated(&rdataset)) - dns_rdataset_disassociate(&rdataset); - cleanup_logging(&log); -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - cleanup_entropy(&ectx); - dns_name_destroy(); - if (verbose > 10) -diff --git a/bin/dnssec/dnssec-revoke.c b/bin/dnssec/dnssec-revoke.c -index 0121a34..74a99b0 100644 ---- a/bin/dnssec/dnssec-revoke.c -+++ b/bin/dnssec/dnssec-revoke.c -@@ -184,14 +184,14 @@ main(int argc, char **argv) { - - if (ectx == NULL) - setup_entropy(mctx, NULL, &ectx); -- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -- if (result != ISC_R_SUCCESS) -- fatal("Could not initialize hash"); - result = dst_lib_init2(mctx, ectx, engine, - ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY); - if (result != ISC_R_SUCCESS) - fatal("Could not initialize dst: %s", - isc_result_totext(result)); -+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -+ if (result != ISC_R_SUCCESS) -+ fatal("Could not initialize hash"); - isc_entropy_stopcallbacksources(ectx); - - result = dst_key_fromnamedfile(filename, dir, -@@ -273,8 +273,8 @@ main(int argc, char **argv) { - - cleanup: - dst_key_free(&key); -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - cleanup_entropy(&ectx); - if (verbose > 10) - isc_mem_stats(mctx, stdout); -diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c -index f017895..2c568fc 100644 ---- a/bin/dnssec/dnssec-settime.c -+++ b/bin/dnssec/dnssec-settime.c -@@ -391,14 +391,14 @@ main(int argc, char **argv) { - - if (ectx == NULL) - setup_entropy(mctx, NULL, &ectx); -- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -- if (result != ISC_R_SUCCESS) -- fatal("Could not initialize hash"); - result = dst_lib_init2(mctx, ectx, engine, - ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY); - if (result != ISC_R_SUCCESS) - fatal("Could not initialize dst: %s", - isc_result_totext(result)); -+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -+ if (result != ISC_R_SUCCESS) -+ fatal("Could not initialize hash"); - isc_entropy_stopcallbacksources(ectx); - - if (predecessor != NULL) { -@@ -683,8 +683,8 @@ main(int argc, char **argv) { - if (prevkey != NULL) - dst_key_free(&prevkey); - dst_key_free(&key); -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - cleanup_entropy(&ectx); - if (verbose > 10) - isc_mem_stats(mctx, stdout); -diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c -index a097ac8..6567421 100644 ---- a/bin/dnssec/dnssec-signzone.c -+++ b/bin/dnssec/dnssec-signzone.c -@@ -3472,14 +3472,15 @@ main(int argc, char *argv[]) { - if (!pseudorandom) - eflags |= ISC_ENTROPY_GOODONLY; - -- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -- if (result != ISC_R_SUCCESS) -- fatal("could not create hash context"); -- - result = dst_lib_init2(mctx, ectx, engine, eflags); - if (result != ISC_R_SUCCESS) - fatal("could not initialize dst: %s", - isc_result_totext(result)); -+ -+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -+ if (result != ISC_R_SUCCESS) -+ fatal("could not create hash context"); -+ - isc_stdtime_get(&now); - - if (startstr != NULL) { -@@ -3896,8 +3897,8 @@ main(int argc, char *argv[]) { - dns_master_styledestroy(&dsstyle, mctx); - - cleanup_logging(&log); -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - cleanup_entropy(&ectx); - dns_name_destroy(); - if (verbose > 10) -diff --git a/bin/dnssec/dnssec-verify.c b/bin/dnssec/dnssec-verify.c -index 087cd5d..07c7294 100644 ---- a/bin/dnssec/dnssec-verify.c -+++ b/bin/dnssec/dnssec-verify.c -@@ -281,15 +281,15 @@ main(int argc, char *argv[]) { - if (ectx == NULL) - setup_entropy(mctx, NULL, &ectx); - -- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -- if (result != ISC_R_SUCCESS) -- fatal("could not create hash context"); -- - result = dst_lib_init2(mctx, ectx, engine, ISC_ENTROPY_BLOCKING); - if (result != ISC_R_SUCCESS) - fatal("could not initialize dst: %s", - isc_result_totext(result)); - -+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); -+ if (result != ISC_R_SUCCESS) -+ fatal("could not create hash context"); -+ - isc_stdtime_get(&now); - - rdclass = strtoclass(classname); -diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c -index 7f045e8..2a0f9c6 100644 ---- a/bin/dnssec/dnssectool.c -+++ b/bin/dnssec/dnssectool.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -235,7 +236,8 @@ setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) { - if (*ectx == NULL) { - result = isc_entropy_create(mctx, ectx); - if (result != ISC_R_SUCCESS) -- fatal("could not create entropy object"); -+ fatal("could not create entropy object: %s", -+ isc_result_totext(result)); - ISC_LIST_INIT(sources); - } - -@@ -244,6 +246,13 @@ setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) { - randomfile = NULL; - } - -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (randomfile != NULL && -+ strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -+ randomfile = NULL; -+ isc_entropy_usehook(*ectx, true); -+ } -+#endif - result = isc_entropy_usebestsource(*ectx, &source, randomfile, - usekeyboard); - -diff --git a/bin/named/server.c b/bin/named/server.c -index 9826588..b3e3fc3 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -8291,6 +8292,10 @@ load_configuration(const char *filename, ns_server_t *server, - "no source of entropy found"); - } else { - const char *randomdev = cfg_obj_asstring(obj); -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (strcmp(randomdev, ISC_PLATFORM_CRYPTORANDOM) == 0) -+ isc_entropy_usehook(ns_g_entropy, true); -+#else - int level = ISC_LOG_ERROR; - result = isc_entropy_createfilesource(ns_g_entropy, - randomdev); -@@ -8325,6 +8330,7 @@ load_configuration(const char *filename, ns_server_t *server, - } - isc_entropy_detach(&ns_g_fallbackentropy); - } -+#endif - #endif - } - -diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c -index 52b0274..23b69c9 100644 ---- a/bin/nsupdate/nsupdate.c -+++ b/bin/nsupdate/nsupdate.c -@@ -279,7 +279,8 @@ setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) { - if (*ectx == NULL) { - result = isc_entropy_create(mctx, ectx); - if (result != ISC_R_SUCCESS) -- fatal("could not create entropy object"); -+ fatal("could not create entropy object: %s", -+ isc_result_totext(result)); - ISC_LIST_INIT(sources); - } - -@@ -288,6 +289,13 @@ setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) { - randomfile = NULL; - } - -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (randomfile != NULL && -+ strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -+ randomfile = NULL; -+ isc_entropy_usehook(*ectx, true); -+ } -+#endif - result = isc_entropy_usebestsource(*ectx, &source, randomfile, - usekeyboard); - -@@ -990,11 +998,11 @@ setup_system(void) { - } - } - -- setup_entropy(gmctx, NULL, &entropy); -+ if (entropy == NULL) -+ setup_entropy(gmctx, NULL, &entropy); - - result = isc_hash_create(gmctx, entropy, DNS_NAME_MAXWIRE); - check_result(result, "isc_hash_create"); -- isc_hash_init(); - - result = dns_dispatchmgr_create(gmctx, entropy, &dispatchmgr); - check_result(result, "dns_dispatchmgr_create"); -diff --git a/bin/tests/makejournal.c b/bin/tests/makejournal.c -index 68b5e5a..cd54c8d 100644 ---- a/bin/tests/makejournal.c -+++ b/bin/tests/makejournal.c -@@ -102,12 +102,12 @@ main(int argc, char **argv) { - CHECK(isc_mem_create(0, 0, &mctx)); - CHECK(isc_entropy_create(mctx, &ectx)); - -- CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); -- hash_active = true; -- - CHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING)); - dst_active = true; - -+ CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); -+ hash_active = true; -+ - CHECK(isc_log_create(mctx, &lctx, &logconfig)); - isc_log_registercategories(lctx, categories); - isc_log_setcontext(lctx); -diff --git a/bin/tests/system/pipelined/pipequeries.c b/bin/tests/system/pipelined/pipequeries.c -index e16ec11..95b65bf 100644 ---- a/bin/tests/system/pipelined/pipequeries.c -+++ b/bin/tests/system/pipelined/pipequeries.c -@@ -204,6 +204,7 @@ sendqueries(isc_task_t *task, isc_event_t *event) { - - int - main(int argc, char *argv[]) { -+ char *randomfile = NULL; - isc_sockaddr_t bind_any; - struct in_addr inaddr; - isc_result_t result; -@@ -222,7 +223,7 @@ main(int argc, char *argv[]) { - int c; - - isc_commandline_errprint = false; -- while ((c = isc_commandline_parse(argc, argv, "p:")) != -1) { -+ while ((c = isc_commandline_parse(argc, argv, "p:r:")) != -1) { - switch (c) { - case 'p': - result = isc_parse_uint16(&port, -@@ -233,6 +234,9 @@ main(int argc, char *argv[]) { - exit(1); - } - break; -+ case 'r': -+ randomfile = isc_commandline_argument; -+ break; - case '?': - fprintf(stderr, "%s: invalid argument '%c'", - argv[0], c); -@@ -275,10 +279,18 @@ main(int argc, char *argv[]) { - - ectx = NULL; - RUNCHECK(isc_entropy_create(mctx, &ectx)); -- RUNCHECK(isc_entropy_createfilesource(ectx, "../random.data")); -- RUNCHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (randomfile != NULL && -+ strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -+ randomfile = NULL; -+ isc_entropy_usehook(ectx, true); -+ } -+#endif -+ if (randomfile != NULL) -+ RUNCHECK(isc_entropy_createfilesource(ectx, randomfile)); - - RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY)); -+ RUNCHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); - - taskmgr = NULL; - RUNCHECK(isc_taskmgr_create(mctx, 1, 0, &taskmgr)); -@@ -331,8 +343,8 @@ main(int argc, char *argv[]) { - isc_task_detach(&task); - isc_taskmgr_destroy(&taskmgr); - -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - isc_entropy_detach(&ectx); - - isc_log_destroy(&lctx); -diff --git a/bin/tests/system/pipelined/tests.sh b/bin/tests/system/pipelined/tests.sh -index c0a99a2..0245527 100644 ---- a/bin/tests/system/pipelined/tests.sh -+++ b/bin/tests/system/pipelined/tests.sh -@@ -19,7 +19,7 @@ status=0 - - echo_i "check pipelined TCP queries" - ret=0 --$PIPEQUERIES -p ${PORT} < input > raw || ret=1 -+$PIPEQUERIES -p ${PORT} -r $RANDFILE < input > raw || ret=1 - awk '{ print $1 " " $5 }' < raw > output - sort < output > output-sorted - $DIFF ref output-sorted || { ret=1 ; echo_i "diff sorted failed"; } -@@ -43,7 +43,7 @@ status=`expr $status + $ret` - - echo_i "check keep-response-order" - ret=0 --$PIPEQUERIES -p ${PORT} ++ < inputb > rawb || ret=1 -+$PIPEQUERIES -p ${PORT} -r $RANDFILE ++ < inputb > rawb || ret=1 - awk '{ print $1 " " $5 }' < rawb > outputb - $DIFF refb outputb || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi -diff --git a/bin/tests/system/rsabigexponent/bigkey.c b/bin/tests/system/rsabigexponent/bigkey.c -index abf12ed..fa5182c 100644 ---- a/bin/tests/system/rsabigexponent/bigkey.c -+++ b/bin/tests/system/rsabigexponent/bigkey.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -183,6 +184,9 @@ main(int argc, char **argv) { - - CHECK(isc_mem_create(0, 0, &mctx), "isc_mem_create()"); - CHECK(isc_entropy_create(mctx, &ectx), "isc_entropy_create()"); -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ isc_entropy_usehook(ectx, true); -+#endif - CHECK(isc_entropy_usebestsource(ectx, &source, - "../random.data", - ISC_ENTROPY_KEYBOARDNO), -diff --git a/bin/tests/system/tkey/keycreate.c b/bin/tests/system/tkey/keycreate.c -index 34360aa..3236968 100644 ---- a/bin/tests/system/tkey/keycreate.c -+++ b/bin/tests/system/tkey/keycreate.c -@@ -206,6 +206,7 @@ sendquery(isc_task_t *task, isc_event_t *event) { - int - main(int argc, char *argv[]) { - char *ourkeyname; -+ char *randomfile; - isc_taskmgr_t *taskmgr; - isc_timermgr_t *timermgr; - isc_socketmgr_t *socketmgr; -@@ -225,10 +226,21 @@ main(int argc, char *argv[]) { - - RUNCHECK(isc_app_start()); - -+ randomfile = NULL; -+ - if (argc < 2) { - fprintf(stderr, "I:no DH key provided\n"); - exit(-1); - } -+ if (strcmp(argv[1], "-r") == 0) { -+ if (argc < 4) { -+ fprintf(stderr, "I:no DH key provided\n"); -+ exit(-1); -+ } -+ randomfile = argv[2]; -+ argv += 2; -+ argc -= 2; -+ } - ourkeyname = argv[1]; - - if (argc >= 3) -@@ -242,14 +254,22 @@ main(int argc, char *argv[]) { - - ectx = NULL; - RUNCHECK(isc_entropy_create(mctx, &ectx)); -- RUNCHECK(isc_entropy_createfilesource(ectx, "../random.data")); -- RUNCHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (randomfile != NULL && -+ strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -+ randomfile = NULL; -+ isc_entropy_usehook(ectx, true); -+ } -+#endif -+ if (randomfile != NULL) -+ RUNCHECK(isc_entropy_createfilesource(ectx, randomfile)); - - log = NULL; - logconfig = NULL; - RUNCHECK(isc_log_create(mctx, &log, &logconfig)); - - RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY)); -+ RUNCHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); - - taskmgr = NULL; - RUNCHECK(isc_taskmgr_create(mctx, 1, 0, &taskmgr)); -@@ -328,8 +348,8 @@ main(int argc, char *argv[]) { - - isc_log_destroy(&log); - -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - isc_entropy_detach(&ectx); - - isc_mem_destroy(&mctx); -diff --git a/bin/tests/system/tkey/keydelete.c b/bin/tests/system/tkey/keydelete.c -index a3dd450..350723f 100644 ---- a/bin/tests/system/tkey/keydelete.c -+++ b/bin/tests/system/tkey/keydelete.c -@@ -137,6 +137,7 @@ sendquery(isc_task_t *task, isc_event_t *event) { - int - main(int argc, char **argv) { - char *keyname; -+ char *randomfile; - isc_taskmgr_t *taskmgr; - isc_timermgr_t *timermgr; - isc_socketmgr_t *socketmgr; -@@ -157,10 +158,21 @@ main(int argc, char **argv) { - - RUNCHECK(isc_app_start()); - -+ randomfile = NULL; -+ - if (argc < 2) { - fprintf(stderr, "I:no key to delete\n"); - exit(-1); - } -+ if (strcmp(argv[1], "-r") == 0) { -+ if (argc < 4) { -+ fprintf(stderr, "I:no DH key provided\n"); -+ exit(-1); -+ } -+ randomfile = argv[2]; -+ argv += 2; -+ argc -= 2; -+ } - keyname = argv[1]; - - dns_result_register(); -@@ -170,14 +182,22 @@ main(int argc, char **argv) { - - ectx = NULL; - RUNCHECK(isc_entropy_create(mctx, &ectx)); -- RUNCHECK(isc_entropy_createfilesource(ectx, "../random.data")); -- RUNCHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (randomfile != NULL && -+ strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -+ randomfile = NULL; -+ isc_entropy_usehook(ectx, true); -+ } -+#endif -+ if (randomfile != NULL) -+ RUNCHECK(isc_entropy_createfilesource(ectx, randomfile)); - - log = NULL; - logconfig = NULL; - RUNCHECK(isc_log_create(mctx, &log, &logconfig)); - - RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY)); -+ RUNCHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); - - taskmgr = NULL; - RUNCHECK(isc_taskmgr_create(mctx, 1, 0, &taskmgr)); -@@ -265,8 +285,8 @@ main(int argc, char **argv) { - - isc_log_destroy(&log); - -- dst_lib_destroy(); - isc_hash_destroy(); -+ dst_lib_destroy(); - isc_entropy_detach(&ectx); - - isc_mem_destroy(&mctx); -diff --git a/bin/tests/system/tkey/tests.sh b/bin/tests/system/tkey/tests.sh -index b265156..bcd60a6 100644 ---- a/bin/tests/system/tkey/tests.sh -+++ b/bin/tests/system/tkey/tests.sh -@@ -33,7 +33,7 @@ for owner in . foo.example. - do - echo_i "creating new key using owner name \"$owner\" ($n)" - ret=0 -- keyname=`$KEYCREATE $dhkeyname $owner` || ret=1 -+ keyname=`$KEYCREATE -r $RANDFILE $dhkeyname $owner` || ret=1 - if [ $ret != 0 ]; then - echo_i "failed" - status=$((status+ret)) -@@ -57,7 +57,7 @@ do - - echo_i "deleting new key ($n)" - ret=0 -- $KEYDELETE $keyname || ret=1 -+ $KEYDELETE -r $RANDFILE $keyname || ret=1 - if [ $ret != 0 ]; then - echo_i "failed" - fi -@@ -79,7 +79,7 @@ done - - echo_i "creating new key using owner name bar.example. ($n)" - ret=0 --keyname=`$KEYCREATE $dhkeyname bar.example.` || ret=1 -+keyname=`$KEYCREATE -r $RANDFILE $dhkeyname bar.example.` || ret=1 - if [ $ret != 0 ]; then - echo_i "failed" - status=$((status+ret)) -@@ -124,7 +124,7 @@ n=$((n+1)) - - echo_i "recreating the bar.example. key ($n)" - ret=0 --keyname=`$KEYCREATE $dhkeyname bar.example.` || ret=1 -+keyname=`$KEYCREATE -r $RANDFILE $dhkeyname bar.example.` || ret=1 - if [ $ret != 0 ]; then - echo_i "failed" - status=$((status+ret)) -diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c -index 26fa609..fb34aa0 100644 ---- a/bin/tools/mdig.c -+++ b/bin/tools/mdig.c -@@ -2005,12 +2005,11 @@ main(int argc, char *argv[]) { - - ectx = NULL; - RUNCHECK(isc_entropy_create(mctx, &ectx)); -+ RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY)); - RUNCHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); - RUNCHECK(isc_entropy_getdata(ectx, cookie_secret, - sizeof(cookie_secret), NULL, 0)); - -- RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY)); -- - ISC_LIST_INIT(queries); - parse_args(false, argc, argv); - if (server == NULL) -diff --git a/configure b/configure -index 368112f..e060e9d 100755 ---- a/configure -+++ b/configure -@@ -640,6 +640,7 @@ ac_includes_default="\ - - ac_subst_vars='LTLIBOBJS - LIBOBJS -+LIBDIR_SUFFIX - BUILD_LIBS - BUILD_LDFLAGS - BUILD_CPPFLAGS -@@ -822,6 +823,7 @@ LIBXML2_CFLAGS - NZDTARGETS - NZDSRCS - NZD_TOOLS -+ISC_PLATFORM_CRYPTORANDOM - PKCS11_TEST - PKCS11_ED25519 - PKCS11_GOST -@@ -1046,6 +1048,7 @@ with_eddsa - with_aes - enable_openssl_hash - with_cc_alg -+enable_crypto_rand - with_lmdb - with_libxml2 - with_libjson -@@ -1747,6 +1750,7 @@ Optional Features: - --enable-threads enable multithreading - --enable-native-pkcs11 use native PKCS11 for all crypto [default=no] - --enable-openssl-hash use OpenSSL for hash functions [default=no] -+ --enable-crypto-rand use the crypto provider for random [default=yes] - --enable-largefile 64-bit file support - --enable-backtrace log stack backtrace on abort [default=yes] - --enable-symtable use internal symbol table for backtrace -@@ -17204,6 +17208,7 @@ case "$use_openssl" in - $as_echo "disabled because of native PKCS11" >&6; } - DST_OPENSSL_INC="" - CRYPTO="-DPKCS11CRYPTO" -+ CRYPTOLIB="pkcs11" - OPENSSLECDSALINKOBJS="" - OPENSSLECDSALINKSRCS="" - OPENSSLEDDSALINKOBJS="" -@@ -17218,6 +17223,7 @@ $as_echo "disabled because of native PKCS11" >&6; } - $as_echo "no" >&6; } - DST_OPENSSL_INC="" - CRYPTO="" -+ CRYPTOLIB="" - OPENSSLECDSALINKOBJS="" - OPENSSLECDSALINKSRCS="" - OPENSSLEDDSALINKOBJS="" -@@ -17230,6 +17236,7 @@ $as_echo "no" >&6; } - auto) - DST_OPENSSL_INC="" - CRYPTO="" -+ CRYPTOLIB="" - OPENSSLECDSALINKOBJS="" - OPENSSLECDSALINKSRCS="" - OPENSSLEDDSALINKOBJS="" -@@ -17239,7 +17246,7 @@ $as_echo "no" >&6; } - OPENSSLLINKOBJS="" - OPENSSLLINKSRCS="" - as_fn_error $? "OpenSSL was not found in any of $openssldirs; use --with-openssl=/path --If you don't want OpenSSL, use --without-openssl" "$LINENO" 5 -+If you do not want OpenSSL, use --without-openssl" "$LINENO" 5 - ;; - *) - if test "yes" = "$want_native_pkcs11" -@@ -17270,6 +17277,7 @@ $as_echo "not found" >&6; } - as_fn_error $? "\"$use_openssl/include/openssl/opensslv.h\" not found" "$LINENO" 5 - fi - CRYPTO='-DOPENSSL' -+ CRYPTOLIB="openssl" - if test "/usr" = "$use_openssl" - then - DST_OPENSSL_INC="" -@@ -17904,8 +17912,6 @@ fi - # Use OpenSSL for hash functions - # - --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for using OpenSSL for hash functions" >&5 --$as_echo_n "checking for using OpenSSL for hash functions... " >&6; } - ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH" - case $want_openssl_hash in - yes) -@@ -18280,6 +18286,86 @@ if test "rt" = "$have_clock_gt"; then - LIBS="-lrt $LIBS" - fi - -+# -+# Use the crypto provider (OpenSSL/PKCS#11) for random functions -+# -+ -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for using the crypto library (vs. builtin) for random functions" >&5 -+$as_echo_n "checking for using the crypto library (vs. builtin) for random functions... " >&6; } -+# Check whether --enable-crypto-rand was given. -+if test "${enable_crypto_rand+set}" = set; then : -+ enableval=$enable_crypto_rand; want_crypto_rand="$enableval" -+else -+ want_crypto_rand="auto" -+fi -+ -+if test "$want_crypto_rand" = "auto" -+then -+ case "$CRYPTOLIB" in -+ "") -+ want_crypto_rand="no" -+ ;; -+ pkcs11) -+ want_crypto_rand="yes" -+ ;; -+ openssl) -+ saved_cflags="$CFLAGS" -+ saved_libs="$LIBS" -+ CFLAGS="$CFLAGS $DST_OPENSSL_INC" -+ LIBS="$LIBS $DST_OPENSSL_LIBS" -+ if test "$cross_compiling" = yes; then : -+ want_crypto_rand="yes" -+else -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+#include -+ -+unsigned char buf[128]; -+ -+int main() -+{ -+ if (RAND_bytes(buf, 128) != 1) -+ return (1); -+ return (0); -+} -+ -+_ACEOF -+if ac_fn_c_try_run "$LINENO"; then : -+ want_crypto_rand="yes" -+else -+ want_crypto_rand="no" -+fi -+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -+ conftest.$ac_objext conftest.beam conftest.$ac_ext -+fi -+ -+ CFLAGS="$saved_cflags" -+ LIBS="$saved_libs" -+ ;; -+ *) -+ as_fn_error $? "Unknown crypto library define $CRYPTOLIB" "$LINENO" 5 -+ ;; -+ esac -+fi -+case $want_crypto_rand in -+ yes) -+ if test "$CRYPTOLIB" = "" -+ then -+ as_fn_error $? "No crypto library for random functions" "$LINENO" 5 -+ fi -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$CRYPTOLIB\"" >&5 -+$as_echo "\"$CRYPTOLIB\"" >&6; } -+ ISC_PLATFORM_CRYPTORANDOM="#define ISC_PLATFORM_CRYPTORANDOM \"$CRYPTOLIB\"" -+ ;; -+ no) -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+ ISC_PLATFORM_CRYPTORANDOM="#undef ISC_PLATFORM_CRYPTORANDOM" -+ ;; -+esac -+ -+ - # - # was --with-lmdb specified? - # -@@ -20556,9 +20642,12 @@ _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t for buflen; int for flags" >&5 - $as_echo "size_t for buflen; int for flags" >&6; } -- $as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T size_t" >>confdefs.h -+ # Changed to solve multilib conflict on Fedora -+ # AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, size_t) -+ # AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t) -+ $as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t" >>confdefs.h - -- $as_echo "#define IRS_GETNAMEINFO_BUFLEN_T size_t" >>confdefs.h -+ $as_echo "#define IRS_GETNAMEINFO_BUFLEN_T socklen_t" >>confdefs.h - - $as_echo "#define IRS_GETNAMEINFO_FLAGS_T int" >>confdefs.h - -@@ -21856,12 +21945,7 @@ ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM" - ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM" - ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM" - if test "yes" = "$use_atomic"; then -- have_atomic=yes # set default -- case "$host" in -- i[3456]86-*) -- # XXX: some old x86 architectures actually do not support -- # (some of) these operations. Do we need stricter checks? -- # The cast to long int works around a bug in the HP C Compiler -+ # The cast to long int works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. -@@ -21894,6 +21978,11 @@ cat >>confdefs.h <<_ACEOF - _ACEOF - - -+ have_atomic=yes # set default -+ case "$host" in -+ i[3456]86-*) -+ # XXX: some old x86 architectures actually do not support -+ # (some of) these operations. Do we need stricter checks? - if test $ac_cv_sizeof_void_p = 8; then - arch=x86_64 - have_xaddq=yes -@@ -21902,39 +21991,6 @@ _ACEOF - fi - ;; - x86_64-*|amd64-*) -- # The cast to long int works around a bug in the HP C Compiler --# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects --# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. --# This bug is HP SR number 8606223364. --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 --$as_echo_n "checking size of void *... " >&6; } --if ${ac_cv_sizeof_void_p+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : -- --else -- if test "$ac_cv_type_void_p" = yes; then -- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 --$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error 77 "cannot compute sizeof (void *) --See \`config.log' for more details" "$LINENO" 5; } -- else -- ac_cv_sizeof_void_p=0 -- fi --fi -- --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 --$as_echo "$ac_cv_sizeof_void_p" >&6; } -- -- -- --cat >>confdefs.h <<_ACEOF --#define SIZEOF_VOID_P $ac_cv_sizeof_void_p --_ACEOF -- -- - if test $ac_cv_sizeof_void_p = 8; then - arch=x86_64 - have_xaddq=yes -@@ -21965,6 +22021,10 @@ $as_echo_n "checking architecture type for atomic operations... " >&6; } - $as_echo "$arch" >&6; } - fi - -+if test ! "$arch" = "x86_64" -a "$have_xaddq" = "yes"; then -+ as_fn_error $? "XADDQ present but disabled by Fedora patch!" "$LINENO" 5 -+fi -+ - if test "yes" = "$have_atomic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler support for inline assembly code" >&5 - $as_echo_n "checking compiler support for inline assembly code... " >&6; } -@@ -24547,6 +24607,30 @@ CFLAGS="$CFLAGS $SO_CFLAGS" - # - dlzdir='${DLZ_DRIVER_DIR}' - -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target libdir" >&5 -+$as_echo_n "checking for target libdir... " >&6; } -+if test "$cross_compiling" = yes; then : -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -+as_fn_error $? "cannot run test program while cross compiling -+See \`config.log' for more details" "$LINENO" 5; } -+else -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+int main(void) {exit((sizeof(void *) == 8) ? 0 : 1);} -+_ACEOF -+if ac_fn_c_try_run "$LINENO"; then : -+ target_lib=lib64 -+else -+ target_lib=lib -+fi -+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -+ conftest.$ac_objext conftest.beam conftest.$ac_ext -+fi -+ -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$target_lib\"" >&5 -+$as_echo "\"$target_lib\"" >&6; } -+ - # - # Private autoconf macro to simplify configuring drivers: - # -@@ -24877,11 +24961,11 @@ $as_echo "no" >&6; } - $as_echo "using mysql with libs ${mysql_lib} and includes ${mysql_include}" >&6; } - ;; - *) -- if test -d "$use_dlz_mysql/lib/mysql" -+ if test -d $use_dlz_mysql/${target_lib}/mysql - then -- mysql_lib="$use_dlz_mysql/lib/mysql" -+ mysql_lib=$use_dlz_mysql/${target_lib}/mysql - else -- mysql_lib="$use_dlz_mysql/lib" -+ mysql_lib=$use_dlz_mysql/${target_lib} - fi - - CONTRIB_DLZ="$CONTRIB_DLZ -DDLZ_MYSQL" -@@ -24966,7 +25050,7 @@ $as_echo "" >&6; } - # Check other locations for includes. - # Order is important (sigh). - -- bdb_incdirs="/db53 /db51 /db48 /db47 /db46 /db45 /db44 /db43 /db42 /db41 /db4 /db" -+ bdb_incdirs="/db53 /db51 /db48 /db47 /db46 /db45 /db44 /db43 /db42 /db41 /db4 /libdb /db" - # include a blank element first - for d in "" $bdb_incdirs - do -@@ -24991,57 +25075,9 @@ $as_echo "" >&6; } - bdb_libnames="db53 db-5.3 db51 db-5.1 db48 db-4.8 db47 db-4.7 db46 db-4.6 db45 db-4.5 db44 db-4.4 db43 db-4.3 db42 db-4.2 db41 db-4.1 db" - for d in $bdb_libnames - do -- if test "$dd" = "/usr" -- then -- as_ac_Lib=`$as_echo "ac_cv_lib_$d''_db_create" | $as_tr_sh` --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for db_create in -l$d" >&5 --$as_echo_n "checking for db_create in -l$d... " >&6; } --if eval \${$as_ac_Lib+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-l$d $LIBS" --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- --/* Override any GCC internal prototype to avoid an error. -- Use char because int might match the return type of a GCC -- builtin and then its argument prototype would still apply. */ --#ifdef __cplusplus --extern "C" --#endif --char db_create (); --int --main () --{ --return db_create (); -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_link "$LINENO"; then : -- eval "$as_ac_Lib=yes" --else -- eval "$as_ac_Lib=no" --fi --rm -f core conftest.err conftest.$ac_objext \ -- conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --eval ac_res=\$$as_ac_Lib -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 --$as_echo "$ac_res" >&6; } --if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : -- dlz_bdb_libs="-l${d}" --fi -- -- if test $dlz_bdb_libs != "yes" -- then -- break -- fi -- elif test -f "$dd/lib/lib${d}.so" -+ if test -f "$dd/${target_lib}/lib${d}.so" - then -- dlz_bdb_libs="-L${dd}/lib -l${d}" -+ dlz_bdb_libs="-L${dd}/${target_lib}/libdb -l${d}" - break - fi - done -@@ -25200,10 +25236,10 @@ $as_echo "no" >&6; } - DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I$use_dlz_ldap/include" - DLZ_DRIVER_LDAP_INCLUDES="-I$use_dlz_ldap/include" - fi -- if test -n "-L$use_dlz_ldap/lib -lldap -llber" -+ if test -n "-L$use_dlz_ldap/${target_lib} -lldap -llber" - then -- DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_ldap/lib -lldap -llber" -- DLZ_DRIVER_LDAP_LIBS="-L$use_dlz_ldap/lib -lldap -llber" -+ DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_ldap/${target_lib} -lldap -llber" -+ DLZ_DRIVER_LDAP_LIBS="-L$use_dlz_ldap/${target_lib} -lldap -llber" - fi - - -@@ -25289,11 +25325,11 @@ fi - odbcdirs="/usr /usr/local /usr/pkg" - for d in $odbcdirs - do -- if test -f $d/include/sql.h -a -f $d/lib/libodbc.a -+ if test -f $d/include/sql.h -a -f $d/${target_lib}/libodbc.a - then - use_dlz_odbc=$d - dlz_odbc_include="-I$use_dlz_odbc/include" -- dlz_odbc_libs="-L$use_dlz_odbc/lib -lodbc" -+ dlz_odbc_libs="-L$use_dlz_odbc/${target_lib} -lodbc" - break - fi - done -@@ -25568,6 +25604,8 @@ DNS_CRYPTO_LIBS="$NEWFLAGS" - - - -+ -+ - # - # Commands to run at the end of config.status. - # Don't just put these into configure, it won't work right if somebody -@@ -27946,6 +27984,8 @@ report() { - echo " IPv6 support (--enable-ipv6)" - test "X$CRYPTO" = "X" -o "yes" = "$want_native_pkcs11" || \ - echo " OpenSSL cryptography/DNSSEC (--with-openssl)" -+ test "no" = "$want_crypto_rand" || \ -+ echo " Crypto provider entropy source (--enable-crypto-rand)" - test "X$PYTHON" = "X" || echo " Python tools (--with-python)" - test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)" - test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)" -@@ -27986,6 +28026,8 @@ report() { - echo " Very verbose query trace logging (--enable-querytrace)" - test "no" = "$with_cmocka" || echo " CMocka Unit Testing Framework (--with-cmocka)" - -+ echo " Cryptographic library for DNSSEC: $CRYPTOLIB" -+ - echo " Dynamically loadable zone (DLZ) drivers:" - test "no" = "$use_dlz_bdb" || \ - echo " Berkeley DB (--with-dlz-bdb)" -@@ -28033,6 +28075,8 @@ report() { - echo " ECDSA algorithm support (--with-ecdsa)" - test "X$CRYPTO" = "X" -o "yes" = "$OPENSSL_ED25519" -o "yes" = "$PKCS11_ED25519" || \ - echo " EDDSA algorithm support (--with-eddsa)" -+ test "yes" = "$want_crypto_rand" || \ -+ echo " Crypto provider entropy source (--enable-crypto-rand)" - - test "yes" = "$enable_seccomp" || \ - echo " Use libseccomp system call filtering (--enable-seccomp)" -diff --git a/configure.ac b/configure.ac -index 11f41e8..fdcfc62 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1600,6 +1600,7 @@ case "$use_openssl" in - AC_MSG_RESULT(disabled because of native PKCS11) - DST_OPENSSL_INC="" - CRYPTO="-DPKCS11CRYPTO" -+ CRYPTOLIB="pkcs11" - OPENSSLECDSALINKOBJS="" - OPENSSLECDSALINKSRCS="" - OPENSSLEDDSALINKOBJS="" -@@ -1613,6 +1614,7 @@ case "$use_openssl" in - AC_MSG_RESULT(no) - DST_OPENSSL_INC="" - CRYPTO="" -+ CRYPTOLIB="" - OPENSSLECDSALINKOBJS="" - OPENSSLECDSALINKSRCS="" - OPENSSLEDDSALINKOBJS="" -@@ -1625,6 +1627,7 @@ case "$use_openssl" in - auto) - DST_OPENSSL_INC="" - CRYPTO="" -+ CRYPTOLIB="" - OPENSSLECDSALINKOBJS="" - OPENSSLECDSALINKSRCS="" - OPENSSLEDDSALINKOBJS="" -@@ -1635,7 +1638,7 @@ case "$use_openssl" in - OPENSSLLINKSRCS="" - AC_MSG_ERROR( - [OpenSSL was not found in any of $openssldirs; use --with-openssl=/path --If you don't want OpenSSL, use --without-openssl]) -+If you do not want OpenSSL, use --without-openssl]) - ;; - *) - if test "yes" = "$want_native_pkcs11" -@@ -1665,6 +1668,7 @@ If you don't want OpenSSL, use --without-openssl]) - AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found]) - fi - CRYPTO='-DOPENSSL' -+ CRYPTOLIB="openssl" - if test "/usr" = "$use_openssl" - then - DST_OPENSSL_INC="" -@@ -2109,7 +2113,6 @@ fi - # Use OpenSSL for hash functions - # - --AC_MSG_CHECKING(for using OpenSSL for hash functions) - ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH" - case $want_openssl_hash in - yes) -@@ -2381,6 +2384,67 @@ if test "rt" = "$have_clock_gt"; then - LIBS="-lrt $LIBS" - fi - -+# -+# Use the crypto provider (OpenSSL/PKCS#11) for random functions -+# -+ -+AC_MSG_CHECKING(for using the crypto library (vs. builtin) for random functions) -+AC_ARG_ENABLE(crypto-rand, -+ [ --enable-crypto-rand use the crypto provider for random [[default=yes]]], -+ want_crypto_rand="$enableval", want_crypto_rand="auto") -+if test "$want_crypto_rand" = "auto" -+then -+ case "$CRYPTOLIB" in -+ "") -+ want_crypto_rand="no" -+ ;; -+ pkcs11) -+ want_crypto_rand="yes" -+ ;; -+ openssl) -+ saved_cflags="$CFLAGS" -+ saved_libs="$LIBS" -+ CFLAGS="$CFLAGS $DST_OPENSSL_INC" -+ LIBS="$LIBS $DST_OPENSSL_LIBS" -+ AC_TRY_RUN([ -+#include -+ -+unsigned char buf[128]; -+ -+int main() -+{ -+ if (RAND_bytes(buf, 128) != 1) -+ return (1); -+ return (0); -+} -+], -+ [want_crypto_rand="yes"], -+ [want_crypto_rand="no"], -+ [want_crypto_rand="yes"]) -+ CFLAGS="$saved_cflags" -+ LIBS="$saved_libs" -+ ;; -+ *) -+ AC_MSG_ERROR([Unknown crypto library define $CRYPTOLIB]) -+ ;; -+ esac -+fi -+case $want_crypto_rand in -+ yes) -+ if test "$CRYPTOLIB" = "" -+ then -+ AC_MSG_ERROR([No crypto library for random functions]) -+ fi -+ AC_MSG_RESULT(["$CRYPTOLIB"]) -+ ISC_PLATFORM_CRYPTORANDOM="#define ISC_PLATFORM_CRYPTORANDOM \"$CRYPTOLIB\"" -+ ;; -+ no) -+ AC_MSG_RESULT(no) -+ ISC_PLATFORM_CRYPTORANDOM="#undef ISC_PLATFORM_CRYPTORANDOM" -+ ;; -+esac -+AC_SUBST(ISC_PLATFORM_CRYPTORANDOM) -+ - # - # was --with-lmdb specified? - # -@@ -4174,12 +4238,12 @@ ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM" - ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM" - ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM" - if test "yes" = "$use_atomic"; then -+ AC_CHECK_SIZEOF([void *]) - have_atomic=yes # set default - case "$host" in - [i[3456]86-*]) - # XXX: some old x86 architectures actually do not support - # (some of) these operations. Do we need stricter checks? -- AC_CHECK_SIZEOF([void *]) - if test $ac_cv_sizeof_void_p = 8; then - arch=x86_64 - have_xaddq=yes -@@ -4188,7 +4252,6 @@ if test "yes" = "$use_atomic"; then - fi - ;; - x86_64-*|amd64-*) -- AC_CHECK_SIZEOF([void *]) - if test $ac_cv_sizeof_void_p = 8; then - arch=x86_64 - have_xaddq=yes -@@ -5622,6 +5685,8 @@ report() { - echo " IPv6 support (--enable-ipv6)" - test "X$CRYPTO" = "X" -o "yes" = "$want_native_pkcs11" || \ - echo " OpenSSL cryptography/DNSSEC (--with-openssl)" -+ test "no" = "$want_crypto_rand" || \ -+ echo " Crypto provider entropy source (--enable-crypto-rand)" - test "X$PYTHON" = "X" || echo " Python tools (--with-python)" - test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)" - test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)" -@@ -5662,6 +5727,8 @@ report() { - echo " Very verbose query trace logging (--enable-querytrace)" - test "no" = "$with_cmocka" || echo " CMocka Unit Testing Framework (--with-cmocka)" - -+ echo " Cryptographic library for DNSSEC: $CRYPTOLIB" -+ - echo " Dynamically loadable zone (DLZ) drivers:" - test "no" = "$use_dlz_bdb" || \ - echo " Berkeley DB (--with-dlz-bdb)" -@@ -5709,6 +5776,8 @@ report() { - echo " ECDSA algorithm support (--with-ecdsa)" - test "X$CRYPTO" = "X" -o "yes" = "$OPENSSL_ED25519" -o "yes" = "$PKCS11_ED25519" || \ - echo " EDDSA algorithm support (--with-eddsa)" -+ test "yes" = "$want_crypto_rand" || \ -+ echo " Crypto provider entropy source (--enable-crypto-rand)" - - test "yes" = "$enable_seccomp" || \ - echo " Use libseccomp system call filtering (--enable-seccomp)" -diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c -index 7a86506..aa54afc 100644 ---- a/lib/dns/dst_api.c -+++ b/lib/dns/dst_api.c -@@ -277,6 +277,12 @@ dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, - #ifdef GSSAPI - RETERR(dst__gssapi_init(&dst_t_func[DST_ALG_GSSAPI])); - #endif -+#if defined(OPENSSL) || defined(PKCS11CRYPTO) -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (dst_entropy_pool != NULL) -+ isc_entropy_sethook(dst_random_getdata); -+#endif -+#endif /* defined(OPENSSL) || defined(PKCS11CRYPTO) */ - dst_initialized = true; - return (ISC_R_SUCCESS); - -@@ -296,11 +302,19 @@ dst_lib_destroy(void) { - for (i = 0; i < DST_MAX_ALGS; i++) - if (dst_t_func[i] != NULL && dst_t_func[i]->cleanup != NULL) - dst_t_func[i]->cleanup(); -+#if defined(OPENSSL) || defined(PKCS11CRYPTO) -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (dst_entropy_pool != NULL) { -+ isc_entropy_usehook(dst_entropy_pool, false); -+ isc_entropy_sethook(NULL); -+ } -+#endif - #ifdef OPENSSL - dst__openssl_destroy(); - #elif PKCS11CRYPTO - (void) dst__pkcs11_destroy(); - #endif /* if OPENSSL, elif PKCS11CRYPTO */ -+#endif /* defined(OPENSSL) || defined(PKCS11CRYPTO) */ - if (dst__memory_pool != NULL) - isc_mem_detach(&dst__memory_pool); - if (dst_entropy_pool != NULL) -@@ -2002,13 +2016,17 @@ dst__entropy_getdata(void *buf, unsigned int len, bool pseudo) { - flags &= ~ISC_ENTROPY_GOODONLY; - else - flags |= ISC_ENTROPY_BLOCKING; -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ return (dst_random_getdata(buf, len, NULL, flags)); -+#else - return (isc_entropy_getdata(dst_entropy_pool, buf, len, NULL, flags)); -+#endif - #endif /* PKCS11CRYPTO */ - } - - unsigned int - dst__entropy_status(void) { --#ifndef PKCS11CRYPTO -+#if !defined(PKCS11CRYPTO) && !defined(ISC_PLATFORM_CRYPTORANDOM) - #ifdef GSSAPI - unsigned int flags = dst_entropy_flags; - isc_result_t ret; -@@ -2031,6 +2049,7 @@ dst__entropy_status(void) { - #endif - return (isc_entropy_status(dst_entropy_pool)); - #else -+ /* Doesn't matter as it is not used in this case. */ - return (0); - #endif - } -diff --git a/lib/dns/include/dst/dst.h b/lib/dns/include/dst/dst.h -index 5b42ab4..3aba028 100644 ---- a/lib/dns/include/dst/dst.h -+++ b/lib/dns/include/dst/dst.h -@@ -159,6 +159,14 @@ dst_lib_destroy(void); - * Releases all resources allocated by DST. - */ - -+isc_result_t -+dst_random_getdata(void *data, unsigned int length, -+ unsigned int *returned, unsigned int flags); -+/*%< -+ * \brief Return data from the crypto random generator. -+ * Specialization of isc_entropy_getdata(). -+ */ -+ - bool - dst_algorithm_supported(unsigned int alg); - /*%< -diff --git a/lib/dns/lib.c b/lib/dns/lib.c -index d9417de..0dc935d 100644 ---- a/lib/dns/lib.c -+++ b/lib/dns/lib.c -@@ -16,6 +16,7 @@ - #include - #include - -+#include - #include - #include - #include -@@ -76,6 +77,7 @@ static unsigned int references = 0; - static void - initialize(void) { - isc_result_t result; -+ isc_entropy_t *ectx = NULL; - - REQUIRE(initialize_done == false); - -@@ -86,11 +88,14 @@ initialize(void) { - result = dns_ecdb_register(dns_g_mctx, &dbimp); - if (result != ISC_R_SUCCESS) - goto cleanup_mctx; -- result = isc_hash_create(dns_g_mctx, NULL, DNS_NAME_MAXWIRE); -+ result = isc_entropy_create(dns_g_mctx, &ectx); - if (result != ISC_R_SUCCESS) - goto cleanup_db; -+ result = isc_hash_create(dns_g_mctx, NULL, DNS_NAME_MAXWIRE); -+ if (result != ISC_R_SUCCESS) -+ goto cleanup_ectx; - -- result = dst_lib_init(dns_g_mctx, NULL, 0); -+ result = dst_lib_init(dns_g_mctx, ectx, 0); - if (result != ISC_R_SUCCESS) - goto cleanup_hash; - -@@ -98,11 +103,17 @@ initialize(void) { - if (result != ISC_R_SUCCESS) - goto cleanup_dst; - -+ isc_hash_init(); -+ isc_entropy_detach(&ectx); -+ - initialize_done = true; - return; - - cleanup_dst: - dst_lib_destroy(); -+ cleanup_ectx: -+ if (ectx != NULL) -+ isc_entropy_detach(&ectx); - cleanup_hash: - isc_hash_destroy(); - cleanup_db: -diff --git a/lib/dns/openssl_link.c b/lib/dns/openssl_link.c -index 1e57c71..3f4f822 100644 ---- a/lib/dns/openssl_link.c -+++ b/lib/dns/openssl_link.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -46,8 +47,6 @@ - #include - #endif - --static RAND_METHOD *rm = NULL; -- - #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - static isc_mutex_t *locks = NULL; - static int nlocks; -@@ -57,6 +56,9 @@ static int nlocks; - static ENGINE *e = NULL; - #endif - -+#ifndef ISC_PLATFORM_CRYPTORANDOM -+static RAND_METHOD *rm = NULL; -+ - static int - entropy_get(unsigned char *buf, int num) { - isc_result_t result; -@@ -102,6 +104,7 @@ entropy_add(const void *buf, int num, double entropy) { - return (1); - } - #endif -+#endif /* !ISC_PLATFORM_CRYPTORANDOM */ - - #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - static void -@@ -192,7 +195,7 @@ _set_thread_id(CRYPTO_THREADID *id) - isc_result_t - dst__openssl_init(const char *engine) { - isc_result_t result; --#if !defined(OPENSSL_NO_ENGINE) -+#if !defined(OPENSSL_NO_ENGINE) && !defined(ISC_PLATFORM_CRYPTORANDOM) - ENGINE *re; - #else - UNUSED(engine); -@@ -222,6 +225,7 @@ dst__openssl_init(const char *engine) { - ERR_load_crypto_strings(); - #endif - -+#ifndef ISC_PLATFORM_CRYPTORANDOM - rm = mem_alloc(sizeof(RAND_METHOD) FILELINE); - if (rm == NULL) { - result = ISC_R_NOMEMORY; -@@ -233,6 +237,7 @@ dst__openssl_init(const char *engine) { - rm->add = entropy_add; - rm->pseudorand = entropy_getpseudo; - rm->status = entropy_status; -+#endif - - #if !defined(OPENSSL_NO_ENGINE) - #if !defined(CONF_MFLAGS_DEFAULT_SECTION) -@@ -266,6 +271,7 @@ dst__openssl_init(const char *engine) { - } - } - -+#ifndef ISC_PLATFORM_CRYPTORANDOM - re = ENGINE_get_default_RAND(); - if (re == NULL) { - re = ENGINE_new(); -@@ -278,9 +284,21 @@ dst__openssl_init(const char *engine) { - ENGINE_free(re); - } else - ENGINE_finish(re); -+#endif - #else -+#ifndef ISC_PLATFORM_CRYPTORANDOM - RAND_set_rand_method(rm); -+#endif - #endif /* !defined(OPENSSL_NO_ENGINE) */ -+ -+ /* Protect ourselves against unseeded PRNG */ -+ if (RAND_status() != 1) { -+ FATAL_ERROR(__FILE__, __LINE__, -+ "OpenSSL pseudorandom number generator " -+ "cannot be initialized (see the `PRNG not " -+ "seeded' message in the OpenSSL FAQ)"); -+ } -+ - return (ISC_R_SUCCESS); - - #if !defined(OPENSSL_NO_ENGINE) -@@ -288,10 +306,14 @@ dst__openssl_init(const char *engine) { - if (e != NULL) - ENGINE_free(e); - e = NULL; -+#ifndef ISC_PLATFORM_CRYPTORANDOM - mem_free(rm FILELINE); - rm = NULL; - #endif -+#endif -+#ifndef ISC_PLATFORM_CRYPTORANDOM - cleanup_mutexinit: -+#endif - #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - CRYPTO_set_locking_callback(NULL); - DESTROYMUTEXBLOCK(locks, nlocks); -@@ -306,14 +328,17 @@ void - dst__openssl_destroy(void) { - #if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L) - OPENSSL_cleanup(); -+#ifndef ISC_PLATFORM_CRYPTORANDOM - if (rm != NULL) { - mem_free(rm FILELINE); - rm = NULL; - } -+#endif - #else - /* - * Sequence taken from apps_shutdown() in . - */ -+#ifndef ISC_PLATFORM_CRYPTORANDOM - if (rm != NULL) { - #if OPENSSL_VERSION_NUMBER >= 0x00907000L - RAND_cleanup(); -@@ -321,6 +346,7 @@ dst__openssl_destroy(void) { - mem_free(rm FILELINE); - rm = NULL; - } -+#endif - #if (OPENSSL_VERSION_NUMBER >= 0x00907000L) - CONF_modules_free(); - #endif -@@ -456,11 +482,45 @@ dst__openssl_getengine(const char *engine) { - } - #endif - --#else /* OPENSSL */ -+isc_result_t -+dst_random_getdata(void *data, unsigned int length, -+ unsigned int *returned, unsigned int flags) { -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+#ifndef DONT_REQUIRE_DST_LIB_INIT -+ INSIST(dst__memory_pool != NULL); -+#endif -+ REQUIRE(data != NULL); -+ REQUIRE(length > 0); - --#include -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+ if ((flags & ISC_ENTROPY_GOODONLY) == 0) { -+ if (RAND_pseudo_bytes((unsigned char *)data, (int)length) < 0) -+ return (dst__openssl_toresult2("RAND_pseudo_bytes", -+ DST_R_OPENSSLFAILURE)); -+ } else { -+ if (RAND_bytes((unsigned char *)data, (int)length) != 1) -+ return (dst__openssl_toresult2("RAND_bytes", -+ DST_R_OPENSSLFAILURE)); -+ } -+#else -+ UNUSED(flags); - --EMPTY_TRANSLATION_UNIT -+ if (RAND_bytes((unsigned char *)data, (int)length) != 1) -+ return (dst__openssl_toresult2("RAND_bytes", -+ DST_R_OPENSSLFAILURE)); -+#endif -+ if (returned != NULL) -+ *returned = length; -+ return (ISC_R_SUCCESS); -+#else -+ UNUSED(data); -+ UNUSED(length); -+ UNUSED(returned); -+ UNUSED(flags); -+ -+ return (ISC_R_NOTIMPLEMENTED); -+#endif -+} - - #endif /* OPENSSL */ - /*! \file */ -diff --git a/lib/dns/pkcs11.c b/lib/dns/pkcs11.c -index 6b30309..20552fa 100644 ---- a/lib/dns/pkcs11.c -+++ b/lib/dns/pkcs11.c -@@ -13,12 +13,15 @@ - - #include - -+#include -+ - #include - #include - - #include - #include - -+#include "dst_internal.h" - #include "dst_pkcs11.h" - - isc_result_t -@@ -34,12 +37,32 @@ dst__pkcs11_toresult(const char *funcname, const char *file, int line, - return (fallback); - } - -+isc_result_t -+dst_random_getdata(void *data, unsigned int length, -+ unsigned int *returned, unsigned int flags) { -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ isc_result_t ret; - --#else /* PKCS11CRYPTO */ -+#ifndef DONT_REQUIRE_DST_LIB_INIT -+ INSIST(dst__memory_pool != NULL); -+#endif -+ REQUIRE(data != NULL); -+ REQUIRE(length > 0); -+ UNUSED(flags); - --#include -+ ret = pk11_rand_bytes(data, (int) length); -+ if ((ret == ISC_R_SUCCESS) && (returned != NULL)) -+ *returned = length; -+ return (ret); -+#else -+ UNUSED(data); -+ UNUSED(length); -+ UNUSED(returned); -+ UNUSED(flags); - --EMPTY_TRANSLATION_UNIT -+ return (ISC_R_NOTIMPLEMENTED); -+#endif -+} - - #endif /* PKCS11CRYPTO */ - /*! \file */ -diff --git a/lib/dns/tests/Kyuafile b/lib/dns/tests/Kyuafile -index 937b548..f3c0e38 100644 ---- a/lib/dns/tests/Kyuafile -+++ b/lib/dns/tests/Kyuafile -@@ -10,6 +10,7 @@ tap_test_program{name='dh_test'} - tap_test_program{name='dispatch_test'} - tap_test_program{name='dnstap_test'} - tap_test_program{name='dst_test'} -+tap_test_program{name='dstrandom_test'} - tap_test_program{name='geoip_test'} - tap_test_program{name='gost_test'} - tap_test_program{name='keytable_test'} -diff --git a/lib/dns/tests/Makefile.in b/lib/dns/tests/Makefile.in -index 4126372..30cab17 100644 ---- a/lib/dns/tests/Makefile.in -+++ b/lib/dns/tests/Makefile.in -@@ -37,6 +37,7 @@ SRCS = acl_test.c \ - dnstap_test.c \ - dst_test.c \ - dnstest.c \ -+ dstrandom_test.c \ - geoip_test.c \ - gost_test.c \ - keytable_test.c \ -@@ -69,6 +70,7 @@ TARGETS = acl_test@EXEEXT@ \ - dh_test@EXEEXT@ \ - dispatch_test@EXEEXT@ \ - dnstap_test@EXEEXT@ \ -+ dstrandom_test@EXEEXT@ \ - dst_test@EXEEXT@ \ - geoip_test@EXEEXT@ \ - gost_test@EXEEXT@ \ -@@ -258,6 +260,11 @@ zt_test@EXEEXT@: zt_test.@O@ dnstest.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} - ${LDFLAGS} -o $@ zt_test.@O@ dnstest.@O@ \ - ${DNSLIBS} ${ISCLIBS} ${LIBS} - -+dstrandom_test@EXEEXT@: dstrandom_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} -+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ -+ dstrandom_test.@O@ ${DNSLIBS} \ -+ ${ISCLIBS} ${ISCPK11LIBS} ${LIBS} -+ - unit:: - sh ${top_builddir}/unit/unittest.sh - -diff --git a/lib/dns/tests/dstrandom_test.c b/lib/dns/tests/dstrandom_test.c -new file mode 100644 -index 0000000..bd3d164 ---- /dev/null -+++ b/lib/dns/tests/dstrandom_test.c -@@ -0,0 +1,115 @@ -+/* -+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ * -+ * See the COPYRIGHT file distributed with this work for additional -+ * information regarding copyright ownership. -+ */ -+ -+#include -+ -+#if HAVE_CMOCKA -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#define UNIT_TESTING -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+isc_mem_t *mctx = NULL; -+isc_entropy_t *ectx = NULL; -+unsigned char buffer[128]; -+ -+/* isc_entropy_getdata() examples */ -+static void -+isc_entropy_getdata_test(void **state) { -+ isc_result_t result; -+ unsigned int returned, status; -+ const char *randomfile = "testdata/dstrandom/random.data"; -+ int ret; -+ -+ UNUSED(state); -+ -+ isc_mem_debugging |= ISC_MEM_DEBUGRECORD; -+ result = isc_mem_create(0, 0, &mctx); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ result = isc_entropy_create(mctx, &ectx); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ result = dst_lib_init(mctx, ectx, 0); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ isc_entropy_usehook(ectx, true); -+ -+ returned = 0; -+ result = isc_entropy_getdata(ectx, buffer, sizeof(buffer), -+ &returned, 0); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ assert_int_equal(returned, sizeof(buffer)); -+ -+ status = isc_entropy_status(ectx); -+ assert_int_equal(status, 0); -+ -+ isc_entropy_usehook(ectx, false); -+#endif -+ -+ ret = chdir(TESTS); -+ assert_int_equal(ret, 0); -+ -+ result = isc_entropy_createfilesource(ectx, randomfile); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ returned = 0; -+ result = isc_entropy_getdata(ectx, buffer, sizeof(buffer), -+ &returned, 0); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ assert_int_equal(returned, sizeof(buffer)); -+ -+ status = isc_entropy_status(ectx); -+ assert_true(status > 0); -+ -+ dst_lib_destroy(); -+ isc_entropy_detach(&ectx); -+ assert_null(ectx); -+ -+ isc_mem_destroy(&mctx); -+ assert_null(mctx); -+} -+ -+int -+main(void) { -+ const struct CMUnitTest tests[] = { -+ cmocka_unit_test(isc_entropy_getdata_test), -+ }; -+ -+ return (cmocka_run_group_tests(tests, NULL, NULL)); -+} -+ -+#else /* HAVE_CMOCKA */ -+ -+#include -+ -+int -+main(void) { -+ printf("1..0 # Skipped: cmocka not available\n"); -+ return (0); -+} -+ -+#endif -diff --git a/lib/dns/win32/libdns.def.in b/lib/dns/win32/libdns.def.in -index 9c2ef79..f597049 100644 ---- a/lib/dns/win32/libdns.def.in -+++ b/lib/dns/win32/libdns.def.in -@@ -1487,6 +1487,13 @@ dst_lib_destroy - dst_lib_init - dst_lib_init2 - dst_lib_initmsgcat -+@IF PKCS11 -+dst_random_getdata -+@ELSE PKCS11 -+@IF OPENSSL -+dst_random_getdata -+@END OPENSSL -+@END PKCS11 - dst_region_computeid - dst_region_computerid - dst_result_register -diff --git a/lib/isc/entropy.c b/lib/isc/entropy.c -index 0c1f3ed..fdd17d7 100644 ---- a/lib/isc/entropy.c -+++ b/lib/isc/entropy.c -@@ -104,11 +104,15 @@ struct isc_entropy { - uint32_t initialized; - uint32_t initcount; - isc_entropypool_t pool; -+ bool usehook; - unsigned int nsources; - isc_entropysource_t *nextsource; - ISC_LIST(isc_entropysource_t) sources; - }; - -+/*% Global Hook */ -+static isc_entropy_getdata_t hook; -+ - /*% Sample Queue */ - typedef struct { - uint32_t last_time; /*%< last time recorded */ -@@ -557,6 +561,11 @@ isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length, - - LOCK(&ent->lock); - -+ if (ent->usehook && (hook != NULL)) { -+ UNLOCK(&ent->lock); -+ return (hook(data, length, returned, flags)); -+ } -+ - remain = length; - buf = data; - total = 0; -@@ -708,6 +717,7 @@ isc_entropy_create(isc_mem_t *mctx, isc_entropy_t **entp) { - ent->refcnt = 1; - ent->initialized = 0; - ent->initcount = 0; -+ ent->usehook = false; - ent->magic = ENTROPY_MAGIC; - - isc_entropypool_init(&ent->pool); -@@ -1286,3 +1296,17 @@ isc_entropy_usebestsource(isc_entropy_t *ectx, isc_entropysource_t **source, - */ - return (final_result); - } -+ -+void -+isc_entropy_usehook(isc_entropy_t *ectx, bool onoff) { -+ REQUIRE(VALID_ENTROPY(ectx)); -+ -+ LOCK(&ectx->lock); -+ ectx->usehook = onoff; -+ UNLOCK(&ectx->lock); -+} -+ -+void -+isc_entropy_sethook(isc_entropy_getdata_t myhook) { -+ hook = myhook; -+} -diff --git a/lib/isc/include/isc/entropy.h b/lib/isc/include/isc/entropy.h -index b5bc956..f32c9dc 100644 ---- a/lib/isc/include/isc/entropy.h -+++ b/lib/isc/include/isc/entropy.h -@@ -302,6 +302,18 @@ isc_entropy_usebestsource(isc_entropy_t *ectx, isc_entropysource_t **source, - * isc_entropy_createcallbacksource(). - */ - -+void -+isc_entropy_usehook(isc_entropy_t *ectx, bool onoff); -+/*!< -+ * \brief Mark/unmark the given entropy structure as being hooked. -+ */ -+ -+void -+isc_entropy_sethook(isc_entropy_getdata_t myhook); -+/*!< -+ * \brief Set the getdata hook (e.g., for a crypto random generator). -+ */ -+ - ISC_LANG_ENDDECLS - - #endif /* ISC_ENTROPY_H */ -diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in -index 2bf8758..f4c684e 100644 ---- a/lib/isc/include/isc/platform.h.in -+++ b/lib/isc/include/isc/platform.h.in -@@ -359,6 +359,11 @@ - */ - @ISC_PLATFORM_HAVESTRINGSH@ - -+/* -+ * Define if the random functions are provided by crypto. -+ */ -+@ISC_PLATFORM_CRYPTORANDOM@ -+ - /* - * Define if the hash functions must be provided by OpenSSL. - */ -diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h -index 3bdd54f..d5acd39 100644 ---- a/lib/isc/include/isc/types.h -+++ b/lib/isc/include/isc/types.h -@@ -95,6 +95,8 @@ typedef struct isc_time isc_time_t; /*%< Time */ - typedef struct isc_timer isc_timer_t; /*%< Timer */ - typedef struct isc_timermgr isc_timermgr_t; /*%< Timer Manager */ - -+typedef isc_result_t (*isc_entropy_getdata_t)(void *, unsigned int, -+ unsigned int *, unsigned int); - typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *); - typedef int (*isc_sockfdwatch_t)(isc_task_t *, isc_socket_t *, void *, int); - -diff --git a/lib/isc/pk11.c b/lib/isc/pk11.c -index 227f807..4a63fdf 100644 ---- a/lib/isc/pk11.c -+++ b/lib/isc/pk11.c -@@ -321,14 +321,16 @@ pk11_rand_seed_fromfile(const char *randomfile) { - ret = isc_stdio_open(randomfile, "r", &stream); - if (ret != ISC_R_SUCCESS) - goto cleanup; -- ret = isc_stdio_read(seed, 1, SEEDSIZE, stream, &cc); -- if (ret!= ISC_R_SUCCESS) -- goto cleanup; -+ while (ret == ISC_R_SUCCESS) { -+ ret = isc_stdio_read(seed, 1, SEEDSIZE, stream, &cc); -+ if ((ret != ISC_R_SUCCESS) && (ret != ISC_R_EOF)) -+ goto cleanup; -+ (void) pkcs_C_SeedRandom(ctx.session, seed, (CK_ULONG) cc); -+ } - ret = isc_stdio_close(stream); - stream = NULL; -- if (ret!= ISC_R_SUCCESS) -+ if (ret != ISC_R_SUCCESS) - goto cleanup; -- (void) pkcs_C_SeedRandom(ctx.session, seed, (CK_ULONG) cc); - - cleanup: - if (stream != NULL) -diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in -index 1f785e0..f9051c3 100644 ---- a/lib/isc/win32/include/isc/platform.h.in -+++ b/lib/isc/win32/include/isc/platform.h.in -@@ -73,6 +73,11 @@ - #define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn) - #define ISC_PLATFORM_NORETURN_POST - -+/* -+ * Define if the random functions are provided by crypto. -+ */ -+@ISC_PLATFORM_CRYPTORANDOM@ -+ - /* - * Define if the hash functions must be provided by OpenSSL. - */ -diff --git a/win32utils/Configure b/win32utils/Configure -index 7ac30fb..55b6c23 100644 ---- a/win32utils/Configure -+++ b/win32utils/Configure -@@ -382,6 +382,7 @@ my @substdefh = ("ALLOW_FILTER_AAAA", - my %configdefp; - - my @substdefp = ("ISC_PLATFORM_BUSYWAITNOP", -+ "ISC_PLATFORM_CRYPTORANDOM", - "ISC_PLATFORM_HAVEATOMICSTORE", - "ISC_PLATFORM_HAVEATOMICSTOREQ", - "ISC_PLATFORM_HAVECMPXCHG", -@@ -516,7 +517,8 @@ my @allcond = (@substcond, "NOTYET", "NOLONGER"); - - # enable-xxx/disable-xxx - --my @enablelist = ("developer", -+my @enablelist = ("crypto-rand", -+ "developer", - "fixed-rrset", - "intrinsics", - "native-pkcs11", -@@ -578,6 +580,7 @@ my @help = ( - "\nOptional Features:\n", - " enable-intrinsics enable intrinsic/atomic functions [default=yes]\n", - " enable-native-pkcs11 use native PKCS#11 for all crypto [default=no]\n", -+" enable-crypto-rand use crypto provider for random [default=yes]\n", - " enable-openssl-hash use OpenSSL for hash functions [default=yes]\n", - " enable-filter-aaaa enable filtering of AAAA records [default=yes]\n", - " enable-fixed-rrset enable fixed rrset ordering [default=no]\n", -@@ -625,7 +628,9 @@ my $want_clean = "no"; - my $want_unknown = "no"; - my $unknown_value; - my $enable_intrinsics = "yes"; -+my $cryptolib = ""; - my $enable_native_pkcs11 = "no"; -+my $enable_crypto_rand = "yes"; - my $enable_openssl_hash = "auto"; - my $enable_filter_aaaa = "yes"; - my $enable_fixed_rrset = "no"; -@@ -844,6 +849,10 @@ sub myenable { - if ($val =~ /^yes$/i) { - $enable_native_pkcs11 = "yes"; - } -+ } elsif ($key =~ /^crypto-rand$/i) { -+ if ($val =~ /^no$/i) { -+ $enable_crypto_rand = "no"; -+ } - } elsif ($key =~ /^openssl-hash$/i) { - if ($val =~ /^yes$/i) { - $enable_openssl_hash = "yes"; -@@ -1146,6 +1155,11 @@ if ($verbose) { - } else { - print "native-pkcs11: disabled\n"; - } -+ if ($enable_crypto_rand eq "yes") { -+ print "crypto-rand: enabled\n"; -+ } else { -+ print "crypto-rand: disabled\n"; -+ } - if ($enable_openssl_hash eq "yes") { - print "openssl-hash: enabled\n"; - } else { -@@ -1498,6 +1512,7 @@ if ($enable_intrinsics eq "yes") { - - # enable-native-pkcs11 - if ($enable_native_pkcs11 eq "yes") { -+ $cryptolib = "pkcs11"; - if ($use_openssl eq "auto") { - $use_openssl = "no"; - } -@@ -1707,6 +1722,7 @@ if ($use_openssl eq "yes") { - $openssl_dll = File::Spec->catdir($openssl_path, "@dirlist[0]"); - } - -+ $cryptolib = "openssl"; - $configcond{"OPENSSL"} = 1; - $configdefd{"CRYPTO"} = "OPENSSL"; - $configvar{"OPENSSL_PATH"} = "$openssl_path"; -@@ -2278,6 +2294,15 @@ if ($use_aes eq "yes") { - } - - -+# enable-crypto-rand -+if ($enable_crypto_rand eq "yes") { -+ if (($use_openssl eq "no") && ($enable_native_pkcs11 eq "no")) { -+ die "No crypto provider for random functions\n"; -+ } -+ $configdefp{"ISC_PLATFORM_CRYPTORANDOM"} = "\"$cryptolib\""; -+} -+print "Cryptographic library for DNSSEC: $cryptolib"; -+ - # enable-openssl-hash - if ($enable_openssl_hash eq "yes") { - if ($use_openssl eq "no") { -@@ -3650,6 +3675,7 @@ exit 0; - # --enable-developer partially supported - # --enable-newstats (9.9/9.9sub only) - # --enable-native-pkcs11 supported -+# --enable-crypto-rand supported - # --enable-openssl-version-check included without a way to disable it - # --enable-openssl-hash supported - # --enable-threads included without a way to disable it --- -2.31.1 - diff --git a/SOURCES/bind-9.11-rt46047.patch b/SOURCES/bind-9.11-rt46047.patch deleted file mode 100644 index dc2a8e2..0000000 --- a/SOURCES/bind-9.11-rt46047.patch +++ /dev/null @@ -1,780 +0,0 @@ -From af3b530773231f8cff6548e36962ad1f25e38c5d Mon Sep 17 00:00:00 2001 -From: Evan Hunt -Date: Thu, 28 Sep 2017 10:09:22 -0700 -Subject: [PATCH] completed and corrected the crypto-random change - -4724. [func] By default, BIND now uses the random number - functions provided by the crypto library (i.e., - OpenSSL or a PKCS#11 provider) as a source of - randomness rather than /dev/random. This is - suitable for virtual machine environments - which have limited entropy pools and lack - hardware random number generators. - - This can be overridden by specifying another - entropy source via the "random-device" option - in named.conf, or via the -r command line option; - however, for functions requiring full cryptographic - strength, such as DNSSEC key generation, this - cannot be overridden. In particular, the -r - command line option no longer has any effect on - dnssec-keygen. - - This can be disabled by building with - "configure --disable-crypto-rand". - [RT #31459] [RT #46047] ---- - bin/confgen/keygen.c | 12 +++--- - bin/dnssec/dnssec-keygen.docbook | 24 +++++++---- - bin/dnssec/dnssectool.c | 12 +++--- - bin/named/client.c | 3 +- - bin/named/config.c | 4 +- - bin/named/controlconf.c | 19 +++++--- - bin/named/include/named/server.h | 2 + - bin/named/interfacemgr.c | 1 + - bin/named/query.c | 1 + - bin/named/server.c | 52 ++++++++++++++-------- - bin/nsupdate/nsupdate.c | 4 +- - bin/tests/system/pipelined/pipequeries.c | 4 +- - bin/tests/system/tkey/keycreate.c | 4 +- - bin/tests/system/tkey/keydelete.c | 5 +-- - doc/arm/Bv9ARM-book.xml | 55 +++++++++++++++++------- - doc/arm/notes-rh-changes.xml | 42 ++++++++++++++++++ - doc/arm/notes.xml | 1 + - lib/dns/dst_api.c | 4 +- - lib/dns/include/dst/dst.h | 14 +++++- - lib/dns/openssl_link.c | 3 +- - lib/isc/include/isc/entropy.h | 48 +++++++++++++++------ - lib/isc/include/isc/random.h | 26 +++++++---- - lib/isccfg/namedconf.c | 2 +- - 23 files changed, 240 insertions(+), 102 deletions(-) - create mode 100644 doc/arm/notes-rh-changes.xml - -diff --git a/bin/confgen/keygen.c b/bin/confgen/keygen.c -index bd269e7..1ac775f 100644 ---- a/bin/confgen/keygen.c -+++ b/bin/confgen/keygen.c -@@ -161,17 +161,15 @@ generate_key(isc_mem_t *mctx, const char *randomfile, dns_secalg_t alg, - - DO("create entropy context", isc_entropy_create(mctx, &ectx)); - -- if (randomfile != NULL && strcmp(randomfile, "keyboard") == 0) { -- randomfile = NULL; -- open_keyboard = ISC_ENTROPY_KEYBOARDYES; -- } - #ifdef ISC_PLATFORM_CRYPTORANDOM -- if (randomfile != NULL && -- strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -- randomfile = NULL; -+ if (randomfile == NULL) { - isc_entropy_usehook(ectx, true); - } - #endif -+ if (randomfile != NULL && strcmp(randomfile, "keyboard") == 0) { -+ randomfile = NULL; -+ open_keyboard = ISC_ENTROPY_KEYBOARDYES; -+ } - DO("start entropy source", isc_entropy_usebestsource(ectx, - &entropy_source, - randomfile, -diff --git a/bin/dnssec/dnssec-keygen.docbook b/bin/dnssec/dnssec-keygen.docbook -index bd19e1d..2c09b30 100644 ---- a/bin/dnssec/dnssec-keygen.docbook -+++ b/bin/dnssec/dnssec-keygen.docbook -@@ -349,15 +349,23 @@ - -r randomdev - - -- Specifies the source of randomness. If the operating -- system does not provide a /dev/random -- or equivalent device, the default source of randomness -- is keyboard input. randomdev -- specifies -+ Specifies a source of randomness. Normally, when generating -+ DNSSEC keys, this option has no effect; the random number -+ generation function provided by the cryptographic library will -+ be used. -+ -+ -+ If that behavior is disabled at compile time, however, -+ the specified file will be used as entropy source -+ for key generation. randomdev is - the name of a character device or file containing random -- data to be used instead of the default. The special value -- keyboard indicates that keyboard -- input should be used. -+ data to be used. The special value keyboard -+ indicates that keyboard input should be used. -+ -+ -+ The default is /dev/random if the -+ operating system provides it or an equivalent device; -+ if not, the default source of randomness is keyboard input. - - - -diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c -index 2a0f9c6..6fcd411 100644 ---- a/bin/dnssec/dnssectool.c -+++ b/bin/dnssec/dnssectool.c -@@ -241,18 +241,16 @@ setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) { - ISC_LIST_INIT(sources); - } - -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ if (randomfile == NULL) { -+ isc_entropy_usehook(*ectx, true); -+ } -+#endif - if (randomfile != NULL && strcmp(randomfile, "keyboard") == 0) { - usekeyboard = ISC_ENTROPY_KEYBOARDYES; - randomfile = NULL; - } - --#ifdef ISC_PLATFORM_CRYPTORANDOM -- if (randomfile != NULL && -- strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -- randomfile = NULL; -- isc_entropy_usehook(*ectx, true); -- } --#endif - result = isc_entropy_usebestsource(*ectx, &source, randomfile, - usekeyboard); - -diff --git a/bin/named/client.c b/bin/named/client.c -index 4a50ad9..4d140e8 100644 ---- a/bin/named/client.c -+++ b/bin/named/client.c -@@ -1768,7 +1768,8 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message, - - isc_buffer_init(&buf, cookie, sizeof(cookie)); - isc_stdtime_get(&now); -- isc_random_get(&nonce); -+ nonce = ((isc_rng_random(ns_g_server->rngctx) << 16) | -+ isc_rng_random(ns_g_server->rngctx)); - - compute_cookie(client, now, nonce, ns_g_server->secret, &buf); - -diff --git a/bin/named/config.c b/bin/named/config.c -index 9b343fa..5e663c6 100644 ---- a/bin/named/config.c -+++ b/bin/named/config.c -@@ -98,7 +98,9 @@ options {\n\ - # pid-file \"" NS_LOCALSTATEDIR "/run/named/named.pid\"; /* or /lwresd.pid */\n\ - port 53;\n\ - prefetch 2 9;\n" --#ifdef PATH_RANDOMDEV -+#if defined(ISC_PLATFORM_CRYPTORANDOM) -+" random-device none;\n" -+#elif defined(PATH_RANDOMDEV) - " random-device \"" PATH_RANDOMDEV "\";\n" - #endif - " recursing-file \"named.recursing\";\n\ -diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c -index 9fdf49b..42128dc 100644 ---- a/bin/named/controlconf.c -+++ b/bin/named/controlconf.c -@@ -327,9 +327,10 @@ log_invalid(isccc_ccmsg_t *ccmsg, isc_result_t result) { - - static void - control_recvmessage(isc_task_t *task, isc_event_t *event) { -- controlconnection_t *conn; -- controllistener_t *listener; -- controlkey_t *key; -+ controlconnection_t *conn = NULL; -+ controllistener_t *listener = NULL; -+ ns_server_t *server = NULL; -+ controlkey_t *key = NULL; - isccc_sexpr_t *request = NULL; - isccc_sexpr_t *response = NULL; - uint32_t algorithm; -@@ -340,16 +341,17 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) { - isc_buffer_t *text; - isc_result_t result; - isc_result_t eresult; -- isccc_sexpr_t *_ctrl; -+ isccc_sexpr_t *_ctrl = NULL; - isccc_time_t sent; - isccc_time_t exp; - uint32_t nonce; -- isccc_sexpr_t *data; -+ isccc_sexpr_t *data = NULL; - - REQUIRE(event->ev_type == ISCCC_EVENT_CCMSG); - - conn = event->ev_arg; - listener = conn->listener; -+ server = listener->controls->server; - algorithm = DST_ALG_UNKNOWN; - secret.rstart = NULL; - text = NULL; -@@ -462,8 +464,11 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) { - * Establish nonce. - */ - if (conn->nonce == 0) { -- while (conn->nonce == 0) -- isc_random_get(&conn->nonce); -+ while (conn->nonce == 0) { -+ uint16_t r1 = isc_rng_random(server->rngctx); -+ uint16_t r2 = isc_rng_random(server->rngctx); -+ conn->nonce = (r1 << 16) | r2; -+ } - eresult = ISC_R_SUCCESS; - } else - eresult = ns_control_docommand(request, listener->readonly, &text); -diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h -index 4fd0194..0ba2627 100644 ---- a/bin/named/include/named/server.h -+++ b/bin/named/include/named/server.h -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -135,6 +136,7 @@ struct ns_server { - char * lockfile; - - uint16_t transfer_tcp_message_size; -+ isc_rng_t * rngctx; - }; - - struct ns_altsecret { -diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c -index 93aac31..e12fad9 100644 ---- a/bin/named/interfacemgr.c -+++ b/bin/named/interfacemgr.c -@@ -17,6 +17,7 @@ - - #include - #include -+#include - #include - #include - #include -diff --git a/bin/named/query.c b/bin/named/query.c -index 58b5914..edf42d2 100644 ---- a/bin/named/query.c -+++ b/bin/named/query.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/bin/named/server.c b/bin/named/server.c -index b2ae57c..cca7fe8 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -8279,21 +8279,32 @@ load_configuration(const char *filename, ns_server_t *server, - * Open the source of entropy. - */ - if (first_time) { -+ const char *randomdev = NULL; -+ int level = ISC_LOG_ERROR; - obj = NULL; - result = ns_config_get(maps, "random-device", &obj); -- if (result != ISC_R_SUCCESS) { -+ if (result == ISC_R_SUCCESS) { -+ if (!cfg_obj_isvoid(obj)) { -+ level = ISC_LOG_INFO; -+ randomdev = cfg_obj_asstring(obj); -+ } -+ } -+ if (randomdev == NULL) { -+#ifdef ISC_PLATFORM_CRYPTORANDOM -+ isc_entropy_usehook(ns_g_entropy, true); -+#else -+ if ((obj != NULL) && !cfg_obj_isvoid(obj)) -+ level = ISC_LOG_INFO; - isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, -- NS_LOGMODULE_SERVER, ISC_LOG_INFO, -+ NS_LOGMODULE_SERVER, level, - "no source of entropy found"); -+ if ((obj == NULL) || cfg_obj_isvoid(obj)) { -+ CHECK(ISC_R_FAILURE); -+ } -+#endif - } else { -- const char *randomdev = cfg_obj_asstring(obj); --#ifdef ISC_PLATFORM_CRYPTORANDOM -- if (strcmp(randomdev, ISC_PLATFORM_CRYPTORANDOM) == 0) -- isc_entropy_usehook(ns_g_entropy, true); --#else -- int level = ISC_LOG_ERROR; - result = isc_entropy_createfilesource(ns_g_entropy, -- randomdev); -+ randomdev); - #ifdef PATH_RANDOMDEV - if (ns_g_fallbackentropy != NULL) { - level = ISC_LOG_INFO; -@@ -8304,8 +8315,8 @@ load_configuration(const char *filename, ns_server_t *server, - NS_LOGCATEGORY_GENERAL, - NS_LOGMODULE_SERVER, - level, -- "could not open entropy source " -- "%s: %s", -+ "could not open " -+ "entropy source %s: %s", - randomdev, - isc_result_totext(result)); - } -@@ -8325,7 +8336,6 @@ load_configuration(const char *filename, ns_server_t *server, - } - isc_entropy_detach(&ns_g_fallbackentropy); - } --#endif - #endif - } - -@@ -9097,6 +9107,7 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) { - server->in_roothints = NULL; - server->blackholeacl = NULL; - server->keepresporder = NULL; -+ server->rngctx = NULL; - - /* Must be first. */ - CHECKFATAL(dst_lib_init2(ns_g_mctx, ns_g_entropy, -@@ -9123,6 +9134,9 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) { - CHECKFATAL(dns_tkeyctx_create(ns_g_mctx, ns_g_entropy, - &server->tkeyctx), - "creating TKEY context"); -+ server->rngctx = NULL; -+ CHECKFATAL(isc_rng_create(ns_g_mctx, ns_g_entropy, &server->rngctx), -+ "creating random numbers context"); - - /* - * Setup the server task, which is responsible for coordinating -@@ -9329,7 +9343,8 @@ ns_server_destroy(ns_server_t **serverp) { - - if (server->zonemgr != NULL) - dns_zonemgr_detach(&server->zonemgr); -- -+ if (server->rngctx != NULL) -+ isc_rng_detach(&server->rngctx); - if (server->tkeyctx != NULL) - dns_tkeyctx_destroy(&server->tkeyctx); - -@@ -13366,10 +13381,10 @@ newzone_cfgctx_destroy(void **cfgp) { - - static isc_result_t - generate_salt(unsigned char *salt, size_t saltlen) { -- int i, n; -+ size_t i, n; - union { - unsigned char rnd[256]; -- uint32_t rnd32[64]; -+ uint16_t rnd16[128]; - } rnd; - unsigned char text[512 + 1]; - isc_region_t r; -@@ -13379,9 +13394,10 @@ generate_salt(unsigned char *salt, size_t saltlen) { - if (saltlen > 256U) - return (ISC_R_RANGE); - -- n = (int) (saltlen + sizeof(uint32_t) - 1) / sizeof(uint32_t); -- for (i = 0; i < n; i++) -- isc_random_get(&rnd.rnd32[i]); -+ n = (saltlen + sizeof(uint16_t) - 1) / sizeof(uint16_t); -+ for (i = 0; i < n; i++) { -+ rnd.rnd16[i] = isc_rng_random(ns_g_server->rngctx); -+ } - - memmove(salt, rnd.rnd, saltlen); - -diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c -index 7f15cbc..458aa76 100644 ---- a/bin/nsupdate/nsupdate.c -+++ b/bin/nsupdate/nsupdate.c -@@ -289,9 +289,7 @@ setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) { - } - - #ifdef ISC_PLATFORM_CRYPTORANDOM -- if (randomfile != NULL && -- strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -- randomfile = NULL; -+ if (randomfile == NULL) { - isc_entropy_usehook(*ectx, true); - } - #endif -diff --git a/bin/tests/system/pipelined/pipequeries.c b/bin/tests/system/pipelined/pipequeries.c -index 95b65bf..7a81d4e 100644 ---- a/bin/tests/system/pipelined/pipequeries.c -+++ b/bin/tests/system/pipelined/pipequeries.c -@@ -280,9 +280,7 @@ main(int argc, char *argv[]) { - ectx = NULL; - RUNCHECK(isc_entropy_create(mctx, &ectx)); - #ifdef ISC_PLATFORM_CRYPTORANDOM -- if (randomfile != NULL && -- strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -- randomfile = NULL; -+ if (randomfile == NULL) { - isc_entropy_usehook(ectx, true); - } - #endif -diff --git a/bin/tests/system/tkey/keycreate.c b/bin/tests/system/tkey/keycreate.c -index 3236968..4fa77b6 100644 ---- a/bin/tests/system/tkey/keycreate.c -+++ b/bin/tests/system/tkey/keycreate.c -@@ -255,9 +255,7 @@ main(int argc, char *argv[]) { - ectx = NULL; - RUNCHECK(isc_entropy_create(mctx, &ectx)); - #ifdef ISC_PLATFORM_CRYPTORANDOM -- if (randomfile != NULL && -- strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -- randomfile = NULL; -+ if (randomfile == NULL) { - isc_entropy_usehook(ectx, true); - } - #endif -diff --git a/bin/tests/system/tkey/keydelete.c b/bin/tests/system/tkey/keydelete.c -index 43fb6b0..105e151 100644 ---- a/bin/tests/system/tkey/keydelete.c -+++ b/bin/tests/system/tkey/keydelete.c -@@ -171,6 +171,7 @@ main(int argc, char **argv) { - randomfile = argv[2]; - argv += 2; - argc -= 2; -+ POST(argc); - } - keyname = argv[1]; - -@@ -182,9 +183,7 @@ main(int argc, char **argv) { - ectx = NULL; - RUNCHECK(isc_entropy_create(mctx, &ectx)); - #ifdef ISC_PLATFORM_CRYPTORANDOM -- if (randomfile != NULL && -- strcmp(randomfile, ISC_PLATFORM_CRYPTORANDOM) == 0) { -- randomfile = NULL; -+ if (randomfile == NULL) { - isc_entropy_usehook(ectx, true); - } - #endif -diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml -index ca98726..1f9df2c 100644 ---- a/doc/arm/Bv9ARM-book.xml -+++ b/doc/arm/Bv9ARM-book.xml -@@ -5034,22 +5034,45 @@ badresp:1,adberr:0,findfail:0,valfail:0] - random-device - - -- This specifies a source of entropy to be used by the server. Entropy is -- primarily needed -- for DNSSEC operations, such as TKEY transactions and dynamic -- update of signed -- zones. This option specifies the device (or file) from which -- to read -- entropy. If it is a file, operations requiring entropy will -- fail when the -- file has been exhausted. If random-device is not specified, the default value -- is -- /dev/random -- (or equivalent) when present, and none otherwise. The -- random-device option takes -- effect during -- the initial configuration load at server startup time and -- is ignored on subsequent reloads. -+ Specifies a source of entropy to be used by the server. -+ This is a device or file from which to read entropy. -+ If it is a file, operations requiring entropy -+ will fail when the file has been exhausted. -+ -+ -+ Entropy is needed for cryptographic operations such as -+ TKEY transactions, dynamic update of signed zones, and -+ generation of TSIG session keys. It is also used for -+ seeding and stirring the pseudo-random number generator, -+ which is used for less critical functions requiring -+ randomness such as generation of DNS message transaction -+ ID's. -+ -+ -+ If random-device is not specified, or -+ if it is set to none, entropy will be -+ read from the random number generation function supplied -+ by the cryptographic library with which BIND was linked -+ (i.e. OpenSSL or a PKCS#11 provider). -+ -+ -+ The random-device option takes -+ effect during the initial configuration load at server -+ startup time and is ignored on subsequent reloads. -+ -+ -+ If BIND is built with -+ configure --disable-crypto-rand, then -+ entropy is not sourced from the -+ cryptographic library. In this case, if -+ random-device is not specified, the -+ default value is the system random device, -+ /dev/random or the equivalent. -+ This default can be overridden with -+ configure --with-randomdev. -+ If no system random device exists, then no entropy source -+ will be configured, and named will only -+ be able to use pseudo-random numbers. - - - -diff --git a/doc/arm/notes-rh-changes.xml b/doc/arm/notes-rh-changes.xml -new file mode 100644 -index 0000000..89a4961 ---- /dev/null -+++ b/doc/arm/notes-rh-changes.xml -@@ -0,0 +1,42 @@ -+ -+ -+
Red Hat Specific Changes -+ -+ -+ -+ By default, BIND now uses the random number generation functions -+ in the cryptographic library (i.e., OpenSSL or a PKCS#11 -+ provider) as a source of high-quality randomness rather than -+ /dev/random. This is suitable for virtual -+ machine environments, which may have limited entropy pools and -+ lack hardware random number generators. -+ -+ -+ This can be overridden by specifying another entropy source via -+ the random-device option in -+ named.conf, or via the -r -+ command line option. However, for functions requiring full -+ cryptographic strength, such as DNSSEC key generation, this -+ cannot be overridden. In particular, the -+ -r command line option no longer has any -+ effect on dnssec-keygen. -+ -+ -+ This can be disabled by building with -+ configure --disable-crypto-rand, in which -+ case /dev/random will be the default -+ entropy source. [RT #31459] [RT #46047] -+ -+ -+ -+
-+ -diff --git a/doc/arm/notes.xml b/doc/arm/notes.xml -index a5e42c0..f8cb1f9 100644 ---- a/doc/arm/notes.xml -+++ b/doc/arm/notes.xml -@@ -47,6 +47,7 @@ - - - -+ - - - -diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c -index aa54afc..2156384 100644 ---- a/lib/dns/dst_api.c -+++ b/lib/dns/dst_api.c -@@ -2017,10 +2017,12 @@ dst__entropy_getdata(void *buf, unsigned int len, bool pseudo) { - else - flags |= ISC_ENTROPY_BLOCKING; - #ifdef ISC_PLATFORM_CRYPTORANDOM -+ /* get entropy directly from crypto provider */ - return (dst_random_getdata(buf, len, NULL, flags)); - #else -+ /* get entropy from entropy source or hook function */ - return (isc_entropy_getdata(dst_entropy_pool, buf, len, NULL, flags)); --#endif -+#endif /* ISC_PLATFORM_CRYPTORANDOM */ - #endif /* PKCS11CRYPTO */ - } - -diff --git a/lib/dns/include/dst/dst.h b/lib/dns/include/dst/dst.h -index 3aba028..180c841 100644 ---- a/lib/dns/include/dst/dst.h -+++ b/lib/dns/include/dst/dst.h -@@ -163,8 +163,18 @@ isc_result_t - dst_random_getdata(void *data, unsigned int length, - unsigned int *returned, unsigned int flags); - /*%< -- * \brief Return data from the crypto random generator. -- * Specialization of isc_entropy_getdata(). -+ * Gets random data from the random generator provided by the -+ * crypto library, if BIND was built with --enable-crypto-rand. -+ * -+ * See isc_entropy_getdata() for parameter usage. Normally when -+ * this function is available, it will be set up as a hook in the -+ * entropy context, so that isc_entropy_getdata() is a front-end to -+ * this function. -+ * -+ * Returns: -+ * \li ISC_R_SUCCESS on success -+ * \li ISC_R_NOTIMPLEMENTED if BIND is built with --disable-crypto-rand -+ * \li DST_R_OPENSSLFAILURE, DST_R_CRYPTOFAILURE, or other codes on error - */ - - bool -diff --git a/lib/dns/openssl_link.c b/lib/dns/openssl_link.c -index 3f4f822..cfdc757 100644 ---- a/lib/dns/openssl_link.c -+++ b/lib/dns/openssl_link.c -@@ -484,7 +484,8 @@ dst__openssl_getengine(const char *engine) { - - isc_result_t - dst_random_getdata(void *data, unsigned int length, -- unsigned int *returned, unsigned int flags) { -+ unsigned int *returned, unsigned int flags) -+{ - #ifdef ISC_PLATFORM_CRYPTORANDOM - #ifndef DONT_REQUIRE_DST_LIB_INIT - INSIST(dst__memory_pool != NULL); -diff --git a/lib/isc/include/isc/entropy.h b/lib/isc/include/isc/entropy.h -index f32c9dc..bed276b 100644 ---- a/lib/isc/include/isc/entropy.h -+++ b/lib/isc/include/isc/entropy.h -@@ -189,9 +189,8 @@ isc_entropy_createcallbacksource(isc_entropy_t *ent, - /*!< - * \brief Create an entropy source that is polled via a callback. - * -- * This would -- * be used when keyboard input is used, or a GUI input method. It can -- * also be used to hook in any external entropy source. -+ * This would be used when keyboard input is used, or a GUI input method. -+ * It can also be used to hook in any external entropy source. - * - * Samples are added via isc_entropy_addcallbacksample(), below. - * _addcallbacksample() is the only function which may be called from -@@ -232,15 +231,32 @@ isc_result_t - isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length, - unsigned int *returned, unsigned int flags); - /*!< -- * \brief Extract data from the entropy pool. This may load the pool from various -- * sources. -+ * \brief Get random data from entropy pool 'ent'. - * -- * Do this by stirring the pool and returning a part of hash as randomness. -- * Note that no secrets are given away here since parts of the hash are -- * xored together before returned. -+ * If a hook has been set up using isc_entropy_sethook() and -+ * isc_entropy_usehook(), then the hook function will be called to get -+ * random data. - * -- * Honor the request from the caller to only return good data, any data, -- * etc. -+ * Otherwise, randomness is extracted from the entropy pool set up in BIND. -+ * This may cause the pool to be loaded from various sources. Ths is done -+ * by stirring the pool and returning a part of hash as randomness. -+ * (Note that no secrets are given away here since parts of the hash are -+ * XORed together before returning.) -+ * -+ * 'flags' may contain ISC_ENTROPY_GOODONLY, ISC_ENTROPY_PARTIAL, or -+ * ISC_ENTROPY_BLOCKING. These will be honored if the hook function is -+ * not in use. If it is, the flags will be passed to the hook function -+ * but it may ignore them. -+ * -+ * Up to 'length' bytes of randomness are retrieved and copied into 'data'. -+ * (If 'returned' is not NULL, and the number of bytes copied is less than -+ * 'length' - which may happen if ISC_ENTROPY_PARTIAL was used - then the -+ * number of bytes copied will be stored in *returned.) -+ * -+ * Returns: -+ * \li ISC_R_SUCCESS on success -+ * \li ISC_R_NOENTROPY if entropy pool is empty -+ * \li other error codes are possible when a hook is in use - */ - - void -@@ -305,13 +321,21 @@ isc_entropy_usebestsource(isc_entropy_t *ectx, isc_entropysource_t **source, - void - isc_entropy_usehook(isc_entropy_t *ectx, bool onoff); - /*!< -- * \brief Mark/unmark the given entropy structure as being hooked. -+ * \brief Configure entropy context 'ectx' to use the hook function -+ * -+ * Sets the entropy context to call the hook function for random number -+ * generation, if such a function has been configured via -+ * isc_entropy_sethook(), whenever isc_entropy_getdata() is called. - */ - - void - isc_entropy_sethook(isc_entropy_getdata_t myhook); - /*!< -- * \brief Set the getdata hook (e.g., for a crypto random generator). -+ * \brief Set the hook function. -+ * -+ * The hook function is a global value: only one hook function -+ * can be set in the system. Individual entropy contexts may be -+ * configured to use it, or not, by calling isc_entropy_usehook(). - */ - - ISC_LANG_ENDDECLS -diff --git a/lib/isc/include/isc/random.h b/lib/isc/include/isc/random.h -index f38e80d..3cb1c56 100644 ---- a/lib/isc/include/isc/random.h -+++ b/lib/isc/include/isc/random.h -@@ -19,13 +19,23 @@ - #include - - /*! \file isc/random.h -- * \brief Implements a random state pool which will let the caller return a -- * series of possibly non-reproducible random values. -+ * \brief Implements pseudo random number generators. - * -- * Note that the -- * strength of these numbers is not all that high, and should not be -- * used in cryptography functions. It is useful for jittering values -- * a bit here and there, such as timeouts, etc. -+ * Two pseudo-random number generators are implemented, in isc_random_* -+ * and isc_rng_*. Neither one is very strong; they should not be used -+ * in cryptography functions. -+ * -+ * isc_random_* is based on arc4random if it is available on the system. -+ * Otherwise it is based on the posix srand() and rand() functions. -+ * It is useful for jittering values a bit here and there, such as -+ * timeouts, etc, but should not be relied upon to generate -+ * unpredictable sequences (for example, when choosing transaction IDs). -+ * -+ * isc_rng_* is based on ChaCha20, and is seeded and stirred from the -+ * system entropy source. It is stronger than isc_random_* and can -+ * be used for generating unpredictable sequences. It is still not as -+ * good as using system entropy directly (see entropy.h) and should not -+ * be used for cryptographic functions such as key generation. - */ - - ISC_LANG_BEGINDECLS -@@ -113,8 +123,8 @@ isc_rng_random(isc_rng_t *rngctx); - uint16_t - isc_rng_uniformrandom(isc_rng_t *rngctx, uint16_t upper_bound); - /*%< -- * Returns a uniformly distributed pseudo random 16-bit unsigned -- * integer. -+ * Returns a uniformly distributed pseudo-random 16-bit unsigned integer -+ * less than 'upper_bound'. - */ - - ISC_LANG_ENDDECLS -diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c -index e74c93b..212194e 100644 ---- a/lib/isccfg/namedconf.c -+++ b/lib/isccfg/namedconf.c -@@ -1109,7 +1109,7 @@ options_clauses[] = { - { "pid-file", &cfg_type_qstringornone, 0 }, - { "port", &cfg_type_uint32, 0 }, - { "querylog", &cfg_type_boolean, 0 }, -- { "random-device", &cfg_type_qstring, 0 }, -+ { "random-device", &cfg_type_qstringornone, 0 }, - { "recursing-file", &cfg_type_qstring, 0 }, - { "recursive-clients", &cfg_type_uint32, 0 }, - { "reserved-sockets", &cfg_type_uint32, 0 }, --- -2.26.2 - diff --git a/SOURCES/bind-9.11-serve-stale.patch b/SOURCES/bind-9.11-serve-stale.patch deleted file mode 100644 index 764a40c..0000000 --- a/SOURCES/bind-9.11-serve-stale.patch +++ /dev/null @@ -1,3862 +0,0 @@ -From d55a57427ee696dec51149950478394e43019607 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Thu, 7 Nov 2019 14:31:03 +0100 -Subject: [PATCH] Implement serve-stale in 9.11 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Squashed commit of the following: - -commit 32f47f36e545223b2a4757588d7bd4af8c5f5760 -Author: Petr Menšík -Date: Tue Sep 3 18:45:54 2019 +0200 - - convert serve_stale to db_test - - Manual checkout from commit e8f61dd315c5d1c88915bb79361182241e42e47a. - Use test modified for cmocka, including serve-stale tests. - -commit 071eb1fb0786f6d614955813d99c3caabff33383 -Author: Michał Kępień -Date: Fri Apr 27 09:13:26 2018 +0200 - - Detect recursion loops during query processing - - Interrupt query processing when query_recurse() attempts to ask the same - name servers for the same QNAME/QTYPE tuple for two times in a row as - this indicates that query processing may be stuck for an indeterminate - period of time, e.g. due to interactions between features able to - restart query_lookup(). - - (cherry picked from commit 46bb4dd124ed031d4c219d1e37a3c6322092e30c) - -commit c12090bc361c7fa4522ace73899e778e44e9b295 -Author: Petr Menšík -Date: Mon Sep 2 11:12:32 2019 +0200 - - Fix test name used in whole test-suite - - Correct name is serve-stale - -commit ff4d826f295d268a248ca06941d65c903e1b405c -Author: Petr Menšík -Date: Fri Aug 30 17:43:28 2019 +0200 - - Clean files in more generic rules - -commit 8d81ed15eda9a2a11e1433d1fdddacfc772708b6 -Author: Petr Menšík -Date: Thu Aug 29 21:27:57 2019 +0200 - - [rt46602] Pass port numbers to tests via environment variables - - Manually applied commit f5d8f079008b648d2e343543e66dd728054c6101 - -commit 94fafa477891576286def8c4041ad127734af2d1 -Author: Tony Finch -Date: Tue Apr 10 16:17:57 2018 +0100 - - Move serve-stale logging to its own category, so that its verbosity can be curtailed. - - (cherry picked from commit 4b442c309dfb2c8880b19af4133047655bb734df) - -commit e0c884bee98c3d2533dfaa667f58c6a80d8a3a00 -Author: Michał Kępień -Date: Fri Apr 27 09:13:26 2018 +0200 - - Prevent check_stale_header() from leaking rdataset headers - - check_stale_header() fails to update the pointer to the previous header - while processing rdataset headers eligible for serve-stale, thus - enabling rdataset headers to be leaked (i.e. disassociated from a node - and left on the relevant TTL heap) while iterating through a node. This - can lead to several different assertion failures. Add the missing - pointer update. - - (cherry picked from commit 391fac1fc8d2e470287b5cc4344b3adb90c6f54a) - -commit d724cc1d80ee8d46113eaf82549d49636739b67c -Author: Matthijs Mekking -Date: Thu Jan 24 10:24:44 2019 +0100 - - Print in dump-file stale ttl - - This change makes rndc dumpdb correctly print the "; stale" line. - It also provides extra information on how long this data may still - be served to clients (in other words how long the stale RRset may - still be used). - - (cherry picked from commit 924ebc605db798e2a383ee5eaaebad739e7c789c) - -commit 625da4bd4590ac6108bb30eddd23ceffb245ae49 -Author: Michał Kępień -Date: Mon Oct 22 15:26:45 2018 +0200 - - Check serve-stale behavior with a cold cache - - Ensure that serve-stale works as expected when returning stale answers - is enabled, the authoritative server does not respond, and there is no - cached answer available. - - (cherry picked from commit 27cfe83a388147edfa0451b28c06c746912ea684) - -commit d67ae10461c409fdafdbbe64f857db2552b71059 -Author: Michał Kępień -Date: Mon Oct 22 15:26:45 2018 +0200 - - Check TTL of stale answers - - Make sure that stale answers returned when the serve-stale feature is - enabled have a TTL matching the value of the stale-answer-ttl setting. - - (cherry picked from commit 893ab37ce78c658215bd3a019f25afe795b37d5a) - -commit 50459107805e68e4a63a8e497bf58ef3ce013ddb -Author: Michał Kępień -Date: Mon Jul 9 14:35:12 2018 +0200 - - Do not use Net::DNS::Nameserver in the "serve-stale" system test - - Net::DNS versions older than 0.67 respond to queries sent to a - Net::DNS::Nameserver even if its ReplyHandler returns undef. This makes - the "serve-stale" system test fail as it takes advantage of the newer - behavior. Since the latest Net::DNS version available with stock - RHEL/CentOS 6 packages is 0.65 and we officially support that operating - system, bin/tests/system/serve-stale/ans2/ans.pl should behave - consistently for various Net::DNS versions. Ensure that by reworking it - so that it does not use Net::DNS::Nameserver. - - (cherry picked from commit c4209418a50c09142375f7edadca731c526f3d3a) - -commit 4b5befc714bb386bd245b1c14ce3bce5ae6fb5fa -Author: Petr Menšík -Date: Tue Jun 5 21:38:29 2018 +0200 - - Fix server-stale requirement, skip without Time::HiRes - - (cherry picked from commit 7a0c7bf9c8e6a724e52635eed213ad25b9504e66) - -commit 5ce51a3a7e5ef3087c4d022e3fca42fb2fd0c996 -Author: Ondřej Surý -Date: Wed Oct 18 13:01:14 2017 +0200 - - [rt46602] Update server-stale test to run on port passed from run.sh script - - (cherry picked from commit f83ebd34b9555a5a834c58146035173bcbd01dda) - -commit 3954a9bf3437f6fab050294a7f2f954a23d161ec -Author: Ondřej Surý -Date: Wed Oct 18 14:18:59 2017 +0200 - - [rt46602] Add serve-stale working files to .gitignore - - (cherry picked from commit cba162e70e7fac43435a606106841a69ce468526) - -commit 112aa21f5fa875494820e4d1eb70e41e10e1aae7 -Author: Mark Andrews -Date: Thu Oct 12 15:33:47 2017 +1100 - - test for Net::DNS::Nameserver - - (cherry picked from commit 5b60d0608ac2852753180b762d1917163f9dc315) - -commit 9d610e46af8a636f44914cee4cf8b2016054db1e -Author: Mark Andrews -Date: Thu Oct 12 15:19:45 2017 +1100 - - add Net::DNS prerequiste test - - (cherry picked from commit fa644181f51559da3e3913acd72dbc3f6d916e71) - -commit e4ea7ba88d9a9a0c79579400c68a5dabe03e8572 -Author: Mark Andrews -Date: Wed Sep 6 19:26:10 2017 +1000 - - add quotes arount $send_response - - (cherry picked from commit 023ab19634b287543169e9b7b5259f3126cd60ff) - -commit 0af0c5d33c2de34da164571288b650282c6be10a -Author: Mark Andrews -Date: Thu Nov 23 16:11:49 2017 +1100 - - initalise serve_stale_ttl - - (cherry picked from commit 2f4e0e5a81278f59037bf06ae99ff52245cd57e9) - -commit fbadd90ee81863d617c4c319d5f0079b877fe102 -Author: Evan Hunt -Date: Thu Sep 14 11:48:21 2017 -0700 - - [master] add thanks to APNIC and add missing note for serve-stale - -commit deb8adaa59955970b9d2f2fe58060a3cbf08312b -Author: Mark Andrews -Date: Wed Sep 6 12:16:10 2017 +1000 - - silence 'staleanswersok' may be used uninitialized in this function warning. [RT #14147 - -commit 0e2d03823768dc545015e6ce309777210f4a9f85 -Author: Petr Menšík -Date: Thu Aug 29 19:57:58 2019 +0200 - - More fixes to merge - -commit 360e25ffe7623ea0a2eec49395001f4940967776 -Author: Mark Andrews -Date: Wed Sep 6 09:58:29 2017 +1000 - - 4700. [func] Serving of stale answers is now supported. This - allows named to provide stale cached answers when - the authoritative server is under attack. - See max-stale-ttl, stale-answer-enable, - stale-answer-ttl. [RT #44790] - -Signed-off-by: Petr Menšík ---- - bin/named/config.c | 9 +- - bin/named/control.c | 2 + - bin/named/include/named/control.h | 1 + - bin/named/include/named/log.h | 1 + - bin/named/include/named/query.h | 15 + - bin/named/include/named/server.h | 13 +- - bin/named/log.c | 1 + - bin/named/query.c | 164 +++++- - bin/named/server.c | 177 +++++- - bin/named/statschannel.c | 6 + - bin/rndc/rndc.c | 2 + - bin/rndc/rndc.docbook | 19 + - bin/tests/system/chain/prereq.sh | 7 + - bin/tests/system/conf.sh.in | 2 +- - bin/tests/system/dyndb/driver/db.c | 2 + - bin/tests/system/serve-stale/.gitignore | 11 + - bin/tests/system/serve-stale/ans2/ans.pl.in | 178 ++++++ - bin/tests/system/serve-stale/clean.sh | 15 + - .../system/serve-stale/ns1/named1.conf.in | 35 ++ - .../system/serve-stale/ns1/named2.conf.in | 35 ++ - bin/tests/system/serve-stale/ns1/root.db | 5 + - .../system/serve-stale/ns3/named.conf.in | 35 ++ - bin/tests/system/serve-stale/prereq.sh | 38 ++ - bin/tests/system/serve-stale/setup.sh | 13 + - bin/tests/system/serve-stale/tests.sh | 536 ++++++++++++++++++ - doc/arm/Bv9ARM-book.xml | 77 ++- - doc/arm/logging-categories.xml | 11 + - doc/arm/notes-rh-changes.xml | 14 +- - doc/misc/options | 10 + - lib/bind9/check.c | 78 ++- - lib/dns/cache.c | 38 +- - lib/dns/db.c | 22 + - lib/dns/ecdb.c | 4 +- - lib/dns/include/dns/cache.h | 21 + - lib/dns/include/dns/db.h | 35 ++ - lib/dns/include/dns/rdataset.h | 11 + - lib/dns/include/dns/resolver.h | 43 +- - lib/dns/include/dns/types.h | 6 + - lib/dns/include/dns/view.h | 3 + - lib/dns/master.c | 14 +- - lib/dns/masterdump.c | 23 + - lib/dns/rbtdb.c | 207 ++++++- - lib/dns/resolver.c | 79 ++- - lib/dns/sdb.c | 4 +- - lib/dns/sdlz.c | 4 +- - lib/dns/tests/db_test.c | 198 ++++++- - lib/dns/view.c | 3 + - lib/isccfg/namedconf.c | 5 + - 48 files changed, 2126 insertions(+), 106 deletions(-) - create mode 100644 bin/tests/system/serve-stale/.gitignore - create mode 100644 bin/tests/system/serve-stale/ans2/ans.pl.in - create mode 100644 bin/tests/system/serve-stale/clean.sh - create mode 100644 bin/tests/system/serve-stale/ns1/named1.conf.in - create mode 100644 bin/tests/system/serve-stale/ns1/named2.conf.in - create mode 100644 bin/tests/system/serve-stale/ns1/root.db - create mode 100644 bin/tests/system/serve-stale/ns3/named.conf.in - create mode 100644 bin/tests/system/serve-stale/prereq.sh - create mode 100644 bin/tests/system/serve-stale/setup.sh - create mode 100755 bin/tests/system/serve-stale/tests.sh - -diff --git a/bin/named/config.c b/bin/named/config.c -index 9e071bb..d2cd3bc 100644 ---- a/bin/named/config.c -+++ b/bin/named/config.c -@@ -182,13 +182,14 @@ options {\n\ - #ifdef HAVE_LMDB - " lmdb-mapsize 32M;\n" - #endif --" max-acache-size 16M;\n\ -- max-cache-size 90%;\n\ -+" max-cache-size 90%;\n\ -+ max-acache-size 16M;\n\ - max-cache-ttl 604800; /* 1 week */\n\ - max-clients-per-query 100;\n\ - max-ncache-ttl 10800; /* 3 hours */\n\ - max-recursion-depth 7;\n\ - max-recursion-queries 100;\n\ -+ max-stale-ttl 604800; /* 1 week */\n\ - message-compression yes;\n\ - # min-roots ;\n\ - minimal-any false;\n\ -@@ -203,10 +204,14 @@ options {\n\ - request-expire true;\n\ - request-ixfr true;\n\ - require-server-cookie no;\n\ -+ resolver-nonbackoff-tries 3;\n\ -+ resolver-retry-interval 800; /* in milliseconds */\n\ - # rfc2308-type1 ;\n\ - root-key-sentinel yes;\n\ - servfail-ttl 1;\n\ - # sortlist \n\ -+ stale-answer-enable false;\n\ -+ stale-answer-ttl 1; /* 1 second */\n\ - # topology \n\ - transfer-format many-answers;\n\ - v6-bias 50;\n\ -diff --git a/bin/named/control.c b/bin/named/control.c -index 23620b4..0756c73 100644 ---- a/bin/named/control.c -+++ b/bin/named/control.c -@@ -282,6 +282,8 @@ ns_control_docommand(isccc_sexpr_t *message, bool readonly, - result = ns_server_validation(ns_g_server, lex, text); - } else if (command_compare(command, NS_COMMAND_ZONESTATUS)) { - result = ns_server_zonestatus(ns_g_server, lex, text); -+ } else if (command_compare(command, NS_COMMAND_SERVESTALE)) { -+ result = ns_server_servestale(ns_g_server, lex, text); - } else { - isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, - NS_LOGMODULE_CONTROL, ISC_LOG_WARNING, -diff --git a/bin/named/include/named/control.h b/bin/named/include/named/control.h -index 56bad8d..37403f1 100644 ---- a/bin/named/include/named/control.h -+++ b/bin/named/include/named/control.h -@@ -67,6 +67,7 @@ - #define NS_COMMAND_MKEYS "managed-keys" - #define NS_COMMAND_DNSTAPREOPEN "dnstap-reopen" - #define NS_COMMAND_DNSTAP "dnstap" -+#define NS_COMMAND_SERVESTALE "serve-stale" - - isc_result_t - ns_controls_create(ns_server_t *server, ns_controls_t **ctrlsp); -diff --git a/bin/named/include/named/log.h b/bin/named/include/named/log.h -index 76e3a51..0d1d985 100644 ---- a/bin/named/include/named/log.h -+++ b/bin/named/include/named/log.h -@@ -30,6 +30,7 @@ - #define NS_LOGCATEGORY_UPDATE_SECURITY (&ns_g_categories[6]) - #define NS_LOGCATEGORY_QUERY_ERRORS (&ns_g_categories[7]) - #define NS_LOGCATEGORY_TAT (&ns_g_categories[8]) -+#define NS_LOGCATEGORY_SERVE_STALE (&ns_g_categories[9]) - - /* - * Backwards compatibility. -diff --git a/bin/named/include/named/query.h b/bin/named/include/named/query.h -index ef1b172..53c052b 100644 ---- a/bin/named/include/named/query.h -+++ b/bin/named/include/named/query.h -@@ -35,6 +35,18 @@ typedef struct ns_dbversion { - ISC_LINK(struct ns_dbversion) link; - } ns_dbversion_t; - -+/*% -+ * nameserver recursion parameters, to uniquely identify a recursion -+ * query; this is used to detect a recursion loop -+ */ -+typedef struct ns_query_recparam { -+ dns_rdatatype_t qtype; -+ dns_name_t * qname; -+ dns_fixedname_t fqname; -+ dns_name_t * qdomain; -+ dns_fixedname_t fqdomain; -+} ns_query_recparam_t; -+ - /*% nameserver query structure */ - struct ns_query { - unsigned int attributes; -@@ -63,6 +75,7 @@ struct ns_query { - unsigned int dns64_aaaaoklen; - unsigned int dns64_options; - unsigned int dns64_ttl; -+ - struct { - dns_db_t * db; - dns_zone_t * zone; -@@ -76,6 +89,8 @@ struct ns_query { - bool authoritative; - bool is_zone; - } redirect; -+ -+ ns_query_recparam_t recparam; - dns_keytag_t root_key_sentinel_keyid; - bool root_key_sentinel_is_ta; - bool root_key_sentinel_not_ta; -diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h -index 0ba2627..08a02dc 100644 ---- a/bin/named/include/named/server.h -+++ b/bin/named/include/named/server.h -@@ -227,7 +227,10 @@ enum { - - dns_nsstatscounter_reclimitdropped = 58, - -- dns_nsstatscounter_max = 59 -+ dns_nsstatscounter_trystale = 59, -+ dns_nsstatscounter_usedstale = 60, -+ -+ dns_nsstatscounter_max = 61 - }; - - /*% -@@ -766,4 +769,12 @@ ns_server_mkeys(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text); - isc_result_t - ns_server_dnstap(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text); - -+ -+/*% -+ * Control whether stale answers are served or not when configured in -+ * named.conf. -+ */ -+isc_result_t -+ns_server_servestale(ns_server_t *server, isc_lex_t *lex, -+ isc_buffer_t **text); - #endif /* NAMED_SERVER_H */ -diff --git a/bin/named/log.c b/bin/named/log.c -index acfa766..ea6f114 100644 ---- a/bin/named/log.c -+++ b/bin/named/log.c -@@ -38,6 +38,7 @@ static isc_logcategory_t categories[] = { - { "update-security", 0 }, - { "query-errors", 0 }, - { "trust-anchor-telemetry", 0 }, -+ { "serve-stale", 0 }, - { NULL, 0 } - }; - -diff --git a/bin/named/query.c b/bin/named/query.c -index b14f081..a95f5ad 100644 ---- a/bin/named/query.c -+++ b/bin/named/query.c -@@ -149,10 +149,14 @@ last_cmpxchg(isc_stdtime_t *x, isc_stdtime_t *e, isc_stdtime_t r) { - #define REDIRECT(c) (((c)->query.attributes & \ - NS_QUERYATTR_REDIRECT) != 0) - --/*% No QNAME Proof? */ -+/*% Does the rdataset 'r' have an attached 'No QNAME Proof'? */ - #define NOQNAME(r) (((r)->attributes & \ - DNS_RDATASETATTR_NOQNAME) != 0) - -+/*% Does the rdataset 'r' contain a stale answer? */ -+#define STALE(r) (((r)->attributes & \ -+ DNS_RDATASETATTR_STALE) != 0) -+ - #ifdef WANT_QUERYTRACE - static inline void - client_trace(ns_client_t *client, int level, const char *message) { -@@ -241,6 +245,10 @@ static bool - rpz_ck_dnssec(ns_client_t *client, isc_result_t qresult, - dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); - -+static void -+recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype, -+ const dns_name_t *qname, const dns_name_t *qdomain); -+ - /*% - * Increment query statistics counters. - */ -@@ -494,6 +502,7 @@ query_reset(ns_client_t *client, bool everything) { - client->query.isreferral = false; - client->query.dns64_options = 0; - client->query.dns64_ttl = UINT32_MAX; -+ recparam_update(&client->query.recparam, 0, NULL, NULL); - client->query.root_key_sentinel_keyid = 0; - client->query.root_key_sentinel_is_ta = false; - client->query.root_key_sentinel_not_ta = false; -@@ -4305,6 +4314,54 @@ log_quota(ns_client_t *client, isc_stdtime_t *last, isc_stdtime_t now, - } - } - -+/*% -+ * Check whether the recursion parameters in 'param' match the current query's -+ * recursion parameters provided in 'qtype', 'qname', and 'qdomain'. -+ */ -+static bool -+recparam_match(const ns_query_recparam_t *param, dns_rdatatype_t qtype, -+ const dns_name_t *qname, const dns_name_t *qdomain) -+{ -+ REQUIRE(param != NULL); -+ -+ return (param->qtype == qtype && -+ param->qname != NULL && qname != NULL && -+ param->qdomain != NULL && qdomain != NULL && -+ dns_name_equal(param->qname, qname) && -+ dns_name_equal(param->qdomain, qdomain)); -+} -+ -+/*% -+ * Update 'param' with current query's recursion parameters provided in -+ * 'qtype', 'qname', and 'qdomain'. -+ */ -+static void -+recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype, -+ const dns_name_t *qname, const dns_name_t *qdomain) -+{ -+ isc_result_t result; -+ -+ REQUIRE(param != NULL); -+ -+ param->qtype = qtype; -+ -+ if (qname == NULL) { -+ param->qname = NULL; -+ } else { -+ param->qname = dns_fixedname_initname(¶m->fqname); -+ result = dns_name_copy(qname, param->qname, NULL); -+ RUNTIME_CHECK(result == ISC_R_SUCCESS); -+ } -+ -+ if (qdomain == NULL) { -+ param->qdomain = NULL; -+ } else { -+ param->qdomain = dns_fixedname_initname(¶m->fqdomain); -+ result = dns_name_copy(qdomain, param->qdomain, NULL); -+ RUNTIME_CHECK(result == ISC_R_SUCCESS); -+ } -+} -+ - static isc_result_t - query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, - dns_name_t *qdomain, dns_rdataset_t *nameservers, -@@ -4314,6 +4371,19 @@ query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, - dns_rdataset_t *rdataset, *sigrdataset; - isc_sockaddr_t *peeraddr; - -+ /* -+ * Check recursion parameters from the previous query to see if they -+ * match. If not, update recursion parameters and proceed. -+ */ -+ if (recparam_match(&client->query.recparam, qtype, qname, qdomain)) { -+ ns_client_log(client, NS_LOGCATEGORY_CLIENT, -+ NS_LOGMODULE_QUERY, ISC_LOG_INFO, -+ "recursion loop detected"); -+ return (ISC_R_FAILURE); -+ } -+ -+ recparam_update(&client->query.recparam, qtype, qname, qdomain); -+ - if (!resuming) - inc_stats(client, dns_nsstatscounter_recursion); - -@@ -6821,6 +6891,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - int line = -1; - bool dns64_exclude, dns64, rpz; - bool nxrewrite = false; -+ bool want_stale = false; - bool redirected = false; - dns_clientinfomethods_t cm; - dns_clientinfo_t ci; -@@ -7130,6 +7201,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - type = qtype; - - restart: -+ // query_start - CTRACE(ISC_LOG_DEBUG(3), "query_find: restart"); - want_restart = false; - authoritative = false; -@@ -7274,6 +7346,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - } - - db_find: -+ // query_lookup - CTRACE(ISC_LOG_DEBUG(3), "query_find: db_find"); - /* - * We'll need some resources... -@@ -7331,6 +7404,35 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - if (!is_zone) - dns_cache_updatestats(client->view->cache, result); - -+ if (want_stale) { -+ char namebuf[DNS_NAME_FORMATSIZE]; -+ bool success; -+ -+ client->query.dboptions &= ~DNS_DBFIND_STALEOK; -+ want_stale = false; -+ -+ if (dns_rdataset_isassociated(rdataset) && -+ dns_rdataset_count(rdataset) > 0 && -+ STALE(rdataset)) { -+ rdataset->ttl = client->view->staleanswerttl; -+ success = true; -+ } else { -+ success = false; -+ } -+ -+ dns_name_format(client->query.qname, -+ namebuf, sizeof(namebuf)); -+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_SERVE_STALE, -+ NS_LOGMODULE_QUERY, ISC_LOG_INFO, -+ "%s resolver failure, stale answer %s", -+ namebuf, success ? "used" : "unavailable"); -+ -+ if (!success) { -+ QUERY_ERROR(DNS_R_SERVFAIL); -+ goto cleanup; -+ } -+ } -+ - resume: - CTRACE(ISC_LOG_DEBUG(3), "query_find: resume"); - -@@ -7676,6 +7778,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - * The cache doesn't even have the root NS. Get them from - * the hints DB. - */ -+ // query_notfound - INSIST(!is_zone); - if (db != NULL) - dns_db_detach(&db); -@@ -7738,12 +7841,14 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - */ - /* FALLTHROUGH */ - case DNS_R_DELEGATION: -+ // query_delegation - authoritative = false; - if (is_zone) { - /* - * Look to see if we are authoritative for the - * child zone if the query type is DS. - */ -+ // query_zone_delegation - if (!RECURSIONOK(client) && - (options & DNS_GETDB_NOEXACT) != 0 && - qtype == dns_rdatatype_ds) { -@@ -8130,6 +8235,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - false, true); - } - } -+ // query_nxdomain - if (dns_rdataset_isassociated(rdataset)) { - /* - * If we've got a NSEC record, we need to save the -@@ -8450,7 +8556,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - /* - * If we have a zero ttl from the cache refetch it. - */ -- if (!is_zone && !resuming && rdataset->ttl == 0 && -+ // query_cname -+ if (!is_zone && !resuming && !STALE(rdataset) && rdataset->ttl == 0 && - RECURSIONOK(client)) - { - if (dns_rdataset_isassociated(rdataset)) -@@ -8676,7 +8783,11 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - "query_find: unexpected error after resuming: %s", - isc_result_totext(result)); - CTRACE(ISC_LOG_ERROR, errmsg); -- QUERY_ERROR(DNS_R_SERVFAIL); -+ if (resuming) { -+ want_stale = true; -+ } else { -+ QUERY_ERROR(DNS_R_SERVFAIL); -+ } - goto cleanup; - } - -@@ -8932,7 +9043,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - /* - * If we have a zero ttl from the cache refetch it. - */ -- if (!is_zone && !resuming && rdataset->ttl == 0 && -+ if (!is_zone && !resuming && !STALE(rdataset) && rdataset->ttl == 0 && - RECURSIONOK(client)) - { - if (dns_rdataset_isassociated(rdataset)) -@@ -8943,6 +9054,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - if (node != NULL) - dns_db_detachnode(db, &node); - -+ // query_respond - INSIST(!REDIRECT(client)); - result = query_recurse(client, qtype, - client->query.qname, -@@ -9223,6 +9335,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - dns_fixedname_name(&wildcardname), - true, false); - cleanup: -+ // query_done - CTRACE(ISC_LOG_DEBUG(3), "query_find: cleanup"); - /* - * General cleanup. -@@ -9279,6 +9392,49 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) - goto restart; - } - -+ if (want_stale) { -+ dns_ttl_t stale_ttl = 0; -+ isc_result_t result; -+ bool staleanswersok = false; -+ -+ /* -+ * Stale answers only make sense if stale_ttl > 0 but -+ * we want rndc to be able to control returning stale -+ * answers if they are configured. -+ */ -+ dns_db_attach(client->view->cachedb, &db); -+ result = dns_db_getservestalettl(db, &stale_ttl); -+ if (result == ISC_R_SUCCESS && stale_ttl > 0) { -+ switch (client->view->staleanswersok) { -+ case dns_stale_answer_yes: -+ staleanswersok = true; -+ break; -+ case dns_stale_answer_conf: -+ staleanswersok = -+ client->view->staleanswersenable; -+ break; -+ case dns_stale_answer_no: -+ staleanswersok = false; -+ break; -+ } -+ } else { -+ staleanswersok = false; -+ } -+ -+ if (staleanswersok) { -+ client->query.dboptions |= DNS_DBFIND_STALEOK; -+ inc_stats(client, dns_nsstatscounter_trystale); -+ if (client->query.fetch != NULL) -+ dns_resolver_destroyfetch( -+ &client->query.fetch); -+ goto db_find; -+ } -+ dns_db_detach(&db); -+ want_stale = false; -+ QUERY_ERROR(DNS_R_SERVFAIL); -+ goto cleanup; -+ } -+ - if (eresult != ISC_R_SUCCESS && - (!PARTIALANSWER(client) || WANTRECURSION(client) - || eresult == DNS_R_DROP)) { -diff --git a/bin/named/server.c b/bin/named/server.c -index 2bdf690..3a5ba91 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -1720,7 +1720,8 @@ static bool - cache_sharable(dns_view_t *originview, dns_view_t *view, - bool new_zero_no_soattl, - unsigned int new_cleaning_interval, -- uint64_t new_max_cache_size) -+ uint64_t new_max_cache_size, -+ uint32_t new_stale_ttl) - { - /* - * If the cache cannot even reused for the same view, it cannot be -@@ -1735,6 +1736,7 @@ cache_sharable(dns_view_t *originview, dns_view_t *view, - */ - if (dns_cache_getcleaninginterval(originview->cache) != - new_cleaning_interval || -+ dns_cache_getservestalettl(originview->cache) != new_stale_ttl || - dns_cache_getcachesize(originview->cache) != new_max_cache_size) { - return (false); - } -@@ -3290,6 +3292,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - size_t max_acache_size; - size_t max_adb_size; - uint32_t lame_ttl, fail_ttl; -+ uint32_t max_stale_ttl; - dns_tsig_keyring_t *ring = NULL; - dns_view_t *pview = NULL; /* Production view */ - isc_mem_t *cmctx = NULL, *hmctx = NULL; -@@ -3318,6 +3321,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - bool old_rpz_ok = false; - isc_dscp_t dscp4 = -1, dscp6 = -1; - dns_dyndbctx_t *dctx = NULL; -+ unsigned int resolver_param; - - REQUIRE(DNS_VIEW_VALID(view)); - -@@ -3732,6 +3736,24 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - if (view->maxncachettl > 7 * 24 * 3600) - view->maxncachettl = 7 * 24 * 3600; - -+ obj = NULL; -+ result = ns_config_get(maps, "max-stale-ttl", &obj); -+ INSIST(result == ISC_R_SUCCESS); -+ max_stale_ttl = cfg_obj_asuint32(obj); -+ -+ obj = NULL; -+ result = ns_config_get(maps, "stale-answer-enable", &obj); -+ INSIST(result == ISC_R_SUCCESS); -+ view->staleanswersenable = cfg_obj_asboolean(obj); -+ -+ result = dns_viewlist_find(&ns_g_server->viewlist, view->name, -+ view->rdclass, &pview); -+ if (result == ISC_R_SUCCESS) { -+ view->staleanswersok = pview->staleanswersok; -+ dns_view_detach(&pview); -+ } else -+ view->staleanswersok = dns_stale_answer_conf; -+ - /* - * Configure the view's cache. - * -@@ -3765,7 +3787,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - nsc = cachelist_find(cachelist, cachename, view->rdclass); - if (nsc != NULL) { - if (!cache_sharable(nsc->primaryview, view, zero_no_soattl, -- cleaning_interval, max_cache_size)) { -+ cleaning_interval, max_cache_size, -+ max_stale_ttl)) { - isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, - NS_LOGMODULE_SERVER, ISC_LOG_ERROR, - "views %s and %s can't share the cache " -@@ -3864,9 +3887,15 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - - dns_cache_setcleaninginterval(cache, cleaning_interval); - dns_cache_setcachesize(cache, max_cache_size); -+ dns_cache_setservestalettl(cache, max_stale_ttl); - - dns_cache_detach(&cache); - -+ obj = NULL; -+ result = ns_config_get(maps, "stale-answer-ttl", &obj); -+ INSIST(result == ISC_R_SUCCESS); -+ view->staleanswerttl = ISC_MAX(cfg_obj_asuint32(obj), 1); -+ - /* - * Resolver. - * -@@ -4055,6 +4084,21 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - maxbits = 4096; - view->maxbits = maxbits; - -+ /* -+ * Set resolver retry parameters. -+ */ -+ obj = NULL; -+ CHECK(ns_config_get(maps, "resolver-retry-interval", &obj)); -+ resolver_param = cfg_obj_asuint32(obj); -+ if (resolver_param > 0) -+ dns_resolver_setretryinterval(view->resolver, resolver_param); -+ -+ obj = NULL; -+ CHECK(ns_config_get(maps, "resolver-nonbackoff-tries", &obj)); -+ resolver_param = cfg_obj_asuint32(obj); -+ if (resolver_param > 0) -+ dns_resolver_setnonbackofftries(view->resolver, resolver_param); -+ - /* - * Set supported DNSSEC algorithms. - */ -@@ -14559,3 +14603,132 @@ ns_server_dnstap(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text) { - return (ISC_R_NOTIMPLEMENTED); - #endif - } -+ -+isc_result_t -+ns_server_servestale(ns_server_t *server, isc_lex_t *lex, -+ isc_buffer_t **text) -+{ -+ char *ptr, *classtxt, *viewtxt = NULL; -+ char msg[128]; -+ dns_rdataclass_t rdclass = dns_rdataclass_in; -+ dns_view_t *view; -+ bool found = false; -+ dns_stale_answer_t staleanswersok = dns_stale_answer_conf; -+ bool wantstatus = false; -+ isc_result_t result = ISC_R_SUCCESS; -+ -+ /* Skip the command name. */ -+ ptr = next_token(lex, text); -+ if (ptr == NULL) -+ return (ISC_R_UNEXPECTEDEND); -+ -+ ptr = next_token(lex, NULL); -+ if (ptr == NULL) -+ return (ISC_R_UNEXPECTEDEND); -+ -+ if (strcasecmp(ptr, "on") == 0 || strcasecmp(ptr, "yes") == 0) { -+ staleanswersok = dns_stale_answer_yes; -+ } else if (strcasecmp(ptr, "off") == 0 || strcasecmp(ptr, "no") == 0) { -+ staleanswersok = dns_stale_answer_no; -+ } else if (strcasecmp(ptr, "reset") == 0) { -+ staleanswersok = dns_stale_answer_conf; -+ } else if (strcasecmp(ptr, "status") == 0) { -+ wantstatus = true; -+ } else -+ return (DNS_R_SYNTAX); -+ -+ /* Look for the optional class name. */ -+ classtxt = next_token(lex, text); -+ if (classtxt != NULL) { -+ /* Look for the optional view name. */ -+ viewtxt = next_token(lex, text); -+ } -+ -+ if (classtxt != NULL) { -+ isc_textregion_t r; -+ -+ r.base = classtxt; -+ r.length = strlen(classtxt); -+ result = dns_rdataclass_fromtext(&rdclass, &r); -+ if (result != ISC_R_SUCCESS) { -+ if (viewtxt == NULL) { -+ viewtxt = classtxt; -+ classtxt = NULL; -+ result = ISC_R_SUCCESS; -+ } else { -+ snprintf(msg, sizeof(msg), -+ "unknown class '%s'", classtxt); -+ (void) putstr(text, msg); -+ goto cleanup; -+ } -+ } -+ } -+ -+ result = isc_task_beginexclusive(server->task); -+ RUNTIME_CHECK(result == ISC_R_SUCCESS); -+ -+ for (view = ISC_LIST_HEAD(server->viewlist); -+ view != NULL; -+ view = ISC_LIST_NEXT(view, link)) -+ { -+ dns_ttl_t stale_ttl = 0; -+ dns_db_t *db = NULL; -+ -+ if (classtxt != NULL && rdclass != view->rdclass) -+ continue; -+ -+ if (viewtxt != NULL && strcmp(view->name, viewtxt) != 0) -+ continue; -+ -+ if (!wantstatus) { -+ view->staleanswersok = staleanswersok; -+ found = true; -+ continue; -+ } -+ -+ db = NULL; -+ dns_db_attach(view->cachedb, &db); -+ (void)dns_db_getservestalettl(db, &stale_ttl); -+ dns_db_detach(&db); -+ if (found) -+ CHECK(putstr(text, "\n")); -+ CHECK(putstr(text, view->name)); -+ CHECK(putstr(text, ": ")); -+ switch (view->staleanswersok) { -+ case dns_stale_answer_yes: -+ if (stale_ttl > 0) -+ CHECK(putstr(text, "on (rndc)")); -+ else -+ CHECK(putstr(text, "off (not-cached)")); -+ break; -+ case dns_stale_answer_no: -+ CHECK(putstr(text, "off (rndc)")); -+ break; -+ case dns_stale_answer_conf: -+ if (view->staleanswersenable && stale_ttl > 0) -+ CHECK(putstr(text, "on")); -+ else if (view->staleanswersenable) -+ CHECK(putstr(text, "off (not-cached)")); -+ else -+ CHECK(putstr(text, "off")); -+ break; -+ } -+ if (stale_ttl > 0) { -+ snprintf(msg, sizeof(msg), -+ " (stale-answer-ttl=%u max-stale-ttl=%u)", -+ view->staleanswerttl, stale_ttl); -+ CHECK(putstr(text, msg)); -+ } -+ found = true; -+ } -+ isc_task_endexclusive(ns_g_server->task); -+ -+ if (!found) -+ result = ISC_R_NOTFOUND; -+ -+cleanup: -+ if (isc_buffer_usedlength(*text) > 0) -+ (void) putnull(text); -+ -+ return (result); -+} -diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c -index 12ab048..4938c03 100644 ---- a/bin/named/statschannel.c -+++ b/bin/named/statschannel.c -@@ -300,6 +300,12 @@ init_desc(void) { - SET_NSSTATDESC(reclimitdropped, - "queries dropped due to recursive client limit", - "RecLimitDropped"); -+ SET_NSSTATDESC(trystale, -+ "attempts to use stale cache data after lookup failure", -+ "QryTryStale"); -+ SET_NSSTATDESC(usedstale, -+ "successful uses of stale cache data after lookup failure", -+ "QryUsedStale"); - INSIST(i == dns_nsstatscounter_max); - - /* Initialize resolver statistics */ -diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c -index 0acfe3a..2c21c1d 100644 ---- a/bin/rndc/rndc.c -+++ b/bin/rndc/rndc.c -@@ -160,6 +160,8 @@ command is one of the following:\n\ - scan Scan available network interfaces for changes.\n\ - secroots [view ...]\n\ - Write security roots to the secroots file.\n\ -+ serve-stale ( yes | no | reset ) [class [view]]\n\ -+ Control whether stale answers are returned\n\ - showzone zone [class [view]]\n\ - Print a zone's configuration.\n\ - sign zone [class [view]]\n\ -diff --git a/bin/rndc/rndc.docbook b/bin/rndc/rndc.docbook -index 159ded9..12a7208 100644 ---- a/bin/rndc/rndc.docbook -+++ b/bin/rndc/rndc.docbook -@@ -689,6 +689,25 @@ - - - -+ -+ serve-stale ( on | off | reset | status) class view -+ -+ -+ Enable, disable, or reset the serving of stale answers -+ as configured in named.conf. Serving of stale answers -+ will remain disabled across named.conf -+ reloads if disabled via rndc until it is reset via rndc. -+ -+ -+ Status will report whether serving of stale answers is -+ currently enabled, disabled or not configured for a -+ view. If serving of stale records is configured then -+ the values of stale-answer-ttl and max-stale-ttl are -+ reported. -+ -+ -+ -+ - - secroots - view ... - -diff --git a/bin/tests/system/chain/prereq.sh b/bin/tests/system/chain/prereq.sh -index 23bedcd..43385de 100644 ---- a/bin/tests/system/chain/prereq.sh -+++ b/bin/tests/system/chain/prereq.sh -@@ -48,3 +48,10 @@ else - echo_i "This test requires the Net::DNS::Nameserver library." >&2 - exit 1 - fi -+if $PERL -e 'use Net::DNS::Nameserver;' 2>/dev/null -+then -+ : -+else -+ echo "I:This test requires the Net::DNS::Nameserver library." >&2 -+ exit 1 -+fi -diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in -index f6412f6..26c8901 100644 ---- a/bin/tests/system/conf.sh.in -+++ b/bin/tests/system/conf.sh.in -@@ -128,7 +128,7 @@ PARALLELDIRS="dnssec rpzrecurse \ - reclimit redirect resolver rndc rootkeysentinel rpz \ - rrchecker rrl rrsetorder rsabigexponent runtime \ - sfcache smartsign sortlist \ -- spf staticstub statistics statschannel stub \ -+ spf serve-stale staticstub statistics statschannel stub \ - tcp tsig tsiggss \ - unknown upforwd verify views wildcard \ - xfer xferquota zero zonechecks" -diff --git a/bin/tests/system/dyndb/driver/db.c b/bin/tests/system/dyndb/driver/db.c -index 02aa6ab..a77c7de 100644 ---- a/bin/tests/system/dyndb/driver/db.c -+++ b/bin/tests/system/dyndb/driver/db.c -@@ -629,6 +629,8 @@ static dns_dbmethods_t sampledb_methods = { - hashsize, - NULL, - NULL, -+ NULL, -+ NULL, - }; - - /* Auxiliary driver functions. */ -diff --git a/bin/tests/system/serve-stale/.gitignore b/bin/tests/system/serve-stale/.gitignore -new file mode 100644 -index 0000000..2272eef ---- /dev/null -+++ b/bin/tests/system/serve-stale/.gitignore -@@ -0,0 +1,11 @@ -+/ans2/ans.pid -+/ans2/ans.pl -+/dig.out* -+/ns1/named.conf -+/ns3/named.conf -+/ns3/root.bk -+/rndc.out* -+named.lock -+named.pid -+named.port -+named.run -diff --git a/bin/tests/system/serve-stale/ans2/ans.pl.in b/bin/tests/system/serve-stale/ans2/ans.pl.in -new file mode 100644 -index 0000000..2b39eca ---- /dev/null -+++ b/bin/tests/system/serve-stale/ans2/ans.pl.in -@@ -0,0 +1,178 @@ -+#!/usr/bin/env perl -+# -+# Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC") -+# -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ -+use strict; -+use warnings; -+ -+use IO::File; -+use IO::Socket; -+use Getopt::Long; -+use Net::DNS; -+use Time::HiRes qw(usleep nanosleep); -+ -+my $pidf = new IO::File "ans.pid", "w" or die "cannot open pid file: $!"; -+print $pidf "$$\n" or die "cannot write pid file: $!"; -+$pidf->close or die "cannot close pid file: $!"; -+sub rmpid { unlink "ans.pid"; exit 1; }; -+ -+$SIG{INT} = \&rmpid; -+$SIG{TERM} = \&rmpid; -+ -+my $send_response = 1; -+ -+my $localaddr = "10.53.0.2"; -+my $localport = @PORT@; -+my $udpsock = IO::Socket::INET->new(LocalAddr => "$localaddr", -+ LocalPort => $localport, Proto => "udp", Reuse => 1) or die "$!"; -+ -+# -+# Delegation -+# -+my $SOA = "example 300 IN SOA . . 0 0 0 0 300"; -+my $NS = "example 300 IN NS ns.example"; -+my $A = "ns.example 300 IN A $localaddr"; -+# -+# Records to be TTL stretched -+# -+my $TXT = "data.example 1 IN TXT \"A text record with a 1 second ttl\""; -+my $negSOA = "example 1 IN SOA . . 0 0 0 0 300"; -+ -+sub reply_handler { -+ my ($qname, $qclass, $qtype) = @_; -+ my ($rcode, @ans, @auth, @add); -+ -+ print ("request: $qname/$qtype\n"); -+ STDOUT->flush(); -+ -+ # Control whether we send a response or not. -+ # We always respond to control commands. -+ if ($qname eq "enable" ) { -+ if ($qtype eq "TXT") { -+ $send_response = 1; -+ my $rr = new Net::DNS::RR("$qname 0 $qclass TXT \"$send_response\""); -+ push @ans, $rr; -+ } -+ $rcode = "NOERROR"; -+ return ($rcode, \@ans, \@auth, \@add, { aa => 1 }); -+ } elsif ($qname eq "disable" ) { -+ if ($qtype eq "TXT") { -+ $send_response = 0; -+ my $rr = new Net::DNS::RR("$qname 0 $qclass TXT \"$send_response\""); -+ push @ans, $rr; -+ } -+ $rcode = "NOERROR"; -+ return ($rcode, \@ans, \@auth, \@add, { aa => 1 }); -+ } -+ -+ # If we are not responding to queries we are done. -+ return if (!$send_response); -+ -+ # Construct the response and send it. -+ if ($qname eq "ns.example" ) { -+ if ($qtype eq "A") { -+ my $rr = new Net::DNS::RR($A); -+ push @ans, $rr; -+ } else { -+ my $rr = new Net::DNS::RR($SOA); -+ push @auth, $rr; -+ } -+ $rcode = "NOERROR"; -+ } elsif ($qname eq "example") { -+ if ($qtype eq "NS") { -+ my $rr = new Net::DNS::RR($NS); -+ push @auth, $rr; -+ $rr = new Net::DNS::RR($A); -+ push @add, $rr; -+ } elsif ($qtype eq "SOA") { -+ my $rr = new Net::DNS::RR($SOA); -+ push @ans, $rr; -+ } else { -+ my $rr = new Net::DNS::RR($SOA); -+ push @auth, $rr; -+ } -+ $rcode = "NOERROR"; -+ } elsif ($qname eq "nodata.example") { -+ my $rr = new Net::DNS::RR($negSOA); -+ push @auth, $rr; -+ $rcode = "NOERROR"; -+ } elsif ($qname eq "data.example") { -+ if ($qtype eq "TXT") { -+ my $rr = new Net::DNS::RR($TXT); -+ push @ans, $rr; -+ } else { -+ my $rr = new Net::DNS::RR($negSOA); -+ push @auth, $rr; -+ } -+ $rcode = "NOERROR"; -+ } elsif ($qname eq "nxdomain.example") { -+ my $rr = new Net::DNS::RR($negSOA); -+ push @auth, $rr; -+ $rcode = "NXDOMAIN"; -+ } else { -+ my $rr = new Net::DNS::RR($SOA); -+ push @auth, $rr; -+ $rcode = "NXDOMAIN"; -+ } -+ -+ # mark the answer as authoritive (by setting the 'aa' flag -+ return ($rcode, \@ans, \@auth, \@add, { aa => 1 }); -+} -+ -+GetOptions( -+ 'port=i' => \$localport, -+); -+ -+my $rin; -+my $rout; -+ -+for (;;) { -+ $rin = ''; -+ vec($rin, fileno($udpsock), 1) = 1; -+ -+ select($rout = $rin, undef, undef, undef); -+ -+ if (vec($rout, fileno($udpsock), 1)) { -+ my ($buf, $request, $err); -+ $udpsock->recv($buf, 512); -+ -+ if ($Net::DNS::VERSION > 0.68) { -+ $request = new Net::DNS::Packet(\$buf, 0); -+ $@ and die $@; -+ } else { -+ my $err; -+ ($request, $err) = new Net::DNS::Packet(\$buf, 0); -+ $err and die $err; -+ } -+ -+ my @questions = $request->question; -+ my $qname = $questions[0]->qname; -+ my $qclass = $questions[0]->qclass; -+ my $qtype = $questions[0]->qtype; -+ my $id = $request->header->id; -+ -+ my ($rcode, $ans, $auth, $add, $headermask) = reply_handler($qname, $qclass, $qtype); -+ -+ if (!defined($rcode)) { -+ print " Silently ignoring query\n"; -+ next; -+ } -+ -+ my $reply = Net::DNS::Packet->new(); -+ $reply->header->qr(1); -+ $reply->header->aa(1) if $headermask->{'aa'}; -+ $reply->header->id($id); -+ $reply->header->rcode($rcode); -+ $reply->push("question", @questions); -+ $reply->push("answer", @$ans) if $ans; -+ $reply->push("authority", @$auth) if $auth; -+ $reply->push("additional", @$add) if $add; -+ -+ my $num_chars = $udpsock->send($reply->data); -+ print " Sent $num_chars bytes via UDP\n"; -+ } -+} -diff --git a/bin/tests/system/serve-stale/clean.sh b/bin/tests/system/serve-stale/clean.sh -new file mode 100644 -index 0000000..2397326 ---- /dev/null -+++ b/bin/tests/system/serve-stale/clean.sh -@@ -0,0 +1,15 @@ -+# Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") -+# -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ -+rm -f test.output -+rm -f dig.out.test* -+rm -f ans2/ans.pl -+rm -f ns3/root.bk -+rm -f rndc.out.test* -+rm -f ns*/named.memstats -+rm -f ns*/managed-keys.bind -+rm -f ns*/named.conf -+rm -f ns*/named.run -diff --git a/bin/tests/system/serve-stale/ns1/named1.conf.in b/bin/tests/system/serve-stale/ns1/named1.conf.in -new file mode 100644 -index 0000000..8a75a10 ---- /dev/null -+++ b/bin/tests/system/serve-stale/ns1/named1.conf.in -@@ -0,0 +1,35 @@ -+/* -+ * Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ */ -+ -+key rndc_key { -+ secret "1234abcd8765"; -+ algorithm hmac-sha256; -+}; -+ -+controls { -+ inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; -+}; -+ -+options { -+ query-source address 10.53.0.1; -+ notify-source 10.53.0.1; -+ transfer-source 10.53.0.1; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.1; }; -+ listen-on-v6 { none; }; -+ recursion yes; -+ max-stale-ttl 3600; -+ stale-answer-ttl 1; -+ stale-answer-enable yes; -+}; -+ -+zone "." { -+ type master; -+ file "root.db"; -+}; -diff --git a/bin/tests/system/serve-stale/ns1/named2.conf.in b/bin/tests/system/serve-stale/ns1/named2.conf.in -new file mode 100644 -index 0000000..072e6ec ---- /dev/null -+++ b/bin/tests/system/serve-stale/ns1/named2.conf.in -@@ -0,0 +1,35 @@ -+/* -+ * Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ */ -+ -+key rndc_key { -+ secret "1234abcd8765"; -+ algorithm hmac-sha256; -+}; -+ -+controls { -+ inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; -+}; -+ -+options { -+ query-source address 10.53.0.1; -+ notify-source 10.53.0.1; -+ transfer-source 10.53.0.1; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.1; }; -+ listen-on-v6 { none; }; -+ recursion yes; -+ max-stale-ttl 7200; -+ stale-answer-ttl 2; -+ stale-answer-enable yes; -+}; -+ -+zone "." { -+ type master; -+ file "root.db"; -+}; -diff --git a/bin/tests/system/serve-stale/ns1/root.db b/bin/tests/system/serve-stale/ns1/root.db -new file mode 100644 -index 0000000..eb9ad3e ---- /dev/null -+++ b/bin/tests/system/serve-stale/ns1/root.db -@@ -0,0 +1,5 @@ -+. 300 SOA . . 0 0 0 0 0 -+. 300 NS ns.nil. -+ns.nil. 300 A 10.53.0.1 -+example. 300 NS ns.example. -+ns.example. 300 A 10.53.0.2 -diff --git a/bin/tests/system/serve-stale/ns3/named.conf.in b/bin/tests/system/serve-stale/ns3/named.conf.in -new file mode 100644 -index 0000000..24a3293 ---- /dev/null -+++ b/bin/tests/system/serve-stale/ns3/named.conf.in -@@ -0,0 +1,35 @@ -+/* -+ * Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ */ -+ -+key rndc_key { -+ secret "1234abcd8765"; -+ algorithm hmac-sha256; -+}; -+ -+controls { -+ inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; -+}; -+ -+options { -+ query-source address 10.53.0.3; -+ notify-source 10.53.0.3; -+ transfer-source 10.53.0.3; -+ port @PORT@; -+ pid-file "named.pid"; -+ listen-on { 10.53.0.3; }; -+ listen-on-v6 { none; }; -+ recursion yes; -+ // max-stale-ttl 3600; -+ // stale-answer-ttl 3; -+}; -+ -+zone "." { -+ type slave; -+ masters { 10.53.0.1; }; -+ file "root.bk"; -+}; -diff --git a/bin/tests/system/serve-stale/prereq.sh b/bin/tests/system/serve-stale/prereq.sh -new file mode 100644 -index 0000000..a3bbef8 ---- /dev/null -+++ b/bin/tests/system/serve-stale/prereq.sh -@@ -0,0 +1,38 @@ -+#!/bin/sh -+# -+# Copyright (C) 2011, 2012, 2014, 2016 Internet Systems Consortium, Inc. ("ISC") -+# -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ -+SYSTEMTESTTOP=.. -+. $SYSTEMTESTTOP/conf.sh -+ -+if $PERL -e 'use Net::DNS;' 2>/dev/null -+then -+ if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION >= 0.69 && $Net::DNS::VERSION <= 0.74);' 2>/dev/null -+ then -+ : -+ else -+ echo "I:Net::DNS versions 0.69 to 0.74 have bugs that cause this test to fail: please update." >&2 -+ exit 1 -+ fi -+else -+ echo "I:This test requires the Net::DNS library." >&2 -+ exit 1 -+fi -+if $PERL -e 'use Net::DNS::Nameserver;' 2>/dev/null -+then -+ : -+else -+ echo "I:This test requires the Net::DNS::Nameserver library." >&2 -+ exit 1 -+fi -+if $PERL -e 'use Time::HiRes;' 2>/dev/null -+then -+ : -+else -+ echo "I:This test requires the Time::HiRes library." >&2 -+ exit 1 -+fi -diff --git a/bin/tests/system/serve-stale/setup.sh b/bin/tests/system/serve-stale/setup.sh -new file mode 100644 -index 0000000..690f43c ---- /dev/null -+++ b/bin/tests/system/serve-stale/setup.sh -@@ -0,0 +1,13 @@ -+#!/bin/sh -+# Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") -+# -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ -+SYSTEMTESTTOP=.. -+. $SYSTEMTESTTOP/conf.sh -+ -+copy_setports ns1/named1.conf.in ns1/named.conf -+copy_setports ans2/ans.pl.in ans2/ans.pl -+copy_setports ns3/named.conf.in ns3/named.conf -diff --git a/bin/tests/system/serve-stale/tests.sh b/bin/tests/system/serve-stale/tests.sh -new file mode 100755 -index 0000000..201c996 ---- /dev/null -+++ b/bin/tests/system/serve-stale/tests.sh -@@ -0,0 +1,536 @@ -+#!/bin/sh -+# -+# Copyright (C) 2000, 2001, 2004, 2007, 2009-2016 Internet Systems Consortium, Inc. ("ISC") -+# -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ -+SYSTEMTESTTOP=.. -+. $SYSTEMTESTTOP/conf.sh -+ -+while getopts "p:c:" flag; do -+ case "$flag" in -+ p) port=$OPTARG ;; -+ c) controlport=$OPTARG ;; -+ *) exit 1 ;; -+ esac -+done -+ -+RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" -+ -+echo "RNDCCMD: ${RNDCCMD}" -+ -+status=0 -+n=0 -+ -+#echo "I:check ans.pl server ($n)" -+#$DIG -p ${PORT} @10.53.0.2 example NS -+#$DIG -p ${PORT} @10.53.0.2 example SOA -+#$DIG -p ${PORT} @10.53.0.2 ns.example A -+#$DIG -p ${PORT} @10.53.0.2 ns.example AAAA -+#$DIG -p ${PORT} @10.53.0.2 txt enable -+#$DIG -p ${PORT} @10.53.0.2 txt disable -+#$DIG -p ${PORT} @10.53.0.2 ns.example AAAA -+#$DIG -p ${PORT} @10.53.0.2 txt enable -+#$DIG -p ${PORT} @10.53.0.2 ns.example AAAA -+##$DIG -p ${PORT} @10.53.0.2 data.example TXT -+#$DIG -p ${PORT} @10.53.0.2 nodata.example TXT -+#$DIG -p ${PORT} @10.53.0.2 nxdomain.example TXT -+ -+n=`expr $n + 1` -+echo "I:prime cache data.example ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:prime cache nodata.example ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:prime cache nxdomain.example ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n -+grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:disable responses from authoritative server ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.2 txt disable > dig.out.test$n -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+sleep 1 -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: on (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale data.example ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nodata.example ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nxdomain.example ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n -+grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc serve-stale off' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale off || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: off (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale data.example (serve-stale off) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nodata.example (serve-stale off) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nxdomain.example (serve-stale off) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc serve-stale on' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale on || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale data.example (serve-stale on) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nodata.example (serve-stale on) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nxdomain.example (serve-stale on) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n -+grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc serve-stale no' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale no || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: off (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale data.example (serve-stale no) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nodata.example (serve-stale no) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nxdomain.example (serve-stale no) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc serve-stale yes' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale yes || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale data.example (serve-stale yes) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nodata.example (serve-stale yes) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nxdomain.example (serve-stale yes) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n -+grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc serve-stale off' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale off || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc serve-stale reset' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale reset || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: on (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale data.example (serve-stale reset) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nodata.example (serve-stale reset) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check stale nxdomain.example (serve-stale reset) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n -+grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc serve-stale off' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale off || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: off (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:updating ns1/named.conf ($n)" -+ret=0 -+sed -e "s/@PORT@/${PORT}/g;s/@CONTROLPORT@/${CONTROLPORT}/g" < ns1/named2.conf.in > ns1/named.conf -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:running 'rndc reload' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 reload > rndc.out.test$n 2>&1 || ret=1 -+grep "server reload successful" rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: off (rndc) (stale-answer-ttl=2 max-stale-ttl=7200)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale > rndc.out.test$n 2>&1 && ret=1 -+grep "unexpected end of input" rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale unknown' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 serve-stale unknown > rndc.out.test$n 2>&1 && ret=1 -+grep "syntax error" rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo_i "flush cache, re-enable serve-stale and query again ($n)" -+ret=0 -+$RNDCCMD 10.53.0.1 flushtree example > rndc.out.test$n.1 2>&1 || ret=1 -+$RNDCCMD 10.53.0.1 serve-stale on > rndc.out.test$n.2 2>&1 || ret=1 -+$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo_i "failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+ret=0 -+$DIG -p ${PORT} @10.53.0.2 txt enable > dig.out.test$n -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "TXT.\"1\"" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:prime cache data.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:prime cache nodata.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:prime cache nxdomain.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n -+grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:disable responses from authoritative server ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.2 txt disable > dig.out.test$n -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+sleep 1 -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: off (stale-answer-ttl=1 max-stale-ttl=604800)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check fail of data.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check fail of nodata.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check fail of nxdomain.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n -+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale on' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.3 serve-stale on > rndc.out.test$n 2>&1 || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check 'rndc serve-stale status' ($n)" -+ret=0 -+$RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -+grep '_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=604800)' rndc.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check data.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check nodata.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n -+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+n=`expr $n + 1` -+echo "I:check nxdomain.example (max-stale-ttl default) ($n)" -+ret=0 -+$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n -+grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 -+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1 -+grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1 -+if [ $ret != 0 ]; then echo "I:failed"; fi -+status=`expr $status + $ret` -+ -+echo "I:exit status: $status" -+[ $status -eq 0 ] || exit 1 -diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml -index 99c8680..5fbabfe 100644 ---- a/doc/arm/Bv9ARM-book.xml -+++ b/doc/arm/Bv9ARM-book.xml -@@ -4336,6 +4336,9 @@ badresp:1,adberr:0,findfail:0,valfail:0] - statement in the named.conf file: -
- -+ [ max-stale-ttl number ; ] -+ [ stale-answer-enable yes_or_no ; ] -+ [ stale-answer-ttl number ; ] - - -
<command>options</command> Statement Definition and -@@ -4429,6 +4432,7 @@ badresp:1,adberr:0,findfail:0,valfail:0] - <command>dnssec-validation</command>, - <command>max-cache-ttl</command>, - <command>max-ncache-ttl</command>, -+ <command>max-stale-ttl</command>, - <command>max-cache-size</command>, and - <command>zero-no-soa-ttl</command>. - </para> -@@ -5438,7 +5442,6 @@ options { - </listitem> - </varlistentry> - -- - <varlistentry> - <term><command>max-zone-ttl</command></term> - <listitem> -@@ -5474,6 +5477,21 @@ options { - </listitem> - </varlistentry> - -+ <varlistentry> -+ <term><command>stale-answer-ttl</command></term> -+ <listitem> -+ <para> -+ Specifies the TTL to be returned on stale answers. -+ The default is 1 second. The minimal allowed is -+ also 1 second; a value of 0 will be updated silently -+ to 1 second. For stale answers to be returned -+ <option>max-stale-ttl</option> must be set to a -+ non zero value and they must not have been disabled -+ by <command>rndc</command>. -+ </para> -+ </listitem> -+ </varlistentry> -+ - <varlistentry> - <term><command>serial-update-method</command></term> - <listitem> -@@ -6227,6 +6245,22 @@ options { - </listitem> - </varlistentry> - -+ <varlistentry> -+ <term><command>serve-stale-enable</command></term> -+ <listitem> -+ <para> -+ Enable the returning of stale answers when the -+ nameservers for the zone are not answering. This -+ is off by default but can be enabled/disabled via -+ <command>rndc server-stale on</command> and -+ <command>rndc server-stale off</command> which -+ override the named.conf setting. <command>rndc -+ server-stale reset</command> will restore control -+ via named.conf. -+ </para> -+ </listitem> -+ </varlistentry> -+ - <varlistentry> - <term><command>nocookie-udp-size</command></term> - <listitem> -@@ -7449,13 +7483,19 @@ options { - <term><command>resolver-query-timeout</command></term> - <listitem> - <para> -- This is the amount of time in seconds that the -- resolver spends attempting to resolve a recursive -- query before failing. The default and minimum -- is <literal>10</literal> and the maximum is -- <literal>30</literal>. Setting it to -- <literal>0</literal> results in the default -- being used. -+ The amount of time in milliseconds that the resolver -+ will spend attempting to resolve a recursive -+ query before failing. The default and minimum -+ is <literal>10000</literal> and the maximum is -+ <literal>30000</literal>. Setting it to -+ <literal>0</literal> will result in the default -+ being used. -+ </para> -+ <para> -+ This value was originally specified in seconds. -+ Values less than or equal to 300 will be be treated -+ as seconds and converted to milliseconds before -+ applying the above limits. - </para> - </listitem> - </varlistentry> -@@ -9016,6 +9056,27 @@ avoid-v6-udp-ports { 40000; range 50000 60000; }; - </listitem> - </varlistentry> - -+ <varlistentry> -+ <term><command>max-stale-ttl</command></term> -+ <listitem> -+ <para> -+ Sets the maximum time for which the server will -+ retain records past their normal expiry to -+ return them as stale records when the servers -+ for those records are not reachable. The default -+ is to not retain the record. -+ </para> -+ <para> -+ <command>rndc serve-stale</command> can be used -+ to disable and re-enable the serving of stale -+ records at runtime. Reloading or reconfiguring -+ <command>named</command> will not re-enable serving -+ of stale records if they have been disabled via -+ <command>rndc</command>. -+ </para> -+ </listitem> -+ </varlistentry> -+ - <varlistentry> - <term><command>min-roots</command></term> - <listitem> -diff --git a/doc/arm/logging-categories.xml b/doc/arm/logging-categories.xml -index 56d05e8..098342b 100644 ---- a/doc/arm/logging-categories.xml -+++ b/doc/arm/logging-categories.xml -@@ -311,6 +311,17 @@ - </para> - </entry> - </row> -+ <row rowsep="0"> -+ <entry colname="1"> -+ <para><command>serve-stale</command></para> -+ </entry> -+ <entry colname="2"> -+ <para> -+ Whether or not a stale answer is used -+ following a resolver failure. -+ </para> -+ </entry> -+ </row> - <row rowsep="0"> - <entry colname="1"> - <para><command>spill</command></para> -diff --git a/doc/arm/notes-rh-changes.xml b/doc/arm/notes-rh-changes.xml -index 89a4961..80b7dee 100644 ---- a/doc/arm/notes-rh-changes.xml -+++ b/doc/arm/notes-rh-changes.xml -@@ -12,6 +12,9 @@ - <section xml:id="relnotes_rh_changes"><info><title>Red Hat Specific Changes - - -+ -+ This version includes some features not present in releases by ISC. -+ - - By default, BIND now uses the random number generation functions - in the cryptographic library (i.e., OpenSSL or a PKCS#11 -@@ -36,7 +39,16 @@ - case /dev/random will be the default - entropy source. [RT #31459] [RT #46047] - -- -+ -+ When acting as a recursive resolver, named -+ can now continue returning answers whose TTLs have expired -+ when the authoritative server is under attack and unable to -+ respond. This is controlled by the -+ stale-answer-enable, -+ stale-answer-ttl and -+ max-stale-ttl options. [RT #44790] -+ -+ - -
- -diff --git a/doc/misc/options b/doc/misc/options -index e11beed..fde93c7 100644 ---- a/doc/misc/options -+++ b/doc/misc/options -@@ -225,6 +225,7 @@ options { - max-refresh-time ; - max-retry-time ; - max-rsa-exponent-size ; -+ max-stale-ttl ; - max-transfer-idle-in ; - max-transfer-idle-out ; - max-transfer-time-in ; -@@ -298,7 +299,9 @@ options { - request-sit ; // obsolete - require-server-cookie ; - reserved-sockets ; -+ resolver-nonbackoff-tries ; - resolver-query-timeout ; -+ resolver-retry-interval ; - response-policy { zone [ log ] [ max-policy-ttl - ] [ policy ( cname | disabled | drop | given | no-op - | nodata | nxdomain | passthru | tcp-only ) ] [ -@@ -328,6 +331,8 @@ options { - sit-secret ; // obsolete - sortlist { ; ... }; - stacksize ( default | unlimited | ); -+ stale-answer-enable ; -+ stale-answer-ttl ; - startup-notify-rate ; - statistics-file ; - statistics-interval ; // not yet implemented -@@ -539,6 +544,7 @@ view [ ] { - max-recursion-queries ; - max-refresh-time ; - max-retry-time ; -+ max-stale-ttl ; - max-transfer-idle-in ; - max-transfer-idle-out ; - max-transfer-time-in ; -@@ -600,7 +606,9 @@ view [ ] { - request-nsid ; - request-sit ; // obsolete - require-server-cookie ; -+ resolver-nonbackoff-tries ; - resolver-query-timeout ; -+ resolver-retry-interval ; - response-policy { zone [ log ] [ max-policy-ttl - ] [ policy ( cname | disabled | drop | given | no-op - | nodata | nxdomain | passthru | tcp-only ) ] [ -@@ -655,6 +663,8 @@ view [ ] { - sig-signing-type ; - sig-validity-interval [ ]; - sortlist { ; ... }; -+ stale-answer-enable ; -+ stale-answer-ttl ; - suppress-initial-notify ; // not yet implemented - topology { ; ... }; // not implemented - transfer-format ( many-answers | one-answer ); -diff --git a/lib/bind9/check.c b/lib/bind9/check.c -index bf769fe..6c57fa4 100644 ---- a/lib/bind9/check.c -+++ b/lib/bind9/check.c -@@ -99,7 +99,8 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "rrset-order: invalid class '%s'", - r.base); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - } - -@@ -112,7 +113,8 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "rrset-order: invalid type '%s'", - r.base); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - } - -@@ -126,7 +128,8 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) { - if (tresult != ISC_R_SUCCESS) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "rrset-order: invalid name '%s'", str); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - } - -@@ -135,14 +138,16 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) { - strcasecmp("order", cfg_obj_asstring(obj)) != 0) { - cfg_obj_log(ent, logctx, ISC_LOG_ERROR, - "rrset-order: keyword 'order' missing"); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - - obj = cfg_tuple_get(ent, "ordering"); - if (!cfg_obj_isstring(obj)) { - cfg_obj_log(ent, logctx, ISC_LOG_ERROR, - "rrset-order: missing ordering"); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } else if (strcasecmp(cfg_obj_asstring(obj), "fixed") == 0) { - #if !DNS_RDATASET_FIXED - cfg_obj_log(obj, logctx, ISC_LOG_WARNING, -@@ -154,7 +159,8 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "rrset-order: invalid order '%s'", - cfg_obj_asstring(obj)); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - return (result); - } -@@ -174,7 +180,7 @@ check_order(const cfg_obj_t *options, isc_log_t *logctx) { - element = cfg_list_next(element)) - { - tresult = check_orderent(cfg_listelt_value(element), logctx); -- if (tresult != ISC_R_SUCCESS) -+ if (result == ISC_R_SUCCESS && tresult != ISC_R_SUCCESS) - result = tresult; - } - return (result); -@@ -204,7 +210,8 @@ check_dual_stack(const cfg_obj_t *options, isc_log_t *logctx) { - if (val > UINT16_MAX) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "port '%u' out of range", val); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } - } - obj = cfg_tuple_get(alternates, "addresses"); -@@ -224,7 +231,8 @@ check_dual_stack(const cfg_obj_t *options, isc_log_t *logctx) { - if (tresult != ISC_R_SUCCESS) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "bad name '%s'", str); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = tresult; - } - obj = cfg_tuple_get(value, "port"); - if (cfg_obj_isuint32(obj)) { -@@ -232,7 +240,8 @@ check_dual_stack(const cfg_obj_t *options, isc_log_t *logctx) { - if (val > UINT16_MAX) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "port '%u' out of range", val); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } - } - } -@@ -1271,7 +1280,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "auto-dnssec may only be activated at the " - "zone level"); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - } - -@@ -1291,7 +1301,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - { - obj = cfg_listelt_value(element); - tresult = mustbesecure(obj, symtab, logctx, mctx); -- if (tresult != ISC_R_SUCCESS) -+ if (result == ISC_R_SUCCESS && tresult != ISC_R_SUCCESS) - result = tresult; - } - if (symtab != NULL) -@@ -1310,7 +1320,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "%s: invalid name '%s'", - server_contact[i], str); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - } - } -@@ -1330,7 +1341,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "disable-empty-zone: invalid name '%s'", - str); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - } - -@@ -1344,11 +1356,12 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - strlen(cfg_obj_asstring(obj)) > 1024U) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "'server-id' too big (>1024 bytes)"); -- result = ISC_R_FAILURE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_FAILURE; - } - - tresult = check_dscp(options, logctx); -- if (tresult != ISC_R_SUCCESS) -+ if (result == ISC_R_SUCCESS && tresult != ISC_R_SUCCESS) - result = tresult; - - obj = NULL; -@@ -1358,11 +1371,13 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - if (lifetime > 604800) { /* 7 days */ - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "'nta-lifetime' cannot exceed one week"); -- result = ISC_R_RANGE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } else if (lifetime == 0) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "'nta-lifetime' may not be zero"); -- result = ISC_R_RANGE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } - } - -@@ -1373,7 +1388,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - if (recheck > 604800) { /* 7 days */ - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "'nta-recheck' cannot exceed one week"); -- result = ISC_R_RANGE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } - - if (recheck > lifetime) -@@ -1391,7 +1407,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - if (strcasecmp(ccalg, "aes") == 0) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "cookie-algorithm: '%s' not supported", ccalg); -- result = ISC_R_NOTIMPLEMENTED; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_NOTIMPLEMENTED; - } - #endif - -@@ -1480,7 +1497,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "%s out of range (%u < %u)", - fstrm[i].name, value, fstrm[i].min); -- result = ISC_R_RANGE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } - - if (strcmp(fstrm[i].name, "fstrm-set-input-queue-size") == 0) { -@@ -1494,7 +1512,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - "%s '%u' not a power-of-2", - fstrm[i].name, - cfg_obj_asuint32(obj)); -- result = ISC_R_RANGE; -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } - } - } -@@ -1512,7 +1531,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - "%" PRId64 "' " - "is too small", - mapsize); -- return (ISC_R_RANGE); -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } else if (mapsize > (1ULL << 40)) { /* 1 terabyte */ - cfg_obj_log(obj, logctx, - ISC_LOG_ERROR, -@@ -1520,10 +1540,20 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, - "%" PRId64 "' " - "is too large", - mapsize); -- return (ISC_R_RANGE); -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; - } - } - -+ obj = NULL; -+ (void)cfg_map_get(options, "resolver-nonbackoff-tries", &obj); -+ if (obj != NULL && cfg_obj_asuint32(obj) == 0U) { -+ cfg_obj_log(obj, logctx, ISC_LOG_ERROR, -+ "'resolver-nonbackoff-tries' must be >= 1"); -+ if (result == ISC_R_SUCCESS) -+ result = ISC_R_RANGE; -+ } -+ - return (result); - } - -diff --git a/lib/dns/cache.c b/lib/dns/cache.c -index 2965a4f..617737a 100644 ---- a/lib/dns/cache.c -+++ b/lib/dns/cache.c -@@ -138,6 +138,7 @@ struct dns_cache { - int db_argc; - char **db_argv; - size_t size; -+ dns_ttl_t serve_stale_ttl; - isc_stats_t *stats; - - /* Locked by 'filelock'. */ -@@ -167,9 +168,13 @@ overmem_cleaning_action(isc_task_t *task, isc_event_t *event); - - static inline isc_result_t - cache_create_db(dns_cache_t *cache, dns_db_t **db) { -- return (dns_db_create(cache->mctx, cache->db_type, dns_rootname, -- dns_dbtype_cache, cache->rdclass, -- cache->db_argc, cache->db_argv, db)); -+ isc_result_t result; -+ result = dns_db_create(cache->mctx, cache->db_type, dns_rootname, -+ dns_dbtype_cache, cache->rdclass, -+ cache->db_argc, cache->db_argv, db); -+ if (result == ISC_R_SUCCESS) -+ dns_db_setservestalettl(*db, cache->serve_stale_ttl); -+ return (result); - } - - isc_result_t -@@ -238,6 +243,7 @@ dns_cache_create3(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr, - cache->references = 1; - cache->live_tasks = 0; - cache->rdclass = rdclass; -+ cache->serve_stale_ttl = 0; - - cache->stats = NULL; - result = isc_stats_create(cmctx, &cache->stats, -@@ -1092,6 +1098,32 @@ dns_cache_getcachesize(dns_cache_t *cache) { - return (size); - } - -+void -+dns_cache_setservestalettl(dns_cache_t *cache, dns_ttl_t ttl) { -+ REQUIRE(VALID_CACHE(cache)); -+ -+ LOCK(&cache->lock); -+ cache->serve_stale_ttl = ttl; -+ UNLOCK(&cache->lock); -+ -+ (void)dns_db_setservestalettl(cache->db, ttl); -+} -+ -+dns_ttl_t -+dns_cache_getservestalettl(dns_cache_t *cache) { -+ dns_ttl_t ttl; -+ isc_result_t result; -+ -+ REQUIRE(VALID_CACHE(cache)); -+ -+ /* -+ * Could get it straight from the dns_cache_t, but use db -+ * to confirm the value that the db is really using. -+ */ -+ result = dns_db_getservestalettl(cache->db, &ttl); -+ return result == ISC_R_SUCCESS ? ttl : 0; -+} -+ - /* - * The cleaner task is shutting down; do the necessary cleanup. - */ -diff --git a/lib/dns/db.c b/lib/dns/db.c -index a28a566..c581646 100644 ---- a/lib/dns/db.c -+++ b/lib/dns/db.c -@@ -1130,3 +1130,25 @@ dns_db_nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name) { - return (ISC_R_NOTIMPLEMENTED); - return ((db->methods->nodefullname)(db, node, name)); - } -+ -+isc_result_t -+dns_db_setservestalettl(dns_db_t *db, dns_ttl_t ttl) -+{ -+ REQUIRE(DNS_DB_VALID(db)); -+ REQUIRE((db->attributes & DNS_DBATTR_CACHE) != 0); -+ -+ if (db->methods->setservestalettl != NULL) -+ return ((db->methods->setservestalettl)(db, ttl)); -+ return (ISC_R_NOTIMPLEMENTED); -+} -+ -+isc_result_t -+dns_db_getservestalettl(dns_db_t *db, dns_ttl_t *ttl) -+{ -+ REQUIRE(DNS_DB_VALID(db)); -+ REQUIRE((db->attributes & DNS_DBATTR_CACHE) != 0); -+ -+ if (db->methods->getservestalettl != NULL) -+ return ((db->methods->getservestalettl)(db, ttl)); -+ return (ISC_R_NOTIMPLEMENTED); -+} -diff --git a/lib/dns/ecdb.c b/lib/dns/ecdb.c -index fc94ccf..76d0417 100644 ---- a/lib/dns/ecdb.c -+++ b/lib/dns/ecdb.c -@@ -588,7 +588,9 @@ static dns_dbmethods_t ecdb_methods = { - NULL, /* setcachestats */ - NULL, /* hashsize */ - NULL, /* nodefullname */ -- NULL /* getsize */ -+ NULL, /* getsize */ -+ NULL, /* setservestalettl */ -+ NULL /* getservestalettl */ - }; - - static isc_result_t -diff --git a/lib/dns/include/dns/cache.h b/lib/dns/include/dns/cache.h -index ab4b0b5..e158014 100644 ---- a/lib/dns/include/dns/cache.h -+++ b/lib/dns/include/dns/cache.h -@@ -260,6 +260,27 @@ dns_cache_getcachesize(dns_cache_t *cache); - * Get the maximum cache size. - */ - -+void -+dns_cache_setservestalettl(dns_cache_t *cache, dns_ttl_t ttl); -+/*%< -+ * Sets the maximum length of time that cached answers may be retained -+ * past their normal TTL. Default value for the library is 0, disabling -+ * the use of stale data. -+ * -+ * Requires: -+ *\li 'cache' to be valid. -+ */ -+ -+dns_ttl_t -+dns_cache_getservestalettl(dns_cache_t *cache); -+/*%< -+ * Gets the maximum length of time that cached answers may be kept past -+ * normal expiry. -+ * -+ * Requires: -+ *\li 'cache' to be valid. -+ */ -+ - isc_result_t - dns_cache_flush(dns_cache_t *cache); - /*%< -diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h -index 96f3a8f..452770f 100644 ---- a/lib/dns/include/dns/db.h -+++ b/lib/dns/include/dns/db.h -@@ -195,6 +195,8 @@ typedef struct dns_dbmethods { - dns_name_t *name); - isc_result_t (*getsize)(dns_db_t *db, dns_dbversion_t *version, - uint64_t *records, uint64_t *bytes); -+ isc_result_t (*setservestalettl)(dns_db_t *db, dns_ttl_t ttl); -+ isc_result_t (*getservestalettl)(dns_db_t *db, dns_ttl_t *ttl); - } dns_dbmethods_t; - - typedef isc_result_t -@@ -253,6 +255,7 @@ struct dns_dbonupdatelistener { - #define DNS_DBFIND_FORCENSEC3 0x0080 - #define DNS_DBFIND_ADDITIONALOK 0x0100 - #define DNS_DBFIND_NOZONECUT 0x0200 -+#define DNS_DBFIND_STALEOK 0x0400 - /*@}*/ - - /*@{*/ -@@ -1683,6 +1686,38 @@ dns_db_nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name); - * \li 'db' is a valid database - * \li 'node' and 'name' are not NULL - */ -+ -+isc_result_t -+dns_db_setservestalettl(dns_db_t *db, dns_ttl_t ttl); -+/*%< -+ * Sets the maximum length of time that cached answers may be retained -+ * past their normal TTL. Default value for the library is 0, disabling -+ * the use of stale data. -+ * -+ * Requires: -+ * \li 'db' is a valid cache database. -+ * \li 'ttl' is the number of seconds to retain data past its normal expiry. -+ * -+ * Returns: -+ * \li #ISC_R_SUCCESS -+ * \li #ISC_R_NOTIMPLEMENTED - Not supported by this DB implementation. -+ */ -+ -+isc_result_t -+dns_db_getservestalettl(dns_db_t *db, dns_ttl_t *ttl); -+/*%< -+ * Gets maximum length of time that cached answers may be kept past -+ * normal TTL expiration. -+ * -+ * Requires: -+ * \li 'db' is a valid cache database. -+ * \li 'ttl' is the number of seconds to retain data past its normal expiry. -+ * -+ * Returns: -+ * \li #ISC_R_SUCCESS -+ * \li #ISC_R_NOTIMPLEMENTED - Not supported by this DB implementation. -+ */ -+ - ISC_LANG_ENDDECLS - - #endif /* DNS_DB_H */ -diff --git a/lib/dns/include/dns/rdataset.h b/lib/dns/include/dns/rdataset.h -index ed9119a..710e97c 100644 ---- a/lib/dns/include/dns/rdataset.h -+++ b/lib/dns/include/dns/rdataset.h -@@ -128,6 +128,7 @@ struct dns_rdataset { - unsigned int magic; /* XXX ? */ - dns_rdatasetmethods_t * methods; - ISC_LINK(dns_rdataset_t) link; -+ - /* - * XXX do we need these, or should they be retrieved by methods? - * Leaning towards the latter, since they are not frequently required -@@ -136,12 +137,19 @@ struct dns_rdataset { - dns_rdataclass_t rdclass; - dns_rdatatype_t type; - dns_ttl_t ttl; -+ /* -+ * Stale ttl is used to see how long this RRset can still be used -+ * to serve to clients, after the TTL has expired. -+ */ -+ dns_ttl_t stale_ttl; - dns_trust_t trust; - dns_rdatatype_t covers; -+ - /* - * attributes - */ - unsigned int attributes; -+ - /*% - * the counter provides the starting point in the "cyclic" order. - * The value UINT32_MAX has a special meaning of "picking up a -@@ -149,11 +157,13 @@ struct dns_rdataset { - * increment the counter. - */ - uint32_t count; -+ - /* - * This RRSIG RRset should be re-generated around this time. - * Only valid if DNS_RDATASETATTR_RESIGN is set in attributes. - */ - isc_stdtime_t resign; -+ - /*@{*/ - /*% - * These are for use by the rdataset implementation, and MUST NOT -@@ -206,6 +216,7 @@ struct dns_rdataset { - #define DNS_RDATASETATTR_OPTOUT 0x00100000 /*%< OPTOUT proof */ - #define DNS_RDATASETATTR_NEGATIVE 0x00200000 - #define DNS_RDATASETATTR_PREFETCH 0x00400000 -+#define DNS_RDATASETATTR_STALE 0x01000000 - - /*% - * _OMITDNSSEC: -diff --git a/lib/dns/include/dns/resolver.h b/lib/dns/include/dns/resolver.h -index 7b3c047..bd7d225 100644 ---- a/lib/dns/include/dns/resolver.h -+++ b/lib/dns/include/dns/resolver.h -@@ -547,9 +547,12 @@ dns_resolver_getmustbesecure(dns_resolver_t *resolver, dns_name_t *name); - - - void --dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds); -+dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int timeout); - /*%< -- * Set the length of time the resolver will work on a query, in seconds. -+ * Set the length of time the resolver will work on a query, in milliseconds. -+ * -+ * 'timeout' was originally defined in seconds, and later redefined to be in -+ * milliseconds. Values less than or equal to 300 are treated as seconds. - * - * If timeout is 0, the default timeout will be applied. - * -@@ -560,7 +563,8 @@ dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds); - unsigned int - dns_resolver_gettimeout(dns_resolver_t *resolver); - /*%< -- * Get the current length of time the resolver will work on a query, in seconds. -+ * Get the current length of time the resolver will work on a query, -+ * in milliseconds. - * - * Requires: - * \li resolver to be valid. -@@ -582,6 +586,39 @@ dns_resolver_getzeronosoattl(dns_resolver_t *resolver); - void - dns_resolver_setzeronosoattl(dns_resolver_t *resolver, bool state); - -+unsigned int -+dns_resolver_getretryinterval(dns_resolver_t *resolver); -+ -+void -+dns_resolver_setretryinterval(dns_resolver_t *resolver, unsigned int interval); -+/*%< -+ * Sets the amount of time, in millseconds, that is waited for a reply -+ * to a server before another server is tried. Interacts with the -+ * value of dns_resolver_getnonbackofftries() by trying that number of times -+ * at this interval, before doing exponential backoff and doubling the interval -+ * on each subsequent try, to a maximum of 10 seconds. Defaults to 800 ms; -+ * silently capped at 2000 ms. -+ * -+ * Requires: -+ * \li resolver to be valid. -+ * \li interval > 0. -+ */ -+ -+unsigned int -+dns_resolver_getnonbackofftries(dns_resolver_t *resolver); -+ -+void -+dns_resolver_setnonbackofftries(dns_resolver_t *resolver, unsigned int tries); -+/*%< -+ * Sets the number of failures of getting a reply from remote servers for -+ * a query before backing off by doubling the retry interval for each -+ * subsequent request sent. Defaults to 3. -+ * -+ * Requires: -+ * \li resolver to be valid. -+ * \li tries > 0. -+ */ -+ - unsigned int - dns_resolver_getoptions(dns_resolver_t *resolver); - -diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h -index 2468e3c..934a641 100644 ---- a/lib/dns/include/dns/types.h -+++ b/lib/dns/include/dns/types.h -@@ -390,6 +390,12 @@ typedef struct { - size_t count; - } dns_indent_t; - -+typedef enum { -+ dns_stale_answer_no, -+ dns_stale_answer_yes, -+ dns_stale_answer_conf -+} dns_stale_answer_t; -+ - /* - * Functions. - */ -diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h -index 53f1db1..96148c7 100644 ---- a/lib/dns/include/dns/view.h -+++ b/lib/dns/include/dns/view.h -@@ -229,6 +229,9 @@ struct dns_view { - dns_dtenv_t *dtenv; /* Dnstap environment */ - dns_dtmsgtype_t dttypes; /* Dnstap message types - to log */ -+ dns_ttl_t staleanswerttl; -+ dns_stale_answer_t staleanswersok; /* rndc setting */ -+ bool staleanswersenable; /* named.conf setting */ - }; - - #define DNS_VIEW_MAGIC ISC_MAGIC('V','i','e','w') -diff --git a/lib/dns/master.c b/lib/dns/master.c -index 7d26b81..36999b5 100644 ---- a/lib/dns/master.c -+++ b/lib/dns/master.c -@@ -1948,12 +1948,18 @@ load_text(dns_loadctx_t *lctx) { - - if ((lctx->options & DNS_MASTER_AGETTL) != 0) { - /* -- * Adjust the TTL for $DATE. If the RR has already -- * expired, ignore it. -+ * Adjust the TTL for $DATE. If the RR has -+ * already expired, set its TTL to 0. This -+ * should be okay even if the TTL stretching -+ * feature is not in effect, because it will -+ * just be quickly expired by the cache, and the -+ * way this was written before the patch it -+ * could potentially add 0 TTLs anyway. - */ - if (lctx->ttl < ttl_offset) -- continue; -- lctx->ttl -= ttl_offset; -+ lctx->ttl = 0; -+ else -+ lctx->ttl -= ttl_offset; - } - - /* -diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c -index fa839a0..91b3cab 100644 ---- a/lib/dns/masterdump.c -+++ b/lib/dns/masterdump.c -@@ -81,6 +81,9 @@ struct dns_master_style { - */ - #define DNS_TOTEXT_LINEBREAK_MAXLEN 100 - -+/*% Does the rdataset 'r' contain a stale answer? */ -+#define STALE(r) (((r)->attributes & DNS_RDATASETATTR_STALE) != 0) -+ - /*% - * Context structure for a masterfile dump in progress. - */ -@@ -94,6 +97,7 @@ typedef struct dns_totext_ctx { - dns_fixedname_t origin_fixname; - uint32_t current_ttl; - bool current_ttl_valid; -+ dns_ttl_t serve_stale_ttl; - } dns_totext_ctx_t; - - LIBDNS_EXTERNAL_DATA const dns_master_style_t -@@ -382,6 +386,7 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) { - ctx->neworigin = NULL; - ctx->current_ttl = 0; - ctx->current_ttl_valid = false; -+ ctx->serve_stale_ttl = 0; - - return (ISC_R_SUCCESS); - } -@@ -1028,6 +1033,11 @@ dump_rdatasets_text(isc_mem_t *mctx, dns_name_t *name, - (ctx->style.flags & DNS_STYLEFLAG_NCACHE) == 0) { - /* Omit negative cache entries */ - } else { -+ if (STALE(rds)) { -+ fprintf(f, "; stale (for %u more seconds)\n", -+ (rds->stale_ttl - -+ ctx->serve_stale_ttl)); -+ } - isc_result_t result = - dump_rdataset(mctx, name, rds, ctx, - buffer, f); -@@ -1496,6 +1506,16 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, - dns_db_attach(db, &dctx->db); - - dctx->do_date = dns_db_iscache(dctx->db); -+ if (dctx->do_date) { -+ /* -+ * Adjust the date backwards by the serve-stale TTL, if any. -+ * This is so the TTL will be loaded correctly when next -+ * started. -+ */ -+ (void)dns_db_getservestalettl(dctx->db, -+ &dctx->tctx.serve_stale_ttl); -+ dctx->now -= dctx->tctx.serve_stale_ttl; -+ } - - if (dctx->format == dns_masterformat_text && - (dctx->tctx.style.flags & DNS_STYLEFLAG_REL_OWNER) != 0) { -@@ -1555,6 +1575,9 @@ writeheader(dns_dumpctx_t *dctx) { - * it in the zone case. - */ - if (dctx->do_date) { -+ fprintf(dctx->f, -+ "; using a %d second stale ttl\n", -+ dctx->tctx.serve_stale_ttl); - result = dns_time32_totext(dctx->now, &buffer); - RUNTIME_CHECK(result == ISC_R_SUCCESS); - isc_buffer_usedregion(&buffer, &r); -diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c -index 3a60bcf..8ea4d47 100644 ---- a/lib/dns/rbtdb.c -+++ b/lib/dns/rbtdb.c -@@ -511,6 +511,7 @@ typedef ISC_LIST(rdatasetheader_t) rdatasetheaderlist_t; - typedef ISC_LIST(dns_rbtnode_t) rbtnodelist_t; - - #define RDATASET_ATTR_NONEXISTENT 0x0001 -+/*%< May be potentially served as stale data. */ - #define RDATASET_ATTR_STALE 0x0002 - #define RDATASET_ATTR_IGNORE 0x0004 - #define RDATASET_ATTR_RETAIN 0x0008 -@@ -523,6 +524,8 @@ typedef ISC_LIST(dns_rbtnode_t) rbtnodelist_t; - #define RDATASET_ATTR_CASESET 0x0400 - #define RDATASET_ATTR_ZEROTTL 0x0800 - #define RDATASET_ATTR_CASEFULLYLOWER 0x1000 -+/*%< Ancient - awaiting cleanup. */ -+#define RDATASET_ATTR_ANCIENT 0x2000 - - typedef struct acache_cbarg { - dns_rdatasetadditional_t type; -@@ -573,6 +576,8 @@ struct acachectl { - (((header)->attributes & RDATASET_ATTR_ZEROTTL) != 0) - #define CASEFULLYLOWER(header) \ - (((header)->attributes & RDATASET_ATTR_CASEFULLYLOWER) != 0) -+#define ANCIENT(header) \ -+ (((header)->attributes & RDATASET_ATTR_ANCIENT) != 0) - - - #define ACTIVE(header, now) \ -@@ -632,6 +637,12 @@ typedef enum { - expire_flush - } expire_t; - -+typedef enum { -+ rdataset_ttl_fresh, -+ rdataset_ttl_stale, -+ rdataset_ttl_ancient -+} rdataset_ttl_t; -+ - typedef struct rbtdb_version { - /* Not locked */ - rbtdb_serial_t serial; -@@ -699,6 +710,12 @@ struct dns_rbtdb { - dns_dbnode_t *soanode; - dns_dbnode_t *nsnode; - -+ /* -+ * Maximum length of time to keep using a stale answer past its -+ * normal TTL expiry. -+ */ -+ dns_ttl_t serve_stale_ttl; -+ - /* - * This is a linked list used to implement the LRU cache. There will - * be node_lock_count linked lists here. Nodes in bucket 1 will be -@@ -742,6 +759,8 @@ struct dns_rbtdb { - #define RBTDB_ATTR_LOADED 0x01 - #define RBTDB_ATTR_LOADING 0x02 - -+#define KEEPSTALE(rbtdb) ((rbtdb)->serve_stale_ttl > 0) -+ - /*% - * Search Context - */ -@@ -1816,15 +1835,15 @@ rollback_node(dns_rbtnode_t *node, rbtdb_serial_t serial) { - } - - static inline void --mark_stale_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header) { -+mark_header_ancient(dns_rbtdb_t *rbtdb, rdatasetheader_t *header) { - - /* -- * If we are already stale there is nothing to do. -+ * If we are already ancient there is nothing to do. - */ -- if ((header->attributes & RDATASET_ATTR_STALE) != 0) -+ if (ANCIENT(header)) - return; - -- header->attributes |= RDATASET_ATTR_STALE; -+ header->attributes |= RDATASET_ATTR_ANCIENT; - header->node->dirty = 1; - - /* -@@ -1865,8 +1884,8 @@ clean_cache_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) { - /* - * If current is nonexistent or stale, we can clean it up. - */ -- if ((current->attributes & -- (RDATASET_ATTR_NONEXISTENT|RDATASET_ATTR_STALE)) != 0) { -+ if (NONEXISTENT(current) || ANCIENT(current) || -+ (STALE(current) && ! KEEPSTALE(rbtdb))) { - if (top_prev != NULL) - top_prev->next = current->next; - else -@@ -2111,6 +2130,80 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) { - } - } - -+#if 0 -+static void -+clean_now_or_later(dns_rbtnode_t *node, dns_rbtdb_t *rbtdb, -+ rdatasetheader_t *header, rdatasetheader_t **header_prevp) -+{ -+ if (dns_rbtnode_refcurrent(node) == 0) { -+ isc_mem_t *mctx; -+ -+ /* -+ * header->down can be non-NULL if the refcount has just -+ * decremented to 0 but decrement_reference() has not performed -+ * clean_cache_node(), in which case we need to purge the stale -+ * headers first. -+ */ -+ mctx = rbtdb->common.mctx; -+ clean_stale_headers(rbtdb, mctx, header); -+ if (*header_prevp != NULL) -+ (*header_prevp)->next = header->next; -+ else -+ node->data = header->next; -+ free_rdataset(rbtdb, mctx, header); -+ } else { -+ header->attributes |= RDATASET_ATTR_STALE | -+ RDATASET_ATTR_ANCIENT; -+ node->dirty = 1; -+ *header_prevp = header; -+ } -+} -+ -+static rdataset_ttl_t -+check_ttl(dns_rbtnode_t *node, rbtdb_search_t *search, -+ rdatasetheader_t *header, rdatasetheader_t **header_prevp, -+ nodelock_t *lock, isc_rwlocktype_t *locktype) -+{ -+ dns_rbtdb_t *rbtdb = search->rbtdb; -+ -+ if (header->rdh_ttl > search->now) -+ return rdataset_ttl_fresh; -+ -+ /* -+ * This rdataset is stale, but perhaps still usable. -+ */ -+ if (KEEPSTALE(rbtdb) && -+ header->rdh_ttl + rbtdb->serve_stale_ttl > search->now) { -+ header->attributes |= RDATASET_ATTR_STALE; -+ /* Doesn't set dirty because it doesn't need removal. */ -+ return rdataset_ttl_stale; -+ } -+ -+ /* -+ * This rdataset is so stale it is no longer usable, even with -+ * KEEPSTALE. If no one else is using the node, we can clean it up -+ * right now, otherwise we mark it as ancient, and the node as dirty, -+ * so it will get cleaned up later. -+ */ -+ if ((header->rdh_ttl <= search->now - RBTDB_VIRTUAL) && -+ (*locktype == isc_rwlocktype_write || -+ NODE_TRYUPGRADE(lock) == ISC_R_SUCCESS)) { -+ /* -+ * We update the node's status only when we can get write -+ * access; otherwise, we leave others to this work. Periodical -+ * cleaning will eventually take the job as the last resort. -+ * We won't downgrade the lock, since other rdatasets are -+ * probably stale, too. -+ */ -+ *locktype = isc_rwlocktype_write; -+ clean_now_or_later(node, rbtdb, header, header_prevp); -+ } else -+ *header_prevp = header; -+ -+ return rdataset_ttl_ancient; -+} -+#endif -+ - /* - * Caller must be holding the node lock. - */ -@@ -3343,6 +3436,12 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rdatasetheader_t *header, - rdataset->attributes |= DNS_RDATASETATTR_OPTOUT; - if (PREFETCH(header)) - rdataset->attributes |= DNS_RDATASETATTR_PREFETCH; -+ if (STALE(header)) { -+ rdataset->attributes |= DNS_RDATASETATTR_STALE; -+ rdataset->stale_ttl = -+ (rbtdb->serve_stale_ttl + header->rdh_ttl) - now; -+ rdataset->ttl = 0; -+ } - rdataset->private1 = rbtdb; - rdataset->private2 = node; - raw = (unsigned char *)header + sizeof(*header); -@@ -4698,6 +4797,19 @@ check_stale_header(dns_rbtnode_t *node, rdatasetheader_t *header, - #endif - - if (!ACTIVE(header, search->now)) { -+ dns_ttl_t stale = header->rdh_ttl + -+ search->rbtdb->serve_stale_ttl; -+ /* -+ * If this data is in the stale window keep it and if -+ * DNS_DBFIND_STALEOK is not set we tell the caller to -+ * skip this record. -+ */ -+ if (KEEPSTALE(search->rbtdb) && stale > search->now) { -+ header->attributes |= RDATASET_ATTR_STALE; -+ *header_prev = header; -+ return ((search->options & DNS_DBFIND_STALEOK) == 0); -+ } -+ - /* - * This rdataset is stale. If no one else is using the - * node, we can clean it up right now, otherwise we mark -@@ -4737,7 +4849,7 @@ check_stale_header(dns_rbtnode_t *node, rdatasetheader_t *header, - node->data = header->next; - free_rdataset(search->rbtdb, mctx, header); - } else { -- mark_stale_header(search->rbtdb, header); -+ mark_header_ancient(search->rbtdb, header); - *header_prev = header; - } - } else -@@ -5178,7 +5290,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, - &locktype, lock, &search, - &header_prev)) { - /* Do nothing. */ -- } else if (EXISTS(header) && (!STALE(header))) { -+ } else if (EXISTS(header) && !ANCIENT(header)) { - /* - * We now know that there is at least one active - * non-stale rdataset at this node. -@@ -5661,7 +5773,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) { - * refcurrent(rbtnode) must be non-zero. This is so - * because 'node' is an argument to the function. - */ -- mark_stale_header(rbtdb, header); -+ mark_header_ancient(rbtdb, header); - if (log) - isc_log_write(dns_lctx, category, module, - level, "overmem cache: stale %s", -@@ -5669,7 +5781,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) { - } else if (force_expire) { - if (! RETAIN(header)) { - set_ttl(rbtdb, header, 0); -- mark_stale_header(rbtdb, header); -+ mark_header_ancient(rbtdb, header); - } else if (log) { - isc_log_write(dns_lctx, category, module, - level, "overmem cache: " -@@ -5928,9 +6040,9 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, - * non-zero. This is so because 'node' is an - * argument to the function. - */ -- mark_stale_header(rbtdb, header); -+ mark_header_ancient(rbtdb, header); - } -- } else if (EXISTS(header) && (!STALE(header))) { -+ } else if (EXISTS(header) && !ANCIENT(header)) { - if (header->type == matchtype) - found = header; - else if (header->type == RBTDB_RDATATYPE_NCACHEANY || -@@ -6232,7 +6344,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - topheader = topheader->next) - { - set_ttl(rbtdb, topheader, 0); -- mark_stale_header(rbtdb, topheader); -+ mark_header_ancient(rbtdb, topheader); - } - goto find_header; - } -@@ -6293,7 +6405,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - * ncache entry. - */ - set_ttl(rbtdb, topheader, 0); -- mark_stale_header(rbtdb, topheader); -+ mark_header_ancient(rbtdb, topheader); - topheader = NULL; - goto find_header; - } -@@ -6331,8 +6443,11 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - } - - /* -- * Trying to add an rdataset with lower trust to a cache DB -- * has no effect, provided that the cache data isn't stale. -+ * Trying to add an rdataset with lower trust to a cache -+ * DB has no effect, provided that the cache data isn't -+ * stale. If the cache data is stale, new lower trust -+ * data will supersede it below. Unclear what the best -+ * policy is here. - */ - if (rbtversion == NULL && trust < header->trust && - (ACTIVE(header, now) || header_nx)) { -@@ -6362,6 +6477,10 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - - if ((options & DNS_DBADD_EXACT) != 0) - flags |= DNS_RDATASLAB_EXACT; -+ /* -+ * TTL use here is irrelevant to the cache; -+ * merge is only done with zonedbs. -+ */ - if ((options & DNS_DBADD_EXACTTTL) != 0 && - newheader->rdh_ttl != header->rdh_ttl) - result = DNS_R_NOTEXACT; -@@ -6405,11 +6524,12 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - } - } - /* -- * Don't replace existing NS, A and AAAA RRsets -- * in the cache if they are already exist. This -- * prevents named being locked to old servers. -- * Don't lower trust of existing record if the -- * update is forced. -+ * Don't replace existing NS, A and AAAA RRsets in the -+ * cache if they are already exist. This prevents named -+ * being locked to old servers. Don't lower trust of -+ * existing record if the update is forced. Nothing -+ * special to be done w.r.t stale data; it gets replaced -+ * normally further down. - */ - if (IS_CACHE(rbtdb) && ACTIVE(header, now) && - header->type == dns_rdatatype_ns && -@@ -6582,10 +6702,10 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - changed->dirty = true; - if (rbtversion == NULL) { - set_ttl(rbtdb, header, 0); -- mark_stale_header(rbtdb, header); -+ mark_header_ancient(rbtdb, header); - if (sigheader != NULL) { - set_ttl(rbtdb, sigheader, 0); -- mark_stale_header(rbtdb, sigheader); -+ mark_header_ancient(rbtdb, sigheader); - } - } - if (rbtversion != NULL && !header_nx) { -@@ -8436,6 +8556,30 @@ nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name) { - return (result); - } - -+static isc_result_t -+setservestalettl(dns_db_t *db, dns_ttl_t ttl) { -+ dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; -+ -+ REQUIRE(VALID_RBTDB(rbtdb)); -+ REQUIRE(IS_CACHE(rbtdb)); -+ -+ /* currently no bounds checking. 0 means disable. */ -+ rbtdb->serve_stale_ttl = ttl; -+ return ISC_R_SUCCESS; -+} -+ -+static isc_result_t -+getservestalettl(dns_db_t *db, dns_ttl_t *ttl) { -+ dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; -+ -+ REQUIRE(VALID_RBTDB(rbtdb)); -+ REQUIRE(IS_CACHE(rbtdb)); -+ -+ *ttl = rbtdb->serve_stale_ttl; -+ return ISC_R_SUCCESS; -+} -+ -+ - static dns_dbmethods_t zone_methods = { - attach, - detach, -@@ -8481,7 +8625,9 @@ static dns_dbmethods_t zone_methods = { - NULL, - hashsize, - nodefullname, -- getsize -+ getsize, -+ NULL, -+ NULL - }; - - static dns_dbmethods_t cache_methods = { -@@ -8529,7 +8675,9 @@ static dns_dbmethods_t cache_methods = { - setcachestats, - hashsize, - nodefullname, -- NULL -+ NULL, -+ setservestalettl, -+ getservestalettl - }; - - isc_result_t -@@ -8800,7 +8948,7 @@ dns_rbtdb_create - rbtdb->rpzs = NULL; - rbtdb->load_rpzs = NULL; - rbtdb->rpz_num = DNS_RPZ_INVALID_NUM; -- -+ rbtdb->serve_stale_ttl = 0; - /* - * Version Initialization. - */ -@@ -9218,7 +9366,8 @@ rdatasetiter_first(dns_rdatasetiter_t *iterator) { - * rdatasets to work. - */ - if (NONEXISTENT(header) || -- (now != 0 && now > header->rdh_ttl)) -+ (now != 0 && now > header->rdh_ttl -+ + rbtdb->serve_stale_ttl)) - header = NULL; - break; - } else -@@ -10427,7 +10576,7 @@ static inline bool - need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) { - if ((header->attributes & - (RDATASET_ATTR_NONEXISTENT | -- RDATASET_ATTR_STALE | -+ RDATASET_ATTR_ANCIENT | - RDATASET_ATTR_ZEROTTL)) != 0) - return (false); - -@@ -10533,7 +10682,7 @@ expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - bool tree_locked, expire_t reason) - { - set_ttl(rbtdb, header, 0); -- mark_stale_header(rbtdb, header); -+ mark_header_ancient(rbtdb, header); - - /* - * Caller must hold the node (write) lock. -diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c -index 49ec49c..2de70a6 100644 ---- a/lib/dns/resolver.c -+++ b/lib/dns/resolver.c -@@ -141,16 +141,17 @@ - #endif /* WANT_QUERYTRACE */ - - #define US_PER_SEC 1000000U -+#define US_PER_MSEC 1000U - /* - * The maximum time we will wait for a single query. - */ --#define MAX_SINGLE_QUERY_TIMEOUT 9U --#define MAX_SINGLE_QUERY_TIMEOUT_US (MAX_SINGLE_QUERY_TIMEOUT*US_PER_SEC) -+#define MAX_SINGLE_QUERY_TIMEOUT 9000U -+#define MAX_SINGLE_QUERY_TIMEOUT_US (MAX_SINGLE_QUERY_TIMEOUT*US_PER_MSEC) - - /* - * We need to allow a individual query time to complete / timeout. - */ --#define MINIMUM_QUERY_TIMEOUT (MAX_SINGLE_QUERY_TIMEOUT + 1U) -+#define MINIMUM_QUERY_TIMEOUT (MAX_SINGLE_QUERY_TIMEOUT + 1000U) - - /* The default time in seconds for the whole query to live. */ - #ifndef DEFAULT_QUERY_TIMEOUT -@@ -159,7 +160,7 @@ - - /* The maximum time in seconds for the whole query to live. */ - #ifndef MAXIMUM_QUERY_TIMEOUT --#define MAXIMUM_QUERY_TIMEOUT 30 -+#define MAXIMUM_QUERY_TIMEOUT 30000 - #endif - - /* The default maximum number of recursions to follow before giving up. */ -@@ -529,6 +530,11 @@ struct dns_resolver { - dns_fetch_t * primefetch; - /* Locked by nlock. */ - unsigned int nfctx; -+ -+ /* Unlocked. Additions for serve-stale feature. */ -+ unsigned int retryinterval; /* in milliseconds */ -+ unsigned int nonbackofftries; -+ - }; - - #define RES_MAGIC ISC_MAGIC('R', 'e', 's', '!') -@@ -1650,14 +1656,12 @@ fctx_setretryinterval(fetchctx_t *fctx, unsigned int rtt) { - unsigned int seconds; - unsigned int us; - -+ us = fctx->res->retryinterval * 1000; - /* -- * We retry every .8 seconds the first two times through the address -- * list, and then we do exponential back-off. -+ * Exponential backoff after the first few tries. - */ -- if (fctx->restarts < 3) -- us = 800000; -- else -- us = (800000 << (fctx->restarts - 2)); -+ if (fctx->restarts >= fctx->res->nonbackofftries) -+ us <<= (fctx->restarts - fctx->res->nonbackofftries - 1); - - /* - * Add a fudge factor to the expected rtt based on the current -@@ -4542,7 +4546,8 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, - /* - * Compute an expiration time for the entire fetch. - */ -- isc_interval_set(&interval, res->query_timeout, 0); -+ isc_interval_set(&interval, res->query_timeout / 1000, -+ res->query_timeout % 1000 * 1000000); - iresult = isc_time_nowplusinterval(&fctx->expires, &interval); - if (iresult != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, -@@ -9105,6 +9110,8 @@ dns_resolver_create(dns_view_t *view, - res->spillattimer = NULL; - res->zspill = 0; - res->zero_no_soa_ttl = false; -+ res->retryinterval = 30000; -+ res->nonbackofftries = 3; - res->query_timeout = DEFAULT_QUERY_TIMEOUT; - res->maxdepth = DEFAULT_RECURSION_DEPTH; - res->maxqueries = DEFAULT_MAX_QUERIES; -@@ -10439,17 +10446,20 @@ dns_resolver_gettimeout(dns_resolver_t *resolver) { - } - - void --dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds) { -+dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int timeout) { - REQUIRE(VALID_RESOLVER(resolver)); - -- if (seconds == 0) -- seconds = DEFAULT_QUERY_TIMEOUT; -- if (seconds > MAXIMUM_QUERY_TIMEOUT) -- seconds = MAXIMUM_QUERY_TIMEOUT; -- if (seconds < MINIMUM_QUERY_TIMEOUT) -- seconds = MINIMUM_QUERY_TIMEOUT; -+ if (timeout <= 300) -+ timeout *= 1000; -+ -+ if (timeout == 0) -+ timeout = DEFAULT_QUERY_TIMEOUT; -+ if (timeout > MAXIMUM_QUERY_TIMEOUT) -+ timeout = MAXIMUM_QUERY_TIMEOUT; -+ if (timeout < MINIMUM_QUERY_TIMEOUT) -+ timeout = MINIMUM_QUERY_TIMEOUT; - -- resolver->query_timeout = seconds; -+ resolver->query_timeout = timeout; - } - - void -@@ -10546,3 +10556,34 @@ dns_resolver_getquotaresponse(dns_resolver_t *resolver, dns_quotatype_t which) - - return (resolver->quotaresp[which]); - } -+ -+unsigned int -+dns_resolver_getretryinterval(dns_resolver_t *resolver) { -+ REQUIRE(VALID_RESOLVER(resolver)); -+ -+ return (resolver->retryinterval); -+} -+ -+void -+dns_resolver_setretryinterval(dns_resolver_t *resolver, unsigned int interval) -+{ -+ REQUIRE(VALID_RESOLVER(resolver)); -+ REQUIRE(interval > 0); -+ -+ resolver->retryinterval = ISC_MIN(interval, 2000); -+} -+ -+unsigned int -+dns_resolver_getnonbackofftries(dns_resolver_t *resolver) { -+ REQUIRE(VALID_RESOLVER(resolver)); -+ -+ return (resolver->nonbackofftries); -+} -+ -+void -+dns_resolver_setnonbackofftries(dns_resolver_t *resolver, unsigned int tries) { -+ REQUIRE(VALID_RESOLVER(resolver)); -+ REQUIRE(tries > 0); -+ -+ resolver->nonbackofftries = tries; -+} -diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c -index 477bb74..09cf932 100644 ---- a/lib/dns/sdb.c -+++ b/lib/dns/sdb.c -@@ -1370,7 +1370,9 @@ static dns_dbmethods_t sdb_methods = { - NULL, /* setcachestats */ - NULL, /* hashsize */ - NULL, /* nodefullname */ -- NULL /* getsize */ -+ NULL, /* getsize */ -+ NULL, /* setservestalettl */ -+ NULL /* getservestalettl */ - }; - - static isc_result_t -diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c -index 037d74a..9218fed 100644 ---- a/lib/dns/sdlz.c -+++ b/lib/dns/sdlz.c -@@ -1336,7 +1336,9 @@ static dns_dbmethods_t sdlzdb_methods = { - NULL, /* setcachestats */ - NULL, /* hashsize */ - NULL, /* nodefullname */ -- NULL /* getsize */ -+ NULL, /* getsize */ -+ NULL, /* setservestalettl */ -+ NULL /* getservestalettl */ - }; - - /* -diff --git a/lib/dns/tests/db_test.c b/lib/dns/tests/db_test.c -index bc1cc3f..60fdb81 100644 ---- a/lib/dns/tests/db_test.c -+++ b/lib/dns/tests/db_test.c -@@ -28,8 +28,9 @@ - - #include - #include --#include - #include -+#include -+#include - - #include "dnstest.h" - -@@ -76,7 +77,7 @@ getoriginnode_test(void **state) { - assert_int_equal(result, ISC_R_SUCCESS); - - result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone, -- dns_rdataclass_in, 0, NULL, &db); -+ dns_rdataclass_in, 0, NULL, &db); - assert_int_equal(result, ISC_R_SUCCESS); - - result = dns_db_getoriginnode(db, &node); -@@ -91,6 +92,197 @@ getoriginnode_test(void **state) { - isc_mem_detach(&mymctx); - } - -+/* test getservestalettl and setservestalettl */ -+static void -+getsetservestalettl_test(void **state) { -+ dns_db_t *db = NULL; -+ isc_mem_t *mymctx = NULL; -+ isc_result_t result; -+ dns_ttl_t ttl; -+ -+ UNUSED(state); -+ -+ result = isc_mem_create(0, 0, &mymctx); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache, -+ dns_rdataclass_in, 0, NULL, &db); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ ttl = 5000; -+ result = dns_db_getservestalettl(db, &ttl); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ assert_int_equal(ttl, 0); -+ -+ ttl = 6 * 3600; -+ result = dns_db_setservestalettl(db, ttl); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ ttl = 5000; -+ result = dns_db_getservestalettl(db, &ttl); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ assert_int_equal(ttl, 6 * 3600); -+ -+ dns_db_detach(&db); -+ isc_mem_detach(&mymctx); -+} -+ -+/* check DNS_DBFIND_STALEOK works */ -+static void -+dns_dbfind_staleok_test(void **state) { -+ dns_db_t *db = NULL; -+ dns_dbnode_t *node = NULL; -+ dns_fixedname_t example_fixed; -+ dns_fixedname_t found_fixed; -+ dns_name_t *example; -+ dns_name_t *found; -+ dns_rdatalist_t rdatalist; -+ dns_rdataset_t rdataset; -+ int count; -+ int pass; -+ isc_mem_t *mymctx = NULL; -+ isc_result_t result; -+ unsigned char data[] = { 0x0a, 0x00, 0x00, 0x01 }; -+ -+ UNUSED(state); -+ -+ result = isc_mem_create(0, 0, &mymctx); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache, -+ dns_rdataclass_in, 0, NULL, &db); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ example = dns_fixedname_initname(&example_fixed); -+ found = dns_fixedname_initname(&found_fixed); -+ -+ result = dns_name_fromstring(example, "example", 0, NULL); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ /* -+ * Pass 0: default; no stale processing permitted. -+ * Pass 1: stale processing for 1 second. -+ * Pass 2: stale turned off after being on. -+ */ -+ for (pass = 0; pass < 3; pass++) { -+ dns_rdata_t rdata = DNS_RDATA_INIT; -+ -+ /* 10.0.0.1 */ -+ rdata.data = data; -+ rdata.length = 4; -+ rdata.rdclass = dns_rdataclass_in; -+ rdata.type = dns_rdatatype_a; -+ -+ dns_rdatalist_init(&rdatalist); -+ rdatalist.ttl = 2; -+ rdatalist.type = dns_rdatatype_a; -+ rdatalist.rdclass = dns_rdataclass_in; -+ ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); -+ -+ switch (pass) { -+ case 0: -+ /* default: stale processing off */ -+ break; -+ case 1: -+ /* turn on stale processing */ -+ result = dns_db_setservestalettl(db, 1); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ break; -+ case 2: -+ /* turn off stale processing */ -+ result = dns_db_setservestalettl(db, 0); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ break; -+ } -+ -+ dns_rdataset_init(&rdataset); -+ result = dns_rdatalist_tordataset(&rdatalist, &rdataset); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ result = dns_db_findnode(db, example, true, &node); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ result = dns_db_addrdataset(db, node, NULL, 0, &rdataset, 0, -+ NULL); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ dns_db_detachnode(db, &node); -+ dns_rdataset_disassociate(&rdataset); -+ -+ result = dns_db_find(db, example, NULL, dns_rdatatype_a, -+ 0, 0, &node, found, &rdataset, NULL); -+ assert_int_equal(result, ISC_R_SUCCESS); -+ -+ /* -+ * May loop for up to 2 seconds performing non stale lookups. -+ */ -+ count = 0; -+ do { -+ count++; -+ assert_in_range(count, 0, 20); /* loop sanity */ -+ assert_int_equal(rdataset.attributes & -+ DNS_RDATASETATTR_STALE, 0); -+ assert_true(rdataset.ttl > 0); -+ dns_db_detachnode(db, &node); -+ dns_rdataset_disassociate(&rdataset); -+ -+ usleep(100000); /* 100 ms */ -+ -+ result = dns_db_find(db, example, NULL, -+ dns_rdatatype_a, 0, 0, -+ &node, found, &rdataset, NULL); -+ } while (result == ISC_R_SUCCESS); -+ -+ assert_int_equal(result, ISC_R_NOTFOUND); -+ -+ /* -+ * Check whether we can get stale data. -+ */ -+ result = dns_db_find(db, example, NULL, dns_rdatatype_a, -+ DNS_DBFIND_STALEOK, 0, -+ &node, found, &rdataset, NULL); -+ switch (pass) { -+ case 0: -+ assert_int_equal(result, ISC_R_NOTFOUND); -+ break; -+ case 1: -+ /* -+ * Should loop for 1 second with stale lookups then -+ * stop. -+ */ -+ count = 0; -+ do { -+ count++; -+ assert_in_range(count, 0, 49); /* loop sanity */ -+ assert_int_equal(result, ISC_R_SUCCESS); -+ assert_int_equal(rdataset.ttl, 0); -+ assert_int_equal(rdataset.attributes & -+ DNS_RDATASETATTR_STALE, -+ DNS_RDATASETATTR_STALE); -+ dns_db_detachnode(db, &node); -+ dns_rdataset_disassociate(&rdataset); -+ -+ usleep(100000); /* 100 ms */ -+ -+ result = dns_db_find(db, example, NULL, -+ dns_rdatatype_a, -+ DNS_DBFIND_STALEOK, -+ 0, &node, found, -+ &rdataset, NULL); -+ } while (result == ISC_R_SUCCESS); -+ assert_in_range(count, 1, 10); -+ assert_int_equal(result, ISC_R_NOTFOUND); -+ break; -+ case 2: -+ assert_int_equal(result, ISC_R_NOTFOUND); -+ break; -+ } -+ } -+ -+ dns_db_detach(&db); -+ isc_mem_detach(&mymctx); -+} -+ - /* database class */ - static void - class_test(void **state) { -@@ -213,6 +405,8 @@ int - main(void) { - const struct CMUnitTest tests[] = { - cmocka_unit_test(getoriginnode_test), -+ cmocka_unit_test(getsetservestalettl_test), -+ cmocka_unit_test(dns_dbfind_staleok_test), - cmocka_unit_test_setup_teardown(class_test, - _setup, _teardown), - cmocka_unit_test_setup_teardown(dbtype_test, -diff --git a/lib/dns/view.c b/lib/dns/view.c -index a7ba613..a644c5f 100644 ---- a/lib/dns/view.c -+++ b/lib/dns/view.c -@@ -229,6 +229,9 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, - view->flush = false; - view->dlv = NULL; - view->maxudp = 0; -+ view->staleanswerttl = 1; -+ view->staleanswersok = dns_stale_answer_conf; -+ view->staleanswersenable = false; - view->nocookieudp = 0; - view->maxbits = 0; - view->v4_aaaa = dns_aaaa_ok; -diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c -index 212194e..b562f95 100644 ---- a/lib/isccfg/namedconf.c -+++ b/lib/isccfg/namedconf.c -@@ -1778,6 +1778,7 @@ view_clauses[] = { - { "max-ncache-ttl", &cfg_type_uint32, 0 }, - { "max-recursion-depth", &cfg_type_uint32, 0 }, - { "max-recursion-queries", &cfg_type_uint32, 0 }, -+ { "max-stale-ttl", &cfg_type_ttlval, 0 }, - { "max-udp-size", &cfg_type_uint32, 0 }, - { "message-compression", &cfg_type_boolean, 0 }, - { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP }, -@@ -1806,7 +1807,9 @@ view_clauses[] = { - { "request-nsid", &cfg_type_boolean, 0 }, - { "request-sit", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, - { "require-server-cookie", &cfg_type_boolean, 0 }, -+ { "resolver-nonbackoff-tries", &cfg_type_uint32, 0 }, - { "resolver-query-timeout", &cfg_type_uint32, 0 }, -+ { "resolver-retry-interval", &cfg_type_uint32, 0 }, - { "response-policy", &cfg_type_rpz, 0 }, - { "rfc2308-type1", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI }, - { "root-delegation-only", &cfg_type_optional_exclude, 0 }, -@@ -1815,6 +1818,8 @@ view_clauses[] = { - { "send-cookie", &cfg_type_boolean, 0 }, - { "servfail-ttl", &cfg_type_ttlval, 0 }, - { "sortlist", &cfg_type_bracketed_aml, 0 }, -+ { "stale-answer-enable", &cfg_type_boolean, 0 }, -+ { "stale-answer-ttl", &cfg_type_ttlval, 0 }, - { "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI }, - { "topology", &cfg_type_bracketed_aml, CFG_CLAUSEFLAG_NOTIMP }, - { "transfer-format", &cfg_type_transferformat, 0 }, --- -2.26.2 - diff --git a/SOURCES/bind-9.11-stale-cache.patch b/SOURCES/bind-9.11-stale-cache.patch deleted file mode 100644 index 1a9f003..0000000 --- a/SOURCES/bind-9.11-stale-cache.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 8a7bff93037432fcfe8532752e89f150ea3030a4 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Mon, 9 Oct 2023 19:00:12 +0200 -Subject: [PATCH] Do not keep stale records by default - -By default set max-stale-ttl to 0, unless stale-answer-enable yes. This -were enabled by mistake when backporting fix for CVE-2023-2828. It -causes increased cache usage on servers not wanting to serve stale -records. Fix that by setting smart defaults based on stale answers -enabled with possible manual tuning. ---- - bin/named/server.c | 25 +++++++++++++++++++------ - 1 file changed, 19 insertions(+), 6 deletions(-) - -diff --git a/bin/named/server.c b/bin/named/server.c -index 7af90d0..afdc4fa 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -3295,7 +3295,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - size_t max_acache_size; - size_t max_adb_size; - uint32_t lame_ttl, fail_ttl; -- uint32_t max_stale_ttl; -+ uint32_t max_stale_ttl = 0; - dns_tsig_keyring_t *ring = NULL; - dns_view_t *pview = NULL; /* Production view */ - isc_mem_t *cmctx = NULL, *hmctx = NULL; -@@ -3739,16 +3739,29 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - if (view->maxncachettl > 7 * 24 * 3600) - view->maxncachettl = 7 * 24 * 3600; - -- obj = NULL; -- result = ns_config_get(maps, "max-stale-ttl", &obj); -- INSIST(result == ISC_R_SUCCESS); -- max_stale_ttl = cfg_obj_asuint32(obj); -- - obj = NULL; - result = ns_config_get(maps, "stale-answer-enable", &obj); - INSIST(result == ISC_R_SUCCESS); - view->staleanswersenable = cfg_obj_asboolean(obj); - -+ // RHEL-11785 -- set the stale-ttl to non-zero value only if enabled -+ obj = NULL; -+ if (view->staleanswersenable) { -+ result = ns_config_get(maps, "max-stale-ttl", &obj); -+ INSIST(result == ISC_R_SUCCESS); -+ max_stale_ttl = cfg_obj_asuint32(obj); -+ /* -+ * If 'stale-answer-enable' is false, max_stale_ttl is set -+ * to 0, meaning keeping stale RRsets in cache is disabled. -+ */ -+ } else { -+ /* Do not use default value if stale is disabled, -+ * but allow manual overriding, like 'stale-cache-enable' */ -+ result = ns_config_get(optionmaps, "max-stale-ttl", &obj); -+ if (result == ISC_R_SUCCESS) -+ max_stale_ttl = cfg_obj_asuint32(obj); -+ } -+ - result = dns_viewlist_find(&ns_g_server->viewlist, view->name, - view->rdclass, &pview); - if (result == ISC_R_SUCCESS) { --- -2.41.0 - diff --git a/SOURCES/bind-9.11-unit-disable-random.patch b/SOURCES/bind-9.11-unit-disable-random.patch deleted file mode 100644 index 553f725..0000000 --- a/SOURCES/bind-9.11-unit-disable-random.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 373f07148217a8e70e33446f5108fb42d1079ba6 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Thu, 21 Feb 2019 22:42:27 +0100 -Subject: [PATCH] Disable random_test - -It fails too often on some architecture, failing the whole build along. -Because it runs two times for pkcs11 and normal build and any of -subtests can occasionally fail, stop it. - -It can be used again by defining 'unstable' variable in Kyuafile. ---- - lib/isc/tests/Kyuafile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/isc/tests/Kyuafile b/lib/isc/tests/Kyuafile -index 4cd2574..9df2340 100644 ---- a/lib/isc/tests/Kyuafile -+++ b/lib/isc/tests/Kyuafile -@@ -19,7 +19,7 @@ tap_test_program{name='pool_test'} - tap_test_program{name='print_test'} - tap_test_program{name='queue_test'} - tap_test_program{name='radix_test'} --tap_test_program{name='random_test'} -+tap_test_program{name='random_test', required_configs='unstable'} - tap_test_program{name='regex_test'} - tap_test_program{name='result_test'} - tap_test_program{name='safe_test'} --- -2.20.1 - diff --git a/SOURCES/bind-9.11-zone2ldap.patch b/SOURCES/bind-9.11-zone2ldap.patch deleted file mode 100644 index d29656e..0000000 --- a/SOURCES/bind-9.11-zone2ldap.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 9683a4d2524b870c4cee09259cb5eb7b8075a507 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Tue, 18 Dec 2018 16:06:26 +0100 -Subject: [PATCH] Make absolute hostname by dns API instead of strings - -Duplicate all strings in dc_list. Free allocated memory on each record. ---- - bin/sdb_tools/zone2ldap.c | 70 +++++++++++++++++++++++++-------------- - 1 file changed, 45 insertions(+), 25 deletions(-) - -diff --git a/bin/sdb_tools/zone2ldap.c b/bin/sdb_tools/zone2ldap.c -index d59936c..9ba73b8 100644 ---- a/bin/sdb_tools/zone2ldap.c -+++ b/bin/sdb_tools/zone2ldap.c -@@ -84,6 +84,10 @@ int get_attr_list_size (char **tmp); - /* Get a DN */ - char *build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag, char *zone); - -+/* Free a DN list */ -+static void -+free_dc_list(char **dc_list); -+ - /* Add to RR list */ - void add_to_rr_list (char *dn, char *name, char *type, char *data, - unsigned int ttl, unsigned int flags); -@@ -120,6 +124,7 @@ static char dNSTTL []="dNSTTL"; - static char zoneName []="zoneName"; - static char dc []="dc"; - static char sameZone []="@"; -+static char dot []="."; - /* LDAPMod mod_values: */ - static char *objectClasses []= { &(topClass[0]), &(dNSZoneClass[0]), NULL }; - static char *topObjectClasses []= { &(topClass[0]), &(dcObjectClass[0]), &(dNSZoneClass[0]), NULL }; -@@ -391,6 +396,8 @@ main (int argc, char **argv) - } - - } -+ -+ free_dc_list(dc_list); - } - else - { -@@ -446,12 +453,18 @@ generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, unsigned int ttl) - char data[2048]; - char **dc_list; - char *dn; -+ size_t argzone_len; -+ bool omit_dot; - - isc_buffer_t buff; - isc_result_t result; - - isc_buffer_init (&buff, name, sizeof (name)); - result = dns_name_totext (dnsname, true, &buff); -+ argzone_len = strlen(argzone); -+ /* If argzone is absolute, output absolute name too */ -+ omit_dot = (!(argzone_len > 0 && argzone[argzone_len-1] == '.')); -+ result = dns_name_totext (dnsname, omit_dot, &buff); - isc_result_check (result, "dns_name_totext"); - name[isc_buffer_usedlength (&buff)] = 0; - -@@ -473,6 +486,7 @@ generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, unsigned int ttl) - printf ("Adding %s (%s %s) to run queue list.\n", dn, type, data); - - add_to_rr_list (dn, dc_list[len], (char*)type, (char*)data, ttl, DNS_OBJECT); -+ free_dc_list(dc_list); - } - - -@@ -533,12 +547,9 @@ add_to_rr_list (char *dn, char *name, char *type, - if (tmp->attrs == (LDAPMod **) NULL) - fatal("calloc"); - -- for (i = 0; i < (int)flags; i++) -- { -- tmp->attrs[i] = (LDAPMod *) malloc (sizeof (LDAPMod)); -- if (tmp->attrs[i] == (LDAPMod *) NULL) -- fatal("malloc"); -- } -+ tmp->attrs[0] = (LDAPMod *) malloc (sizeof (LDAPMod)); -+ if (tmp->attrs[0] == (LDAPMod *) NULL) -+ fatal("malloc"); - tmp->attrs[0]->mod_op = LDAP_MOD_ADD; - tmp->attrs[0]->mod_type = objectClass; - -@@ -554,9 +565,18 @@ add_to_rr_list (char *dn, char *name, char *type, - return; - } - -+ for (i = 1; i < (int)flags-1; i++) -+ { -+ tmp->attrs[i] = (LDAPMod *) malloc (sizeof (LDAPMod)); -+ if (tmp->attrs[i] == (LDAPMod *) NULL) -+ fatal("malloc"); -+ } -+ tmp->attrs[i] = NULL; -+ -+ - tmp->attrs[1]->mod_op = LDAP_MOD_ADD; - tmp->attrs[1]->mod_type = relativeDomainName; -- tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2); -+ tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 3); - - if (tmp->attrs[1]->mod_values == (char **)NULL) - fatal("calloc"); -@@ -701,24 +721,16 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags) - { - char *tmp; - int i = 0; -+ int j = 0; - char *hname=0L, *last=0L; - int hlen=strlen(hostname), zlen=(strlen(zone)); - - /* printf("hostname: %s zone: %s\n",hostname, zone); */ -- hname=0L; - if(flags == DNS_OBJECT) - { -- if( (zone[ zlen - 1 ] == '.') && (hostname[hlen - 1] != '.') ) -- { -- hname=(char*)malloc(hlen + 1); -- hlen += 1; -- sprintf(hname, "%s.", hostname); -- hostname = hname; -- } - if(strcmp(hostname, zone) == 0) - { -- if( hname == 0 ) -- hname=strdup(hostname); -+ hname= strdup(hostname); - last = strdup(sameZone); - }else - { -@@ -726,8 +738,6 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags) - ||( strcmp( hostname + (hlen - zlen), zone ) != 0) - ) - { -- if( hname != 0 ) -- free(hname); - hname=(char*)malloc( hlen + zlen + 1); - if( *zone == '.' ) - sprintf(hname, "%s%s", hostname, zone); -@@ -735,8 +745,7 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags) - sprintf(hname,"%s",zone); - }else - { -- if( hname == 0 ) -- hname = strdup(hostname); -+ hname = strdup(hostname); - } - last = hname; - } -@@ -749,18 +758,21 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags) - for (tmp = strrchr (hname, '.'); tmp != (char *) 0; - tmp = strrchr (hname, '.')) - { -- if( *( tmp + 1 ) != '\0' ) -+ tmp[0] = '\0'; -+ if( tmp[1] != '\0' ) - { -- *tmp = '\0'; - dn_buffer[i++] = ++tmp; - }else - { /* trailing '.' ! */ -- dn_buffer[i++] = strdup("."); -- *tmp = '\0'; -+ dn_buffer[i++] = dot; - if( tmp == hname ) - break; - } - } -+ for (j=0; j -Date: Fri, 14 Feb 2020 09:18:48 +0100 -Subject: [PATCH] Use RESOLVER_NTASKS_PERCPU - 32 for regular tuning, 8 for - small - -Modify original upstream commit 0d80266f7e3, add high limit of used -tasks. Minimum would be lower on machines with few cpus, but maximum -would stay unchanged. Should prevent negatives of this change. - -Signed-off-by: Petr Mensik ---- - bin/named/server.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/bin/named/server.c b/bin/named/server.c -index 39b1124..94b4daa 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -148,11 +148,13 @@ - #endif - - #ifdef TUNE_LARGE --#define RESOLVER_NTASKS 523 -+#define RESOLVER_NTASKS_MAX 523 -+#define RESOLVER_NTASKS_PERCPU 32 - #define UDPBUFFERS 32768 - #define EXCLBUFFERS 32768 - #else --#define RESOLVER_NTASKS 31 -+#define RESOLVER_NTASKS_MAX 31 -+#define RESOLVER_NTASKS_PERCPU 8 - #define UDPBUFFERS 1000 - #define EXCLBUFFERS 4096 - #endif /* TUNE_LARGE */ -@@ -3318,7 +3320,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - ns_cache_t *nsc; - bool zero_no_soattl; - dns_acl_t *clients = NULL, *mapped = NULL, *excluded = NULL; -- unsigned int query_timeout, ndisp; -+ unsigned int query_timeout, ndisp, ntasks; - bool old_rpz_ok = false; - isc_dscp_t dscp4 = -1, dscp6 = -1; - dns_dyndbctx_t *dctx = NULL; -@@ -3926,7 +3928,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, - dns_view_setresquerystats(view, resquerystats); - - ndisp = 4 * ISC_MIN(ns_g_udpdisp, MAX_UDP_DISPATCH); -- CHECK(dns_view_createresolver(view, ns_g_taskmgr, RESOLVER_NTASKS, -+ ntasks = ISC_MIN(RESOLVER_NTASKS_PERCPU * ns_g_cpus, -+ RESOLVER_NTASKS_MAX); -+ CHECK(dns_view_createresolver(view, ns_g_taskmgr, ntasks, - ndisp, ns_g_socketmgr, ns_g_timermgr, - resopts, ns_g_dispatchmgr, - dispatch4, dispatch6)); --- -2.34.1 - diff --git a/SOURCES/bind-9.16-CVE-2022-3094-1.patch b/SOURCES/bind-9.16-CVE-2022-3094-1.patch deleted file mode 100644 index 3a3e9c0..0000000 --- a/SOURCES/bind-9.16-CVE-2022-3094-1.patch +++ /dev/null @@ -1,240 +0,0 @@ -From 128b3b676eb9413b4d25fb29c560895cfbbfa92e Mon Sep 17 00:00:00 2001 -From: Evan Hunt -Date: Thu, 1 Sep 2022 16:05:04 -0700 -Subject: [PATCH] add an update quota - -limit the number of simultaneous DNS UPDATE events that can be -processed by adding a quota for update and update forwarding. -this quota currently, arbitrarily, defaults to 100. - -also add a statistics counter to record when the update quota -has been exceeded. - -(cherry picked from commit 7c47254a140c3e9cf383cda73c7b6a55c4782826) ---- - bin/named/bind9.xsl | 2 +- - bin/named/bind9.xsl.h | 8 +++++++- - bin/named/include/named/server.h | 7 ++++++- - bin/named/server.c | 3 +++ - bin/named/statschannel.c | 5 +++-- - bin/named/update.c | 34 +++++++++++++++++++++++++++++++- - doc/arm/Bv9ARM-book.xml | 15 ++++++++++++++ - 7 files changed, 68 insertions(+), 6 deletions(-) - -diff --git a/bin/named/bind9.xsl b/bin/named/bind9.xsl -index 9a1c6ff..85fd4c4 100644 ---- a/bin/named/bind9.xsl -+++ b/bin/named/bind9.xsl -@@ -12,7 +12,7 @@ - - - -- -+ - - - -diff --git a/bin/named/bind9.xsl.h b/bin/named/bind9.xsl.h -index 9ce8cd7..5e0a892 100644 ---- a/bin/named/bind9.xsl.h -+++ b/bin/named/bind9.xsl.h -@@ -17,7 +17,13 @@ static char xslmsg[] = - "\n" - "\n" - " \n" -- " \n" -+#if 0 -+ " \n" -+ " \n" -+#endif -+ " \n" - " \n" - " \n" - " \n" -diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h -index 08a02dc..259acc7 100644 ---- a/bin/named/include/named/server.h -+++ b/bin/named/include/named/server.h -@@ -137,6 +137,9 @@ struct ns_server { - - uint16_t transfer_tcp_message_size; - isc_rng_t * rngctx; -+ -+/* CVE-2022-3094 */ -+ isc_quota_t updquota; - }; - - struct ns_altsecret { -@@ -230,7 +233,9 @@ enum { - dns_nsstatscounter_trystale = 59, - dns_nsstatscounter_usedstale = 60, - -- dns_nsstatscounter_max = 61 -+ dns_nsstatscounter_updatequota = 61, -+ -+ dns_nsstatscounter_max = 62 - }; - - /*% -diff --git a/bin/named/server.c b/bin/named/server.c -index 2d2fa0e..f09b895 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -9143,6 +9143,8 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) { - RUNTIME_CHECK(result == ISC_R_SUCCESS); - result = isc_quota_init(&server->recursionquota, 100); - RUNTIME_CHECK(result == ISC_R_SUCCESS); -+ result = isc_quota_init(&server->updquota, 100); -+ RUNTIME_CHECK(result == ISC_R_SUCCESS); - - result = dns_aclenv_init(mctx, &server->aclenv); - RUNTIME_CHECK(result == ISC_R_SUCCESS); -@@ -9410,6 +9412,7 @@ ns_server_destroy(ns_server_t **serverp) { - - dns_aclenv_destroy(&server->aclenv); - -+ isc_quota_destroy(&server->updquota); - isc_quota_destroy(&server->recursionquota); - isc_quota_destroy(&server->tcpquota); - isc_quota_destroy(&server->xfroutquota); -diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c -index 56a9c21..1e8723c 100644 ---- a/bin/named/statschannel.c -+++ b/bin/named/statschannel.c -@@ -300,6 +300,7 @@ init_desc(void) { - SET_NSSTATDESC(reclimitdropped, - "queries dropped due to recursive client limit", - "RecLimitDropped"); -+ SET_NSSTATDESC(updatequota, "Update quota exceeded", "UpdateQuota"); - SET_NSSTATDESC(trystale, - "attempts to use stale cache data after lookup failure", - "QryTryStale"); -@@ -1546,7 +1547,7 @@ generatexml(ns_server_t *server, uint32_t flags, - ISC_XMLCHAR "type=\"text/xsl\" href=\"/bind9.xsl\"")); - TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "statistics")); - TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "version", -- ISC_XMLCHAR "3.8")); -+ ISC_XMLCHAR "3.8.1")); - - /* Set common fields for statistics dump */ - dumparg.type = isc_statsformat_xml; -@@ -2303,7 +2304,7 @@ generatejson(ns_server_t *server, size_t *msglen, - /* - * These statistics are included no matter which URL we use. - */ -- obj = json_object_new_string("1.2"); -+ obj = json_object_new_string("1.2.1"); - CHECKMEM(obj); - json_object_object_add(bindstats, "json-stats-version", obj); - -diff --git a/bin/named/update.c b/bin/named/update.c -index 6ad7d27..dccc543 100644 ---- a/bin/named/update.c -+++ b/bin/named/update.c -@@ -1526,6 +1526,17 @@ send_update_event(ns_client_t *client, dns_zone_t *zone) { - isc_task_t *zonetask = NULL; - ns_client_t *evclient; - -+ result = isc_quota_attach(&ns_g_server->updquota, -+ &(isc_quota_t *){ NULL }); -+ if (result != ISC_R_SUCCESS) { -+ update_log(client, zone, LOGLEVEL_PROTOCOL, -+ "update failed: too many DNS UPDATEs queued (%s)", -+ isc_result_totext(result)); -+ isc_stats_increment(ns_g_server->nsstats, -+ dns_nsstatscounter_updatequota); -+ CHECK(DNS_R_DROP); -+ } -+ - event = (update_event_t *) - isc_event_allocate(client->mctx, client, DNS_EVENT_UPDATE, - update_action, NULL, sizeof(*event)); -@@ -1652,7 +1663,12 @@ ns_update_start(ns_client_t *client, isc_result_t sigresult) { - * We are still in the client task context, so we can - * simply give an error response without switching tasks. - */ -- respond(client, result); -+ if (result == DNS_R_DROP) { -+ ns_client_next(client, result); -+ } else { -+ respond(client, result); -+ } -+ - if (zone != NULL) - dns_zone_detach(&zone); - } -@@ -3385,6 +3401,7 @@ updatedone_action(isc_task_t *task, isc_event_t *event) { - dns_zone_detach(&uev->zone); - client->nupdates--; - respond(client, uev->result); -+ isc_quota_detach(&(isc_quota_t *){ &ns_g_server->updquota }); - isc_event_free(&event); - ns_client_detach(&client); - } -@@ -3402,6 +3419,8 @@ forward_fail(isc_task_t *task, isc_event_t *event) { - INSIST(client->nupdates > 0); - client->nupdates--; - respond(client, DNS_R_SERVFAIL); -+ -+ isc_quota_detach(&(isc_quota_t *){ &ns_g_server->updquota }); - isc_event_free(&event); - ns_client_detach(&client); - } -@@ -3439,6 +3458,8 @@ forward_done(isc_task_t *task, isc_event_t *event) { - client->nupdates--; - ns_client_sendraw(client, uev->answer); - dns_message_detach(&uev->answer); -+ -+ isc_quota_detach(&(isc_quota_t *){ &ns_g_server->updquota }); - isc_event_free(&event); - ns_client_detach(&client); - } -@@ -3472,6 +3493,17 @@ send_forward_event(ns_client_t *client, dns_zone_t *zone) { - isc_task_t *zonetask = NULL; - ns_client_t *evclient; - -+ result = isc_quota_attach(&ns_g_server->updquota, -+ &(isc_quota_t *){ NULL }); -+ if (result != ISC_R_SUCCESS) { -+ update_log(client, zone, LOGLEVEL_PROTOCOL, -+ "update failed: too many DNS UPDATEs queued (%s)", -+ isc_result_totext(result)); -+ isc_stats_increment(ns_g_server->nsstats, -+ dns_nsstatscounter_updatequota); -+ return (DNS_R_DROP); -+ } -+ - /* - * This may take some time so replace this client. - */ -diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml -index c17f168..9aca6d7 100644 ---- a/doc/arm/Bv9ARM-book.xml -+++ b/doc/arm/Bv9ARM-book.xml -@@ -15105,6 +15105,21 @@ HOST-127.EXAMPLE. MX 0 . - - - -+ -+ -+ UpdateQuota -+ -+ -+ -+ -+ -+ -+ This indicates the number of times a dynamic update or update -+ forwarding request was rejected because the number of pending -+ requests exceeded the update quota. -+ -+ -+ - - - RateDropped --- -2.39.2 - diff --git a/SOURCES/bind-9.16-CVE-2022-3094-2.patch b/SOURCES/bind-9.16-CVE-2022-3094-2.patch deleted file mode 100644 index f4ec472..0000000 --- a/SOURCES/bind-9.16-CVE-2022-3094-2.patch +++ /dev/null @@ -1,136 +0,0 @@ -From d9a03233c6ea11f20c2fbeca87b763673859f8b2 Mon Sep 17 00:00:00 2001 -From: Evan Hunt -Date: Thu, 1 Sep 2022 16:22:46 -0700 -Subject: [PATCH] add a configuration option for the update quota - -add an "update-quota" option to configure the update quota. - -(cherry picked from commit f57758a7303ad0034ff2ff08eaaf2ef899630f19) ---- - bin/named/config.c | 1 + - bin/named/named.conf.docbook | 2 ++ - bin/named/server.c | 1 + - bin/tests/system/checkconf/good.conf | 1 + - doc/arm/Bv9ARM-book.xml | 11 +++++++++++ - doc/arm/options.grammar.xml | 1 + - doc/misc/options | 1 + - lib/isccfg/namedconf.c | 1 + - 8 files changed, 19 insertions(+) - -diff --git a/bin/named/config.c b/bin/named/config.c -index 62d1e88..e3731cf 100644 ---- a/bin/named/config.c -+++ b/bin/named/config.c -@@ -134,6 +134,7 @@ options {\n\ - transfers-per-ns 2;\n\ - # treat-cr-as-space ;\n\ - trust-anchor-telemetry yes;\n\ -+ update-quota 100;\n\ - # use-id-pool ;\n\ - # use-ixfr ;\n\ - \n\ -diff --git a/bin/named/named.conf.docbook b/bin/named/named.conf.docbook -index 6565fce..5842cb5 100644 ---- a/bin/named/named.conf.docbook -+++ b/bin/named/named.conf.docbook -@@ -455,6 +455,7 @@ options { - trust-anchor-telemetry boolean; // experimental - try-tcp-refresh boolean; - update-check-ksk boolean; -+ update-quota integer; - use-alt-transfer-source boolean; - use-v4-udp-ports { portrange; ... }; - use-v6-udp-ports { portrange; ... }; -@@ -864,6 +865,7 @@ view string [ class ] { - type ( delegation-only | forward | hint | master | redirect - | slave | static-stub | stub ); - update-check-ksk boolean; -+ update-quota integer; - update-policy ( local | { ( deny | grant ) string ( - 6to4-self | external | krb5-self | krb5-selfsub | - krb5-subdomain | ms-self | ms-selfsub | ms-subdomain | -diff --git a/bin/named/server.c b/bin/named/server.c -index f09b895..7af90d0 100644 ---- a/bin/named/server.c -+++ b/bin/named/server.c -@@ -7792,6 +7792,7 @@ load_configuration(const char *filename, ns_server_t *server, - configure_server_quota(maps, "tcp-clients", &server->tcpquota); - configure_server_quota(maps, "recursive-clients", - &server->recursionquota); -+ configure_server_quota(maps, "update-quota", &server->updquota); - - if (server->recursionquota.max > 1000) { - int margin = ISC_MAX(100, ns_g_cpus + 1); -diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf -index 1359cf3..5d9b292 100644 ---- a/bin/tests/system/checkconf/good.conf -+++ b/bin/tests/system/checkconf/good.conf -@@ -63,6 +63,7 @@ options { - serial-queries 10; - serial-query-rate 100; - server-id none; -+ update-quota 200; - max-cache-size 20000000000000; - nta-lifetime 604800; - nta-recheck 604800; -diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml -index 9aca6d7..acf772b 100644 ---- a/doc/arm/Bv9ARM-book.xml -+++ b/doc/arm/Bv9ARM-book.xml -@@ -8599,6 +8599,17 @@ avoid-v6-udp-ports { 40000; range 50000 60000; }; - - - -+ -+ update-quota -+ -+ -+ This is the maximum number of simultaneous DNS UPDATE messages that -+ the server will accept for updating local authoritiative zones or -+ forwarding to a primary server. The default is 100. -+ -+ -+ -+ - - - -diff --git a/doc/arm/options.grammar.xml b/doc/arm/options.grammar.xml -index 793ac0b..1d17ea8 100644 ---- a/doc/arm/options.grammar.xml -+++ b/doc/arm/options.grammar.xml -@@ -277,6 +277,7 @@ - trust-anchor-telemetry boolean; // experimental - try-tcp-refresh boolean; - update-check-ksk boolean; -+ update-quota integer; - use-alt-transfer-source boolean; - use-v4-udp-ports { portrange; ... }; - use-v6-udp-ports { portrange; ... }; -diff --git a/doc/misc/options b/doc/misc/options -index fde93c7..e6d6ba6 100644 ---- a/doc/misc/options -+++ b/doc/misc/options -@@ -357,6 +357,7 @@ options { - trust-anchor-telemetry ; // experimental - try-tcp-refresh ; - update-check-ksk ; -+ update-quota ; - use-alt-transfer-source ; - use-id-pool ; // obsolete - use-ixfr ; // obsolete -diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c -index b562f95..667111c 100644 ---- a/lib/isccfg/namedconf.c -+++ b/lib/isccfg/namedconf.c -@@ -1136,6 +1136,7 @@ options_clauses[] = { - { "transfers-out", &cfg_type_uint32, 0 }, - { "transfers-per-ns", &cfg_type_uint32, 0 }, - { "treat-cr-as-space", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, -+ { "update-quota", &cfg_type_uint32, 0 }, - { "use-id-pool", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, - { "use-ixfr", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, - { "use-v4-udp-ports", &cfg_type_bracketed_portlist, 0 }, --- -2.39.2 - diff --git a/SOURCES/bind-9.16-CVE-2022-3094-3.patch b/SOURCES/bind-9.16-CVE-2022-3094-3.patch deleted file mode 100644 index 1d39423..0000000 --- a/SOURCES/bind-9.16-CVE-2022-3094-3.patch +++ /dev/null @@ -1,553 +0,0 @@ -From cba333b262b7ee0034a66cc93cf27f6c4918eea2 Mon Sep 17 00:00:00 2001 -From: Evan Hunt -Date: Tue, 8 Nov 2022 17:32:41 -0800 -Subject: [PATCH] move update ACL and update-policy checks before quota - -check allow-update, update-policy, and allow-update-forwarding before -consuming quota slots, so that unauthorized clients can't fill the -quota. - -(this moves the access check before the prerequisite check, which -violates the precise wording of RFC 2136. however, RFC co-author Paul -Vixie has stated that the RFC is mistaken on this point; it should have -said that access checking must happen *no later than* the completion of -prerequisite checks, not that it must happen exactly then.) - -(cherry picked from commit 964f559edb5036880b8e463b8f190b9007ee055d) ---- - bin/named/update.c | 440 ++++++++++++++++++++++++++++++--------------- - 1 file changed, 298 insertions(+), 142 deletions(-) - -diff --git a/bin/named/update.c b/bin/named/update.c -index 8853ee7..4d1fe78 100644 ---- a/bin/named/update.c -+++ b/bin/named/update.c -@@ -251,6 +251,9 @@ static void updatedone_action(isc_task_t *task, isc_event_t *event); - static isc_result_t send_forward_event(ns_client_t *client, dns_zone_t *zone); - static void forward_done(isc_task_t *task, isc_event_t *event); - static isc_result_t add_rr_prepare_action(void *data, rr_t *rr); -+static isc_result_t -+rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, -+ const dns_rdata_t *rdata, bool *flag); - - /**************************************************************************/ - -@@ -328,23 +331,24 @@ checkqueryacl(ns_client_t *client, dns_acl_t *queryacl, dns_name_t *zonename, - { - char namebuf[DNS_NAME_FORMATSIZE]; - char classbuf[DNS_RDATACLASS_FORMATSIZE]; -- int level; - isc_result_t result; -+ bool update_possible = -+ ((updateacl != NULL && !dns_acl_isnone(updateacl)) || -+ ssutable != NULL); - - result = ns_client_checkaclsilent(client, NULL, queryacl, true); - if (result != ISC_R_SUCCESS) { -+ int level = update_possible ? ISC_LOG_ERROR : ISC_LOG_INFO; -+ - dns_name_format(zonename, namebuf, sizeof(namebuf)); - dns_rdataclass_format(client->view->rdclass, classbuf, - sizeof(classbuf)); - -- level = (updateacl == NULL && ssutable == NULL) ? -- ISC_LOG_INFO : ISC_LOG_ERROR; -- - ns_client_log(client, NS_LOGCATEGORY_UPDATE_SECURITY, - NS_LOGMODULE_UPDATE, level, - "update '%s/%s' denied due to allow-query", - namebuf, classbuf); -- } else if (updateacl == NULL && ssutable == NULL) { -+ } else if (!update_possible) { - dns_name_format(zonename, namebuf, sizeof(namebuf)); - dns_rdataclass_format(client->view->rdclass, classbuf, - sizeof(classbuf)); -@@ -1525,6 +1529,277 @@ send_update_event(ns_client_t *client, dns_zone_t *zone) { - update_event_t *event = NULL; - isc_task_t *zonetask = NULL; - ns_client_t *evclient; -+#if 1 -+ dns_ssutable_t *ssutable = NULL; -+ dns_message_t *request = client->message; -+ dns_rdataclass_t zoneclass; -+ dns_rdatatype_t covers; -+ dns_name_t *zonename = NULL; -+ dns_db_t *db = NULL; -+ dns_dbversion_t *ver = NULL; -+ -+ CHECK(dns_zone_getdb(zone, &db)); -+ zonename = dns_db_origin(db); -+ zoneclass = dns_db_class(db); -+ dns_zone_getssutable(zone, &ssutable); -+ dns_db_currentversion(db, &ver); -+ -+ /* -+ * Update message processing can leak record existence information -+ * so check that we are allowed to query this zone. Additionally, -+ * if we would refuse all updates for this zone, we bail out here. -+ */ -+ CHECK(checkqueryacl(client, dns_zone_getqueryacl(zone), -+ dns_zone_getorigin(zone), -+ dns_zone_getupdateacl(zone), ssutable)); -+ -+ /* -+ * Check requestor's permissions. -+ */ -+ if (ssutable == NULL) -+ CHECK(checkupdateacl(client, dns_zone_getupdateacl(zone), -+ "update", zonename, false, false)); -+ else if (client->signer == NULL && !TCPCLIENT(client)) -+ CHECK(checkupdateacl(client, NULL, "update", zonename, -+ false, true)); -+ -+ if (dns_zone_getupdatedisabled(zone)) -+ FAILC(DNS_R_REFUSED, "dynamic update temporarily disabled " -+ "because the zone is frozen. Use " -+ "'rndc thaw' to re-enable updates."); -+ -+ /* -+ * Perform the Update Section Prescan. -+ */ -+ -+ for (result = dns_message_firstname(request, DNS_SECTION_UPDATE); -+ result == ISC_R_SUCCESS; -+ result = dns_message_nextname(request, DNS_SECTION_UPDATE)) -+ { -+ dns_name_t *name = NULL; -+ dns_rdata_t rdata = DNS_RDATA_INIT; -+ dns_ttl_t ttl; -+ dns_rdataclass_t update_class; -+ get_current_rr(request, DNS_SECTION_UPDATE, zoneclass, -+ &name, &rdata, &covers, &ttl, &update_class); -+ -+ if (! dns_name_issubdomain(name, zonename)) -+ FAILC(DNS_R_NOTZONE, -+ "update RR is outside zone"); -+ if (update_class == zoneclass) { -+ /* -+ * Check for meta-RRs. The RFC2136 pseudocode says -+ * check for ANY|AXFR|MAILA|MAILB, but the text adds -+ * "or any other QUERY metatype" -+ */ -+ if (dns_rdatatype_ismeta(rdata.type)) { -+ FAILC(DNS_R_FORMERR, -+ "meta-RR in update"); -+ } -+ result = dns_zone_checknames(zone, name, &rdata); -+ if (result != ISC_R_SUCCESS) -+ FAIL(DNS_R_REFUSED); -+ } else if (update_class == dns_rdataclass_any) { -+ if (ttl != 0 || rdata.length != 0 || -+ (dns_rdatatype_ismeta(rdata.type) && -+ rdata.type != dns_rdatatype_any)) -+ FAILC(DNS_R_FORMERR, -+ "meta-RR in update"); -+ } else if (update_class == dns_rdataclass_none) { -+ if (ttl != 0 || -+ dns_rdatatype_ismeta(rdata.type)) -+ FAILC(DNS_R_FORMERR, -+ "meta-RR in update"); -+ } else { -+ update_log(client, zone, ISC_LOG_WARNING, -+ "update RR has incorrect class %d", -+ update_class); -+ FAIL(DNS_R_FORMERR); -+ } -+ -+ /* -+ * draft-ietf-dnsind-simple-secure-update-01 says -+ * "Unlike traditional dynamic update, the client -+ * is forbidden from updating NSEC records." -+ */ -+ if (rdata.type == dns_rdatatype_nsec3) { -+ FAILC(DNS_R_REFUSED, -+ "explicit NSEC3 updates are not allowed " -+ "in secure zones"); -+ } else if (rdata.type == dns_rdatatype_nsec) { -+ FAILC(DNS_R_REFUSED, -+ "explicit NSEC updates are not allowed " -+ "in secure zones"); -+ } else if (rdata.type == dns_rdatatype_rrsig && -+ !dns_name_equal(name, zonename)) { -+ FAILC(DNS_R_REFUSED, -+ "explicit RRSIG updates are currently " -+ "not supported in secure zones except " -+ "at the apex"); -+ } -+ -+ if (ssutable != NULL) { -+ isc_netaddr_t netaddr; -+ dst_key_t *tsigkey = NULL; -+ isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr); -+ -+ if (client->message->tsigkey != NULL) -+ tsigkey = client->message->tsigkey->key; -+ -+ if (rdata.type != dns_rdatatype_any) { -+ if (!dns_ssutable_checkrules2 -+ (ssutable, client->signer, name, &netaddr, -+ TCPCLIENT(client), -+ &ns_g_server->aclenv, -+ rdata.type, tsigkey)) -+ { -+ FAILC(DNS_R_REFUSED, -+ "rejected by secure update"); -+ } -+ } else { -+ if (!ssu_checkall(db, ver, name, ssutable, -+ client->signer, -+ &netaddr, -+ TCPCLIENT(client), -+ tsigkey)) -+ { -+ FAILC(DNS_R_REFUSED, -+ "rejected by secure update"); -+ } -+ } -+ } -+ } -+ if (result != ISC_R_NOMORE) -+ FAIL(result); -+ -+ update_log(client, zone, LOGLEVEL_DEBUG, -+ "update section prescan OK"); -+#if 0 -+ if (ssutable == NULL) { -+ CHECK(checkupdateacl(client, dns_zone_getupdateacl(zone), -+ // zonename -+ "update", dns_zone_getorigin(zone), false, -+ false)); -+ } else if (client->signer == NULL && !TCPCLIENT(client)) { -+ CHECK(checkupdateacl(client, NULL, "update", -+ dns_zone_getorigin(zone), false, true)); -+ } -+ -+ if (dns_zone_getupdatedisabled(zone)) { -+ FAILC(DNS_R_REFUSED, "dynamic update temporarily disabled " -+ "because the zone is frozen. Use " -+ "'rndc thaw' to re-enable updates."); -+ } -+ -+ /* -+ * Prescan the update section, checking for updates that -+ * are illegal or violate policy. -+ */ -+ for (result = dns_message_firstname(request, DNS_SECTION_UPDATE); -+ result == ISC_R_SUCCESS; -+ result = dns_message_nextname(request, DNS_SECTION_UPDATE)) -+ { -+ dns_name_t *name = NULL; -+ dns_rdata_t rdata = DNS_RDATA_INIT; -+ dns_ttl_t ttl; -+ dns_rdataclass_t update_class; -+ -+ get_current_rr(request, DNS_SECTION_UPDATE, zoneclass, &name, -+ &rdata, &covers, &ttl, &update_class); -+ -+ if (!dns_name_issubdomain(name, zonename)) { -+ FAILC(DNS_R_NOTZONE, "update RR is outside zone"); -+ } -+ if (update_class == zoneclass) { -+ /* -+ * Check for meta-RRs. The RFC2136 pseudocode says -+ * check for ANY|AXFR|MAILA|MAILB, but the text adds -+ * "or any other QUERY metatype" -+ */ -+ if (dns_rdatatype_ismeta(rdata.type)) { -+ FAILC(DNS_R_FORMERR, "meta-RR in update"); -+ } -+ result = dns_zone_checknames(zone, name, &rdata); -+ if (result != ISC_R_SUCCESS) { -+ FAIL(DNS_R_REFUSED); -+ } -+ } else if (update_class == dns_rdataclass_any) { -+ if (ttl != 0 || rdata.length != 0 || -+ (dns_rdatatype_ismeta(rdata.type) && -+ rdata.type != dns_rdatatype_any)) -+ { -+ FAILC(DNS_R_FORMERR, "meta-RR in update"); -+ } -+ } else if (update_class == dns_rdataclass_none) { -+ if (ttl != 0 || dns_rdatatype_ismeta(rdata.type)) { -+ FAILC(DNS_R_FORMERR, "meta-RR in update"); -+ } -+ } else { -+ update_log(client, zone, ISC_LOG_WARNING, -+ "update RR has incorrect class %d", -+ update_class); -+ FAIL(DNS_R_FORMERR); -+ } -+ -+ /* -+ * draft-ietf-dnsind-simple-secure-update-01 says -+ * "Unlike traditional dynamic update, the client -+ * is forbidden from updating NSEC records." -+ */ -+ if (rdata.type == dns_rdatatype_nsec3) { -+ FAILC(DNS_R_REFUSED, "explicit NSEC3 updates are not " -+ "allowed " -+ "in secure zones"); -+ } else if (rdata.type == dns_rdatatype_nsec) { -+ FAILC(DNS_R_REFUSED, "explicit NSEC updates are not " -+ "allowed " -+ "in secure zones"); -+ } else if (rdata.type == dns_rdatatype_rrsig && -+ !dns_name_equal(name, zonename)) -+ { -+ FAILC(DNS_R_REFUSED, "explicit RRSIG updates are " -+ "currently " -+ "not supported in secure zones " -+ "except " -+ "at the apex"); -+ } -+ -+ if (ssutable != NULL) { -+ isc_netaddr_t netaddr; -+ dst_key_t *tsigkey = NULL; -+ isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr); -+ -+ if (client->message->tsigkey != NULL) { -+ tsigkey = client->message->tsigkey->key; -+ } -+ -+ if (rdata.type != dns_rdatatype_any) { -+ if (!dns_ssutable_checkrules( -+ ssutable, client->signer, name, -+ &netaddr, TCPCLIENT(client), env, -+ rdata.type, tsigkey)) -+ { -+ FAILC(DNS_R_REFUSED, "rejected by " -+ "secure update"); -+ } -+ } else { -+ if (!ssu_checkall(db, ver, name, ssutable, -+ client->signer, &netaddr, env, -+ TCPCLIENT(client), tsigkey)) -+ { -+ FAILC(DNS_R_REFUSED, "rejected by " -+ "secure update"); -+ } -+ } -+ } -+ } -+ if (result != ISC_R_NOMORE) { -+ FAIL(result); -+ } -+ -+ update_log(client, zone, LOGLEVEL_DEBUG, "update section prescan OK"); -+#endif -+#endif - - result = isc_quota_attach(&ns_g_server->updquota, - &(isc_quota_t *){ NULL }); -@@ -1558,6 +1833,15 @@ send_update_event(ns_client_t *client, dns_zone_t *zone) { - failure: - if (event != NULL) - isc_event_free(ISC_EVENT_PTR(&event)); -+ if (db != NULL) { -+ dns_db_closeversion(db, &ver, false); -+ dns_db_detach(&db); -+ } -+ -+ if (ssutable != NULL) { -+ dns_ssutable_detach(&ssutable); -+ } -+ - return (result); - } - -@@ -1644,9 +1928,6 @@ ns_update_start(ns_client_t *client, isc_result_t sigresult) { - CHECK(send_update_event(client, zone)); - break; - case dns_zone_slave: -- CHECK(checkupdateacl(client, dns_zone_getforwardacl(zone), -- "update forwarding", zonename, true, -- false)); - CHECK(send_forward_event(client, zone)); - break; - default: -@@ -1656,7 +1937,6 @@ ns_update_start(ns_client_t *client, isc_result_t sigresult) { - - failure: - if (result == DNS_R_REFUSED) { -- INSIST(dns_zone_gettype(zone) == dns_zone_slave); - inc_stats(zone, dns_nsstatscounter_updaterej); - } - /* -@@ -2520,7 +2800,7 @@ update_action(isc_task_t *task, isc_event_t *event) { - dns_rdatatype_t covers; - dns_message_t *request = client->message; - dns_rdataclass_t zoneclass; -- dns_name_t *zonename; -+ dns_name_t *zonename = NULL; - dns_ssutable_t *ssutable = NULL; - dns_fixedname_t tmpnamefixed; - dns_name_t *tmpname = NULL; -@@ -2542,14 +2822,7 @@ update_action(isc_task_t *task, isc_event_t *event) { - zonename = dns_db_origin(db); - zoneclass = dns_db_class(db); - dns_zone_getssutable(zone, &ssutable); -- -- /* -- * Update message processing can leak record existence information -- * so check that we are allowed to query this zone. Additionally -- * if we would refuse all updates for this zone we bail out here. -- */ -- CHECK(checkqueryacl(client, dns_zone_getqueryacl(zone), zonename, -- dns_zone_getupdateacl(zone), ssutable)); -+ options = dns_zone_getoptions(zone); - - /* - * Get old and new versions now that queryacl has been checked. -@@ -2673,134 +2946,10 @@ update_action(isc_task_t *task, isc_event_t *event) { - update_log(client, zone, LOGLEVEL_DEBUG, - "prerequisites are OK"); - -- /* -- * Check Requestor's Permissions. It seems a bit silly to do this -- * only after prerequisite testing, but that is what RFC2136 says. -- */ -- if (ssutable == NULL) -- CHECK(checkupdateacl(client, dns_zone_getupdateacl(zone), -- "update", zonename, false, false)); -- else if (client->signer == NULL && !TCPCLIENT(client)) -- CHECK(checkupdateacl(client, NULL, "update", zonename, -- false, true)); -- -- if (dns_zone_getupdatedisabled(zone)) -- FAILC(DNS_R_REFUSED, "dynamic update temporarily disabled " -- "because the zone is frozen. Use " -- "'rndc thaw' to re-enable updates."); -- -- /* -- * Perform the Update Section Prescan. -- */ -- -- for (result = dns_message_firstname(request, DNS_SECTION_UPDATE); -- result == ISC_R_SUCCESS; -- result = dns_message_nextname(request, DNS_SECTION_UPDATE)) -- { -- dns_name_t *name = NULL; -- dns_rdata_t rdata = DNS_RDATA_INIT; -- dns_ttl_t ttl; -- dns_rdataclass_t update_class; -- get_current_rr(request, DNS_SECTION_UPDATE, zoneclass, -- &name, &rdata, &covers, &ttl, &update_class); -- -- if (! dns_name_issubdomain(name, zonename)) -- FAILC(DNS_R_NOTZONE, -- "update RR is outside zone"); -- if (update_class == zoneclass) { -- /* -- * Check for meta-RRs. The RFC2136 pseudocode says -- * check for ANY|AXFR|MAILA|MAILB, but the text adds -- * "or any other QUERY metatype" -- */ -- if (dns_rdatatype_ismeta(rdata.type)) { -- FAILC(DNS_R_FORMERR, -- "meta-RR in update"); -- } -- result = dns_zone_checknames(zone, name, &rdata); -- if (result != ISC_R_SUCCESS) -- FAIL(DNS_R_REFUSED); -- } else if (update_class == dns_rdataclass_any) { -- if (ttl != 0 || rdata.length != 0 || -- (dns_rdatatype_ismeta(rdata.type) && -- rdata.type != dns_rdatatype_any)) -- FAILC(DNS_R_FORMERR, -- "meta-RR in update"); -- } else if (update_class == dns_rdataclass_none) { -- if (ttl != 0 || -- dns_rdatatype_ismeta(rdata.type)) -- FAILC(DNS_R_FORMERR, -- "meta-RR in update"); -- } else { -- update_log(client, zone, ISC_LOG_WARNING, -- "update RR has incorrect class %d", -- update_class); -- FAIL(DNS_R_FORMERR); -- } -- -- /* -- * draft-ietf-dnsind-simple-secure-update-01 says -- * "Unlike traditional dynamic update, the client -- * is forbidden from updating NSEC records." -- */ -- if (rdata.type == dns_rdatatype_nsec3) { -- FAILC(DNS_R_REFUSED, -- "explicit NSEC3 updates are not allowed " -- "in secure zones"); -- } else if (rdata.type == dns_rdatatype_nsec) { -- FAILC(DNS_R_REFUSED, -- "explicit NSEC updates are not allowed " -- "in secure zones"); -- } else if (rdata.type == dns_rdatatype_rrsig && -- !dns_name_equal(name, zonename)) { -- FAILC(DNS_R_REFUSED, -- "explicit RRSIG updates are currently " -- "not supported in secure zones except " -- "at the apex"); -- } -- -- if (ssutable != NULL) { -- isc_netaddr_t netaddr; -- dst_key_t *tsigkey = NULL; -- isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr); -- -- if (client->message->tsigkey != NULL) -- tsigkey = client->message->tsigkey->key; -- -- if (rdata.type != dns_rdatatype_any) { -- if (!dns_ssutable_checkrules2 -- (ssutable, client->signer, name, &netaddr, -- TCPCLIENT(client), -- &ns_g_server->aclenv, -- rdata.type, tsigkey)) -- { -- FAILC(DNS_R_REFUSED, -- "rejected by secure update"); -- } -- } else { -- if (!ssu_checkall(db, ver, name, ssutable, -- client->signer, -- &netaddr, -- TCPCLIENT(client), -- tsigkey)) -- { -- FAILC(DNS_R_REFUSED, -- "rejected by secure update"); -- } -- } -- } -- } -- if (result != ISC_R_NOMORE) -- FAIL(result); -- -- update_log(client, zone, LOGLEVEL_DEBUG, -- "update section prescan OK"); -- - /* - * Process the Update Section. - */ - -- options = dns_zone_getoptions(zone); - options2 = dns_zone_getoptions2(zone); - for (result = dns_message_firstname(request, DNS_SECTION_UPDATE); - result == ISC_R_SUCCESS; -@@ -3494,6 +3643,13 @@ send_forward_event(ns_client_t *client, dns_zone_t *zone) { - isc_task_t *zonetask = NULL; - ns_client_t *evclient; - -+ result = checkupdateacl(client, dns_zone_getforwardacl(zone), -+ "update forwarding", dns_zone_getorigin(zone), -+ true, false); -+ if (result != ISC_R_SUCCESS) { -+ return (result); -+ } -+ - result = isc_quota_attach(&ns_g_server->updquota, - &(isc_quota_t *){ NULL }); - if (result != ISC_R_SUCCESS) { --- -2.39.2 - diff --git a/SOURCES/bind-9.16-CVE-2022-3094-test.patch b/SOURCES/bind-9.16-CVE-2022-3094-test.patch deleted file mode 100644 index fe93e26..0000000 --- a/SOURCES/bind-9.16-CVE-2022-3094-test.patch +++ /dev/null @@ -1,266 +0,0 @@ -From 3d84c651f823cb90b73fd736d32ad6de57b11610 Mon Sep 17 00:00:00 2001 -From: Evan Hunt -Date: Wed, 9 Nov 2022 21:56:16 -0800 -Subject: [PATCH] test failure conditions - -verify that updates are refused when the client is disallowed by -allow-query, and update forwarding is refused when the client is -is disallowed by update-forwarding. - -verify that "too many DNS UPDATEs" appears in the log file when too -many simultaneous updates are processing. - -(cherry picked from commit b91339b80e5b82a56622c93cc1e3cca2d0c11bc0) ---- - bin/tests/system/nsupdate/ns1/named.conf.in | 2 + - bin/tests/system/nsupdate/tests.sh | 28 +++++++++++++ - bin/tests/system/upforwd/clean.sh | 2 + - .../ns3/{named.conf.in => named1.conf.in} | 7 +++- - bin/tests/system/upforwd/ns3/named2.conf.in | 41 +++++++++++++++++++ - bin/tests/system/upforwd/setup.sh | 2 +- - bin/tests/system/upforwd/tests.sh | 40 ++++++++++++++++++ - 7 files changed, 120 insertions(+), 2 deletions(-) - rename bin/tests/system/upforwd/ns3/{named.conf.in => named1.conf.in} (85%) - create mode 100644 bin/tests/system/upforwd/ns3/named2.conf.in - -diff --git a/bin/tests/system/nsupdate/ns1/named.conf.in b/bin/tests/system/nsupdate/ns1/named.conf.in -index cb80269..228ad6a 100644 ---- a/bin/tests/system/nsupdate/ns1/named.conf.in -+++ b/bin/tests/system/nsupdate/ns1/named.conf.in -@@ -20,6 +20,7 @@ options { - listen-on-v6 { none; }; - recursion no; - notify yes; -+ update-quota 1; - }; - - key rndc_key { -@@ -76,6 +77,7 @@ zone "other.nil" { - check-integrity no; - check-mx warn; - update-policy local; -+ allow-query { !10.53.0.2; any; }; - allow-query-on { 10.53.0.1; 127.0.0.1; }; - allow-transfer { any; }; - }; -diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh -index f8994ff..4cabf8d 100755 ---- a/bin/tests/system/nsupdate/tests.sh -+++ b/bin/tests/system/nsupdate/tests.sh -@@ -1069,6 +1069,34 @@ END - grep "NSEC3PARAM has excessive iterations (> 150)" nsupdate.out-$n >/dev/null || ret=1 - [ $ret = 0 ] || { echo_i "failed"; status=1; } - -+n=$((n + 1)) -+ret=0 -+echo_i "check that update is rejected if query is not allowed ($n)" -+{ -+ $NSUPDATE -d < nsupdate.out.test$n 2>&1 -+grep 'status: REFUSED' nsupdate.out.test$n > /dev/null || ret=1 -+[ $ret = 0 ] || { echo_i "failed"; status=1; } -+ -+n=$((n + 1)) -+ret=0 -+echo_i "check that update is rejected if quota is exceeded ($n)" -+for loop in 1 2 3 4 5 6 7 8 9 10; do -+{ -+ $NSUPDATE -l -p ${PORT} -k ns1/session.key > nsupdate.out.test$n-${loop} 2>&1 < nsupdate.out.$n 2>&1 -+grep REFUSED nsupdate.out.$n > /dev/null || ret=1 -+if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi -+n=`expr $n + 1` -+ -+n=$((n + 1)) -+ret=0 -+echo_i "attempting updates that should exceed quota ($n)" -+# lower the update quota to 1. -+copy_setports ns3/named2.conf.in ns3/named.conf -+$RNDCCMD 10.53.0.3 reconfig -+nextpart ns3/named.run > /dev/null -+for loop in 1 2 3 4 5 6 7 8 9 10; do -+{ -+ $NSUPDATE -- - > /dev/null 2>&1 < -Date: Tue, 20 Sep 2022 11:21:45 +0200 -Subject: [PATCH] Fix CVE-2022-38177 - -5961. [security] Fix memory leak in ECDSA verify processing. - (CVE-2022-38177) [GL #3487] ---- - lib/dns/opensslecdsa_link.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/dns/opensslecdsa_link.c b/lib/dns/opensslecdsa_link.c -index 83b5b51..7576e04 100644 ---- a/lib/dns/opensslecdsa_link.c -+++ b/lib/dns/opensslecdsa_link.c -@@ -224,7 +224,7 @@ opensslecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) { - siglen = DNS_SIG_ECDSA384SIZE; - - if (sig->length != siglen) -- return (DST_R_VERIFYFAILURE); -+ DST_RET(DST_R_VERIFYFAILURE); - - if (!EVP_DigestFinal_ex(evp_md_ctx, digest, &dgstlen)) - DST_RET (dst__openssl_toresult3(dctx->category, --- -2.37.3 - diff --git a/SOURCES/bind-9.16-CVE-2022-38178.patch b/SOURCES/bind-9.16-CVE-2022-38178.patch deleted file mode 100644 index eb45109..0000000 --- a/SOURCES/bind-9.16-CVE-2022-38178.patch +++ /dev/null @@ -1,27 +0,0 @@ -From bb68864bf05d29df644427ec841bc3db6a336519 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Tue, 20 Sep 2022 11:22:47 +0200 -Subject: [PATCH] Fix CVE-2022-38178 - -5962. [security] Fix memory leak in EdDSA verify processing. - (CVE-2022-38178) [GL #3487] ---- - lib/dns/openssleddsa_link.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/dns/openssleddsa_link.c b/lib/dns/openssleddsa_link.c -index 8b115ec..4f3c2a8 100644 ---- a/lib/dns/openssleddsa_link.c -+++ b/lib/dns/openssleddsa_link.c -@@ -325,7 +325,7 @@ openssleddsa_verify(dst_context_t *dctx, const isc_region_t *sig) { - siglen = DNS_SIG_ED448SIZE; - - if (sig->length != siglen) -- return (DST_R_VERIFYFAILURE); -+ DST_RET(DST_R_VERIFYFAILURE); - - isc_buffer_usedregion(buf, &tbsreg); - --- -2.37.3 - diff --git a/SOURCES/bind-9.16-CVE-2023-3341.patch b/SOURCES/bind-9.16-CVE-2023-3341.patch deleted file mode 100644 index 9aa2a87..0000000 --- a/SOURCES/bind-9.16-CVE-2023-3341.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 3883ec072e5feed1237dc864854ab95ded7302d6 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Tue, 19 Sep 2023 13:14:52 +0200 -Subject: [PATCH] Backport of CVE-2023-3341 fix - -Taken from BIND 9.16.44 change. ---- - lib/isccc/cc.c | 36 +++++++++++++++++++++++--------- - lib/isccc/include/isccc/result.h | 4 +++- - lib/isccc/result.c | 4 +++- - 3 files changed, 32 insertions(+), 12 deletions(-) - -diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c -index 463a053..a54e60c 100644 ---- a/lib/isccc/cc.c -+++ b/lib/isccc/cc.c -@@ -53,6 +53,10 @@ - - #define MAX_TAGS 256 - #define DUP_LIFETIME 900 -+#ifndef ISCCC_MAXDEPTH -+#define ISCCC_MAXDEPTH \ -+ 10 /* Big enough for rndc which just sends a string each way. */ -+#endif - - typedef isccc_sexpr_t *sexpr_ptr; - -@@ -573,19 +577,23 @@ verify(isccc_sexpr_t *alist, unsigned char *data, unsigned int length, - - static isc_result_t - table_fromwire(isccc_region_t *source, isccc_region_t *secret, -- uint32_t algorithm, isccc_sexpr_t **alistp); -+ uint32_t algorithm, unsigned int depth, isccc_sexpr_t **alistp); - - static isc_result_t --list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp); -+list_fromwire(isccc_region_t *source, unsigned int depth, isccc_sexpr_t **listp); - - static isc_result_t --value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) { -+value_fromwire(isccc_region_t *source, unsigned int depth, isccc_sexpr_t **valuep) { - unsigned int msgtype; - uint32_t len; - isccc_sexpr_t *value; - isccc_region_t active; - isc_result_t result; - -+ if (depth > ISCCC_MAXDEPTH) { -+ return (ISCCC_R_MAXDEPTH); -+ } -+ - if (REGION_SIZE(*source) < 1 + 4) - return (ISC_R_UNEXPECTEDEND); - GET8(msgtype, source->rstart); -@@ -603,9 +611,9 @@ value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) { - } else - result = ISC_R_NOMEMORY; - } else if (msgtype == ISCCC_CCMSGTYPE_TABLE) -- result = table_fromwire(&active, NULL, 0, valuep); -+ result = table_fromwire(&active, NULL, 0, depth + 1, valuep); - else if (msgtype == ISCCC_CCMSGTYPE_LIST) -- result = list_fromwire(&active, valuep); -+ result = list_fromwire(&active, depth + 1, valuep); - else - result = ISCCC_R_SYNTAX; - -@@ -614,7 +622,7 @@ value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) { - - static isc_result_t - table_fromwire(isccc_region_t *source, isccc_region_t *secret, -- uint32_t algorithm, isccc_sexpr_t **alistp) -+ uint32_t algorithm, unsigned int depth, isccc_sexpr_t **alistp) - { - char key[256]; - uint32_t len; -@@ -625,6 +633,10 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret, - - REQUIRE(alistp != NULL && *alistp == NULL); - -+ if (depth > ISCCC_MAXDEPTH) { -+ return (ISCCC_R_MAXDEPTH); -+ } -+ - checksum_rstart = NULL; - first_tag = true; - alist = isccc_alist_create(); -@@ -640,7 +652,7 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret, - GET_MEM(key, len, source->rstart); - key[len] = '\0'; /* Ensure NUL termination. */ - value = NULL; -- result = value_fromwire(source, &value); -+ result = value_fromwire(source, depth + 1, &value); - if (result != ISC_R_SUCCESS) - goto bad; - if (isccc_alist_define(alist, key, value) == NULL) { -@@ -673,14 +685,18 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret, - } - - static isc_result_t --list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp) { -+list_fromwire(isccc_region_t *source, unsigned int depth, isccc_sexpr_t **listp) { - isccc_sexpr_t *list, *value; - isc_result_t result; - -+ if (depth > ISCCC_MAXDEPTH) { -+ return (ISCCC_R_MAXDEPTH); -+ } -+ - list = NULL; - while (!REGION_EMPTY(*source)) { - value = NULL; -- result = value_fromwire(source, &value); -+ result = value_fromwire(source, depth + 1, &value); - if (result != ISC_R_SUCCESS) { - isccc_sexpr_free(&list); - return (result); -@@ -711,7 +727,7 @@ isccc_cc_fromwire(isccc_region_t *source, isccc_sexpr_t **alistp, - if (version != 1) - return (ISCCC_R_UNKNOWNVERSION); - -- return (table_fromwire(source, secret, algorithm, alistp)); -+ return (table_fromwire(source, secret, algorithm, 0, alistp)); - } - - static isc_result_t -diff --git a/lib/isccc/include/isccc/result.h b/lib/isccc/include/isccc/result.h -index 6c79dd7..b30b08a 100644 ---- a/lib/isccc/include/isccc/result.h -+++ b/lib/isccc/include/isccc/result.h -@@ -47,8 +47,10 @@ - #define ISCCC_R_CLOCKSKEW (ISC_RESULTCLASS_ISCCC + 4) - /*% Duplicate */ - #define ISCCC_R_DUPLICATE (ISC_RESULTCLASS_ISCCC + 5) -+/*% Maximum recursion depth */ -+#define ISCCC_R_MAXDEPTH (ISC_RESULTCLASS_ISCCC + 6) - --#define ISCCC_R_NRESULTS 6 /*%< Number of results */ -+#define ISCCC_R_NRESULTS 7 /*%< Number of results */ - - ISC_LANG_BEGINDECLS - -diff --git a/lib/isccc/result.c b/lib/isccc/result.c -index 8419bbb..a3a3b9a 100644 ---- a/lib/isccc/result.c -+++ b/lib/isccc/result.c -@@ -40,7 +40,8 @@ static const char *text[ISCCC_R_NRESULTS] = { - "bad auth", /* 3 */ - "expired", /* 4 */ - "clock skew", /* 5 */ -- "duplicate" /* 6 */ -+ "duplicate", /* 6 */ -+ "max depth", /* 7 */ - }; - - static const char *ids[ISCCC_R_NRESULTS] = { -@@ -50,6 +51,7 @@ static const char *ids[ISCCC_R_NRESULTS] = { - "ISCCC_R_EXPIRED", - "ISCCC_R_CLOCKSKEW", - "ISCCC_R_DUPLICATE", -+ "ISCCC_R_MAXDEPTH" - }; - - #define ISCCC_RESULT_RESULTSET 2 --- -2.41.0 - diff --git a/SOURCES/bind-9.16-update-b.root-servers.net.patch b/SOURCES/bind-9.16-update-b.root-servers.net.patch deleted file mode 100644 index 9bc20e8..0000000 --- a/SOURCES/bind-9.16-update-b.root-servers.net.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4e595a6b961e73af43350833109ccba0950119f9 Mon Sep 17 00:00:00 2001 -From: Mark Andrews -Date: Thu, 12 Oct 2023 10:19:38 +1100 -Subject: [PATCH] Update b.root-servers.net IP addresses - -This covers both root hints and the default primaries for the root -zone mirror. The official change date is Nov 27, 2023. - -(cherry picked from commit 2ca2f7e9852a3d6e93f065c01ea4679f723688f7) ---- - lib/dns/rootns.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/dns/rootns.c b/lib/dns/rootns.c -index 9653f3b..d6ff76e 100644 ---- a/lib/dns/rootns.c -+++ b/lib/dns/rootns.c -@@ -56,8 +56,8 @@ static char root_ns[] = - ". 518400 IN NS M.ROOT-SERVERS.NET.\n" - "A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4\n" - "A.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:BA3E::2:30\n" --"B.ROOT-SERVERS.NET. 3600000 IN A 199.9.14.201\n" --"B.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:200::b\n" -+"B.ROOT-SERVERS.NET. 3600000 IN A 170.247.170.2\n" -+"B.ROOT-SERVERS.NET. 3600000 IN AAAA 2801:1b8:10::b\n" - "C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12\n" - "C.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2::c\n" - "D.ROOT-SERVERS.NET. 3600000 IN A 199.7.91.13\n" --- -2.43.0 - diff --git a/SOURCES/bind-9.18-CVE-2024-11187-pre-test.patch b/SOURCES/bind-9.18-CVE-2024-11187-pre-test.patch deleted file mode 100644 index aa0476f..0000000 --- a/SOURCES/bind-9.18-CVE-2024-11187-pre-test.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 8a9b9ff5a8b2443f7df4f60397ad215931ba44f1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= -Date: Tue, 7 Jan 2025 15:22:40 +0100 -Subject: [PATCH] Isolate using the -T noaa flag only for part of the resolver - test - -Instead of running the whole resolver/ns4 server with -T noaa flag, -use it only for the part where it is actually needed. The -T noaa -could interfere with other parts of the test because the answers don't -have the authoritative-answer bit set, and we could have false -positives (or false negatives) in the test because the authoritative -server doesn't follow the DNS protocol for all the tests in the resolver -system test. - -(cherry picked from commit e51d4d3b88af00d6667f2055087ebfc47fb3107c) ---- - bin/tests/system/conf.sh.in | 12 ++++++++++++ - bin/tests/system/resolver/ns4/named.noaa | 5 ----- - bin/tests/system/resolver/tests.sh | 8 ++++++++ - 3 files changed, 20 insertions(+), 5 deletions(-) - delete mode 100644 bin/tests/system/resolver/ns4/named.noaa - -diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in -index 06852f5..f77f7de 100644 ---- a/bin/tests/system/conf.sh.in -+++ b/bin/tests/system/conf.sh.in -@@ -305,6 +305,18 @@ digcomp() { - return $result - } - -+start_server() { -+ $PERL "$SYSTEMTESTTOP/start.pl" "$SYSTESTDIR" "$@" -+} -+ -+stop_server() { -+ $PERL "$SYSTEMTESTTOP/stop.pl" "$SYSTESTDIR" "$@" -+} -+ -+send() { -+ $PERL "$SYSTEMTESTTOP/send.pl" "$@" -+} -+ - # - # Useful functions in test scripts - # -diff --git a/bin/tests/system/resolver/ns4/named.noaa b/bin/tests/system/resolver/ns4/named.noaa -deleted file mode 100644 -index 3b121ad..0000000 ---- a/bin/tests/system/resolver/ns4/named.noaa -+++ /dev/null -@@ -1,5 +0,0 @@ --Copyright (C) Internet Systems Consortium, Inc. ("ISC") -- --See COPYRIGHT in the source root or https://isc.org/copyright.html for terms. -- --Add -T noaa. -diff --git a/bin/tests/system/resolver/tests.sh b/bin/tests/system/resolver/tests.sh -index 6eb52fe..bf37467 100755 ---- a/bin/tests/system/resolver/tests.sh -+++ b/bin/tests/system/resolver/tests.sh -@@ -281,6 +281,10 @@ done - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -+stop_server ns4 -+touch ns4/named.noaa -+start_server --noclean --restart --port ${PORT} ns4 || ret=1 -+ - n=`expr $n + 1` - echo_i "RT21594 regression test check setup ($n)" - ret=0 -@@ -317,6 +321,10 @@ grep "status: NXDOMAIN" dig.ns5.out.${n} > /dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` - -+stop_server ns4 -+rm ns4/named.noaa -+start_server --noclean --restart --port ${PORT} ns4 || ret=1 -+ - n=`expr $n + 1` - echo_i "check that replacement of additional data by a negative cache no data entry clears the additional RRSIGs ($n)" - ret=0 --- -2.48.1 - diff --git a/SOURCES/bind-9.18-CVE-2024-11187.patch b/SOURCES/bind-9.18-CVE-2024-11187.patch deleted file mode 100644 index 8ccfe06..0000000 --- a/SOURCES/bind-9.18-CVE-2024-11187.patch +++ /dev/null @@ -1,151 +0,0 @@ -From ca6c3446ef07d89fd3a28b6979d947af2ab5754f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= -Date: Thu, 14 Nov 2024 10:37:29 +0100 -Subject: [PATCH] Limit the additional processing for large RDATA sets - -When answering queries, don't add data to the additional section if -the answer has more than 13 names in the RDATA. This limits the -number of lookups into the database(s) during a single client query, -reducing query processing load. - -Also, don't append any additional data to type=ANY queries. The -answer to ANY is already big enough. - -(cherry picked from commit a1982cf1bb95c818aa7b58988b5611dec80f2408) -PatchNumber: 47 ---- - bin/named/query.c | 14 ++++++++------ - bin/tests/system/additional/tests.sh | 2 +- - lib/dns/include/dns/rdataset.h | 12 ++++++++++++ - lib/dns/rdataset.c | 12 ++++++++++++ - 4 files changed, 33 insertions(+), 7 deletions(-) - -diff --git a/bin/named/query.c b/bin/named/query.c -index 51a29a8..e023d74 100644 ---- a/bin/named/query.c -+++ b/bin/named/query.c -@@ -1835,9 +1835,10 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) { - * section, it's helpful if we add the SRV additional data - * as well. - */ -- eresult = dns_rdataset_additionaldata(trdataset, -- query_addadditional, -- client); -+ eresult = dns_rdataset_additionaldata2(trdataset, -+ query_addadditional, -+ client, -+ DNS_RDATASET_MAXADDITIONAL); - } - - cleanup: -@@ -2432,7 +2433,7 @@ query_addrdataset(ns_client_t *client, dns_name_t *fname, - rdataset->rdclass); - rdataset->attributes |= DNS_RDATASETATTR_LOADORDER; - -- if (NOADDITIONAL(client)) -+ if (NOADDITIONAL(client) || client->query.qtype == dns_rdatatype_any) - return; - - /* -@@ -2442,8 +2443,9 @@ query_addrdataset(ns_client_t *client, dns_name_t *fname, - */ - additionalctx.client = client; - additionalctx.rdataset = rdataset; -- (void)dns_rdataset_additionaldata(rdataset, query_addadditional2, -- &additionalctx); -+ (void)dns_rdataset_additionaldata2(rdataset, query_addadditional2, -+ &additionalctx, -+ DNS_RDATASET_MAXADDITIONAL); - CTRACE(ISC_LOG_DEBUG(3), "query_addrdataset: done"); - } - -diff --git a/bin/tests/system/additional/tests.sh b/bin/tests/system/additional/tests.sh -index 6400723..a33cc8a 100644 ---- a/bin/tests/system/additional/tests.sh -+++ b/bin/tests/system/additional/tests.sh -@@ -261,7 +261,7 @@ n=`expr $n + 1` - echo_i "testing with 'minimal-any no;' ($n)" - ret=0 - $DIG $DIGOPTS -t ANY www.rt.example @10.53.0.1 > dig.out.$n || ret=1 --grep "ANSWER: 3, AUTHORITY: 1, ADDITIONAL: 2" dig.out.$n > /dev/null || ret=1 -+grep "ANSWER: 3, AUTHORITY: 1, ADDITIONAL: 1" dig.out.$n > /dev/null || ret=1 - if [ $ret -eq 1 ] ; then - echo_i "failed"; status=`expr status + 1` - fi -diff --git a/lib/dns/include/dns/rdataset.h b/lib/dns/include/dns/rdataset.h -index 710e97c..b3532f6 100644 ---- a/lib/dns/include/dns/rdataset.h -+++ b/lib/dns/include/dns/rdataset.h -@@ -53,6 +53,8 @@ - #include - #include - -+#define DNS_RDATASET_MAXADDITIONAL 13 -+ - ISC_LANG_BEGINDECLS - - typedef enum { -@@ -501,13 +503,23 @@ dns_rdataset_additionaldata(dns_rdataset_t *rdataset, - *\li If a call to dns_rdata_additionaldata() is not successful, the - * result returned will be the result of dns_rdataset_additionaldata(). - * -+ *\li If 'limit' is non-zero and the number of the rdatasets is larger -+ * than 'limit', no additional data will be processed. -+ * - * Returns: - * - *\li #ISC_R_SUCCESS - * -+ *\li #DNS_R_TOOMANYRECORDS in case rdataset count is larger than 'limit' -+ * - *\li Any error that dns_rdata_additionaldata() can return. - */ - -+isc_result_t -+dns_rdataset_additionaldata2(dns_rdataset_t *rdataset, -+ dns_additionaldatafunc_t add, void *arg, -+ size_t limit); -+ - isc_result_t - dns_rdataset_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig); -diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c -index b42dea5..5160acf 100644 ---- a/lib/dns/rdataset.c -+++ b/lib/dns/rdataset.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - static const char *trustnames[] = { - "none", -@@ -608,6 +609,13 @@ dns_rdataset_towire(dns_rdataset_t *rdataset, - isc_result_t - dns_rdataset_additionaldata(dns_rdataset_t *rdataset, - dns_additionaldatafunc_t add, void *arg) -+{ -+ return dns_rdataset_additionaldata2(rdataset, add, arg, 0); -+} -+ -+isc_result_t -+dns_rdataset_additionaldata2(dns_rdataset_t *rdataset, -+ dns_additionaldatafunc_t add, void *arg, size_t limit) - { - dns_rdata_t rdata = DNS_RDATA_INIT; - isc_result_t result; -@@ -620,6 +628,10 @@ dns_rdataset_additionaldata(dns_rdataset_t *rdataset, - REQUIRE(DNS_RDATASET_VALID(rdataset)); - REQUIRE((rdataset->attributes & DNS_RDATASETATTR_QUESTION) == 0); - -+ if (limit != 0 && dns_rdataset_count(rdataset) > limit) { -+ return DNS_R_TOOMANYRECORDS; -+ } -+ - result = dns_rdataset_first(rdataset); - if (result != ISC_R_SUCCESS) - return (result); --- -2.48.1 - diff --git a/SOURCES/bind-9.3.1rc1-sdb_tools-Makefile.in b/SOURCES/bind-9.3.1rc1-sdb_tools-Makefile.in deleted file mode 100644 index c7e0868..0000000 --- a/SOURCES/bind-9.3.1rc1-sdb_tools-Makefile.in +++ /dev/null @@ -1,63 +0,0 @@ -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \ - ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \ - ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} - -CDEFINES = -DBIND9 - -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ -ISCCCLIBS = ../../lib/isccc/libisccc.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ -LWRESLIBS = ../../lib/lwres/liblwres.@A@ -BIND9LIBS = ../../lib/bind9/libbind9.@A@ - -DNSDEPLIBS = ../../lib/dns/libdns.@A@ -ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ -ISCCCDEPLIBS = ../../lib/isccc/libisccc.@A@ -ISCDEPLIBS = ../../lib/isc/libisc.@A@ -LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@ -BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@ - -DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \ - ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS} - -LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} ${DBDRIVER_LIBS} @LIBS@ - -TARGETS = zone2ldap@EXEEXT@ zonetodb@EXEEXT@ - -OBJS = zone2ldap.@O@ zonetodb.@O@ - -SRCS = zone2ldap.c zonetodb.c - -MANPAGES = zone2ldap.1 - -EXT_CFLAGS = - -@BIND9_MAKE_RULES@ - -zone2ldap@EXEEXT@: zone2ldap.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ zone2ldap.@O@ -lldap -llber ${LIBS} - -zonetodb@EXEEXT@: zonetodb.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ zonetodb.@O@ -lpq ${LIBS} - -clean distclean manclean maintainer-clean:: - rm -f ${TARGETS} ${OBJS} - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1 - -install:: ${TARGETS} installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zone2ldap@EXEEXT@ ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zonetodb@EXEEXT@ ${DESTDIR}${sbindir} - ${INSTALL_DATA} ${srcdir}/zone2ldap.1 ${DESTDIR}${mandir}/man1/zone2ldap.1 diff --git a/SOURCES/bind-9.3.2-redhat_doc.patch b/SOURCES/bind-9.3.2-redhat_doc.patch deleted file mode 100644 index d50374f..0000000 --- a/SOURCES/bind-9.3.2-redhat_doc.patch +++ /dev/null @@ -1,98 +0,0 @@ -From facdbb0f2a266c6a3a1fa823afaa09cbd3fc38a5 Mon Sep 17 00:00:00 2001 -From: Petr Mensik -Date: Thu, 26 Nov 2020 12:13:10 +0100 -Subject: [PATCH] Note specific Red Hat changes in manual page - -Change docbook template instead of generated manual page. Remove -system-config-bind reference, package were discontinued. ---- - bin/named/named.docbook | 73 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 73 insertions(+) - -diff --git a/bin/named/named.docbook b/bin/named/named.docbook -index 7e743a9..802bec3 100644 ---- a/bin/named/named.docbook -+++ b/bin/named/named.docbook -@@ -516,6 +516,79 @@ - -
- -+ NOTES -+ Red Hat SELinux BIND Security Profile -+ -+ -+ By default, Red Hat ships BIND with the most secure SELinux policy -+ that will not prevent normal BIND operation and will prevent exploitation -+ of all known BIND security vulnerabilities . See the selinux(8) man page -+ for information about SElinux. -+ -+ -+ -+ It is not necessary to run named in a chroot environment if the Red Hat -+ SELinux policy for named is enabled. When enabled, this policy is far -+ more secure than a chroot environment. Users are recommended to enable -+ SELinux and remove the bind-chroot package. -+ -+ -+ -+ With this extra security comes some restrictions: -+ -+ -+ -+ By default, the SELinux policy allows named to write any master -+ zone database files. Only the root user may create files in the $ROOTDIR/var/named -+ zone database file directory (the options { "directory" } option), where -+ $ROOTDIR is set in /etc/sysconfig/named. -+ -+ -+ -+ The "named" group must be granted read privelege to -+ these files in order for named to be enabled to read them. -+ -+ -+ -+ Any file created in the zone database file directory is automatically assigned -+ the SELinux file context named_zone_t . -+ -+ -+ -+ By default, SELinux prevents any role from modifying named_zone_t files; this -+ means that files in the zone database directory cannot be modified by dynamic -+ DNS (DDNS) updates or zone transfers. -+ -+ -+ -+ The Red Hat BIND distribution and SELinux policy creates three directories where -+ named is allowed to create and modify files: /var/named/slaves, /var/named/dynamic -+ /var/named/data. By placing files you want named to modify, such as -+ slave or DDNS updateable zone files and database / statistics dump files in -+ these directories, named will work normally and no further operator action is -+ required. Files in these directories are automatically assigned the 'named_cache_t' -+ file context, which SELinux allows named to write. -+ -+ -+ -+ Red Hat BIND SDB support -+ -+ -+ Red Hat ships named with compiled in Simplified Database Backend modules that ISC -+ provides in the "contrib/sdb" directory. Install bind-sdb package if you want use them. -+ -+ -+ -+ The SDB modules for LDAP, PostGreSQL, DirDB and SQLite are compiled into named-sdb. -+ -+ -+ -+ See the documentation for the various SDB modules in /usr/share/doc/bind-sdb-*/ . -+ -+ -+ -+ -+ - SEE ALSO - - RFC 1033, --- -2.26.2 - diff --git a/SOURCES/bind-9.3.2b1-fix_sdb_ldap.patch b/SOURCES/bind-9.3.2b1-fix_sdb_ldap.patch deleted file mode 100644 index e5a418e..0000000 --- a/SOURCES/bind-9.3.2b1-fix_sdb_ldap.patch +++ /dev/null @@ -1,511 +0,0 @@ -diff --git a/bin/sdb_tools/Makefile.in b/bin/sdb_tools/Makefile.in -index 95ab742..5059a17 100644 ---- a/bin/sdb_tools/Makefile.in -+++ b/bin/sdb_tools/Makefile.in -@@ -32,11 +32,11 @@ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \ - LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ - ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} ${DBDRIVER_LIBS} @LIBS@ - --TARGETS = zone2ldap@EXEEXT@ zonetodb@EXEEXT@ zone2sqlite@EXEEXT@ -+TARGETS = zone2ldap@EXEEXT@ zonetodb@EXEEXT@ zone2sqlite@EXEEXT@ ldap2zone@EXEEXT@ - --OBJS = zone2ldap.@O@ zonetodb.@O@ zone2sqlite.@O@ -+OBJS = zone2ldap.@O@ zonetodb.@O@ zone2sqlite.@O@ ldap2zone.@O@ - --SRCS = zone2ldap.c zonetodb.c zone2sqlite.c -+SRCS = zone2ldap.c zonetodb.c zone2sqlite.c ldap2zone.c - - MANPAGES = zone2ldap.1 - -@@ -47,6 +47,9 @@ EXT_CFLAGS = - zone2ldap@EXEEXT@: zone2ldap.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ zone2ldap.@O@ -lldap -llber ${LIBS} - -+ldap2zone@EXEEXT@: ldap2zone.@O@ ${DEPLIBS} -+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ldap2zone.@O@ -lldap -llber ${LIBS} -+ - zonetodb@EXEEXT@: zonetodb.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ zonetodb.@O@ -lpq ${LIBS} - -@@ -64,4 +67,5 @@ install:: ${TARGETS} installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zone2ldap@EXEEXT@ ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zonetodb@EXEEXT@ ${DESTDIR}${sbindir} - ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} zone2sqlite@EXEEXT@ ${DESTDIR}${sbindir} -+ ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} ldap2zone@EXEEXT@ ${DESTDIR}${sbindir} - ${INSTALL_DATA} ${srcdir}/zone2ldap.1 ${DESTDIR}${mandir}/man1/zone2ldap.1 -diff --git a/bin/sdb_tools/zone2ldap.c b/bin/sdb_tools/zone2ldap.c -index e0e9207..d59936c 100644 ---- a/bin/sdb_tools/zone2ldap.c -+++ b/bin/sdb_tools/zone2ldap.c -@@ -73,7 +73,7 @@ void add_ldap_values (ldap_info * ldinfo); - void init_ldap_conn (void); - - /* Ldap error checking */ --void ldap_result_check (const char *msg, char *dn, int err); -+void ldap_result_check (const char *msg, const char *dn, int err); - - /* Put a hostname into a char ** array */ - char **hostname_to_dn_list (char *hostname, char *zone, unsigned int flags); -@@ -82,7 +82,7 @@ char **hostname_to_dn_list (char *hostname, char *zone, unsigned int flags); - int get_attr_list_size (char **tmp); - - /* Get a DN */ --char *build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag); -+char *build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag, char *zone); - - /* Add to RR list */ - void add_to_rr_list (char *dn, char *name, char *type, char *data, -@@ -104,11 +104,26 @@ void - init_ldap_conn (); - void usage(); - --char *argzone, *ldapbase, *binddn, *bindpw = NULL; --const char *ldapsystem = "localhost"; --static const char *objectClasses[] = -- { "top", "dNSZone", NULL }; --static const char *topObjectClasses[] = { "top", NULL }; -+static char *argzone, *ldapbase, *binddn, *bindpw = NULL; -+ -+/* these are needed to placate gcc4's const-ness const-ernations : */ -+static char localhost[] = "localhost"; -+static char *ldapsystem=&(localhost[0]); -+/* dnszone schema class names: */ -+static char topClass [] ="top"; -+static char dNSZoneClass[] ="dNSZone"; -+static char objectClass [] ="objectClass"; -+static char dcObjectClass[]="dcObject"; -+/* dnszone schema attribute names: */ -+static char relativeDomainName[]="relativeDomainName"; -+static char dNSTTL []="dNSTTL"; -+static char zoneName []="zoneName"; -+static char dc []="dc"; -+static char sameZone []="@"; -+/* LDAPMod mod_values: */ -+static char *objectClasses []= { &(topClass[0]), &(dNSZoneClass[0]), NULL }; -+static char *topObjectClasses []= { &(topClass[0]), &(dcObjectClass[0]), &(dNSZoneClass[0]), NULL }; -+static char *dn_buffer [64]={NULL}; - LDAP *conn; - unsigned int debug = 0; - -@@ -120,7 +135,7 @@ static void - fatal(const char *msg) { - perror(msg); - if (conn != NULL) -- ldap_unbind_s(conn); -+ ldap_unbind_ext_s(conn, NULL, NULL); - exit(1); - } - -@@ -132,12 +147,13 @@ main (int argc, char **argv) - isc_result_t result; - char *basedn; - ldap_info *tmp; -- LDAPMod *base_attrs[2]; -- LDAPMod base; -+ LDAPMod *base_attrs[5]; -+ LDAPMod base, dcBase, znBase, rdnBase; - isc_buffer_t buff; - char *zonefile=0L; - char fullbasedn[1024]; - char *ctmp; -+ char *zn, *dcp[2], *znp[2], *rdn[2]; - dns_fixedname_t fixedzone, fixedname; - dns_rdataset_t rdataset; - char **dc_list; -@@ -150,7 +166,7 @@ main (int argc, char **argv) - extern char *optarg; - extern int optind, opterr, optopt; - int create_base = 0; -- int topt; -+ int topt, dcn, zdn, znlen; - - if (argc < 2) - { -@@ -158,7 +174,7 @@ main (int argc, char **argv) - exit (-1); - } - -- while ((topt = getopt (argc, argv, "D:w:b:z:f:h:?dcv")) != -1) -+ while ((topt = getopt (argc, argv, "D:Ww:b:z:f:h:?dcv")) != -1) - { - switch (topt) - { -@@ -181,6 +197,9 @@ main (int argc, char **argv) - if (bindpw == NULL) - fatal("strdup"); - break; -+ case 'W': -+ bindpw = getpass("Enter LDAP Password: "); -+ break; - case 'b': - ldapbase = strdup (optarg); - if (ldapbase == NULL) -@@ -302,17 +321,51 @@ main (int argc, char **argv) - printf ("Creating base zone DN %s\n", argzone); - - dc_list = hostname_to_dn_list (argzone, argzone, DNS_TOP); -- basedn = build_dn_from_dc_list (dc_list, 0, NO_SPEC); -+ basedn = build_dn_from_dc_list (dc_list, 0, NO_SPEC, argzone); -+ if (debug) -+ printf ("base DN %s\n", basedn); - -- for (ctmp = &basedn[strlen (basedn)]; ctmp >= &basedn[0]; ctmp--) -+ for (ctmp = &basedn[strlen (basedn)], dcn=0; ctmp >= &basedn[0]; ctmp--) - { - if ((*ctmp == ',') || (ctmp == &basedn[0])) - { - base.mod_op = LDAP_MOD_ADD; -- base.mod_type = (char*)"objectClass"; -+ base.mod_type = objectClass; - base.mod_values = (char**)topObjectClasses; - base_attrs[0] = (void*)&base; -- base_attrs[1] = NULL; -+ -+ dcBase.mod_op = LDAP_MOD_ADD; -+ dcBase.mod_type = dc; -+ dcp[0]=dc_list[dcn]; -+ dcp[1]=0L; -+ dcBase.mod_values=dcp; -+ base_attrs[1] = (void*)&dcBase; -+ -+ znBase.mod_op = LDAP_MOD_ADD; -+ znBase.mod_type = zoneName; -+ for( zdn = dcn, znlen = 0; zdn >= 0; zdn-- ) -+ znlen += strlen(dc_list[zdn])+1; -+ znp[0] = (char*)malloc(znlen+1); -+ znp[1] = 0L; -+ for( zdn = dcn, zn=znp[0]; zdn >= 0; zdn-- ) -+ zn+=sprintf(zn,"%s%s",dc_list[zdn], -+ ((zdn > 0) && (*(dc_list[zdn-1])!='.')) ? "." : "" -+ ); -+ -+ znBase.mod_values = znp; -+ base_attrs[2] = (void*)&znBase; -+ -+ rdnBase.mod_op = LDAP_MOD_ADD; -+ rdnBase.mod_type = relativeDomainName; -+ rdn[0] = strdup(sameZone); -+ rdn[1] = 0L; -+ rdnBase.mod_values = rdn; -+ base_attrs[3] = (void*)&rdnBase; -+ -+ dcn++; -+ -+ base.mod_values = topObjectClasses; -+ base_attrs[4] = NULL; - - if (ldapbase) - { -@@ -329,6 +382,10 @@ main (int argc, char **argv) - else - sprintf (fullbasedn, "%s", ctmp); - } -+ -+ if( debug ) -+ printf("Full base dn: %s\n", fullbasedn); -+ - result = ldap_add_s (conn, fullbasedn, base_attrs); - ldap_result_check ("initial ldap_add_s", fullbasedn, result); - } -@@ -408,14 +465,14 @@ generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, unsigned int ttl) - isc_result_check (result, "dns_rdata_totext"); - data[isc_buffer_usedlength (&buff)] = 0; - -- dc_list = hostname_to_dn_list (name, argzone, DNS_OBJECT); -+ dc_list = hostname_to_dn_list ((char*)name, argzone, DNS_OBJECT); - len = (get_attr_list_size (dc_list) - 2); -- dn = build_dn_from_dc_list (dc_list, ttl, WI_SPEC); -+ dn = build_dn_from_dc_list (dc_list, ttl, WI_SPEC, argzone); - - if (debug) - printf ("Adding %s (%s %s) to run queue list.\n", dn, type, data); - -- add_to_rr_list (dn, dc_list[len], type, data, ttl, DNS_OBJECT); -+ add_to_rr_list (dn, dc_list[len], (char*)type, (char*)data, ttl, DNS_OBJECT); - } - - -@@ -455,7 +512,8 @@ add_to_rr_list (char *dn, char *name, char *type, - int attrlist; - char ldap_type_buffer[128]; - char charttl[64]; -- -+ char *zn; -+ int znlen; - - if ((tmp = locate_by_dn (dn)) == NULL) - { -@@ -482,10 +540,10 @@ add_to_rr_list (char *dn, char *name, char *type, - fatal("malloc"); - } - tmp->attrs[0]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[0]->mod_type = (char*)"objectClass"; -+ tmp->attrs[0]->mod_type = objectClass; - - if (flags == DNS_OBJECT) -- tmp->attrs[0]->mod_values = (char**)objectClasses; -+ tmp->attrs[0]->mod_values = objectClasses; - else - { - tmp->attrs[0]->mod_values = (char**)topObjectClasses; -@@ -497,7 +555,7 @@ add_to_rr_list (char *dn, char *name, char *type, - } - - tmp->attrs[1]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[1]->mod_type = (char*)"relativeDomainName"; -+ tmp->attrs[1]->mod_type = relativeDomainName; - tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2); - - if (tmp->attrs[1]->mod_values == (char **)NULL) -@@ -526,7 +584,7 @@ add_to_rr_list (char *dn, char *name, char *type, - fatal("strdup"); - - tmp->attrs[3]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[3]->mod_type = (char*)"dNSTTL"; -+ tmp->attrs[3]->mod_type = dNSTTL; - tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2); - - if (tmp->attrs[3]->mod_values == (char **)NULL) -@@ -539,14 +597,25 @@ add_to_rr_list (char *dn, char *name, char *type, - if (tmp->attrs[3]->mod_values[0] == NULL) - fatal("strdup"); - -+ znlen=strlen(gbl_zone); -+ if ( gbl_zone[znlen-1] == '.' ) -+ { /* ldapdb MUST search by relative zone name */ -+ zn = (char*)malloc(znlen); -+ memcpy(zn, gbl_zone, znlen-1); -+ zn[znlen-1]='\0'; -+ }else -+ { -+ zn = gbl_zone; -+ } -+ - tmp->attrs[4]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[4]->mod_type = (char*)"zoneName"; -+ tmp->attrs[4]->mod_type = zoneName; - tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2); - - if (tmp->attrs[4]->mod_values == (char **)NULL) - fatal("calloc"); - -- tmp->attrs[4]->mod_values[0] = gbl_zone; -+ tmp->attrs[4]->mod_values[0] = zn; - tmp->attrs[4]->mod_values[1] = NULL; - - tmp->attrs[5] = NULL; -@@ -557,7 +626,7 @@ add_to_rr_list (char *dn, char *name, char *type, - else - { - -- for (i = 0; tmp->attrs[i] != NULL; i++) -+ for (i = 0; tmp->attrs[i] != NULL; i++) - { - sprintf (ldap_type_buffer, "%sRecord", type); - if (!strncmp -@@ -631,44 +700,70 @@ char ** - hostname_to_dn_list (char *hostname, char *zone, unsigned int flags) - { - char *tmp; -- static char *dn_buffer[64]; - int i = 0; -- char *zname; -- char *hnamebuff; -- -- zname = strdup (hostname); -- if (zname == NULL) -- fatal("strdup"); -- -- if (flags == DNS_OBJECT) -- { -- -- if (strlen (zname) != strlen (zone)) -- { -- tmp = &zname[strlen (zname) - strlen (zone)]; -- *--tmp = '\0'; -- hnamebuff = strdup (zname); -- if (hnamebuff == NULL) -- fatal("strdup"); -- zname = ++tmp; -- } -- else -- hnamebuff = (char*)"@"; -- } -- else -- { -- zname = zone; -- hnamebuff = NULL; -- } -- -- for (tmp = strrchr (zname, '.'); tmp != (char *) 0; -- tmp = strrchr (zname, '.')) -- { -- *tmp++ = '\0'; -- dn_buffer[i++] = tmp; -- } -- dn_buffer[i++] = zname; -- dn_buffer[i++] = hnamebuff; -+ char *hname=0L, *last=0L; -+ int hlen=strlen(hostname), zlen=(strlen(zone)); -+ -+/* printf("hostname: %s zone: %s\n",hostname, zone); */ -+ hname=0L; -+ if(flags == DNS_OBJECT) -+ { -+ if( (zone[ zlen - 1 ] == '.') && (hostname[hlen - 1] != '.') ) -+ { -+ hname=(char*)malloc(hlen + 1); -+ hlen += 1; -+ sprintf(hname, "%s.", hostname); -+ hostname = hname; -+ } -+ if(strcmp(hostname, zone) == 0) -+ { -+ if( hname == 0 ) -+ hname=strdup(hostname); -+ last = strdup(sameZone); -+ }else -+ { -+ if( (hlen < zlen) -+ ||( strcmp( hostname + (hlen - zlen), zone ) != 0) -+ ) -+ { -+ if( hname != 0 ) -+ free(hname); -+ hname=(char*)malloc( hlen + zlen + 1); -+ if( *zone == '.' ) -+ sprintf(hname, "%s%s", hostname, zone); -+ else -+ sprintf(hname,"%s",zone); -+ }else -+ { -+ if( hname == 0 ) -+ hname = strdup(hostname); -+ } -+ last = hname; -+ } -+ }else -+ { /* flags == DNS_TOP */ -+ hname = strdup(zone); -+ last = hname; -+ } -+ -+ for (tmp = strrchr (hname, '.'); tmp != (char *) 0; -+ tmp = strrchr (hname, '.')) -+ { -+ if( *( tmp + 1 ) != '\0' ) -+ { -+ *tmp = '\0'; -+ dn_buffer[i++] = ++tmp; -+ }else -+ { /* trailing '.' ! */ -+ dn_buffer[i++] = strdup("."); -+ *tmp = '\0'; -+ if( tmp == hname ) -+ break; -+ } -+ } -+ if( ( last != hname ) && (tmp != hname) ) -+ dn_buffer[i++] = hname; -+ dn_buffer[i++] = last; - dn_buffer[i] = NULL; - - return dn_buffer; -@@ -680,30 +775,38 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags) - * exception of "@"/SOA. */ - - char * --build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag) -+build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag, char *zone) - { - int size; -- int x; -- static char dn[1024]; -- char tmp[128]; -+ int x, znlen; -+ static char dn[DNS_NAME_MAXTEXT*3/2]; -+ char tmp[DNS_NAME_MAXTEXT*3/2]; -+ char zn[DNS_NAME_MAXTEXT+1]; - - bzero (tmp, sizeof (tmp)); - bzero (dn, sizeof (dn)); - size = get_attr_list_size (dc_list); -+ znlen = strlen(zone); -+ if ( zone[znlen-1] == '.' ) -+ { /* ldapdb MUST search by relative zone name */ -+ memcpy(&(zn[0]),zone,znlen-1); -+ zn[znlen-1]='\0'; -+ zone = zn; -+ } - for (x = size - 2; x > 0; x--) - { - if (flag == WI_SPEC) - { - if (x == (size - 2) && (strncmp (dc_list[x], "@", 1) == 0) && (ttl)) -- sprintf (tmp, "relativeDomainName=%s + dNSTTL=%u,", dc_list[x], ttl); -+ snprintf (tmp, sizeof(tmp), "zoneName=%s + relativeDomainName=%s,", zone, dc_list[x]); - else if (x == (size - 2)) -- sprintf(tmp, "relativeDomainName=%s,",dc_list[x]); -+ snprintf(tmp, sizeof(tmp), "zoneName=%s + relativeDomainName=%s,", zone, dc_list[x]); - else -- sprintf(tmp,"dc=%s,", dc_list[x]); -+ snprintf(tmp, sizeof(tmp), "dc=%s,", dc_list[x]); - } - else - { -- sprintf(tmp, "dc=%s,", dc_list[x]); -+ snprintf(tmp, sizeof(tmp), "dc=%s,", dc_list[x]); - } - - -@@ -732,19 +835,18 @@ init_ldap_conn () - } - - result = ldap_simple_bind_s (conn, binddn, bindpw); -- ldap_result_check ("ldap_simple_bind_s", (char*)"LDAP Bind", result); -+ ldap_result_check ("ldap_simple_bind_s", "LDAP Bind", result); - } - - /* Like isc_result_check, only for LDAP */ - void --ldap_result_check (const char *msg, char *dn, int err) -+ldap_result_check (const char *msg, const char *dn, int err) - { - if ((err != LDAP_SUCCESS) && (err != LDAP_ALREADY_EXISTS)) - { -- fprintf(stderr, "Error while adding %s (%s):\n", -- dn, msg); -- ldap_perror (conn, dn); -- ldap_unbind_s (conn); -+ fprintf(stderr, "Error while adding %s (%s):\n%s", -+ dn, msg, ldap_err2string(err)); -+ ldap_unbind_ext_s (conn, NULL, NULL); - exit (-1); - } - } -@@ -758,16 +860,15 @@ add_ldap_values (ldap_info * ldinfo) - int result; - char dnbuffer[1024]; - -- - if (ldapbase != NULL) - sprintf (dnbuffer, "%s,%s", ldinfo->dn, ldapbase); - else - sprintf (dnbuffer, "%s", ldinfo->dn); - - result = ldap_add_s (conn, dnbuffer, ldinfo->attrs); -- ldap_result_check ("ldap_add_s", dnbuffer, result); --} -+ ldap_result_check ("ldap_add_s", dnbuffer, result); - -+} - - - -@@ -776,5 +877,5 @@ void - usage () - { - fprintf (stderr, -- "zone2ldap -D [BIND DN] -w [BIND PASSWORD] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST] " -+ "zone2ldap -D [BIND DN] [-w BIND PASSWORD | -W:prompt] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST] " - "[-c Create LDAP Base structure][-d Debug Output (lots !)] \n ");} diff --git a/SOURCES/bind-9.3.2b2-sdbsrc.patch b/SOURCES/bind-9.3.2b2-sdbsrc.patch deleted file mode 100644 index 46e183c..0000000 --- a/SOURCES/bind-9.3.2b2-sdbsrc.patch +++ /dev/null @@ -1,230 +0,0 @@ -diff --git a/contrib/sdb/bdb/bdb.c b/contrib/sdb/bdb/bdb.c -index 23594bb..b3c6619 100644 ---- a/contrib/sdb/bdb/bdb.c -+++ b/contrib/sdb/bdb/bdb.c -@@ -43,7 +43,7 @@ - #include - #include - --#include -+#include "bdb.h" - #include - #include - -diff --git a/contrib/sdb/ldap/zone2ldap.c b/contrib/sdb/ldap/zone2ldap.c -index 07c89bc..23dd873 100644 ---- a/contrib/sdb/ldap/zone2ldap.c -+++ b/contrib/sdb/ldap/zone2ldap.c -@@ -63,16 +63,16 @@ typedef struct LDAP_INFO - ldap_info; - - /* usage Info */ --void usage (); -+void usage (void); - - /* Add to the ldap dit */ - void add_ldap_values (ldap_info * ldinfo); - - /* Init an ldap connection */ --void init_ldap_conn (); -+void init_ldap_conn (void); - - /* Ldap error checking */ --void ldap_result_check (char *msg, char *dn, int err); -+void ldap_result_check (const char *msg, char *dn, int err); - - /* Put a hostname into a char ** array */ - char **hostname_to_dn_list (char *hostname, char *zone, unsigned int flags); -@@ -88,7 +88,7 @@ void add_to_rr_list (char *dn, char *name, char *type, char *data, - unsigned int ttl, unsigned int flags); - - /* Error checking */ --void isc_result_check (isc_result_t res, char *errorstr); -+void isc_result_check (isc_result_t res, const char *errorstr); - - /* Generate LDIF Format files */ - void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, -@@ -97,11 +97,17 @@ void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, - /* head pointer to the list */ - ldap_info *ldap_info_base = NULL; - -+ldap_info * -+locate_by_dn (char *dn); -+void -+init_ldap_conn (); -+void usage(); -+ - char *argzone, *ldapbase, *binddn, *bindpw = NULL; --char *ldapsystem = "localhost"; --static char *objectClasses[] = -+const char *ldapsystem = "localhost"; -+static const char *objectClasses[] = - { "top", "dNSZone", NULL }; --static char *topObjectClasses[] = { "top", NULL }; -+static const char *topObjectClasses[] = { "top", NULL }; - LDAP *conn; - unsigned int debug = 0; - -@@ -128,7 +134,7 @@ main (int argc, char **argv) - LDAPMod *base_attrs[2]; - LDAPMod base; - isc_buffer_t buff; -- char *zonefile; -+ char *zonefile=0L; - char fullbasedn[1024]; - char *ctmp; - dns_fixedname_t fixedzone, fixedname; -@@ -304,9 +310,9 @@ main (int argc, char **argv) - if ((*ctmp == ',') || (ctmp == &basedn[0])) - { - base.mod_op = LDAP_MOD_ADD; -- base.mod_type = "objectClass"; -- base.mod_values = topObjectClasses; -- base_attrs[0] = &base; -+ base.mod_type = (char*)"objectClass"; -+ base.mod_values = (char**)topObjectClasses; -+ base_attrs[0] = (void*)&base; - base_attrs[1] = NULL; - - if (ldapbase) -@@ -363,7 +369,7 @@ main (int argc, char **argv) - * I should probably rename this function, as not to cause any - * confusion with the isc* routines. Will exit on error. */ - void --isc_result_check (isc_result_t res, char *errorstr) -+isc_result_check (isc_result_t res, const char *errorstr) - { - if (res != ISC_R_SUCCESS) - { -@@ -470,20 +476,20 @@ add_to_rr_list (char *dn, char *name, char *type, - if (tmp->attrs == (LDAPMod **) NULL) - fatal("calloc"); - -- for (i = 0; i < flags; i++) -+ for (i = 0; i < (int)flags; i++) - { - tmp->attrs[i] = (LDAPMod *) malloc (sizeof (LDAPMod)); - if (tmp->attrs[i] == (LDAPMod *) NULL) - fatal("malloc"); - } - tmp->attrs[0]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[0]->mod_type = "objectClass"; -+ tmp->attrs[0]->mod_type = (char*)"objectClass"; - - if (flags == DNS_OBJECT) -- tmp->attrs[0]->mod_values = objectClasses; -+ tmp->attrs[0]->mod_values = (char**)objectClasses; - else - { -- tmp->attrs[0]->mod_values = topObjectClasses; -+ tmp->attrs[0]->mod_values = (char**)topObjectClasses; - tmp->attrs[1] = NULL; - tmp->attrcnt = 2; - tmp->next = ldap_info_base; -@@ -492,7 +498,7 @@ add_to_rr_list (char *dn, char *name, char *type, - } - - tmp->attrs[1]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[1]->mod_type = "relativeDomainName"; -+ tmp->attrs[1]->mod_type = (char*)"relativeDomainName"; - tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2); - - if (tmp->attrs[1]->mod_values == (char **)NULL) -@@ -521,7 +527,7 @@ add_to_rr_list (char *dn, char *name, char *type, - fatal("strdup"); - - tmp->attrs[3]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[3]->mod_type = "dNSTTL"; -+ tmp->attrs[3]->mod_type = (char*)"dNSTTL"; - tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2); - - if (tmp->attrs[3]->mod_values == (char **)NULL) -@@ -535,7 +541,7 @@ add_to_rr_list (char *dn, char *name, char *type, - fatal("strdup"); - - tmp->attrs[4]->mod_op = LDAP_MOD_ADD; -- tmp->attrs[4]->mod_type = "zoneName"; -+ tmp->attrs[4]->mod_type = (char*)"zoneName"; - tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2); - - if (tmp->attrs[4]->mod_values == (char **)NULL) -@@ -648,7 +654,7 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags) - zname = ++tmp; - } - else -- hnamebuff = "@"; -+ hnamebuff = (char*)"@"; - } - else - { -@@ -727,12 +733,12 @@ init_ldap_conn () - } - - result = ldap_simple_bind_s (conn, binddn, bindpw); -- ldap_result_check ("ldap_simple_bind_s", "LDAP Bind", result); -+ ldap_result_check ("ldap_simple_bind_s", (char*)"LDAP Bind", result); - } - - /* Like isc_result_check, only for LDAP */ - void --ldap_result_check (char *msg, char *dn, int err) -+ldap_result_check (const char *msg, char *dn, int err) - { - if ((err != LDAP_SUCCESS) && (err != LDAP_ALREADY_EXISTS)) - { -diff --git a/contrib/sdb/pgsql/pgsqldb.c b/contrib/sdb/pgsql/pgsqldb.c -index 50d3cba..516eb9f 100644 ---- a/contrib/sdb/pgsql/pgsqldb.c -+++ b/contrib/sdb/pgsql/pgsqldb.c -@@ -23,7 +23,7 @@ - #include - #include - --#include -+#include - - #include - #include -diff --git a/contrib/sdb/pgsql/zonetodb.c b/contrib/sdb/pgsql/zonetodb.c -index b8f5912..ff2d135 100644 ---- a/contrib/sdb/pgsql/zonetodb.c -+++ b/contrib/sdb/pgsql/zonetodb.c -@@ -37,7 +37,7 @@ - #include - #include - --#include -+#include - - /* - * Generate a PostgreSQL table from a zone. -@@ -54,6 +54,9 @@ char *dbname, *dbtable; - char str[10240]; - - void -+closeandexit(int status); -+ -+void - closeandexit(int status) { - if (conn != NULL) - PQfinish(conn); -@@ -61,6 +64,9 @@ closeandexit(int status) { - } - - void -+check_result(isc_result_t result, const char *message); -+ -+void - check_result(isc_result_t result, const char *message) { - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "%s: %s\n", message, -@@ -84,7 +90,8 @@ quotestring(const unsigned char *source, unsigned char *dest) { - } - *dest++ = 0; - } -- -+void -+addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata); - void - addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) { - unsigned char namearray[DNS_NAME_MAXTEXT + 1]; diff --git a/SOURCES/bind-9.5-PIE.patch b/SOURCES/bind-9.5-PIE.patch deleted file mode 100644 index a525b9b..0000000 --- a/SOURCES/bind-9.5-PIE.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- bind-9.5.0b2/bin/named/Makefile.in.pie 2008-02-11 17:21:47.000000000 +0100 -+++ bind-9.5.0b2/bin/named/Makefile.in 2008-02-11 17:22:10.000000000 +0100 -@@ -100,8 +100,12 @@ HTMLPAGES = named.html lwresd.html named - - MANOBJS = ${MANPAGES} ${HTMLPAGES} - -+EXT_CFLAGS = -fpie -+ - @BIND9_MAKE_RULES@ - -+LDFLAGS += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack -+ - main.@O@: main.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \ - -DVERSION=\"${VERSION}\" \ -diff -up bind-9.5.0b2/bin/named/unix/Makefile.in.pie bind-9.5.0b2/bin/named/unix/Makefile.in ---- bind-9.5.0b2/bin/named/unix/Makefile.in.pie 2008-02-11 17:22:21.000000000 +0100 -+++ bind-9.5.0b2/bin/named/unix/Makefile.in 2008-02-11 17:23:00.000000000 +0100 -@@ -19,6 +19,8 @@ srcdir = @srcdir@ - VPATH = @srcdir@ - top_srcdir = @top_srcdir@ - -+EXT_CFLAGS = -fpie -+ - @BIND9_MAKE_INCLUDES@ - - CINCLUDES = -I${srcdir}/include -I${srcdir}/../include \ diff --git a/SOURCES/bind-9.5-dlz-64bit.patch b/SOURCES/bind-9.5-dlz-64bit.patch deleted file mode 100644 index ec064c6..0000000 --- a/SOURCES/bind-9.5-dlz-64bit.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in -index 47525af..eefe3c3 100644 ---- a/contrib/dlz/config.dlz.in -+++ b/contrib/dlz/config.dlz.in -@@ -17,6 +17,13 @@ - # - dlzdir='${DLZ_DRIVER_DIR}' - -+AC_MSG_CHECKING([for target libdir]) -+AC_RUN_IFELSE([int main(void) {exit((sizeof(void *) == 8) ? 0 : 1);}], -+ [target_lib=lib64], -+ [target_lib=lib], -+) -+AC_MSG_RESULT(["$target_lib"]) -+ - # - # Private autoconf macro to simplify configuring drivers: - # -@@ -292,9 +299,9 @@ case "$use_dlz_bdb" in - then - break - fi -- elif test -f "$dd/lib/lib${d}.so" -+ elif test -f "$dd/${target_lib}/lib${d}.so" - then -- dlz_bdb_libs="-L${dd}/lib -l${d}" -+ dlz_bdb_libs="-L${dd}/${target_lib} -l${d}" - break - fi - done -@@ -396,7 +403,7 @@ case "$use_dlz_ldap" in - *) - DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver, - [-I$use_dlz_ldap/include], -- [-L$use_dlz_ldap/lib -lldap -llber]) -+ [-L$use_dlz_ldap/${target_lib} -lldap -llber]) - - AC_MSG_RESULT( - [using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include]) -@@ -432,11 +439,11 @@ then - odbcdirs="/usr /usr/local /usr/pkg" - for d in $odbcdirs - do -- if test -f $d/include/sql.h -a -f $d/lib/libodbc.a -+ if test -f $d/include/sql.h -a -f $d/${target_lib}/libodbc.a - then - use_dlz_odbc=$d - dlz_odbc_include="-I$use_dlz_odbc/include" -- dlz_odbc_libs="-L$use_dlz_odbc/lib -lodbc" -+ dlz_odbc_libs="-L$use_dlz_odbc/${target_lib} -lodbc" - break - fi - done diff --git a/SOURCES/bind-9.9.1-P2-dlz-libdb.patch b/SOURCES/bind-9.9.1-P2-dlz-libdb.patch deleted file mode 100644 index 866ed8f..0000000 --- a/SOURCES/bind-9.9.1-P2-dlz-libdb.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -up bind-9.10.1b1/contrib/dlz/config.dlz.in.libdb bind-9.10.1b1/contrib/dlz/config.dlz.in ---- bind-9.10.1b1/contrib/dlz/config.dlz.in.libdb 2014-08-04 12:33:09.320735111 +0200 -+++ bind-9.10.1b1/contrib/dlz/config.dlz.in 2014-08-04 12:41:46.888241910 +0200 -@@ -263,7 +263,7 @@ case "$use_dlz_bdb" in - # Check other locations for includes. - # Order is important (sigh). - -- bdb_incdirs="/db53 /db51 /db48 /db47 /db46 /db45 /db44 /db43 /db42 /db41 /db4 /db" -+ bdb_incdirs="/db53 /db51 /db48 /db47 /db46 /db45 /db44 /db43 /db42 /db41 /db4 /libdb /db" - # include a blank element first - for d in "" $bdb_incdirs - do -@@ -288,16 +288,9 @@ case "$use_dlz_bdb" in - bdb_libnames="db53 db-5.3 db51 db-5.1 db48 db-4.8 db47 db-4.7 db46 db-4.6 db45 db-4.5 db44 db-4.4 db43 db-4.3 db42 db-4.2 db41 db-4.1 db" - for d in $bdb_libnames - do -- if test "$dd" = "/usr" -+ if test -f "$dd/${target_lib}/lib${d}.so" - then -- AC_CHECK_LIB($d, db_create, dlz_bdb_libs="-l${d}") -- if test $dlz_bdb_libs != "yes" -- then -- break -- fi -- elif test -f "$dd/${target_lib}/lib${d}.so" -- then -- dlz_bdb_libs="-L${dd}/${target_lib} -l${d}" -+ dlz_bdb_libs="-L${dd}/${target_lib}/libdb -l${d}" - break - fi - done diff --git a/SOURCES/bind-9.9.1-P2-multlib-conflict.patch b/SOURCES/bind-9.9.1-P2-multlib-conflict.patch deleted file mode 100644 index 8768b86..0000000 --- a/SOURCES/bind-9.9.1-P2-multlib-conflict.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/config.h.in b/config.h.in -index 4ecaa8f..2f65ccc 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -600,7 +600,7 @@ int sigwait(const unsigned int *set, int *sig); - #undef PREFER_GOSTASN1 - - /* The size of `void *', as computed by sizeof. */ --#undef SIZEOF_VOID_P -+/* #undef SIZEOF_VOID_P */ - - /* Define to 1 if you have the ANSI C header files. */ - #undef STDC_HEADERS -diff --git a/isc-config.sh.in b/isc-config.sh.in -index a8a0a89..b5e94ed 100644 ---- a/isc-config.sh.in -+++ b/isc-config.sh.in -@@ -13,7 +13,18 @@ prefix=@prefix@ - exec_prefix=@exec_prefix@ - exec_prefix_set= - includedir=@includedir@ --libdir=@libdir@ -+arch=$(uname -m) -+ -+case $arch in -+ x86_64 | amd64 | sparc64 | s390x | ppc64) -+ libdir=/usr/lib64 -+ sec_libdir=/usr/lib -+ ;; -+ * ) -+ libdir=/usr/lib -+ sec_libdir=/usr/lib64 -+ ;; -+esac - - usage() - { -@@ -132,6 +143,16 @@ if test x"$echo_libs" = x"true"; then - if test x"${exec_prefix_set}" = x"true"; then - libs="-L${exec_prefix}/lib" - else -+ if [ ! -x $libdir/libisc.so ] ; then -+ if [ ! -x $sec_libdir/libisc.so ] ; then -+ echo "Error: ISC libs not found in $libdir" -+ if [ -d $sec_libdir ] ; then -+ echo "Error: ISC libs not found in $sec_libdir" -+ fi -+ exit 1 -+ fi -+ libdir=$sec_libdir -+ fi - libs="-L${libdir}" - fi - if test x"$libirs" = x"true" ; then diff --git a/SOURCES/bind-95-rh452060.patch b/SOURCES/bind-95-rh452060.patch deleted file mode 100644 index 6f4a892..0000000 --- a/SOURCES/bind-95-rh452060.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c -index c06c804..e75b8b7 100644 ---- a/bin/dig/dighost.c -+++ b/bin/dig/dighost.c -@@ -1816,6 +1816,13 @@ clear_query(dig_query_t *query) { - - if (query->timer != NULL) - isc_timer_detach(&query->timer); -+ -+ if (query->waiting_senddone) { -+ debug("send_done not yet called"); -+ query->pending_free = true; -+ return; -+ } -+ - lookup = query->lookup; - - if (lookup->current_query == query) -@@ -1841,10 +1848,7 @@ clear_query(dig_query_t *query) { - isc_mempool_put(commctx, query->recvspace); - isc_buffer_invalidate(&query->recvbuf); - isc_buffer_invalidate(&query->lengthbuf); -- if (query->waiting_senddone) -- query->pending_free = true; -- else -- isc_mem_free(mctx, query); -+ isc_mem_free(mctx, query); - } - - /*% -@@ -2895,9 +2899,9 @@ send_done(isc_task_t *_task, isc_event_t *event) { - isc_event_free(&event); - - if (query->pending_free) -- isc_mem_free(mctx, query); -+ clear_query(query); - -- check_if_done(); -+ check_next_lookup(l); - UNLOCK_LOOKUP; - } - diff --git a/SOURCES/bind-96-old-api.patch b/SOURCES/bind-96-old-api.patch deleted file mode 100644 index d181d3e..0000000 --- a/SOURCES/bind-96-old-api.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up bind-9.6.0b1/contrib/sdb/ldap/ldapdb.c.old-api bind-9.6.0b1/contrib/sdb/ldap/ldapdb.c ---- bind-9.6.0b1/contrib/sdb/ldap/ldapdb.c.old-api 2008-11-24 13:28:13.000000000 +0100 -+++ bind-9.6.0b1/contrib/sdb/ldap/ldapdb.c 2008-11-24 13:28:23.000000000 +0100 -@@ -25,6 +25,7 @@ - /* Using LDAPv3 by default, change this if you want v2 */ - #ifndef LDAPDB_LDAP_VERSION - #define LDAPDB_LDAP_VERSION 3 -+#define LDAP_DEPRECATED 1 - #endif - - #include -diff -up bind-9.6.0b1/contrib/sdb/ldap/zone2ldap.c.old-api bind-9.6.0b1/contrib/sdb/ldap/zone2ldap.c ---- bind-9.6.0b1/contrib/sdb/ldap/zone2ldap.c.old-api 2008-11-24 13:29:05.000000000 +0100 -+++ bind-9.6.0b1/contrib/sdb/ldap/zone2ldap.c 2008-11-24 13:29:14.000000000 +0100 -@@ -13,6 +13,8 @@ - * ditched dNSDomain2 schema support. Version 0.3-ALPHA - */ - -+#define LDAP_DEPRECATED 1 -+ - #include - #include - #include diff --git a/SOURCES/bind93-rh490837.patch b/SOURCES/bind93-rh490837.patch deleted file mode 100644 index 6ea55ba..0000000 --- a/SOURCES/bind93-rh490837.patch +++ /dev/null @@ -1,81 +0,0 @@ -diff --git a/lib/isc/include/isc/stdio.h b/lib/isc/include/isc/stdio.h -index 1f44b5a..a3625f9 100644 ---- a/lib/isc/include/isc/stdio.h -+++ b/lib/isc/include/isc/stdio.h -@@ -69,6 +69,9 @@ isc_stdio_sync(FILE *f); - * direct counterpart in the stdio library. - */ - -+isc_result_t -+isc_stdio_fgetc(FILE *f, int *ret); -+ - ISC_LANG_ENDDECLS - - #endif /* ISC_STDIO_H */ -diff --git a/lib/isc/lex.c b/lib/isc/lex.c -index a8955bc..fc6103b 100644 ---- a/lib/isc/lex.c -+++ b/lib/isc/lex.c -@@ -434,17 +434,14 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { - if (source->is_file) { - stream = source->input; - --#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED) -- c = getc_unlocked(stream); --#else -- c = getc(stream); --#endif -- if (c == EOF) { -- if (ferror(stream)) { -- source->result = ISC_R_IOERROR; -- result = source->result; -+ result = isc_stdio_fgetc(stream, &c); -+ -+ if (result != ISC_R_SUCCESS) { -+ if (result != ISC_R_EOF) { -+ source->result = result; - goto done; - } -+ - source->at_eof = true; - } - } else { -diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c -index 2f12bcc..5bfd648 100644 ---- a/lib/isc/unix/errno2result.c -+++ b/lib/isc/unix/errno2result.c -@@ -40,6 +40,7 @@ isc___errno2result(int posixerrno, bool dolog, - case EINVAL: /* XXX sometimes this is not for files */ - case ENAMETOOLONG: - case EBADF: -+ case EISDIR: - return (ISC_R_INVALIDFILE); - case ENOENT: - return (ISC_R_FILENOTFOUND); -diff --git a/lib/isc/unix/stdio.c b/lib/isc/unix/stdio.c -index e60fa65..77f0b13 100644 ---- a/lib/isc/unix/stdio.c -+++ b/lib/isc/unix/stdio.c -@@ -149,3 +149,22 @@ isc_stdio_sync(FILE *f) { - return (isc__errno2result(errno)); - } - -+isc_result_t -+isc_stdio_fgetc(FILE *f, int *ret) { -+ int r; -+ isc_result_t result = ISC_R_SUCCESS; -+ -+#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED) -+ r = fgetc_unlocked(f); -+#else -+ r = fgets(f); -+#endif -+ -+ if (r == EOF) -+ result = ferror(f) ? isc__errno2result(errno) : ISC_R_EOF; -+ -+ *ret = r; -+ -+ return result; -+} -+ diff --git a/SOURCES/bind97-rh478718.patch b/SOURCES/bind97-rh478718.patch deleted file mode 100644 index dfc4165..0000000 --- a/SOURCES/bind97-rh478718.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index 26c509e..c1bfd62 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4152,6 +4152,10 @@ if test "yes" = "$use_atomic"; then - AC_MSG_RESULT($arch) - fi - -+if test ! "$arch" = "x86_64" -a "$have_xaddq" = "yes"; then -+ AC_MSG_ERROR([XADDQ present but disabled by Fedora patch!]) -+fi -+ - if test "yes" = "$have_atomic"; then - AC_MSG_CHECKING([compiler support for inline assembly code]) - -diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in -index c902d46..9c7c342 100644 ---- a/lib/isc/include/isc/platform.h.in -+++ b/lib/isc/include/isc/platform.h.in -@@ -284,19 +284,25 @@ - * If the "xaddq" operation (64bit xadd) is available on this architecture, - * ISC_PLATFORM_HAVEXADDQ will be defined. - */ --@ISC_PLATFORM_HAVEXADDQ@ - - /* -- * If the 32-bit "atomic swap" operation is available on this -- * architecture, ISC_PLATFORM_HAVEATOMICSTORE" will be defined. -+ * If the 64-bit "atomic swap" operation is available on this -+ * architecture, ISC_PLATFORM_HAVEATOMICSTOREQ" will be defined. - */ --@ISC_PLATFORM_HAVEATOMICSTORE@ -+ -+#ifdef __x86_64__ -+#define ISC_PLATFORM_HAVEXADDQ 1 -+#define ISC_PLATFORM_HAVEATOMICSTOREQ 1 -+#else -+#undef ISC_PLATFORM_HAVEXADDQ -+#undef ISC_PLATFORM_HAVEATOMICSTOREQ -+#endif - - /* -- * If the 64-bit "atomic swap" operation is available on this -+ * If the 32-bit "atomic swap" operation is available on this - * architecture, ISC_PLATFORM_HAVEATOMICSTORE" will be defined. - */ --@ISC_PLATFORM_HAVEATOMICSTOREQ@ -+@ISC_PLATFORM_HAVEATOMICSTORE@ - - /* - * If the "compare-and-exchange" operation is available on this architecture, diff --git a/SOURCES/bind97-rh645544.patch b/SOURCES/bind97-rh645544.patch deleted file mode 100644 index c15eeb5..0000000 --- a/SOURCES/bind97-rh645544.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c -index ecb3ddb..f7f73cd 100644 ---- a/lib/dns/resolver.c -+++ b/lib/dns/resolver.c -@@ -1456,7 +1456,7 @@ log_edns(fetchctx_t *fctx) { - */ - dns_name_format(&fctx->domain, domainbuf, sizeof(domainbuf)); - isc_log_write(dns_lctx, DNS_LOGCATEGORY_EDNS_DISABLED, -- DNS_LOGMODULE_RESOLVER, ISC_LOG_INFO, -+ DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(1), - "success resolving '%s' (in '%s'?) after %s", - fctx->info, domainbuf, fctx->reason); - -@@ -4667,7 +4667,7 @@ log_lame(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo) { - dns_name_format(&fctx->domain, domainbuf, sizeof(domainbuf)); - isc_sockaddr_format(&addrinfo->sockaddr, addrbuf, sizeof(addrbuf)); - isc_log_write(dns_lctx, DNS_LOGCATEGORY_LAME_SERVERS, -- DNS_LOGMODULE_RESOLVER, ISC_LOG_INFO, -+ DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(1), - "lame server resolving '%s' (in '%s'?): %s", - namebuf, domainbuf, addrbuf); - } -@@ -4685,7 +4685,7 @@ log_formerr(fetchctx_t *fctx, const char *format, ...) { - isc_sockaddr_format(&fctx->addrinfo->sockaddr, nsbuf, sizeof(nsbuf)); - - isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, -- DNS_LOGMODULE_RESOLVER, ISC_LOG_NOTICE, -+ DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(1), - "DNS format error from %s resolving %s for %s: %s", - nsbuf, fctx->info, fctx->clientstr, msgbuf); - } diff --git a/SOURCES/bind97-rh669163.patch b/SOURCES/bind97-rh669163.patch deleted file mode 100644 index 125049f..0000000 --- a/SOURCES/bind97-rh669163.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -up bind-9.7.2-P3/lib/lwres/lwconfig.c.rh669163 bind-9.7.2-P3/lib/lwres/lwconfig.c ---- bind-9.7.2-P3/lib/lwres/lwconfig.c.rh669163 2011-01-28 14:48:38.934472578 +0100 -+++ bind-9.7.2-P3/lib/lwres/lwconfig.c 2011-01-28 14:49:50.421326035 +0100 -@@ -612,6 +612,10 @@ lwres_conf_parse(lwres_context_t *ctx, c - break; - } - -+ /* Ignore options with no parameters */ -+ if (stopchar == '\n') -+ continue; -+ - if (strlen(word) == 0U) - rval = LWRES_R_SUCCESS; - else if (strcmp(word, "nameserver") == 0) diff --git a/SOURCES/bind99-rh640538.patch b/SOURCES/bind99-rh640538.patch deleted file mode 100644 index 5066a14..0000000 --- a/SOURCES/bind99-rh640538.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook -index 1079421..f11abd1 100644 ---- a/bin/dig/dig.docbook -+++ b/bin/dig/dig.docbook -@@ -1177,6 +1177,39 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr - - - -+ RETURN CODES -+ -+ Dig return codes are: -+ -+ -+ -+ 0: Everything went well, including things like NXDOMAIN -+ -+ -+ -+ -+ 1: Usage error -+ -+ -+ -+ -+ 8: Couldn't open batch file -+ -+ -+ -+ -+ 9: No reply from server -+ -+ -+ -+ -+ 10: Internal error -+ -+ -+ -+ -+ -+ - FILES - - /etc/resolv.conf diff --git a/SOURCES/dnszone.schema b/SOURCES/dnszone.schema deleted file mode 100644 index cb72a3f..0000000 --- a/SOURCES/dnszone.schema +++ /dev/null @@ -1,148 +0,0 @@ -# A schema for storing DNS zones in LDAP -# -attributetype ( 1.3.6.1.4.1.2428.20.0.0 NAME 'dNSTTL' - DESC 'An integer denoting time to live' - EQUALITY integerMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) - -attributetype ( 1.3.6.1.4.1.2428.20.0.1 NAME 'dNSClass' - DESC 'The class of a resource record' - EQUALITY caseIgnoreIA5Match - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.0.2 NAME 'zoneName' - DESC 'The name of a zone, i.e. the name of the highest node in the zone' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.0.3 NAME 'relativeDomainName' - DESC 'The starting labels of a domain name' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.12 NAME 'pTRRecord' - DESC 'domain name pointer, RFC 1035' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.13 NAME 'hInfoRecord' - DESC 'host information, RFC 1035' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.14 NAME 'mInfoRecord' - DESC 'mailbox or mail list information, RFC 1035' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.16 NAME 'tXTRecord' - DESC 'text string, RFC 1035' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.18 NAME 'aFSDBRecord' - DESC 'for AFS Data Base location, RFC 1183' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.24 NAME 'SigRecord' - DESC 'Signature, RFC 2535' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.25 NAME 'KeyRecord' - DESC 'Key, RFC 2535' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.28 NAME 'aAAARecord' - DESC 'IPv6 address, RFC 1886' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.29 NAME 'LocRecord' - DESC 'Location, RFC 1876' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.30 NAME 'nXTRecord' - DESC 'non-existant, RFC 2535' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.33 NAME 'sRVRecord' - DESC 'service location, RFC 2782' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.35 NAME 'nAPTRRecord' - DESC 'Naming Authority Pointer, RFC 2915' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.36 NAME 'kXRecord' - DESC 'Key Exchange Delegation, RFC 2230' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.37 NAME 'certRecord' - DESC 'certificate, RFC 2538' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.38 NAME 'a6Record' - DESC 'A6 Record Type, RFC 2874' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.39 NAME 'dNameRecord' - DESC 'Non-Terminal DNS Name Redirection, RFC 2672' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.43 NAME 'dSRecord' - DESC 'Delegation Signer, RFC 3658' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.46 NAME 'rRSIGRecord' - DESC 'RRSIG, RFC 3755' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -attributetype ( 1.3.6.1.4.1.2428.20.1.47 NAME 'nSECRecord' - DESC 'NSEC, RFC 3755' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) - -objectclass ( 1.3.6.1.4.1.2428.20.3 NAME 'dNSZone' - SUP top STRUCTURAL - MUST ( zoneName $ relativeDomainName ) - MAY ( DNSTTL $ DNSClass $ - ARecord $ MDRecord $ MXRecord $ NSRecord $ - SOARecord $ CNAMERecord $ PTRRecord $ HINFORecord $ - MINFORecord $ TXTRecord $ SIGRecord $ KEYRecord $ - AAAARecord $ LOCRecord $ NXTRecord $ SRVRecord $ - NAPTRRecord $ KXRecord $ CERTRecord $ A6Record $ - DNAMERecord ) ) diff --git a/SOURCES/ldap2zone.1 b/SOURCES/ldap2zone.1 deleted file mode 100644 index a48c69f..0000000 --- a/SOURCES/ldap2zone.1 +++ /dev/null @@ -1,41 +0,0 @@ -.\" Copyright (C) 2004, 2005 Stig Venaas -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" Manpage written by Jan Gorig -.TH ldap2zone 1 "15 March 2010" "BIND9" -.SH NAME -ldap2zone - Creates zone file from LDAP dnszone information -.SH SYNOPSIS -.B ldap2zone zone-name LDAP-URL default-ttl [serial] -.SH DESCRIPTION -ldap2zone is a tool that reads info for a zone from LDAP and constructs a standard plain ascii zone file that is written to the standard output. The LDAP information has to be stored using the dnszone schema. The schema is used by BIND with LDAP back-end. - -\fBzone-name\fR -.RS 4 -Name of the zone, eg "mydomain.net." -.RE -.PP -\fBLDAP-URL\fR -.RS 4 -LDAP URL to dnszone information -.RE -.PP -\fBdefault-ttl\fR -.RS 4 -Default TTL value to be used in zone -.RE -.PP -\fBserial\fR -.RS 4 -(optional) Program checks this number to be different than SOA serial number. -.RE - -.SH "EXIT STATUS" -Exits with 0 on success or 1 on failure. -.SH "SEE ALSO" -named(8) ldap(3) -http://www.venaas.no/dns/ldap2zone/ -.SH "COPYRIGHT" -Copyright (C) 2004, 2005 Stig Venaas diff --git a/SOURCES/ldap2zone.c b/SOURCES/ldap2zone.c deleted file mode 100644 index 80e7919..0000000 --- a/SOURCES/ldap2zone.c +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (C) 2004, 2005 Stig Venaas - * $Id: ldap2zone.c,v 1.1 2007/07/24 15:18:00 atkac Exp $ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#define LDAP_DEPRECATED 1 - -#include -#include -#include -#include - -#include - -struct string { - void *data; - size_t len; -}; - -struct assstack_entry { - struct string key; - struct string val; - struct assstack_entry *next; -}; - -struct assstack_entry *assstack_find(struct assstack_entry *stack, struct string *key); -void assstack_push(struct assstack_entry **stack, struct assstack_entry *item); -void assstack_insertbottom(struct assstack_entry **stack, struct assstack_entry *item); -void printsoa(struct string *soa); -void printrrs(char *defaultttl, struct assstack_entry *item); -void print_zone(char *defaultttl, struct assstack_entry *stack); -void usage(char *name); -void err(char *name, const char *msg); -int putrr(struct assstack_entry **stack, struct berval *name, char *type, char *ttl, struct berval *val); - -struct assstack_entry *assstack_find(struct assstack_entry *stack, struct string *key) { - for (; stack; stack = stack->next) - if (stack->key.len == key->len && !memcmp(stack->key.data, key->data, key->len)) - return stack; - return NULL; -} - -void assstack_push(struct assstack_entry **stack, struct assstack_entry *item) { - item->next = *stack; - *stack = item; -} - -void assstack_insertbottom(struct assstack_entry **stack, struct assstack_entry *item) { - struct assstack_entry *p; - - item->next = NULL; - if (!*stack) { - *stack = item; - return; - } - /* find end, should keep track of end somewhere */ - /* really a queue, not a stack */ - p = *stack; - while (p->next) - p = p->next; - p->next = item; -} - -void printsoa(struct string *soa) { - char *s; - size_t i; - - s = (char *)soa->data; - i = 0; - while (i < soa->len) { - putchar(s[i]); - if (s[i++] == ' ') - break; - } - while (i < soa->len) { - putchar(s[i]); - if (s[i++] == ' ') - break; - } - printf("(\n\t\t\t\t"); - while (i < soa->len) { - putchar(s[i]); - if (s[i++] == ' ') - break; - } - printf("; Serialnumber\n\t\t\t\t"); - while (i < soa->len) { - if (s[i] == ' ') - break; - putchar(s[i++]); - } - i++; - printf("\t; Refresh\n\t\t\t\t"); - while (i < soa->len) { - if (s[i] == ' ') - break; - putchar(s[i++]); - } - i++; - printf("\t; Retry\n\t\t\t\t"); - while (i < soa->len) { - if (s[i] == ' ') - break; - putchar(s[i++]); - } - i++; - printf("\t; Expire\n\t\t\t\t"); - while (i < soa->len) { - putchar(s[i++]); - } - printf(" )\t; Minimum TTL\n"); -} - -void printrrs(char *defaultttl, struct assstack_entry *item) { - struct assstack_entry *stack; - char *s; - int first; - size_t i; - char *ttl, *type; - int top; - - s = (char *)item->key.data; - - if (item->key.len == 1 && *s == '@') { - top = 1; - printf("@\t"); - } else { - top = 0; - for (i = 0; i < item->key.len; i++) - putchar(s[i]); - if (item->key.len < 8) - putchar('\t'); - putchar('\t'); - } - - first = 1; - for (stack = (struct assstack_entry *) item->val.data; stack; stack = stack->next) { - ttl = (char *)stack->key.data; - s = strchr(ttl, ' '); - *s++ = '\0'; - type = s; - - if (first) - first = 0; - else - printf("\t\t"); - - if (strcmp(defaultttl, ttl)) - printf("%s", ttl); - putchar('\t'); - - if (top) { - top = 0; - printf("IN\t%s\t", type); - /* Should always be SOA here */ - if (!strcmp(type, "SOA")) { - printsoa(&stack->val); - continue; - } - } else - printf("%s\t", type); - - s = (char *)stack->val.data; - for (i = 0; i < stack->val.len; i++) - putchar(s[i]); - putchar('\n'); - } -} - -void print_zone(char *defaultttl, struct assstack_entry *stack) { - printf("$TTL %s\n", defaultttl); - for (; stack; stack = stack->next) - printrrs(defaultttl, stack); -}; - -void usage(char *name) { - fprintf(stderr, "Usage:%s zone-name LDAP-URL default-ttl [serial]\n", name); - exit(1); -}; - -void err(char *name, const char *msg) { - fprintf(stderr, "%s: %s\n", name, msg); - exit(1); -}; - -int putrr(struct assstack_entry **stack, struct berval *name, char *type, char *ttl, struct berval *val) { - struct string key; - struct assstack_entry *rr, *rrdata; - - /* Do nothing if name or value have 0 length */ - if (!name->bv_len || !val->bv_len) - return 0; - - /* see if already have an entry for this name */ - key.len = name->bv_len; - key.data = name->bv_val; - - rr = assstack_find(*stack, &key); - if (!rr) { - /* Not found, create and push new entry */ - rr = (struct assstack_entry *) malloc(sizeof(struct assstack_entry)); - if (!rr) - return -1; - rr->key.len = name->bv_len; - rr->key.data = (void *) malloc(rr->key.len); - if (!rr->key.data) { - free(rr); - return -1; - } - memcpy(rr->key.data, name->bv_val, name->bv_len); - rr->val.len = sizeof(void *); - rr->val.data = NULL; - if (name->bv_len == 1 && *(char *)name->bv_val == '@') - assstack_push(stack, rr); - else - assstack_insertbottom(stack, rr); - } - - rrdata = (struct assstack_entry *) malloc(sizeof(struct assstack_entry)); - if (!rrdata) { - free(rr->key.data); - free(rr); - return -1; - } - rrdata->key.len = strlen(type) + strlen(ttl) + 1; - rrdata->key.data = (void *) malloc(rrdata->key.len); - if (!rrdata->key.data) { - free(rrdata); - free(rr->key.data); - free(rr); - return -1; - } - sprintf((char *)rrdata->key.data, "%s %s", ttl, type); - - rrdata->val.len = val->bv_len; - rrdata->val.data = (void *) malloc(val->bv_len); - if (!rrdata->val.data) { - free(rrdata->key.data); - free(rrdata); - free(rr->key.data); - free(rr); - return -1; - } - memcpy(rrdata->val.data, val->bv_val, val->bv_len); - - if (!strcmp(type, "SOA")) - assstack_push((struct assstack_entry **) &(rr->val.data), rrdata); - else - assstack_insertbottom((struct assstack_entry **) &(rr->val.data), rrdata); - return 0; -} - -int main(int argc, char **argv) { - char *s, *hostporturl, *base = NULL; - char *ttl, *defaultttl; - LDAP *ld; - char *fltr = NULL; - LDAPMessage *res, *e; - char *a, **ttlvals, **soavals, *serial; - struct berval **vals, **names; - char type[64]; - BerElement *ptr; - int i, j, rc, msgid; - struct assstack_entry *zone = NULL; - - if (argc < 4 || argc > 5) - usage(argv[0]); - - hostporturl = argv[2]; - - if (hostporturl != strstr( hostporturl, "ldap")) - err(argv[0], "Not an LDAP URL"); - - s = strchr(hostporturl, ':'); - - if (!s || strlen(s) < 3 || s[1] != '/' || s[2] != '/') - err(argv[0], "Not an LDAP URL"); - - s = strchr(s+3, '/'); - if (s) { - *s++ = '\0'; - base = s; - s = strchr(base, '?'); - if (s) - err(argv[0], "LDAP URL can only contain host, port and base"); - } - - defaultttl = argv[3]; - - rc = ldap_initialize(&ld, hostporturl); - if (rc != LDAP_SUCCESS) - err(argv[0], "ldap_initialize() failed"); - - if (argc == 5) { - /* serial number specified, check if different from one in SOA */ - fltr = (char *)malloc(strlen(argv[1]) + strlen("(&(relativeDomainName=@)(zoneName=))") + 1); - sprintf(fltr, "(&(relativeDomainName=@)(zoneName=%s))", argv[1]); - msgid = ldap_search(ld, base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0); - if (msgid == -1) - err(argv[0], "ldap_search() failed"); - - while ((rc = ldap_result(ld, msgid, 0, NULL, &res)) != LDAP_RES_SEARCH_RESULT ) { - /* not supporting continuation references at present */ - if (rc != LDAP_RES_SEARCH_ENTRY) - err(argv[0], "ldap_result() returned cont.ref? Exiting"); - - /* only one entry per result message */ - e = ldap_first_entry(ld, res); - if (e == NULL) { - ldap_msgfree(res); - err(argv[0], "ldap_first_entry() failed"); - } - - soavals = ldap_get_values(ld, e, "SOARecord"); - if (soavals) - break; - } - - ldap_msgfree(res); - if (!soavals) { - err(argv[0], "No SOA Record found"); - } - - /* We have a SOA, compare serial numbers */ - /* Only checkinf first value, should be only one */ - s = strchr(soavals[0], ' '); - s++; - s = strchr(s, ' '); - s++; - serial = s; - s = strchr(s, ' '); - *s = '\0'; - if (!strcmp(serial, argv[4])) { - ldap_value_free(soavals); - err(argv[0], "serial numbers match"); - } - ldap_value_free(soavals); - } - - if (!fltr) - fltr = (char *)malloc(strlen(argv[1]) + strlen("(zoneName=)") + 1); - if (!fltr) - err(argv[0], "Malloc failed"); - sprintf(fltr, "(zoneName=%s)", argv[1]); - - msgid = ldap_search(ld, base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0); - if (msgid == -1) - err(argv[0], "ldap_search() failed"); - - while ((rc = ldap_result(ld, msgid, 0, NULL, &res)) != LDAP_RES_SEARCH_RESULT ) { - /* not supporting continuation references at present */ - if (rc != LDAP_RES_SEARCH_ENTRY) - err(argv[0], "ldap_result() returned cont.ref? Exiting"); - - /* only one entry per result message */ - e = ldap_first_entry(ld, res); - if (e == NULL) { - ldap_msgfree(res); - err(argv[0], "ldap_first_entry() failed"); - } - - names = ldap_get_values_len(ld, e, "relativeDomainName"); - if (!names) - continue; - - ttlvals = ldap_get_values(ld, e, "dNSTTL"); - ttl = ttlvals ? ttlvals[0] : defaultttl; - - for (a = ldap_first_attribute(ld, e, &ptr); a != NULL; a = ldap_next_attribute(ld, e, ptr)) { - char *s; - - for (s = a; *s; s++) - *s = toupper(*s); - s = strstr(a, "RECORD"); - if ((s == NULL) || (s == a) || (s - a >= (signed int)sizeof(type))) { - ldap_memfree(a); - continue; - } - - strncpy(type, a, s - a); - type[s - a] = '\0'; - vals = ldap_get_values_len(ld, e, a); - if (vals) { - for (i = 0; vals[i]; i++) - for (j = 0; names[j]; j++) - if (putrr(&zone, names[j], type, ttl, vals[i])) - err(argv[0], "malloc failed"); - ldap_value_free_len(vals); - } - ldap_memfree(a); - } - - if (ptr) - ber_free(ptr, 0); - if (ttlvals) - ldap_value_free(ttlvals); - ldap_value_free_len(names); - /* free this result */ - ldap_msgfree(res); - } - - /* free final result */ - ldap_msgfree(res); - - print_zone(defaultttl, zone); - return 0; -} diff --git a/SOURCES/named-pkcs11.service b/SOURCES/named-pkcs11.service deleted file mode 100644 index 27e0693..0000000 --- a/SOURCES/named-pkcs11.service +++ /dev/null @@ -1,26 +0,0 @@ -[Unit] -Description=Berkeley Internet Name Domain (DNS) with native PKCS#11 -Wants=nss-lookup.target -Wants=named-setup-rndc.service -Before=nss-lookup.target -After=network.target -After=named-setup-rndc.service - -[Service] -Type=forking -Environment=NAMEDCONF=/etc/named.conf -EnvironmentFile=-/etc/sysconfig/named -Environment=KRB5_KTNAME=/etc/named.keytab -PIDFile=/run/named/named.pid - -ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' -ExecStart=/usr/sbin/named-pkcs11 -u named -c ${NAMEDCONF} $OPTIONS - -ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/rndc reload; else /bin/kill -HUP $MAINPID; fi' - -ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID' - -PrivateTmp=true - -[Install] -WantedBy=multi-user.target diff --git a/SOURCES/named-sdb-chroot-setup.service b/SOURCES/named-sdb-chroot-setup.service deleted file mode 100644 index 5a3e173..0000000 --- a/SOURCES/named-sdb-chroot-setup.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Set-up/destroy chroot environment for named-sdb -BindsTo=named-sdb-chroot.service -Wants=named-setup-rndc.service -After=named-setup-rndc.service - - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/libexec/setup-named-chroot.sh /var/named/chroot_sdb on /etc/named-chroot.files -ExecStop=/usr/libexec/setup-named-chroot.sh /var/named/chroot_sdb off /etc/named-chroot.files diff --git a/SOURCES/named-sdb-chroot.service b/SOURCES/named-sdb-chroot.service deleted file mode 100644 index acf88ba..0000000 --- a/SOURCES/named-sdb-chroot.service +++ /dev/null @@ -1,30 +0,0 @@ -# Don't forget to add "$AddUnixListenSocket /var/named/chroot_sdb/dev/log" -# line to your /etc/rsyslog.conf file. Otherwise your logging becomes -# broken when rsyslogd daemon is restarted (due update, for example). - -[Unit] -Description=Berkeley Internet Name Domain (DNS) -Wants=nss-lookup.target -Requires=named-sdb-chroot-setup.service -Before=nss-lookup.target -After=named-sdb-chroot-setup.service -After=network.target - -[Service] -Type=forking -Environment=NAMEDCONF=/etc/named.conf -EnvironmentFile=-/etc/sysconfig/named -Environment=KRB5_KTNAME=/etc/named.keytab -PIDFile=/var/named/chroot_sdb/run/named/named.pid - -ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -t /var/named/chroot_sdb -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' -ExecStart=/usr/sbin/named-sdb -u named -c ${NAMEDCONF} -t /var/named/chroot_sdb $OPTIONS - -ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/rndc reload; else /bin/kill -HUP $MAINPID; fi' - -ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID' - -PrivateTmp=false - -[Install] -WantedBy=multi-user.target diff --git a/SOURCES/named-sdb.8 b/SOURCES/named-sdb.8 deleted file mode 100644 index 1e456c3..0000000 --- a/SOURCES/named-sdb.8 +++ /dev/null @@ -1 +0,0 @@ -.so man8/named.8.gz \ No newline at end of file diff --git a/SOURCES/named-sdb.service b/SOURCES/named-sdb.service deleted file mode 100644 index cdf3a62..0000000 --- a/SOURCES/named-sdb.service +++ /dev/null @@ -1,26 +0,0 @@ -[Unit] -Description=Berkeley Internet Name Domain (DNS) -Wants=nss-lookup.target -Wants=named-setup-rndc.service -Before=nss-lookup.target -After=named-setup-rndc.service -After=network.target - -[Service] -Type=forking -Environment=NAMEDCONF=/etc/named.conf -EnvironmentFile=-/etc/sysconfig/named -Environment=KRB5_KTNAME=/etc/named.keytab -PIDFile=/run/named/named.pid - -ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' -ExecStart=/usr/sbin/named-sdb -u named -c ${NAMEDCONF} $OPTIONS - -ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/rndc reload; else /bin/kill -HUP $MAINPID; fi' - -ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID' - -PrivateTmp=true - -[Install] -WantedBy=multi-user.target diff --git a/SOURCES/named.root b/SOURCES/named.root deleted file mode 100644 index 18b8e44..0000000 --- a/SOURCES/named.root +++ /dev/null @@ -1,56 +0,0 @@ - -; <<>> DiG 9.18.20 <<>> -4 +tcp +norec +nostats @d.root-servers.net -; (1 server found) -;; global options: +cmd -;; Got answer: -;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47286 -;; flags: qr aa; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 27 - -;; OPT PSEUDOSECTION: -; EDNS: version: 0, flags:; udp: 1450 -;; QUESTION SECTION: -;. IN NS - -;; ANSWER SECTION: -. 518400 IN NS a.root-servers.net. -. 518400 IN NS b.root-servers.net. -. 518400 IN NS c.root-servers.net. -. 518400 IN NS d.root-servers.net. -. 518400 IN NS e.root-servers.net. -. 518400 IN NS f.root-servers.net. -. 518400 IN NS g.root-servers.net. -. 518400 IN NS h.root-servers.net. -. 518400 IN NS i.root-servers.net. -. 518400 IN NS j.root-servers.net. -. 518400 IN NS k.root-servers.net. -. 518400 IN NS l.root-servers.net. -. 518400 IN NS m.root-servers.net. - -;; ADDITIONAL SECTION: -a.root-servers.net. 518400 IN A 198.41.0.4 -b.root-servers.net. 518400 IN A 170.247.170.2 -c.root-servers.net. 518400 IN A 192.33.4.12 -d.root-servers.net. 518400 IN A 199.7.91.13 -e.root-servers.net. 518400 IN A 192.203.230.10 -f.root-servers.net. 518400 IN A 192.5.5.241 -g.root-servers.net. 518400 IN A 192.112.36.4 -h.root-servers.net. 518400 IN A 198.97.190.53 -i.root-servers.net. 518400 IN A 192.36.148.17 -j.root-servers.net. 518400 IN A 192.58.128.30 -k.root-servers.net. 518400 IN A 193.0.14.129 -l.root-servers.net. 518400 IN A 199.7.83.42 -m.root-servers.net. 518400 IN A 202.12.27.33 -a.root-servers.net. 518400 IN AAAA 2001:503:ba3e::2:30 -b.root-servers.net. 518400 IN AAAA 2801:1b8:10::b -c.root-servers.net. 518400 IN AAAA 2001:500:2::c -d.root-servers.net. 518400 IN AAAA 2001:500:2d::d -e.root-servers.net. 518400 IN AAAA 2001:500:a8::e -f.root-servers.net. 518400 IN AAAA 2001:500:2f::f -g.root-servers.net. 518400 IN AAAA 2001:500:12::d0d -h.root-servers.net. 518400 IN AAAA 2001:500:1::53 -i.root-servers.net. 518400 IN AAAA 2001:7fe::53 -j.root-servers.net. 518400 IN AAAA 2001:503:c27::2:30 -k.root-servers.net. 518400 IN AAAA 2001:7fd::1 -l.root-servers.net. 518400 IN AAAA 2001:500:9f::42 -m.root-servers.net. 518400 IN AAAA 2001:dc3::35 - diff --git a/SOURCES/setup-named-softhsm.sh b/SOURCES/setup-named-softhsm.sh deleted file mode 100755 index 7ae0a6d..0000000 --- a/SOURCES/setup-named-softhsm.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# This script will initialise token storage of softhsm PKCS11 provider -# in custom location. Is useful to store tokens in non-standard location. - -SOFTHSM2_CONF="$1" -TOKENPATH="$2" -GROUPNAME="$3" -# Do not use this script for real keys worth protection -# This is intended for crypto accelerators using PKCS11 interface. -# Uninitialized token would fail any crypto operation. -PIN=1234 - -set -e - -if [ -z "$SOFTHSM2_CONF" -o -z "$TOKENPATH" ]; then - echo "Usage: $0 [group]" >&2 - exit 1 -fi - -if ! [ -f "$SOFTHSM2_CONF" ]; then -cat << SED > "$SOFTHSM2_CONF" -# SoftHSM v2 configuration file - -directories.tokendir = ${TOKENPATH} -objectstore.backend = file - -# ERROR, WARNING, INFO, DEBUG -log.level = ERROR - -# If CKF_REMOVABLE_DEVICE flag should be set -slots.removable = false -SED -else - echo "Config file $SOFTHSM2_CONF already exists" >&2 -fi - -[ -d "$TOKENPATH" ] || mkdir -p "$TOKENPATH" - -export SOFTHSM2_CONF - -if softhsm2-util --show-slots | grep 'Initialized:[[:space:]]*yes' > /dev/null -then - echo "Token in ${TOKENPATH} is already initialized" >&2 -else - echo "Initializing tokens to ${TOKENPATH}..." - softhsm2-util --init-token --free --label rpm --pin $PIN --so-pin $PIN - - if [ -n "$GROUPNAME" ]; then - chgrp -R -- "$GROUPNAME" "$TOKENPATH" - chmod -R -- g=rX,o= "$TOKENPATH" - fi -fi - -echo "export SOFTHSM2_CONF=\"$SOFTHSM2_CONF\"" diff --git a/SOURCES/zone2sqlite.1 b/SOURCES/zone2sqlite.1 deleted file mode 100644 index 6897827..0000000 --- a/SOURCES/zone2sqlite.1 +++ /dev/null @@ -1,53 +0,0 @@ -.\" Copyright (C) 2004, 2005, 2007-2009 Internet Systems Consortium, Inc. ("ISC") -.\" Copyright (C) 2000, 2001 Internet Software Consortium. -.\" -.\" Permission to use, copy, modify, and/or distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -.\" PERFORMANCE OF THIS SOFTWARE. -.\" -.\" Manpage written by Jan Gorig -.TH zone2sqlite 1 "15 March 2010" "BIND9" -.SH NAME -zone2sqlite - Load BIND 9 zone file into SQLite database -.SH SYNOPSIS -.B zone2sqlite zone zonefile dbfile dbtable -.SH DESCRIPTION -zone2sqlite parses DNS zone file and creates database for use with SQLite BIND SDB driver. - -\fBzone\fR -.RS 4 -Zone origin, eg "mydomain.net." -.RE -.PP -\fBzonefile\fR -.RS 4 -Master zone database file, eg. mydomain.net.zone -.RE -.PP -\fBdbfile\fR -.RS 4 -Name of SQLite database file -.RE -.PP -\fBdbtable\fR -.RS 4 -Name of table in database -.RE - -.SH "EXIT STATUS" -Exits with 0 on success or 1 on failure. -.SH "SEE ALSO" -named(8) -.SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007\-2009 Internet Systems Consortium, Inc. ("ISC") -.br -Copyright \(co 2000, 2001 Internet Software Consortium. -.br diff --git a/SOURCES/zonetodb.1 b/SOURCES/zonetodb.1 deleted file mode 100644 index 897e74f..0000000 --- a/SOURCES/zonetodb.1 +++ /dev/null @@ -1,53 +0,0 @@ -.\" Copyright (C) 2004, 2005, 2007-2009 Internet Systems Consortium, Inc. ("ISC") -.\" Copyright (C) 2000, 2001 Internet Software Consortium. -.\" -.\" Permission to use, copy, modify, and/or distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -.\" PERFORMANCE OF THIS SOFTWARE. -.\" -.\" Manpage written by Jan Gorig -.TH zonetodb 1 "15 March 2010" "BIND9" -.SH NAME -zonetodb - Generate a PostgreSQL table from a zone. -.SH SYNOPSIS -.B zonetodb origin file dbname dbtable -.SH DESCRIPTION -zonetodb parses DNS zone file and creates table in selected database for use with PostgreSQL BIND SDB driver. - -\fBzone\fR -.RS 4 -Zone origin, eg "pgdb.net." -.RE -.PP -\fBfile\fR -.RS 4 -Master zone database file, eg. pgdb.net.db -.RE -.PP -\fBdbname\fR -.RS 4 -Name of PostgreSQL database (database must exist) -.RE -.PP -\fBdbtable\fR -.RS 4 -Name of table in database -.RE - -.SH "EXIT STATUS" -Exits with 0 on success or 1 on failure. -.SH "SEE ALSO" -named(8) -.SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007\-2009 Internet Systems Consortium, Inc. ("ISC") -.br -Copyright \(co 2000, 2001 Internet Software Consortium. -.br diff --git a/bind-9.16-redhat_doc.patch b/bind-9.16-redhat_doc.patch new file mode 100644 index 0000000..fe8ed11 --- /dev/null +++ b/bind-9.16-redhat_doc.patch @@ -0,0 +1,66 @@ +From 402403b4bbb4f603693378e86b6c97997ccb0401 Mon Sep 17 00:00:00 2001 +From: Petr Mensik +Date: Wed, 17 Jun 2020 23:17:13 +0200 +Subject: [PATCH] Update man named with Red Hat specifics + +This is almost unmodified text and requires revalidation. Some of those +statements are no longer correct. +--- + bin/named/named.rst | 41 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +diff --git a/bin/named/named.rst b/bin/named/named.rst +index ea440b2..fa51984 100644 +--- a/bin/named/named.rst ++++ b/bin/named/named.rst +@@ -212,6 +212,47 @@ Files + |named_pid| + The default process-id file. + ++Notes ++~~~~~ ++ ++**Red Hat SELinux BIND Security Profile:** ++ ++By default, Red Hat ships BIND with the most secure SELinux policy ++that will not prevent normal BIND operation and will prevent exploitation ++of all known BIND security vulnerabilities . See the selinux(8) man page ++for information about SElinux. ++ ++It is not necessary to run named in a chroot environment if the Red Hat ++SELinux policy for named is enabled. When enabled, this policy is far ++more secure than a chroot environment. Users are recommended to enable ++SELinux and remove the bind-chroot package. ++ ++*With this extra security comes some restrictions:* ++ ++By default, the SELinux policy does not allow named to write any master ++zone database files. Only the root user may create files in the $ROOTDIR/var/named ++zone database file directory (the options { "directory" } option), where ++$ROOTDIR is set in /etc/sysconfig/named. ++ ++The "named" group must be granted read privelege to ++these files in order for named to be enabled to read them. ++ ++Any file created in the zone database file directory is automatically assigned ++the SELinux file context *named_zone_t* . ++ ++By default, SELinux prevents any role from modifying *named_zone_t* files; this ++means that files in the zone database directory cannot be modified by dynamic ++DNS (DDNS) updates or zone transfers. ++ ++The Red Hat BIND distribution and SELinux policy creates three directories where ++named is allowed to create and modify files: */var/named/slaves*, */var/named/dynamic* ++*/var/named/data*. By placing files you want named to modify, such as ++slave or DDNS updateable zone files and database / statistics dump files in ++these directories, named will work normally and no further operator action is ++required. Files in these directories are automatically assigned the '*named_cache_t*' ++file context, which SELinux allows named to write. ++ ++ + See Also + ~~~~~~~~ + +-- +2.34.1 + diff --git a/bind-9.18-unittest-netmgr-unstable.patch b/bind-9.18-unittest-netmgr-unstable.patch new file mode 100644 index 0000000..992758d --- /dev/null +++ b/bind-9.18-unittest-netmgr-unstable.patch @@ -0,0 +1,75 @@ +From 0f3a398fe813189c5dd56b0367a72c7b3f19504b Mon Sep 17 00:00:00 2001 +From: Petr Mensik +Date: Wed, 14 Sep 2022 13:06:24 +0200 +Subject: [PATCH] Disable some often failing tests + +Make those tests skipped in default build, when CI=true environment is +set. It is not clear why they fail mostly on COPR, but they do fail +often. +--- + tests/isc/netmgr_test.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/tests/isc/netmgr_test.c b/tests/isc/netmgr_test.c +index 94e4bf7..7f9629c 100644 +--- a/tests/isc/netmgr_test.c ++++ b/tests/isc/netmgr_test.c +@@ -1567,13 +1567,13 @@ stream_half_recv_half_send(void **state __attribute__((unused))) { + /* TCP */ + ISC_RUN_TEST_IMPL(tcp_noop) { stream_noop(state); } + +-ISC_RUN_TEST_IMPL(tcp_noresponse) { stream_noresponse(state); } ++ISC_RUN_TEST_IMPL(tcp_noresponse) { SKIP_IN_CI; stream_noresponse(state); } + + ISC_RUN_TEST_IMPL(tcp_timeout_recovery) { stream_timeout_recovery(state); } + + ISC_RUN_TEST_IMPL(tcp_recv_one) { stream_recv_one(state); } + +-ISC_RUN_TEST_IMPL(tcp_recv_two) { stream_recv_two(state); } ++ISC_RUN_TEST_IMPL(tcp_recv_two) { SKIP_IN_CI; stream_recv_two(state); } + + ISC_RUN_TEST_IMPL(tcp_recv_send) { + SKIP_IN_CI; +@@ -1623,6 +1623,7 @@ ISC_RUN_TEST_IMPL(tcp_recv_one_quota) { + } + + ISC_RUN_TEST_IMPL(tcp_recv_two_quota) { ++ SKIP_IN_CI; + atomic_store(&check_listener_quota, true); + stream_recv_two(state); + } +@@ -1836,6 +1837,7 @@ ISC_RUN_TEST_IMPL(tcpdns_recv_two) { + isc_result_t result = ISC_R_SUCCESS; + isc_nmsocket_t *listen_sock = NULL; + ++ SKIP_IN_CI; + atomic_store(&nsends, 2); + + result = isc_nm_listentcpdns(listen_nm, &tcp_listen_addr, +@@ -2095,6 +2097,7 @@ ISC_RUN_TEST_IMPL(tls_recv_one) { + } + + ISC_RUN_TEST_IMPL(tls_recv_two) { ++ SKIP_IN_CI; + stream_use_TLS = true; + stream_recv_two(state); + } +@@ -2160,6 +2163,7 @@ ISC_RUN_TEST_IMPL(tls_recv_one_quota) { + } + + ISC_RUN_TEST_IMPL(tls_recv_two_quota) { ++ SKIP_IN_CI; + stream_use_TLS = true; + atomic_store(&check_listener_quota, true); + stream_recv_two(state); +@@ -2395,6 +2399,7 @@ ISC_RUN_TEST_IMPL(tlsdns_recv_two) { + isc_result_t result = ISC_R_SUCCESS; + isc_nmsocket_t *listen_sock = NULL; + ++ SKIP_IN_CI; + atomic_store(&nsends, 2); + + result = isc_nm_listentlsdns(listen_nm, &tcp_listen_addr, +-- +2.37.2 + diff --git a/bind-9.18.33.tar.xz.asc b/bind-9.18.33.tar.xz.asc new file mode 100644 index 0000000..55084f2 --- /dev/null +++ b/bind-9.18.33.tar.xz.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE2ZzOr4eXRwFPA41jGC4jV5Ri76oFAmePaRMACgkQGC4jV5Ri +76qwUQ//buDAfAdEW1UKO63ugwHoyy4fqaGzKnbQpFmg9vc9Us9M2nDL2MDgE4aM +5JwbYpqdeuZfcMuM/R2GVT79U52JdEgsPGSI3jP+N3nFq+l0J447HAm8T9PdAA4E +YFbuvd2SjMHV9xkKS+V8k/kCo3tLmbZQ6m8eoyzV8rIqsEmL+2uR4LdcTncyC0cQ +x+9oxxBQPQAVAcQp+bYGA00TW7B36xEGJysPxB5hy94awmt4T1eiWgv6uCSkW6kN +48XXgYKFpFGXm4lQTTMTPtotRDHJ1azbOTh6385XUsJy95IMPd2eLqlm9YL3dlDD ++2L0EHR6UInj3/azEnuyZr9cQEBqM1OxTlZ8f1mfjzNITJy1LBGmgVxfL5X2u20g +Z+vCodmdSyV0UgdRLai3QlloY6mNFw7OyDP7iBviwI6zFrE90BSSQkK1F46sk8OE +hDwA5Wu8Kc511ygzEHAL2gzsZieZ941LaJq5kNOFbRdtEJuWTBzFHmlE0cGG9lbt +RCBHHvzKP1oj2zGARZ7PxSHesrs2p+x6dIM1X8QCyCoirS4CRQiYJ/0Va4jAHusy +zfrkuwixtNvZ3waOyckJQiVWNOXlSCkE1IlR56VSDNNIJfAaDi7G+EUthtoVcd57 +c3wtu0mhML68Kazq0sS0LiYDH6DU90anpVEj9owZNJqOyBJnbcY= +=GaWc +-----END PGP SIGNATURE----- diff --git a/bind-9.20-nsupdate-tls-doc.patch b/bind-9.20-nsupdate-tls-doc.patch new file mode 100644 index 0000000..d74c706 --- /dev/null +++ b/bind-9.20-nsupdate-tls-doc.patch @@ -0,0 +1,114 @@ +From c5c756ce2ac4c1563d024428e148ca27c7721f71 Mon Sep 17 00:00:00 2001 +From: Aram Sargsyan +Date: Wed, 21 Sep 2022 15:05:11 +0000 +Subject: [PATCH 2/3] Document nsupdate options related to DoT + +Add documentation for the newly implemented DoT feature of the +nsupdate program. + +(cherry picked from commit bd8299d7b501234263a6aee98049f879b1c700b7) +--- + bin/nsupdate/nsupdate.rst | 48 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 47 insertions(+), 1 deletion(-) + +diff --git a/bin/nsupdate/nsupdate.rst b/bin/nsupdate/nsupdate.rst +index 81bb4815cf4..f1ab5c76fa7 100644 +--- a/bin/nsupdate/nsupdate.rst ++++ b/bin/nsupdate/nsupdate.rst +@@ -19,7 +19,7 @@ nsupdate - dynamic DNS update utility + Synopsis + ~~~~~~~~ + +-:program:`nsupdate` [**-d**] [**-D**] [**-i**] [**-L** level] [ [**-g**] | [**-o**] | [**-l**] | [**-y** [hmac:]keyname:secret] | [**-k** keyfile] ] [**-t** timeout] [**-u** udptimeout] [**-r** udpretries] [**-v**] [**-T**] [**-P**] [**-V**] [ [**-4**] | [**-6**] ] [filename] ++:program:`nsupdate` [**-d**] [**-D**] [**-i**] [**-L** level] [ [**-g**] | [**-o**] | [**-l**] | [**-y** [hmac:]keyname:secret] | [**-k** keyfile] ] [ [**-S**] [**-K** tlskeyfile] [**-E** tlscertfile] [**-A** tlscafile] [**-H** tlshostname] [-O] ] [**-t** timeout] [**-u** udptimeout] [**-r** udpretries] [**-v**] [**-T**] [**-P**] [**-V**] [ [**-4**] | [**-6**] ] [filename] + + Description + ~~~~~~~~~~~ +@@ -71,6 +71,15 @@ Options + + This option sets use of IPv6 only. + ++.. option:: -A tlscafile ++ ++ This option specifies the file of the certificate authorities (CA) certificates ++ (in PEM format) in order to verify the remote server TLS certificate when ++ using DNS-over-TLS (DoT), to achieve Strict or Mutual TLS. When used, it will ++ override the certificates from the global certificates store, which are ++ otherwise used by default when :option:`-S` is enabled. This option can not ++ be used in conjuction with :option:`-O`, and it implies :option:`-S`. ++ + .. option:: -C + + Overrides the default `resolv.conf` file. This is only intended for testing. +@@ -84,10 +93,23 @@ Options + + This option sets extra debug mode. + ++.. option:: -E tlscertfile ++ ++ This option sets the certificate(s) file for authentication for the ++ DNS-over-TLS (DoT) transport to the remote server. The certificate ++ chain file is expected to be in PEM format. This option implies :option:`-S`, ++ and can only be used with :option:`-K`. ++ + .. option:: -g + + This option enables standard GSS-TSIG mode. + ++.. option:: -H tlshostname ++ ++ This option makes :program:`nsupdate` use the provided hostname during remote ++ server TLS certificate verification. Otherwise, the DNS server name ++ is used. This option implies :option:`-S`. ++ + .. option:: -i + + This option forces interactive mode, even when standard input is not a terminal. +@@ -104,6 +126,13 @@ Options + key used to authenticate Dynamic DNS update requests. In this case, + the key specified is not an HMAC-MD5 key. + ++.. option:: -K tlskeyfile ++ ++ This option sets the key file for authenticated encryption for the ++ DNS-over-TLS (DoT) transport with the remote server. The private key file is ++ expected to be in PEM format. This option implies :option:`-S`, and can only ++ be used with :option:`-E`. ++ + .. option:: -l + + This option sets local-host only mode, which sets the server address to localhost +@@ -123,6 +152,14 @@ Options + This option enables a non-standards-compliant variant of GSS-TSIG + used by Windows 2000. + ++.. option:: -O ++ ++ This option enables Opportunistic TLS. When used, the remote peer's TLS ++ certificate will not be verified. This option should be used for debugging ++ purposes only, and it is not recommended to use it in production. This ++ option can not be used in conjuction with :option:`-A`, and it implies ++ :option:`-S`. ++ + .. option:: -p port + + This option sets the port to use for connections to a name server. The default is +@@ -138,6 +175,15 @@ Options + This option sets the number of UDP retries. The default is 3. If zero, only one update + request is made. + ++.. option:: -S ++ ++ This option indicates whether to use DNS-over-TLS (DoT) when querying ++ name servers specified by ``server servername port`` syntax in the input ++ file, and the primary server discovered through a SOA request. When the ++ :option:`-K` and :option:`-E` options are used, then the specified TLS ++ client certificate and private key pair are used for authentication ++ (Mutual TLS). This option implies :option:`-v`. ++ + .. option:: -t timeout + + This option sets the maximum time an update request can take before it is aborted. The +-- +2.47.0 + diff --git a/bind-9.20-nsupdate-tls-test.patch b/bind-9.20-nsupdate-tls-test.patch new file mode 100644 index 0000000..65d825d --- /dev/null +++ b/bind-9.20-nsupdate-tls-test.patch @@ -0,0 +1,1630 @@ +From 2e0dd9a0a3e77f21a37d894133d301afdac6db7b Mon Sep 17 00:00:00 2001 +From: Aram Sargsyan +Date: Wed, 21 Sep 2022 13:15:50 +0000 +Subject: [PATCH] Extend the nsupdate system test with DoT-related checks + +Add a simple test PKI based on the existing one in the doth test. + +Check ephemeral, forward-secrecy, and forward-secrecy-mutual-tls +TLS configurations with different scenarios. + +(cherry picked from commit f2bb80d6ae172f6fd7943bf913d1b0566b5df352) +--- + bin/tests/system/nsupdate/.gitignore | 5 + + bin/tests/system/nsupdate/CA/CA-other.pem | 26 +++ + bin/tests/system/nsupdate/CA/CA.cfg | 77 +++++++ + bin/tests/system/nsupdate/CA/CA.pem | 29 +++ + bin/tests/system/nsupdate/CA/README | 2 + + .../CA/certs/srv01.client01.example.nil.key | 40 ++++ + .../CA/certs/srv01.client01.example.nil.pem | 93 +++++++++ + .../srv01.client02-expired.example.nil.key | 40 ++++ + .../srv01.client02-expired.example.nil.pem | 93 +++++++++ + .../CA/certs/srv01.crt01.example.nil.key | 40 ++++ + .../CA/certs/srv01.crt01.example.nil.pem | 93 +++++++++ + .../certs/srv01.crt02-expired.example.nil.key | 40 ++++ + .../certs/srv01.crt02-expired.example.nil.pem | 93 +++++++++ + bin/tests/system/nsupdate/CA/index.txt | 4 + + bin/tests/system/nsupdate/CA/index.txt.attr | 1 + + .../nsupdate/CA/newcerts/70B9F4EB2FA19598.pem | 93 +++++++++ + .../nsupdate/CA/newcerts/70B9F4EB2FA19599.pem | 93 +++++++++ + .../nsupdate/CA/newcerts/70B9F4EB2FA1959A.pem | 93 +++++++++ + .../nsupdate/CA/newcerts/70B9F4EB2FA1959B.pem | 93 +++++++++ + .../system/nsupdate/CA/private/CA-other.key | 39 ++++ + bin/tests/system/nsupdate/CA/private/CA.key | 39 ++++ + bin/tests/system/nsupdate/CA/serial | 1 + + bin/tests/system/nsupdate/dhparam3072.pem | 11 + + bin/tests/system/nsupdate/ns1/named.conf.in | 34 +++ + bin/tests/system/nsupdate/ns10/named.conf.in | 2 + + bin/tests/system/nsupdate/tests.sh | 193 ++++++++++++++++++ + 26 files changed, 1367 insertions(+) + create mode 100644 bin/tests/system/nsupdate/.gitignore + create mode 100644 bin/tests/system/nsupdate/CA/CA-other.pem + create mode 100644 bin/tests/system/nsupdate/CA/CA.cfg + create mode 100644 bin/tests/system/nsupdate/CA/CA.pem + create mode 100644 bin/tests/system/nsupdate/CA/README + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.key + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.pem + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.key + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.pem + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.key + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.pem + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.key + create mode 100644 bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.pem + create mode 100644 bin/tests/system/nsupdate/CA/index.txt + create mode 100644 bin/tests/system/nsupdate/CA/index.txt.attr + create mode 100644 bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19598.pem + create mode 100644 bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19599.pem + create mode 100644 bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959A.pem + create mode 100644 bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959B.pem + create mode 100644 bin/tests/system/nsupdate/CA/private/CA-other.key + create mode 100644 bin/tests/system/nsupdate/CA/private/CA.key + create mode 100644 bin/tests/system/nsupdate/CA/serial + create mode 100644 bin/tests/system/nsupdate/dhparam3072.pem + +diff --git a/bin/tests/system/nsupdate/.gitignore b/bin/tests/system/nsupdate/.gitignore +new file mode 100644 +index 0000000..df5fe68 +--- /dev/null ++++ b/bin/tests/system/nsupdate/.gitignore +@@ -0,0 +1,5 @@ ++# temporary files generated by "openssl ca" ++/CA/*.old ++# there is little point in keeping the certificate requests ++# for the issued certificates ++/CA/certs/*.csr +diff --git a/bin/tests/system/nsupdate/CA/CA-other.pem b/bin/tests/system/nsupdate/CA/CA-other.pem +new file mode 100644 +index 0000000..6bdbeda +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/CA-other.pem +@@ -0,0 +1,26 @@ ++-----BEGIN CERTIFICATE----- ++MIIEZTCCAs0CFDYlin3oeYDu16bFItl9tGZz1Ra4MA0GCSqGSIb3DQEBCwUAMG4x ++CzAJBgNVBAYTAlVBMRcwFQYDVQQIDA5LaGFya2l2IE9ibGFzdDEQMA4GA1UEBwwH ++S2hhcmtpdjEMMAoGA1UECgwDSVNDMSYwJAYDVQQLDB1Tb2Z0d2FyZSBFbmdlbmVl ++cmluZyAoQklORCA5KTAgFw0yMjA5MDcyMTIzNTBaGA8yMDUyMDgzMDIxMjM1MFow ++bjELMAkGA1UEBhMCVUExFzAVBgNVBAgMDktoYXJraXYgT2JsYXN0MRAwDgYDVQQH ++DAdLaGFya2l2MQwwCgYDVQQKDANJU0MxJjAkBgNVBAsMHVNvZnR3YXJlIEVuZ2Vu ++ZWVyaW5nIChCSU5EIDkpMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA ++10Xj8dH8/XCfUvhdL/S3E10TnrYY8IIDBmU0lkUR5IHwgP9IYVyR/0Mibg79FAs+ ++rvuEDifUK+6wvkpj+BXNVZCspo9/u3cl7dqrLH+1SeUs50OeQnbbTrBl0PuNwvzE ++kbk7xwLlVDOyRmmvY/EEu7WkitQZgXSAYgttrk62CuJUQUmwUTX5Jxndsjydk/zW ++/DiulTsX+zv8kG5NiwpXCfL6QxBoMZNI4fUmDL3bX1XfHaFA+45GT2lHu07xc+cV ++eZIRCo0Nk+fIO53lDol8mmR8/5vna27gRnqEUSU7MZAMG6QBXkotnq3rHnrI/ku6 ++dCJW4tbWV/ANQ+TG17g2tygzC/smqTuLqavyP9V5cRrdU9awEqwvy8uVbGkTmUZd ++tjkGWCcmBSWJvkH3MRJmijS7rDcb8m/g9+xKe79V1c8durGWvcfMRZZhWaoHyhnH ++g9+JLUCC3EUCp/1206w5vTXEQNpqi9Z3AZfgboPzJyji4OeYfcQ5eaIZ3OuIpyQz ++AgMBAAEwDQYJKoZIhvcNAQELBQADggGBAKdQkmmyUqcE1by7AeHoxkqFgqUeSAlh ++flXi5DD+j5+Op2GAUrx84LGy4+heKEwAkV5Cw2c9IMHmDDMnGe/g4FjBS+dTZsTs ++JRXXDR7t20eWiBpvO/3IMqVpPq9CAQY1L9PYAVuVM5cwdzsJXdH82z2BZ3Ttg3GX ++NPnybxzD/auC051vqEp28Jzbswd4c3VvTmRnYY7rYNNKnLD7812BIp7lnE6s5X2D ++y0PPSYdhscTqfJV0+GDF5hUduOFX1xTcPlXaXfyKLLelqtrw40p3ynww9v/J4mwt ++FBV+a8gguM7tCZMoV/VJZghObglV/wpokAQchL/pnxL7+U8JklRqaU4DlxyGZ+K4 ++QlR5mJe19ZlkgHePk1MbwNZaTXjaOFirYmZzs4YynOp3iBHrW3CYY3kVlrUpKP08 ++o101hce32VxkyST6i5W24MU02O/wuPdyQpN+rJjYv32Axsrh/ePkI5qKew9eZ63i ++WzNb7BW1LrHrQ/lXoJ3ekRQd10UX3xhk/w== ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/CA.cfg b/bin/tests/system/nsupdate/CA/CA.cfg +new file mode 100644 +index 0000000..1a3ed65 +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/CA.cfg +@@ -0,0 +1,77 @@ ++# See ../../doth/CA/ca.cfg for more information ++ ++# certificate authority configuration ++[ca] ++default_ca = CA_default # The default ca section ++ ++[CA_default] ++dir = . ++new_certs_dir = $dir/newcerts # new certs dir (must be created) ++certificate = $dir/CA.pem # The CA cert ++private_key = $dir/private/CA.key # CA private key ++ ++serial = $dir/serial # serial number file for the next certificate ++ # Update before issuing it: ++ # xxd -l 8 -u -ps /dev/urandom > ./serial ++database = $dir/index.txt # (must be created manually: touch ./index.txt) ++ ++default_days = 1 # how long to certify for ++ ++#default_crl_days = 30 # the number of days before the ++default_crl_days = 10950 # next CRL is due. That is the ++ # days from now to place in the ++ # CRL nextUpdate field. If CRL ++ # is expired, certificate ++ # verifications will fail even ++ # for otherwise valid ++ # certificates. Clients might ++ # cache the CRL, so the expiry ++ # period should normally be ++ # relatively short (default: ++ # 30) for production CAs. ++ ++default_md = sha256 # digest to use ++ ++policy = policy_default # default policy ++email_in_dn = no # Don't add the email into cert DN ++ ++name_opt = ca_default # Subject name display option ++cert_opt = ca_default # Certificate display option ++ ++# We need the following in order to copy Subject Alt Name(s) from a ++# request to the certificate. ++copy_extensions = copy # copy extensions from request ++ ++[policy_default] ++countryName = optional ++stateOrProvinceName = optional ++organizationalUnitName = optional ++commonName = supplied ++emailAddress = optional ++ ++# default certificate requests settings ++[req] ++# Options for the `req` tool (`man req`). ++default_bits = 3072 # for RSA only ++distinguished_name = req_default ++string_mask = utf8only ++# SHA-1 is deprecated, so use SHA-256 instead. ++default_md = sha256 ++# do not encrypt the private key file ++encrypt_key = no ++ ++[req_default] ++# See . ++countryName = Country Name (2 letter code) ++stateOrProvinceName = State or Province Name (full name) ++localityName = Locality Name (e.g., city) ++0.organizationName = Organization Name (e.g., company) ++organizationalUnitName = Organizational Unit Name (e.g. department) ++commonName = Common Name (e.g. server FQDN or YOUR name) ++emailAddress = Email Address ++# defaults ++countryName_default = UA ++stateOrProvinceName_default = Kharkiv Oblast ++localityName_default = Kharkiv ++0.organizationName_default = ISC ++organizationalUnitName_default = Software Engeneering (BIND 9) +diff --git a/bin/tests/system/nsupdate/CA/CA.pem b/bin/tests/system/nsupdate/CA/CA.pem +new file mode 100644 +index 0000000..1f725db +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/CA.pem +@@ -0,0 +1,29 @@ ++-----BEGIN CERTIFICATE----- ++MIIE3TCCA0WgAwIBAgIUeZPKrvbGEBZaRc2jNczlIsJXyPYwDQYJKoZIhvcNAQEL ++BQAwfTELMAkGA1UEBhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4G ++A1UEBwwHS2hhcmtpdjEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0 ++aXVtMRwwGgYDVQQDDBNjYS50ZXN0LmV4YW1wbGUuY29tMCAXDTIyMDEyNDEyNDA1 ++NFoYDzIwNTIwMTE3MTI0MDU0WjB9MQswCQYDVQQGEwJVQTEYMBYGA1UECAwPS2hh ++cmtpdiBPYmxhc3QnMRAwDgYDVQQHDAdLaGFya2l2MSQwIgYDVQQKDBtJbnRlcm5l ++dCBTeXN0ZW1zIENvbnNvcnRpdW0xHDAaBgNVBAMME2NhLnRlc3QuZXhhbXBsZS5j ++b20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCi6hEegBzpUKbE1NTo ++Z7uz7EMUY7TBckkiw/7ydTLKNa8YI4JpBguFvWQsDY0dGFJIoVwyHyNx3seW/LoI ++B5zWPZ2xbOvLLceA+t2NZpbc98E7jUOVS123yED+nqlfZjCq9Zt0r/ezwnQtjnFF ++ko1mcU4H9Jvg8aIgnU2AxE78zciU9CY8799pFFNThIjbooI8oVbfjbzbpmLzxjA5 ++3rDmZBTh+ySTlMa2U2oT4WPjRltZWnJVegRRLpG95GnTbQ1fkJAbj1Iu10XTkCee ++wBOqaA1UJem0a6pby5odE414Y7c0ETKcmaJtYENQyO0IJwZWDKtVe5OTIAklakia ++eyFTCAw1h5tHCYLaJW/Yu2wlLl5RNQcRZ9+cWXnldTY+TI1iBjfmADjLdKJYUlhX ++z7kWJtTi63Sdv6WYcEXxaWpxT+R3e2kaR/R7GOo4gdkWpX1siGlRteHHH2/36CSQ ++ZD2etcTUpGW+KDHFR4grnEfL1rt9UgvCjpa4KcssmZtWSSUCAwEAAaNTMFEwHQYD ++VR0OBBYEFHyJ6Fzr5R9ySATFj/uSCJz1YCY5MB8GA1UdIwQYMBaAFHyJ6Fzr5R9y ++SATFj/uSCJz1YCY5MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggGB ++AF3y0hvzyZWtmuG1JwIcOcc1aPl1KdRy8bao/5iHYGYYrsdDgcO5/e+y9S/izalc ++TdW7SKB5iBOCiE8fBNtToCvGP+fxNxHijpAmTr37G5sWuSo1T1VYFizHWL+df/Ig ++TcSvDrEjSnAwaEdNJUWtjoIC4VzNKTLtZf16QIATTzTZa3bfgSetpWS7LhLQbHod ++CSGI2QB1LRbqGC+a1Y85QxHv81jWzPWPzXYvnOLrDdQyBMOBcxDzrN4b6zg+5Itz ++qGYt+IS71jAH0IhxAyD/U5n1jGJv02BnSq0ynLEOD6gsnZjqAwPbt/PM9pGbtbXO ++70Q9rxr+vQc1IISKAEiH3txaEPi10wU98d6LbInJvQrmgHo/ntet8skWNYuxlEzS ++wvynuE9KvvQtOTodWt5AePtKrhHdxu527a4CHVp59nYUjKSdMKjvmhMRXM1cNjFE ++rA/pyyhozR47w3RzHMJVHw2GJ2B/HeqmxpXr1CmJjoRP38QCR7N+mqiZy85Fq2j2 ++8Q== ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/README b/bin/tests/system/nsupdate/CA/README +new file mode 100644 +index 0000000..13069ca +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/README +@@ -0,0 +1,2 @@ ++Please take a look at the contents of the CA.cfg file for further ++instructions and configurations options. +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.key b/bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.key +new file mode 100644 +index 0000000..5e3420e +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.key +@@ -0,0 +1,40 @@ ++-----BEGIN PRIVATE KEY----- ++MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQCrYC6cYeOJxlIr ++vOnhBf0YZUIg9lYWQDPSy5/37yJUp8lVcMpS8OKiWDh/EK0rBeARtmkhfy04Vt3V ++5PPepzI19zMqUoCut9Z8NXTDDIrDOhhhaHNiWFb/eCVXHHu+mIgh3RyKE6WaUkiY ++2T3EKKZ+mxFWfs4Ju1GJiqgbALVzK0GTsWJAMCnq9qPnvPDpngcrrqmgHU3Z+BhN ++g0dOaO5XyFUVhjxtHvUx8d7Pwn5rjiJaxXav0AHeq3oDspYzzKAmrt7EvXaFlseI ++5Ea8P8ZUyZWDh5xJDTHdxBdSmeRlSZud863OZghX9IO+XofaQloBKm1o0Y042Riu ++Xi5UcosBRZav9aPQKV0ii7TUMK8CNsUt6SnrLOpqfiezcPyHHyvEsTqmwum3wm9G ++Y7eWLlPYt83D9LVtsvxXSayfmMn+tPV8k0guk9zpGFRjXxij5xKq/jjwc+UXHv5A ++ZYGoj2BGwhbyqJ2xG7zOBd43sqiGR72Nkt7g5UKJuOP4sSQIfpkCAwEAAQKCAYEA ++i3PT2fsp3cXcvayXID3wSvayzgHF4YtS4FhEDsuvwvVZtsX2TXGo6fQh3Pvj/dtl ++DuTBPbmwQWUmVNRewbKKADHsl6bVAdekmCQjpEhDbkOK7VDCe6do+693qyAJbfnO ++5Md5Xr5IBoCohIBaa5Gskd97R0gePvsHiYWj730vKc1sKlOwoIzQv1r92yf7Xg7y ++xM/3RcwyuojQtdp6nspyEEp7Oe2mpCEJ4x9vcN5SYxEg0X5Xaw83RkuBGRsscHA0 ++GN+4eJ59Ld1R9uktLYvUA06ZdoAVZyblE4xxjk2vueE3K2/kT2ooKHVWulGI+PnF ++2xYedZsZkgwLbXcEhPXBo3vMTjzRlePh668ULi9B6ntMjWpCSCvGnz142Uwatfq0 ++PeasBVgRngu9Wg+smkA4kHnDi7ih3zpLh6sTcOKL7F1cBgvtjgIyzZDp9eJUEfVH ++G/89mTCswhqV1WtQ3n9zbYVbSK9vaAxCrfK50pG+IfHXG9EqnrQPzKsRxNsDpN91 ++AoHBANeNLQb3gSk6sBg53smh9oFUEwwgAjHY31ZOOInO4X7udXrtRcON6SCkZjaD ++6y1N3Orjama6mr+/eHxJeDEbWBB7INOsaqHewoQF8qaOa7HHmCbXcUIlAQFvaE6e ++Qd5e+YHLmbYZbkPfntqWmXuSmk7hUxjnPPOv1P9sgv/3b4TJQJ4FEJasKpWgIOAy ++3g8UrjtbI3ITSo3SKCei3wvOCzIdnzwgcHY420jU1yU/oDzN07D4K0iODAbasUl1 ++ZH5UvwKBwQDLiNual2aCUtjKAoRLnGDtP6LOYV3eXchBrywIj2tNAMlD7TXbjG04 ++Le+I9O+azRorvXQ2WBBIYzka1JozK8WTsxkQYRd9AEy2AsQgPlK5hfy3xcGxSscC ++vdxSdQQQ/ASKHHbCTKhDhnA2b2fvLhWxZqsbSO4hSmvjXrSUpGrAABFipK9VqS6Y ++Sg6uEo1AlTrwsGW66LHpFeG6YQ0uj4sF0x5mzH7R50And30lVg8DjJASdClzOIWJ ++WV+3opbgSqcCgcEAvGGJhJkyrJG57LJG3vlJsmWD8AjZYi8joQ3jo6zGrmRBEBnl ++6q5PnFORcPuBwapW9IGkL/vN2t6/sf+Tp3c6U80IN3ZsCuPgI/n+w0mdHVZOx0Nq ++nGAyrMps4qi08F8YuDL0N42qLG93KZqMsM7DRUTvlsghIOf+wuxW4NWjBO3OJ0xN ++3yDAZtv3X3mVUKDGVOGl7MCnW6LbrShOvsZoSnhQ/f9ryiaOnuxEyyz8IafQ5s09 ++Jr/eCu9+GbEbDr2JAoHAXUZg7Z3IupzhAOLaYhROTyvEnrP8YrWz2nY+xcWENQvR ++MLH65pyaSQ60IZ2uWND512XBZk5BWAsw1lzsNdsvdpqzN9BnBUAn55mo6+Xj32XK ++BSY5t9g/D8CWwasiq+3y3qBgxHaA/kEUF75CcVg7VMtqStzHVLZYbyCtvRkEWu0t ++CnnSaH1Z/yyhQaD63sgE9NzCIkAVmG4QvmtPsTDTU14HJrE8xVEnE28tCPlBdCzs ++sahOfqE+gU1WEkAOyMctAoHAASVc1KFfBI48tM+cr8vDt1QklVgnKn44DL6HF5tp ++iA8/xhB2fHKq6a+xuGxubXo7jo0KbKyYXPFyE5MDrzIDKp0GLUr7WtaunNVMKbKs ++B/2YSw+PELoIc5GpiH4lqP5iFYyHKmJighou4oxLcjMlHpRWUERPdxA+L6zggPyJ ++56PX2tcezcCZMVm65VpHsX3CqEQyWnFDCt0zclRNFWPKCENsl10emenBZVnxb8fc ++smxv7aRpgoWBRa5vinKvOv2T ++-----END PRIVATE KEY----- +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.pem b/bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.pem +new file mode 100644 +index 0000000..f546d35 +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.client01.example.nil.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010842 (0x70b9f4eb2fa1959a) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 8 08:20:17 2022 GMT ++ Not After : Aug 31 08:20:17 2052 GMT ++ Subject: CN=srv01.client01.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:ab:60:2e:9c:61:e3:89:c6:52:2b:bc:e9:e1:05: ++ fd:18:65:42:20:f6:56:16:40:33:d2:cb:9f:f7:ef: ++ 22:54:a7:c9:55:70:ca:52:f0:e2:a2:58:38:7f:10: ++ ad:2b:05:e0:11:b6:69:21:7f:2d:38:56:dd:d5:e4: ++ f3:de:a7:32:35:f7:33:2a:52:80:ae:b7:d6:7c:35: ++ 74:c3:0c:8a:c3:3a:18:61:68:73:62:58:56:ff:78: ++ 25:57:1c:7b:be:98:88:21:dd:1c:8a:13:a5:9a:52: ++ 48:98:d9:3d:c4:28:a6:7e:9b:11:56:7e:ce:09:bb: ++ 51:89:8a:a8:1b:00:b5:73:2b:41:93:b1:62:40:30: ++ 29:ea:f6:a3:e7:bc:f0:e9:9e:07:2b:ae:a9:a0:1d: ++ 4d:d9:f8:18:4d:83:47:4e:68:ee:57:c8:55:15:86: ++ 3c:6d:1e:f5:31:f1:de:cf:c2:7e:6b:8e:22:5a:c5: ++ 76:af:d0:01:de:ab:7a:03:b2:96:33:cc:a0:26:ae: ++ de:c4:bd:76:85:96:c7:88:e4:46:bc:3f:c6:54:c9: ++ 95:83:87:9c:49:0d:31:dd:c4:17:52:99:e4:65:49: ++ 9b:9d:f3:ad:ce:66:08:57:f4:83:be:5e:87:da:42: ++ 5a:01:2a:6d:68:d1:8d:38:d9:18:ae:5e:2e:54:72: ++ 8b:01:45:96:af:f5:a3:d0:29:5d:22:8b:b4:d4:30: ++ af:02:36:c5:2d:e9:29:eb:2c:ea:6a:7e:27:b3:70: ++ fc:87:1f:2b:c4:b1:3a:a6:c2:e9:b7:c2:6f:46:63: ++ b7:96:2e:53:d8:b7:cd:c3:f4:b5:6d:b2:fc:57:49: ++ ac:9f:98:c9:fe:b4:f5:7c:93:48:2e:93:dc:e9:18: ++ 54:63:5f:18:a3:e7:12:aa:fe:38:f0:73:e5:17:1e: ++ fe:40:65:81:a8:8f:60:46:c2:16:f2:a8:9d:b1:1b: ++ bc:ce:05:de:37:b2:a8:86:47:bd:8d:92:de:e0:e5: ++ 42:89:b8:e3:f8:b1:24:08:7e:99 ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.client01.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 07:97:69:51:12:50:6a:e1:02:a0:b0:dc:93:75:16:c4:38:0f: ++ 5c:b3:47:da:bf:fa:9c:b6:de:c0:ef:38:f7:cc:d9:8d:71:ba: ++ 51:89:e5:48:36:dd:e1:f8:73:9d:92:80:1c:42:30:69:4f:8c: ++ 19:5d:f7:1d:03:e4:f2:76:e0:58:7b:c2:76:c4:0a:7e:20:69: ++ 26:6c:3e:cb:31:45:93:1d:07:5f:45:44:8e:5a:fb:87:17:7b: ++ 4d:5c:bf:37:bd:5e:ba:5c:22:84:bf:26:21:4a:c4:e9:f9:cb: ++ 73:de:fc:62:04:96:ad:aa:fd:89:09:5c:74:d6:bd:5f:07:17: ++ ef:9c:3d:ee:b7:dc:08:11:7f:12:66:ab:c4:ff:43:6d:7f:1e: ++ 01:b6:d1:19:73:53:18:e4:02:b0:7c:9e:99:63:d8:57:dd:07: ++ 79:fb:83:39:09:de:76:6e:68:b7:87:81:13:b8:26:e5:1c:c9: ++ a0:23:e5:97:39:ff:93:c7:8d:08:d8:ce:97:34:fc:ad:22:14: ++ 89:c0:ae:83:7d:0a:3f:cf:a0:9b:b4:6a:5c:b3:6d:5d:3b:88: ++ ca:1e:9b:99:54:64:57:58:3c:4c:bd:26:ee:11:c3:13:0b:1d: ++ f5:fd:d9:37:b0:31:72:6f:1d:e8:ba:43:37:46:f7:71:fe:6d: ++ 4a:30:33:29:c5:7b:37:8b:7e:06:22:89:a4:46:36:f0:fe:c6: ++ f5:f0:53:04:c0:35:52:78:6e:10:24:3a:d8:bf:7b:13:2f:98: ++ bc:69:31:41:68:02:5a:c4:f9:11:a2:6b:3f:c8:e0:d4:b3:80: ++ af:d2:be:fe:28:70:61:18:ed:8a:de:c4:cb:da:c9:60:94:91: ++ 76:63:69:8c:6e:96:f5:ba:e7:be:1e:1c:c3:84:b1:8d:e8:31: ++ f7:66:8c:0d:da:a8:78:57:19:fd:a0:8d:fa:9a:7e:51:1c:d1: ++ d0:84:07:a2:45:40:2d:c4:6b:e9:9f:86:4a:08:20:8f:9c:79: ++ 97:e3:7f:2a:14:73 ++-----BEGIN CERTIFICATE----- ++MIIEVTCCAr2gAwIBAgIIcLn06y+hlZowDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMCAXDTIyMDkwODA4MjAxN1oYDzIwNTIwODMx ++MDgyMDE3WjAlMSMwIQYDVQQDDBpzcnYwMS5jbGllbnQwMS5leGFtcGxlLm5pbDCC ++AaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKtgLpxh44nGUiu86eEF/Rhl ++QiD2VhZAM9LLn/fvIlSnyVVwylLw4qJYOH8QrSsF4BG2aSF/LThW3dXk896nMjX3 ++MypSgK631nw1dMMMisM6GGFoc2JYVv94JVcce76YiCHdHIoTpZpSSJjZPcQopn6b ++EVZ+zgm7UYmKqBsAtXMrQZOxYkAwKer2o+e88OmeByuuqaAdTdn4GE2DR05o7lfI ++VRWGPG0e9THx3s/CfmuOIlrFdq/QAd6regOyljPMoCau3sS9doWWx4jkRrw/xlTJ ++lYOHnEkNMd3EF1KZ5GVJm53zrc5mCFf0g75eh9pCWgEqbWjRjTjZGK5eLlRyiwFF ++lq/1o9ApXSKLtNQwrwI2xS3pKess6mp+J7Nw/IcfK8SxOqbC6bfCb0Zjt5YuU9i3 ++zcP0tW2y/FdJrJ+Yyf609XyTSC6T3OkYVGNfGKPnEqr+OPBz5Rce/kBlgaiPYEbC ++FvKonbEbvM4F3jeyqIZHvY2S3uDlQom44/ixJAh+mQIDAQABoy8wLTArBgNVHREE ++JDAighpzcnYwMS5jbGllbnQwMS5leGFtcGxlLm5pbIcECjUAATANBgkqhkiG9w0B ++AQsFAAOCAYEAB5dpURJQauECoLDck3UWxDgPXLNH2r/6nLbewO8498zZjXG6UYnl ++SDbd4fhznZKAHEIwaU+MGV33HQPk8nbgWHvCdsQKfiBpJmw+yzFFkx0HX0VEjlr7 ++hxd7TVy/N71eulwihL8mIUrE6fnLc978YgSWrar9iQlcdNa9XwcX75w97rfcCBF/ ++EmarxP9DbX8eAbbRGXNTGOQCsHyemWPYV90HefuDOQnedm5ot4eBE7gm5RzJoCPl ++lzn/k8eNCNjOlzT8rSIUicCug30KP8+gm7RqXLNtXTuIyh6bmVRkV1g8TL0m7hHD ++Ewsd9f3ZN7Axcm8d6LpDN0b3cf5tSjAzKcV7N4t+BiKJpEY28P7G9fBTBMA1Unhu ++ECQ62L97Ey+YvGkxQWgCWsT5EaJrP8jg1LOAr9K+/ihwYRjtit7Ey9rJYJSRdmNp ++jG6W9brnvh4cw4Sxjegx92aMDdqoeFcZ/aCN+pp+URzR0IQHokVALcRr6Z+GSggg ++j5x5l+N/KhRz ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.key b/bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.key +new file mode 100644 +index 0000000..d8f68ac +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.key +@@ -0,0 +1,40 @@ ++-----BEGIN PRIVATE KEY----- ++MIIG/wIBADANBgkqhkiG9w0BAQEFAASCBukwggblAgEAAoIBgQDAEScXJTqthaA7 ++WQsiZGN9uwUyNU9o1RkrzUa94rZCjAjPCQ2ozVjZG3fbF4r88FXy4VD0/ZCqSRVd ++6ptaR8QvggdGh/YF7xUCpDyh2vxbdTYS9xJQVfi+DH0hkeKS2EE/cf6yF8BoHQm+ ++/MQk7O/SXFKpT9ZdMLiraC456YtbxvBkQve4vbKQMiJovDhwLxSuyHxjBNURsgrx ++jhMQsjtp9P464vFYViiTwSiqpxnJkRJD+PUdNFg9Mp8RZ9EfU9Tg1Qx4LG84P+GJ ++abUJPBL0qe7lL8VHZaaC+up4SDGJEbYjiiftfB1t6KugKd5A9PKbYSLanCIy9z34 ++TOE4p+LDr6Rnf5Sk/VIliU30mtY1upgg8UvJpc+sclgqzTtKPukEMeKadDLVUmA0 ++rQyFAmVYQXQqV5E0VTapFFtFzCgn1226VaPdnwAEpEPCr1yvhlOm1adJqjHWXpJ9 ++Jt2N9IeKm0joJfTHNMrP4/eEGTtDx2q42m5vha+NDPt86sdznJsCAwEAAQKCAYBv ++D3wTHiv3+rTUnICbuoDtSx+OENWCQPb1JRYq5tWNVXwie5GycktV/1QnFE4CRNbu ++QuuVPqpQTUJVtDtw0N7Yuc+LMUNJ2x3DEUUeMoqKOBS0krm8SnozKvWQW9MwJmxU ++S46DXMida20fSvoAgCGM+mWyEcBa0rl2JB/WzP0QbNDEqRSldsuyJctP1Mat2AuV ++pciHWVv7h4BcfVL47Jb+hfQcCO6Vrfx4s9DYHRgEPibZtzPFV2dOu97PKcD65HXL ++o30hP9xhhy8nT4oFijEQ9rPi0JvOpvB5bJQ42OAznWByR0uL9ZoXopkYDDemzt7t ++D5F9X/2iH9dv3GA0AiPCF6DjyVMwbh/NOt8oxS+NMY2RPlzA+r9SZpCcyPFk1hMi ++LHzrPU8dwC2GmaMKB3Uw/bA5ufw3IpcbJIZEBJQ5Ttf7zEFcfDo/jidTz3ZOptOT ++kSKoCN73AUlmcx8UoKF9JwcpJq63ww8eef+1HLL5Dk0uM4YSKd15gI6477RgfgEC ++gcEA48ZpMdz4mz7rO0CMyPfOLdHOcxHuZI4oJg6gJ1IBxCnIB1mhy6xn+NdkS5Mm ++/1S6eFuo+DgabXO/A2xSDrJ4Lnlf4H4OjQKCeJdO9JglHjdTzv7TB8Vm/IdGC0Jk ++eDRY1lmkSXcdSmGqPVgd2AHpkcTgLyUb+iIWkIspelsaNNQBHJzd4S/x9Pp/ftrg ++CpfwGKsmNia3n3m21lkeTLtKVsPuK8CAJnCDaEI22mhV83x6grPxA0GVFZ0VHfCL ++qZVhAoHBANfd/oVKWGTiJzlc+aHJAb4XRROQzCL4yi6uspT3h9QN5QiFD7PhgIOg ++mES35mpGocN78oc19zhfD4XLNkLbQuMQhpk0D4MjLfUS/IskFoOJWuQbIBPqrMzY ++Z93DDkiBno2As1IN7fZ9amw7Thcf8Qt6yVNFjIMcfk63VmC+AnPUj4KCes7IuGDH ++SA/LjjiKgMa3g3I5/HVB6q1dyZQggBF3dCJ/V8ecgtdibUfzvvViZ52Hd7XDs1SX ++yCas+IE3ewKBwQC/YSFYBRtZjacmFNl1rkitVQCKzMEp+guf1mAYSZ40TQrFqjj4 ++obaGbavWmCCHHpDCufkh/jmuRzdyT9wufyPdoJu/Sws8zaQEYNW1S/S8C66+WHvF ++psYeXiarJTC3kvwlthIErDGPIrpgap5AtXKjyPC4jAySwXuGHXdPWCaPxqXcfa0s ++HRXGSYdAdfUS0ZCpmXw0uZlFRIYsWZrMy/ztJBkE5+yE37p5qlDeeBXnzGo/UaOq ++obr6+w4YJtmiNmECgcEAsSAPqzEgrM7AnpoCn1S+4EpZvL8wMXXw+DMSh5dAVah9 ++COudwdzDxb2tk51OLF/+dderXnTSgOfHZeIjiOI+1PAHcYg9Pj5MhG5q2ITpEE9R ++TCBRxuXlmkPrnhRiEO6CudsjyK1zV7D69QoIfoMQF3pN3c0QibiEj3RyJPlkK8T7 ++aHxF5ozedVKvd35wGUbUebm02rJny5Mly9FMCQZN74cTvQa+cSSkW7UAtGx1gQWY ++vbKdcIC/Eidk7Q867VQnAoHBAKqiugBoItfhuN1GUI5bqIx0ya4DSVECpSFiF8h3 ++eK+bO7uG4OBH+qoAmC8EqQNVPtivxpsA2aBvdoUMTYPu/S5cVFXcMkEJ1jX8L8IZ ++ImE5LXC+SiZO3G9SyHfj+rgwr66G7NWDVJhZ2t/56s4qEdewwR4Vjm99gVvHHAFP ++rrkT9jfHVmozRroL/XAMNITZpJw+vwPMwWOaRncjzyyPp0JWt0h+Wv0+A3SjBIh2 ++c+Ctg5Ig6vwr2weVc7s/4jz9Kg== ++-----END PRIVATE KEY----- +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.pem b/bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.pem +new file mode 100644 +index 0000000..365b493 +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.client02-expired.example.nil.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010843 (0x70b9f4eb2fa1959b) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 7 08:14:18 2022 GMT ++ Not After : Sep 8 08:14:18 2022 GMT ++ Subject: CN=srv01.client02-expired.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:c0:11:27:17:25:3a:ad:85:a0:3b:59:0b:22:64: ++ 63:7d:bb:05:32:35:4f:68:d5:19:2b:cd:46:bd:e2: ++ b6:42:8c:08:cf:09:0d:a8:cd:58:d9:1b:77:db:17: ++ 8a:fc:f0:55:f2:e1:50:f4:fd:90:aa:49:15:5d:ea: ++ 9b:5a:47:c4:2f:82:07:46:87:f6:05:ef:15:02:a4: ++ 3c:a1:da:fc:5b:75:36:12:f7:12:50:55:f8:be:0c: ++ 7d:21:91:e2:92:d8:41:3f:71:fe:b2:17:c0:68:1d: ++ 09:be:fc:c4:24:ec:ef:d2:5c:52:a9:4f:d6:5d:30: ++ b8:ab:68:2e:39:e9:8b:5b:c6:f0:64:42:f7:b8:bd: ++ b2:90:32:22:68:bc:38:70:2f:14:ae:c8:7c:63:04: ++ d5:11:b2:0a:f1:8e:13:10:b2:3b:69:f4:fe:3a:e2: ++ f1:58:56:28:93:c1:28:aa:a7:19:c9:91:12:43:f8: ++ f5:1d:34:58:3d:32:9f:11:67:d1:1f:53:d4:e0:d5: ++ 0c:78:2c:6f:38:3f:e1:89:69:b5:09:3c:12:f4:a9: ++ ee:e5:2f:c5:47:65:a6:82:fa:ea:78:48:31:89:11: ++ b6:23:8a:27:ed:7c:1d:6d:e8:ab:a0:29:de:40:f4: ++ f2:9b:61:22:da:9c:22:32:f7:3d:f8:4c:e1:38:a7: ++ e2:c3:af:a4:67:7f:94:a4:fd:52:25:89:4d:f4:9a: ++ d6:35:ba:98:20:f1:4b:c9:a5:cf:ac:72:58:2a:cd: ++ 3b:4a:3e:e9:04:31:e2:9a:74:32:d5:52:60:34:ad: ++ 0c:85:02:65:58:41:74:2a:57:91:34:55:36:a9:14: ++ 5b:45:cc:28:27:d7:6d:ba:55:a3:dd:9f:00:04:a4: ++ 43:c2:af:5c:af:86:53:a6:d5:a7:49:aa:31:d6:5e: ++ 92:7d:26:dd:8d:f4:87:8a:9b:48:e8:25:f4:c7:34: ++ ca:cf:e3:f7:84:19:3b:43:c7:6a:b8:da:6e:6f:85: ++ af:8d:0c:fb:7c:ea:c7:73:9c:9b ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.client02-expired.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 18:f1:7c:24:5b:d2:03:b0:60:0e:60:e6:32:f9:a7:47:d1:e4: ++ bd:3f:a3:21:53:90:84:9a:c6:2c:87:b2:16:28:95:07:a3:2a: ++ c3:33:8f:60:70:3f:26:58:be:ec:a2:6c:44:89:d3:4e:ef:bb: ++ ce:af:9b:5f:15:06:03:21:74:e3:6f:2a:dc:5c:19:4e:d3:cb: ++ ba:c3:5f:d8:76:89:59:50:82:69:5f:a1:ac:9f:be:79:e1:22: ++ 12:37:f9:d3:2e:00:35:03:03:9d:08:24:45:65:7a:e9:72:31: ++ e1:67:44:32:17:25:dd:b9:72:eb:c6:40:d7:5d:8d:5f:00:48: ++ 07:09:0d:3c:4c:a1:f1:05:4b:05:9b:2b:5a:21:09:46:f4:17: ++ 7a:cf:34:87:ad:bf:ef:bd:56:74:d7:1a:8f:07:ce:70:b1:aa: ++ 4d:82:4f:08:dc:56:27:f9:21:20:b8:06:c7:29:b4:8e:36:82: ++ b8:43:85:1c:2d:9f:be:2d:b9:9d:40:de:52:55:6a:2e:0b:28: ++ 33:fc:f8:1b:70:e9:c5:46:50:f3:05:be:8d:ed:99:ec:f1:8c: ++ 51:8a:1c:4b:95:f4:c4:dd:cd:42:74:bc:6f:66:64:54:b8:c1: ++ 6e:c8:3d:e9:fe:10:02:61:50:77:38:b9:b0:b8:13:37:8f:0e: ++ 5b:49:92:3a:9d:9a:60:51:68:99:8a:d5:7e:92:71:7e:fa:db: ++ 52:37:4d:f9:0d:6c:3b:79:a3:b9:16:b7:95:00:ea:eb:17:54: ++ e2:50:d7:a5:08:54:58:2c:79:66:01:4b:95:65:ed:b8:81:f7: ++ 4c:fa:f8:89:37:ad:d9:dc:c9:75:9d:02:3e:e5:92:b3:03:ab: ++ 70:69:83:f5:6c:a6:27:7e:2e:fc:9d:b2:59:0a:43:ad:3f:55: ++ 2f:5d:ec:ef:52:f0:3e:be:b5:d6:e2:c3:91:9d:dd:5d:e1:9e: ++ e6:18:90:0b:6a:85:f8:e3:83:2a:7c:91:c3:52:1c:6d:aa:2b: ++ 44:b8:6f:2b:af:6e ++-----BEGIN CERTIFICATE----- ++MIIEYzCCAsugAwIBAgIIcLn06y+hlZswDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMB4XDTIyMDkwNzA4MTQxOFoXDTIyMDkwODA4 ++MTQxOFowLTErMCkGA1UEAwwic3J2MDEuY2xpZW50MDItZXhwaXJlZC5leGFtcGxl ++Lm5pbDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAMARJxclOq2FoDtZ ++CyJkY327BTI1T2jVGSvNRr3itkKMCM8JDajNWNkbd9sXivzwVfLhUPT9kKpJFV3q ++m1pHxC+CB0aH9gXvFQKkPKHa/Ft1NhL3ElBV+L4MfSGR4pLYQT9x/rIXwGgdCb78 ++xCTs79JcUqlP1l0wuKtoLjnpi1vG8GRC97i9spAyImi8OHAvFK7IfGME1RGyCvGO ++ExCyO2n0/jri8VhWKJPBKKqnGcmREkP49R00WD0ynxFn0R9T1ODVDHgsbzg/4Ylp ++tQk8EvSp7uUvxUdlpoL66nhIMYkRtiOKJ+18HW3oq6Ap3kD08pthItqcIjL3PfhM ++4Tin4sOvpGd/lKT9UiWJTfSa1jW6mCDxS8mlz6xyWCrNO0o+6QQx4pp0MtVSYDSt ++DIUCZVhBdCpXkTRVNqkUW0XMKCfXbbpVo92fAASkQ8KvXK+GU6bVp0mqMdZekn0m ++3Y30h4qbSOgl9Mc0ys/j94QZO0PHarjabm+Fr40M+3zqx3OcmwIDAQABozcwNTAz ++BgNVHREELDAqgiJzcnYwMS5jbGllbnQwMi1leHBpcmVkLmV4YW1wbGUubmlshwQK ++NQABMA0GCSqGSIb3DQEBCwUAA4IBgQAY8XwkW9IDsGAOYOYy+adH0eS9P6MhU5CE ++msYsh7IWKJUHoyrDM49gcD8mWL7somxEidNO77vOr5tfFQYDIXTjbyrcXBlO08u6 ++w1/YdolZUIJpX6Gsn7554SISN/nTLgA1AwOdCCRFZXrpcjHhZ0QyFyXduXLrxkDX ++XY1fAEgHCQ08TKHxBUsFmytaIQlG9Bd6zzSHrb/vvVZ01xqPB85wsapNgk8I3FYn +++SEguAbHKbSONoK4Q4UcLZ++LbmdQN5SVWouCygz/PgbcOnFRlDzBb6N7Zns8YxR ++ihxLlfTE3c1CdLxvZmRUuMFuyD3p/hACYVB3OLmwuBM3jw5bSZI6nZpgUWiZitV+ ++knF++ttSN035DWw7eaO5FreVAOrrF1TiUNelCFRYLHlmAUuVZe24gfdM+viJN63Z ++3Ml1nQI+5ZKzA6twaYP1bKYnfi78nbJZCkOtP1UvXezvUvA+vrXW4sORnd1d4Z7m ++GJALaoX444MqfJHDUhxtqitEuG8rr24= ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.key b/bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.key +new file mode 100644 +index 0000000..8a1f5dc +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.key +@@ -0,0 +1,40 @@ ++-----BEGIN PRIVATE KEY----- ++MIIG/AIBADANBgkqhkiG9w0BAQEFAASCBuYwggbiAgEAAoIBgQC0mmOYBK29qym/ ++InBUMN/Ha3dduF4LzQ6gbHQ350t40Zbaypl9krHkGgoetBy+7syVjFIDk4XhQENo ++hoa8amJt1grK7k+TLe5r33r23PpEpjmALDh8ic3Zo5ns6CtIbYRBPQ4aH2heF4iP ++pdpNHDYmrrR+0v6iWdVnOlbCIWUN3Zdv8OW0HoeulzUN9Juu3Io+KKq4oqvunbLF ++kfZxmaWGyzGcBdablBNGqZrJpVVfbMzQhCfisbVzOQh/gC8EJpYMjSmbvl7MOa+i ++24KCVwfmskrZPch5bmdh80g3qE+fs8+EtlAIPemF6al2UIDnLG9llcviI0FYOXDn ++eCk9wtYgfCuHML2Yh2PtSq257XpLE6E9Yl62dGTvJaPdk0eq0yV+KtcJG1xZUPHU ++xpzyZIp8y8xSN1CIS4Q1QFEOoQaiYLaw44/52I5Fd30OfRGSIhUPozeExCXcFLQg ++ercWlnLUv01d0qtxQ0S+h0TSuHT3hj/SXd1e5nSr+8yjXaaEgAsCAwEAAQKCAYAG ++wzkzeglfbsdTZuC55lKazwVbNwoeewEvNKBtb3W+AmsZqjhxIUsT9X2nhKsG4z45 ++41U22RFMS/G6Oj9VUs54umkRDDdilXe2Blo+YCvm4iqJCB7dWvOgUKX03wSv45nu ++L3EVvVNVIqB0cItqE8JbVHNhxFjQj3iUMvUIs+Nqz39aK7UON45xFSxhZ2Vk+NEc ++Xr11yHGTr8f/6eVGf7BZCcbDxtwwWy0Vmkg3gL9foV1R+YDc1jarJ9mPnKcmCqPH ++lW5aT5putR0kO1vO6Rh7YfbHsqw334B9v1yjB4TgaJBKVHz5Z8KTvDFHodMtLqCC ++WV61O2h7gh4mQ6lEX5tjArqYdKMuWLAhZ+9AK9sSs4k+/nlvEbqAOCbkx7UmrZoF ++QkYfDt2Gjrk7WLwb9CCFIH0a2EEB2Fms1iHBK++S3iA4w0kfbePP0mo4GTsTwA45 ++DKDbYByzJzVUvGmowMaaypE548sopQ9K4kQJ9okLV+Gc1V7fjklYIIBmwDgqfIEC ++gcEA5Xt0qFjYn4H2gu2xyD0etx83CjKUx0mjwPvdwLg79HMb9P+OTTU+NzsHTa2I ++CTEJ1gA4VkqOtKxEBJQarQmJnVL/fiIp88h9fmLBQ48HLefH33S+bF3VWvKOgJeY ++uVyyWnhTwHNQv3RsO+DEcjqG3aJ2vdzCnDLBr9ATFV8uzpk1Op0h7QljUbhHv1mS ++ip2yQVeuJwtWFixjqEp7BuTluqk/UlGP39PBjgG04Tpw3MkiZNJgk/kSnN+YYOiu ++i91rAoHBAMl4/WAaIL5lHiyakHAmE0fwUm+LUKPG1rF22qvqdBFV6OE14/VgTKNP ++LfcS7Ulzmt7hM7fbcJ0FYxeyPbbQRjBRsGXFzLU96VgoUxoI/IyFXFY83UJ0s63L ++RhZmg4GNvpO0qfOjL4wQtB3N6LPhxpF+pLkkHXSdFkUyocaXGUGOBC+ZEBaCd8Lm ++2GlGoi/f+zSl4xSY4crspS7GNG2+jcXh5K/OMdjEb1/tyRYnHf0D89WNmr10EeYG ++Pe9alaDv4QKBwDROcYa1yZqB6who2W8Ez216BfejE9pg5JxmTGNTGwda/XJYlbzv ++d+Dq6X1BIpLFxLIslqrEj8aKxW4tu+7ZD672bhn3+4v/lOsr41Vc0owaGqrKV2Un ++9iumweh5pWwKvvR0HNLu9ebNyKXVU7GduYPnNh2MpicoQpGqYc8rROX+ce2MR2Fa ++FHNaB7CL4CUMUMcoDyADK3oeYBDJ+UTXA64KSc6fnKWuBJ4zsWDtCzCn/9jvQug3 ++i5CKPpdIMhDbRQKBwEekz61B/UzXVnCUEjLfR1H4osfpqaZjyerXkhE6UUXs3+Be ++Mo8KTJZyTK0kvN62zmbdfG+wCA6+YKuHhayhyaPbGLhIK3Bz8KuZw1tpwK0Tq287 ++O48rQs3VkDndAHysdA3AXAM4j2rmcbZ7h3mYGu2YNGll71eNmOLIi4C8MI4AO3rV ++mkP25zGWt3RQWtJdes4RA3xKlVh86IyGjRRNg8rPdmwSDeXAjL53J1/KTz6vDiFt ++to4SXV8H7zRTaQwO4QKBwBwMU2zjMYXLJq0LAmn3h4h6CVZjPrqzR8PeSd/YM831 ++qdH7OvnkadqIdqMOo6BUA9PvUIY/B5c5zSSOJg9gh1PJ3vDLIZY23zkXigh7poBe ++YW6/PLvGQJ0Rzyz5pf6uPX8AWkAqTyI1Ox3NdxzirarxWDPznvA2KsVxVF/jxnvr ++TD/R5kCQUcxZuInguahGYd1JF3dArYh6NKRPyVO0r73LfVeZ+udlo/+ZMNVGlNNF ++v3Tmy/b2gUdEwuKFCxx97g== ++-----END PRIVATE KEY----- +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.pem b/bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.pem +new file mode 100644 +index 0000000..4a4556c +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.crt01.example.nil.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010840 (0x70b9f4eb2fa19598) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 7 20:28:03 2022 GMT ++ Not After : Aug 30 20:28:03 2052 GMT ++ Subject: CN=srv01.crt01.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:b4:9a:63:98:04:ad:bd:ab:29:bf:22:70:54:30: ++ df:c7:6b:77:5d:b8:5e:0b:cd:0e:a0:6c:74:37:e7: ++ 4b:78:d1:96:da:ca:99:7d:92:b1:e4:1a:0a:1e:b4: ++ 1c:be:ee:cc:95:8c:52:03:93:85:e1:40:43:68:86: ++ 86:bc:6a:62:6d:d6:0a:ca:ee:4f:93:2d:ee:6b:df: ++ 7a:f6:dc:fa:44:a6:39:80:2c:38:7c:89:cd:d9:a3: ++ 99:ec:e8:2b:48:6d:84:41:3d:0e:1a:1f:68:5e:17: ++ 88:8f:a5:da:4d:1c:36:26:ae:b4:7e:d2:fe:a2:59: ++ d5:67:3a:56:c2:21:65:0d:dd:97:6f:f0:e5:b4:1e: ++ 87:ae:97:35:0d:f4:9b:ae:dc:8a:3e:28:aa:b8:a2: ++ ab:ee:9d:b2:c5:91:f6:71:99:a5:86:cb:31:9c:05: ++ d6:9b:94:13:46:a9:9a:c9:a5:55:5f:6c:cc:d0:84: ++ 27:e2:b1:b5:73:39:08:7f:80:2f:04:26:96:0c:8d: ++ 29:9b:be:5e:cc:39:af:a2:db:82:82:57:07:e6:b2: ++ 4a:d9:3d:c8:79:6e:67:61:f3:48:37:a8:4f:9f:b3: ++ cf:84:b6:50:08:3d:e9:85:e9:a9:76:50:80:e7:2c: ++ 6f:65:95:cb:e2:23:41:58:39:70:e7:78:29:3d:c2: ++ d6:20:7c:2b:87:30:bd:98:87:63:ed:4a:ad:b9:ed: ++ 7a:4b:13:a1:3d:62:5e:b6:74:64:ef:25:a3:dd:93: ++ 47:aa:d3:25:7e:2a:d7:09:1b:5c:59:50:f1:d4:c6: ++ 9c:f2:64:8a:7c:cb:cc:52:37:50:88:4b:84:35:40: ++ 51:0e:a1:06:a2:60:b6:b0:e3:8f:f9:d8:8e:45:77: ++ 7d:0e:7d:11:92:22:15:0f:a3:37:84:c4:25:dc:14: ++ b4:20:7a:b7:16:96:72:d4:bf:4d:5d:d2:ab:71:43: ++ 44:be:87:44:d2:b8:74:f7:86:3f:d2:5d:dd:5e:e6: ++ 74:ab:fb:cc:a3:5d:a6:84:80:0b ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.crt01.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 94:15:c0:4a:f1:aa:15:30:f7:cb:fe:f9:fa:ba:5f:f0:18:1f: ++ 7e:44:9a:b1:d4:9c:f9:78:d3:a7:c7:65:f2:d1:48:62:f4:cb: ++ 2f:20:ea:7c:af:08:cf:db:e2:0f:ab:c0:22:38:16:c5:0c:e5: ++ c7:6e:34:b1:ed:f6:02:1a:69:c0:09:d1:43:b3:30:77:fc:00: ++ 07:1b:da:88:97:5b:28:4e:e6:92:ca:00:cc:86:66:a9:a9:0a: ++ 75:be:74:88:7d:09:52:e7:a9:82:8f:a9:62:5e:b3:19:64:14: ++ e5:54:9e:6d:9c:98:39:8b:1f:92:92:59:f9:a2:46:75:96:11: ++ 71:8a:c8:71:05:10:2a:b8:f3:a4:19:db:eb:05:17:0a:dd:98: ++ 2c:58:54:3a:7f:8c:c2:26:9e:62:ca:04:dd:3c:99:1f:a0:64: ++ 69:fb:d6:04:c1:0b:8c:62:f6:2d:ea:bc:6c:a9:39:7b:f1:20: ++ b8:b7:04:3c:a7:65:fa:1f:db:22:e2:5b:8b:91:75:60:be:e1: ++ 1e:50:13:23:d5:4b:93:87:20:ec:46:6f:5f:94:dc:b1:60:d1: ++ 79:4b:5e:76:c9:6d:0d:be:a6:9a:6b:67:8b:a7:48:7e:51:b5: ++ 9b:9d:ec:a6:0c:c1:b3:d9:0b:26:8b:f2:7c:cf:61:d0:a2:a0: ++ 90:90:18:6b:b4:ca:56:b8:5e:5a:8b:78:71:c4:d1:fc:15:30: ++ 0a:03:26:74:85:3d:6c:ed:d3:e1:c9:c1:b0:d4:0c:b9:f3:04: ++ 93:0d:e3:a6:2c:a7:ee:e0:24:0d:dd:37:fc:6b:09:d5:b5:55: ++ 33:12:82:cf:f2:ba:0f:b0:e2:ce:f7:c0:ac:2c:7f:ab:f9:dd: ++ 87:b1:9b:95:f2:d7:32:98:dd:4c:b3:28:b7:0d:2b:2f:62:65: ++ ce:59:fb:95:d4:5f:9d:fd:83:5a:01:3b:5f:48:5f:3c:fa:4b: ++ 52:91:66:e1:49:8e:cd:09:78:f5:ce:f8:cd:5c:85:3e:ad:bd: ++ 1c:4e:e0:3f:0a:8b ++-----BEGIN CERTIFICATE----- ++MIIETzCCAregAwIBAgIIcLn06y+hlZgwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMCAXDTIyMDkwNzIwMjgwM1oYDzIwNTIwODMw ++MjAyODAzWjAiMSAwHgYDVQQDDBdzcnYwMS5jcnQwMS5leGFtcGxlLm5pbDCCAaIw ++DQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALSaY5gErb2rKb8icFQw38drd124 ++XgvNDqBsdDfnS3jRltrKmX2SseQaCh60HL7uzJWMUgOTheFAQ2iGhrxqYm3WCsru ++T5Mt7mvfevbc+kSmOYAsOHyJzdmjmezoK0hthEE9DhofaF4XiI+l2k0cNiautH7S ++/qJZ1Wc6VsIhZQ3dl2/w5bQeh66XNQ30m67cij4oqriiq+6dssWR9nGZpYbLMZwF ++1puUE0apmsmlVV9szNCEJ+KxtXM5CH+ALwQmlgyNKZu+Xsw5r6LbgoJXB+ayStk9 ++yHluZ2HzSDeoT5+zz4S2UAg96YXpqXZQgOcsb2WVy+IjQVg5cOd4KT3C1iB8K4cw ++vZiHY+1KrbnteksToT1iXrZ0ZO8lo92TR6rTJX4q1wkbXFlQ8dTGnPJkinzLzFI3 ++UIhLhDVAUQ6hBqJgtrDjj/nYjkV3fQ59EZIiFQ+jN4TEJdwUtCB6txaWctS/TV3S ++q3FDRL6HRNK4dPeGP9Jd3V7mdKv7zKNdpoSACwIDAQABoywwKjAoBgNVHREEITAf ++ghdzcnYwMS5jcnQwMS5leGFtcGxlLm5pbIcECjUAATANBgkqhkiG9w0BAQsFAAOC ++AYEAlBXASvGqFTD3y/75+rpf8BgffkSasdSc+XjTp8dl8tFIYvTLLyDqfK8Iz9vi ++D6vAIjgWxQzlx240se32AhppwAnRQ7Mwd/wABxvaiJdbKE7mksoAzIZmqakKdb50 ++iH0JUuepgo+pYl6zGWQU5VSebZyYOYsfkpJZ+aJGdZYRcYrIcQUQKrjzpBnb6wUX ++Ct2YLFhUOn+MwiaeYsoE3TyZH6BkafvWBMELjGL2Leq8bKk5e/EguLcEPKdl+h/b ++IuJbi5F1YL7hHlATI9VLk4cg7EZvX5TcsWDReUtedsltDb6mmmtni6dIflG1m53s ++pgzBs9kLJovyfM9h0KKgkJAYa7TKVrheWot4ccTR/BUwCgMmdIU9bO3T4cnBsNQM ++ufMEkw3jpiyn7uAkDd03/GsJ1bVVMxKCz/K6D7DizvfArCx/q/ndh7GblfLXMpjd ++TLMotw0rL2Jlzln7ldRfnf2DWgE7X0hfPPpLUpFm4UmOzQl49c74zVyFPq29HE7g ++PwqL ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.key b/bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.key +new file mode 100644 +index 0000000..307d26d +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.key +@@ -0,0 +1,40 @@ ++-----BEGIN PRIVATE KEY----- ++MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQDsLIgBtYs6dFYN ++V7N1/QVYBe2Kq+gpDvFSNC4iYm5BdP94M7T/FXP6zpAQpP7SZhR7C3l71iCI+UEx ++FJpJNow4dEvz4lHn5W+9ZTjmnDCAPyRW9mieCXaBW1mBRFafHD9I8JW/YEAp36xC ++PcNvhS3DDgi29xIqUQC/z/5srtd93sFy+DIDX8k/St7l+iSQRvBKXwnYk0y/HGFM ++0tzbbPivc1u3O3robRy7JiNHh/1QBg/xtYiKqCVpV+NGO9JrUvtaAfaW6SrPE+cW ++TP1a9h8Ljfclo2jXFfxcSEkF4oUkcFex2AUkriY6AJtyqEcFxfN8LfJYcjf7wYtP ++Qo/dmqxbrm8hYq0pgbmLS2z/YZkPfAnTbQAgLbEMAGyZTJLcDhEt57p7x8ixoxph +++Mwsrxe228w2Av77ZhV3hHDNQiW3FmQorp2MgYWg4FCCqujprFH8K2NEsQi4kNeM ++HCOyGwhZhdXdOUT3R15ICDTrLN91Rwi2tuYy7XZ0d849Tf4CsTMCAwEAAQKCAYA+ ++B7AtKr6HutiDJp63BZ6qsNvkCSSv7AHMAnJ/i3TD8nPK4WHPgZX1sN070eov3qnQ ++a4Ib2XCwKS9LMcsYIaCQj1MHmlDC5IsFpplcUHeYp3zm7k8p+vhKH3ERt548qhGh ++GbdrDV+s39eBinFTUBpl2cDGNXxq6t2Ug4+iggWNRL1wcenI4xabbhG/O4Tw9ADW ++t8GBRabppw2TPOrPIv7qLhVPueqdM1NRgEHR3tDUfNMhO/nB2UoCMhg6cSniEGf8 ++32NDQHI7ajIcETnn9z0tAP67+w5VUYMlP3+VGr8v4UZCL6Qal9Swv4XWPqHjHoIi ++q5by4H6HEYeoUPT5hCJjMdXlHrWWUgsX/YdgY4tJJBowMR6rovA7Ypy71FxRnXkP ++2iD36jZmDI1mBQ41Yx7P5iM+veRQmBOH/x70Bd9ZbSLlmeTX5dhjAxNShjZxxeUy ++QbQGe3JLzdCGzRY9TKFMmLa/qs+Ggqxopdh4AZuHtQpKUej6g9GI9Eo0IIWTKEkC ++gcEA+EC1ms0MEIIq/JJrsN4ByEyZXbuNKny/04h8dfkT0lTXk8QihQLke6ZLLOl9 ++mwgO9NOHkghtU9wdNXg/dNR2VDevUZCjIlYZT6stjEX7X0oNACJwSeBwEXxn6I94 ++umuvJ9hq9WchTnQA4lrIXCETIUxThjm7jfJe9RKzghQkCfGnxzclXg0viqxvm21j ++eg0iide23y9xpFd8Qn1oq+hhzcKqHWdkHuDjRJD5gfAEPD7MJ7oT5jR4szQoIUcP ++4C+NAoHBAPOLUwAwcY5zUBAZ7oZ8wRgnAFZjHdYYWDr04ahA1DpwPeX67MczdGud ++L7hUq3APa3qcj4hrDL2jkF6FkbURhtdguMccb4hBENyYr+qjoTAfYJIZwJ9akQ/j ++x8u+5kGsN+ozaKikHFsI2xXHJhbShICL3sIfNeqGFB2onp/dv8WdywTnSf2aXGjf ++NFvVJYnaEOGiTM7uIf/F0n8Iae8HSdPZXtDTXNjnLFzzHjvFe1mfyYO55BDkxmr2 ++PDnhVkbTvwKBwQCNPwQU16WNnwImQojTUP1ioXKBSjy/d8sM6BMobFdCzNL7WBTr ++6QFm+O681vyIQMWBtvjjtbe+hvZ3fbtdFaVdtXEiz1CCMMql8ZcwwICNbuyGrxGE ++dxZMXKQiRb9DEhHOcewpRExG/umh4FUvVgI0Z+D99csosEYm2kUYNa1rmvsC9fVk ++1cu+8u1tWYfH4cFM/FcoFS5revtQOVpctRMwpxlzMWhdyUaFtJbBv3YpcPFniQ/Z ++YvFpxLswc+Ysf+ECgcEAhEeMUXH+e6zOM7CiCZIBHykv2bwEHKEkawFO/6AWpZcJ ++R7y+loOwHDNIFAqJA1icvAAFRcc/KFGKvIw30+0tHBaAxkT/nzYX/nlAM2Wkywp/ ++3Vr3cJY0bDj/7/5D+i+cPyylD9PzQs7QkEeWvJajOV6/Ixjoo/UnP+SyI4rB+of2 ++GTe2zHPm9V8mhSqENReoS6Vnqo1VEiNUbYMYZqfCxbou8aWbrIQDaIj0RurAULGl ++NlLlOPfJfZc4pwdpYRbpAoHAJ7Vxdfn1ec+8xIpjn6dQzWDQWrOw+4pyi54sPlVb ++RUWC9nYDbTwEKkWdQ0FdyJkU7tiYIIFlVNfPAa1lkujIiC5zxe41VJ1598pXPEXn ++a6UB1yn2Ay7kmCq7/qOD6IRkAS8TKyzM6Z7nFgglMEPPdzYBkeKP/aWl75el1B4e ++mpGz7o6u6kSHXt0UWZ7VT9AspEw0oyHIoaXmYHvpXjGtWghn6MKPMngKIb87Xjvt ++bKvcUjDKJOb0BURXpKzS8Rf9 ++-----END PRIVATE KEY----- +diff --git a/bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.pem b/bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.pem +new file mode 100644 +index 0000000..3fa0b9a +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/certs/srv01.crt02-expired.example.nil.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010841 (0x70b9f4eb2fa19599) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 6 20:34:09 2022 GMT ++ Not After : Sep 7 20:34:09 2022 GMT ++ Subject: CN=srv01.crt02-expired.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:ec:2c:88:01:b5:8b:3a:74:56:0d:57:b3:75:fd: ++ 05:58:05:ed:8a:ab:e8:29:0e:f1:52:34:2e:22:62: ++ 6e:41:74:ff:78:33:b4:ff:15:73:fa:ce:90:10:a4: ++ fe:d2:66:14:7b:0b:79:7b:d6:20:88:f9:41:31:14: ++ 9a:49:36:8c:38:74:4b:f3:e2:51:e7:e5:6f:bd:65: ++ 38:e6:9c:30:80:3f:24:56:f6:68:9e:09:76:81:5b: ++ 59:81:44:56:9f:1c:3f:48:f0:95:bf:60:40:29:df: ++ ac:42:3d:c3:6f:85:2d:c3:0e:08:b6:f7:12:2a:51: ++ 00:bf:cf:fe:6c:ae:d7:7d:de:c1:72:f8:32:03:5f: ++ c9:3f:4a:de:e5:fa:24:90:46:f0:4a:5f:09:d8:93: ++ 4c:bf:1c:61:4c:d2:dc:db:6c:f8:af:73:5b:b7:3b: ++ 7a:e8:6d:1c:bb:26:23:47:87:fd:50:06:0f:f1:b5: ++ 88:8a:a8:25:69:57:e3:46:3b:d2:6b:52:fb:5a:01: ++ f6:96:e9:2a:cf:13:e7:16:4c:fd:5a:f6:1f:0b:8d: ++ f7:25:a3:68:d7:15:fc:5c:48:49:05:e2:85:24:70: ++ 57:b1:d8:05:24:ae:26:3a:00:9b:72:a8:47:05:c5: ++ f3:7c:2d:f2:58:72:37:fb:c1:8b:4f:42:8f:dd:9a: ++ ac:5b:ae:6f:21:62:ad:29:81:b9:8b:4b:6c:ff:61: ++ 99:0f:7c:09:d3:6d:00:20:2d:b1:0c:00:6c:99:4c: ++ 92:dc:0e:11:2d:e7:ba:7b:c7:c8:b1:a3:1a:61:f8: ++ cc:2c:af:17:b6:db:cc:36:02:fe:fb:66:15:77:84: ++ 70:cd:42:25:b7:16:64:28:ae:9d:8c:81:85:a0:e0: ++ 50:82:aa:e8:e9:ac:51:fc:2b:63:44:b1:08:b8:90: ++ d7:8c:1c:23:b2:1b:08:59:85:d5:dd:39:44:f7:47: ++ 5e:48:08:34:eb:2c:df:75:47:08:b6:b6:e6:32:ed: ++ 76:74:77:ce:3d:4d:fe:02:b1:33 ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.crt02-expired.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 2a:52:c4:cb:a9:2f:f7:2b:ed:04:b5:03:d5:06:59:ed:5c:7c: ++ b7:00:9e:c4:33:90:fe:d0:b0:18:f3:f2:06:30:54:18:fe:34: ++ cb:ea:61:4f:9c:23:67:3c:ae:ed:20:df:82:52:ec:59:88:45: ++ ad:3c:6c:a7:34:24:1c:4d:66:ab:71:3d:59:8c:ef:cd:a0:e2: ++ 7b:59:2d:43:94:cd:f5:0a:3c:4e:81:24:e8:fd:c6:d0:fd:ad: ++ 6f:cc:29:5b:67:0b:b7:ee:43:38:a4:91:c2:d9:3b:f8:d6:97: ++ bc:92:dd:ec:a1:ab:85:35:44:f4:0a:df:ad:8d:8c:52:c3:49: ++ 7e:39:10:a1:13:43:78:71:e2:92:aa:31:3d:d9:94:15:7f:86: ++ c8:aa:b4:a1:6d:bf:eb:55:b1:d7:41:6f:c3:7d:88:5e:9c:b7: ++ b1:4b:0d:a7:17:4f:3e:4a:46:3f:6f:48:27:8c:d0:e5:51:fc: ++ 42:ba:c5:b9:4f:63:6f:2e:f2:fd:0c:c0:6e:23:b4:59:93:68: ++ a4:2d:16:ce:f4:7b:3a:45:1d:a0:6e:98:0b:f7:6a:e6:75:0c: ++ db:56:19:6b:88:f0:7f:6b:08:f8:fc:bb:d1:3f:25:25:1a:6c: ++ 8e:34:cb:91:18:54:d5:2d:ce:9c:d0:b7:c3:bc:b5:0a:e0:b9: ++ 73:6f:4d:ad:6b:3c:b6:49:ef:c0:10:13:c7:0a:78:4d:98:7d: ++ cb:84:a1:29:40:8c:dd:31:7d:ae:c4:f5:25:5d:b9:74:b2:f5: ++ e2:2b:e0:43:c8:50:61:a3:a8:26:1a:03:ab:1a:24:3b:13:56: ++ da:0d:ee:ff:2f:bd:d5:77:82:72:63:b8:aa:e1:18:f7:3b:c1: ++ a1:f8:51:b1:70:b9:25:39:df:a3:41:79:d7:2b:ec:32:f6:cb: ++ 30:28:d2:1e:f1:b4:e1:80:03:9f:c2:0f:36:85:82:5e:39:ba: ++ 9e:eb:67:76:42:93:bf:e0:df:64:b2:b5:5f:98:a1:45:3f:4a: ++ 1f:5c:c5:04:10:f6 ++-----BEGIN CERTIFICATE----- ++MIIEXTCCAsWgAwIBAgIIcLn06y+hlZkwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMB4XDTIyMDkwNjIwMzQwOVoXDTIyMDkwNzIw ++MzQwOVowKjEoMCYGA1UEAwwfc3J2MDEuY3J0MDItZXhwaXJlZC5leGFtcGxlLm5p ++bDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAOwsiAG1izp0Vg1Xs3X9 ++BVgF7Yqr6CkO8VI0LiJibkF0/3gztP8Vc/rOkBCk/tJmFHsLeXvWIIj5QTEUmkk2 ++jDh0S/PiUeflb71lOOacMIA/JFb2aJ4JdoFbWYFEVp8cP0jwlb9gQCnfrEI9w2+F ++LcMOCLb3EipRAL/P/myu133ewXL4MgNfyT9K3uX6JJBG8EpfCdiTTL8cYUzS3Nts +++K9zW7c7euhtHLsmI0eH/VAGD/G1iIqoJWlX40Y70mtS+1oB9pbpKs8T5xZM/Vr2 ++HwuN9yWjaNcV/FxISQXihSRwV7HYBSSuJjoAm3KoRwXF83wt8lhyN/vBi09Cj92a ++rFuubyFirSmBuYtLbP9hmQ98CdNtACAtsQwAbJlMktwOES3nunvHyLGjGmH4zCyv ++F7bbzDYC/vtmFXeEcM1CJbcWZCiunYyBhaDgUIKq6OmsUfwrY0SxCLiQ14wcI7Ib ++CFmF1d05RPdHXkgINOss33VHCLa25jLtdnR3zj1N/gKxMwIDAQABozQwMjAwBgNV ++HREEKTAngh9zcnYwMS5jcnQwMi1leHBpcmVkLmV4YW1wbGUubmlshwQKNQABMA0G ++CSqGSIb3DQEBCwUAA4IBgQAqUsTLqS/3K+0EtQPVBlntXHy3AJ7EM5D+0LAY8/IG ++MFQY/jTL6mFPnCNnPK7tIN+CUuxZiEWtPGynNCQcTWarcT1ZjO/NoOJ7WS1DlM31 ++CjxOgSTo/cbQ/a1vzClbZwu37kM4pJHC2Tv41pe8kt3soauFNUT0Ct+tjYxSw0l+ ++ORChE0N4ceKSqjE92ZQVf4bIqrShbb/rVbHXQW/DfYhenLexSw2nF08+SkY/b0gn ++jNDlUfxCusW5T2NvLvL9DMBuI7RZk2ikLRbO9Hs6RR2gbpgL92rmdQzbVhlriPB/ ++awj4/LvRPyUlGmyONMuRGFTVLc6c0LfDvLUK4Llzb02tazy2Se/AEBPHCnhNmH3L ++hKEpQIzdMX2uxPUlXbl0svXiK+BDyFBho6gmGgOrGiQ7E1baDe7/L73Vd4JyY7iq ++4Rj3O8Gh+FGxcLklOd+jQXnXK+wy9sswKNIe8bThgAOfwg82hYJeObqe62d2QpO/ ++4N9ksrVfmKFFP0ofXMUEEPY= ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/index.txt b/bin/tests/system/nsupdate/CA/index.txt +new file mode 100644 +index 0000000..020155f +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/index.txt +@@ -0,0 +1,4 @@ ++V 20520830202803Z 70B9F4EB2FA19598 unknown /CN=srv01.crt01.example.nil ++V 220907203409Z 70B9F4EB2FA19599 unknown /CN=srv01.crt02-expired.example.nil ++V 20520831082017Z 70B9F4EB2FA1959A unknown /CN=srv01.client01.example.nil ++V 220908081418Z 70B9F4EB2FA1959B unknown /CN=srv01.client02-expired.example.nil +diff --git a/bin/tests/system/nsupdate/CA/index.txt.attr b/bin/tests/system/nsupdate/CA/index.txt.attr +new file mode 100644 +index 0000000..8f7e63a +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/index.txt.attr +@@ -0,0 +1 @@ ++unique_subject = yes +diff --git a/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19598.pem b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19598.pem +new file mode 100644 +index 0000000..4a4556c +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19598.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010840 (0x70b9f4eb2fa19598) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 7 20:28:03 2022 GMT ++ Not After : Aug 30 20:28:03 2052 GMT ++ Subject: CN=srv01.crt01.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:b4:9a:63:98:04:ad:bd:ab:29:bf:22:70:54:30: ++ df:c7:6b:77:5d:b8:5e:0b:cd:0e:a0:6c:74:37:e7: ++ 4b:78:d1:96:da:ca:99:7d:92:b1:e4:1a:0a:1e:b4: ++ 1c:be:ee:cc:95:8c:52:03:93:85:e1:40:43:68:86: ++ 86:bc:6a:62:6d:d6:0a:ca:ee:4f:93:2d:ee:6b:df: ++ 7a:f6:dc:fa:44:a6:39:80:2c:38:7c:89:cd:d9:a3: ++ 99:ec:e8:2b:48:6d:84:41:3d:0e:1a:1f:68:5e:17: ++ 88:8f:a5:da:4d:1c:36:26:ae:b4:7e:d2:fe:a2:59: ++ d5:67:3a:56:c2:21:65:0d:dd:97:6f:f0:e5:b4:1e: ++ 87:ae:97:35:0d:f4:9b:ae:dc:8a:3e:28:aa:b8:a2: ++ ab:ee:9d:b2:c5:91:f6:71:99:a5:86:cb:31:9c:05: ++ d6:9b:94:13:46:a9:9a:c9:a5:55:5f:6c:cc:d0:84: ++ 27:e2:b1:b5:73:39:08:7f:80:2f:04:26:96:0c:8d: ++ 29:9b:be:5e:cc:39:af:a2:db:82:82:57:07:e6:b2: ++ 4a:d9:3d:c8:79:6e:67:61:f3:48:37:a8:4f:9f:b3: ++ cf:84:b6:50:08:3d:e9:85:e9:a9:76:50:80:e7:2c: ++ 6f:65:95:cb:e2:23:41:58:39:70:e7:78:29:3d:c2: ++ d6:20:7c:2b:87:30:bd:98:87:63:ed:4a:ad:b9:ed: ++ 7a:4b:13:a1:3d:62:5e:b6:74:64:ef:25:a3:dd:93: ++ 47:aa:d3:25:7e:2a:d7:09:1b:5c:59:50:f1:d4:c6: ++ 9c:f2:64:8a:7c:cb:cc:52:37:50:88:4b:84:35:40: ++ 51:0e:a1:06:a2:60:b6:b0:e3:8f:f9:d8:8e:45:77: ++ 7d:0e:7d:11:92:22:15:0f:a3:37:84:c4:25:dc:14: ++ b4:20:7a:b7:16:96:72:d4:bf:4d:5d:d2:ab:71:43: ++ 44:be:87:44:d2:b8:74:f7:86:3f:d2:5d:dd:5e:e6: ++ 74:ab:fb:cc:a3:5d:a6:84:80:0b ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.crt01.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 94:15:c0:4a:f1:aa:15:30:f7:cb:fe:f9:fa:ba:5f:f0:18:1f: ++ 7e:44:9a:b1:d4:9c:f9:78:d3:a7:c7:65:f2:d1:48:62:f4:cb: ++ 2f:20:ea:7c:af:08:cf:db:e2:0f:ab:c0:22:38:16:c5:0c:e5: ++ c7:6e:34:b1:ed:f6:02:1a:69:c0:09:d1:43:b3:30:77:fc:00: ++ 07:1b:da:88:97:5b:28:4e:e6:92:ca:00:cc:86:66:a9:a9:0a: ++ 75:be:74:88:7d:09:52:e7:a9:82:8f:a9:62:5e:b3:19:64:14: ++ e5:54:9e:6d:9c:98:39:8b:1f:92:92:59:f9:a2:46:75:96:11: ++ 71:8a:c8:71:05:10:2a:b8:f3:a4:19:db:eb:05:17:0a:dd:98: ++ 2c:58:54:3a:7f:8c:c2:26:9e:62:ca:04:dd:3c:99:1f:a0:64: ++ 69:fb:d6:04:c1:0b:8c:62:f6:2d:ea:bc:6c:a9:39:7b:f1:20: ++ b8:b7:04:3c:a7:65:fa:1f:db:22:e2:5b:8b:91:75:60:be:e1: ++ 1e:50:13:23:d5:4b:93:87:20:ec:46:6f:5f:94:dc:b1:60:d1: ++ 79:4b:5e:76:c9:6d:0d:be:a6:9a:6b:67:8b:a7:48:7e:51:b5: ++ 9b:9d:ec:a6:0c:c1:b3:d9:0b:26:8b:f2:7c:cf:61:d0:a2:a0: ++ 90:90:18:6b:b4:ca:56:b8:5e:5a:8b:78:71:c4:d1:fc:15:30: ++ 0a:03:26:74:85:3d:6c:ed:d3:e1:c9:c1:b0:d4:0c:b9:f3:04: ++ 93:0d:e3:a6:2c:a7:ee:e0:24:0d:dd:37:fc:6b:09:d5:b5:55: ++ 33:12:82:cf:f2:ba:0f:b0:e2:ce:f7:c0:ac:2c:7f:ab:f9:dd: ++ 87:b1:9b:95:f2:d7:32:98:dd:4c:b3:28:b7:0d:2b:2f:62:65: ++ ce:59:fb:95:d4:5f:9d:fd:83:5a:01:3b:5f:48:5f:3c:fa:4b: ++ 52:91:66:e1:49:8e:cd:09:78:f5:ce:f8:cd:5c:85:3e:ad:bd: ++ 1c:4e:e0:3f:0a:8b ++-----BEGIN CERTIFICATE----- ++MIIETzCCAregAwIBAgIIcLn06y+hlZgwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMCAXDTIyMDkwNzIwMjgwM1oYDzIwNTIwODMw ++MjAyODAzWjAiMSAwHgYDVQQDDBdzcnYwMS5jcnQwMS5leGFtcGxlLm5pbDCCAaIw ++DQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALSaY5gErb2rKb8icFQw38drd124 ++XgvNDqBsdDfnS3jRltrKmX2SseQaCh60HL7uzJWMUgOTheFAQ2iGhrxqYm3WCsru ++T5Mt7mvfevbc+kSmOYAsOHyJzdmjmezoK0hthEE9DhofaF4XiI+l2k0cNiautH7S ++/qJZ1Wc6VsIhZQ3dl2/w5bQeh66XNQ30m67cij4oqriiq+6dssWR9nGZpYbLMZwF ++1puUE0apmsmlVV9szNCEJ+KxtXM5CH+ALwQmlgyNKZu+Xsw5r6LbgoJXB+ayStk9 ++yHluZ2HzSDeoT5+zz4S2UAg96YXpqXZQgOcsb2WVy+IjQVg5cOd4KT3C1iB8K4cw ++vZiHY+1KrbnteksToT1iXrZ0ZO8lo92TR6rTJX4q1wkbXFlQ8dTGnPJkinzLzFI3 ++UIhLhDVAUQ6hBqJgtrDjj/nYjkV3fQ59EZIiFQ+jN4TEJdwUtCB6txaWctS/TV3S ++q3FDRL6HRNK4dPeGP9Jd3V7mdKv7zKNdpoSACwIDAQABoywwKjAoBgNVHREEITAf ++ghdzcnYwMS5jcnQwMS5leGFtcGxlLm5pbIcECjUAATANBgkqhkiG9w0BAQsFAAOC ++AYEAlBXASvGqFTD3y/75+rpf8BgffkSasdSc+XjTp8dl8tFIYvTLLyDqfK8Iz9vi ++D6vAIjgWxQzlx240se32AhppwAnRQ7Mwd/wABxvaiJdbKE7mksoAzIZmqakKdb50 ++iH0JUuepgo+pYl6zGWQU5VSebZyYOYsfkpJZ+aJGdZYRcYrIcQUQKrjzpBnb6wUX ++Ct2YLFhUOn+MwiaeYsoE3TyZH6BkafvWBMELjGL2Leq8bKk5e/EguLcEPKdl+h/b ++IuJbi5F1YL7hHlATI9VLk4cg7EZvX5TcsWDReUtedsltDb6mmmtni6dIflG1m53s ++pgzBs9kLJovyfM9h0KKgkJAYa7TKVrheWot4ccTR/BUwCgMmdIU9bO3T4cnBsNQM ++ufMEkw3jpiyn7uAkDd03/GsJ1bVVMxKCz/K6D7DizvfArCx/q/ndh7GblfLXMpjd ++TLMotw0rL2Jlzln7ldRfnf2DWgE7X0hfPPpLUpFm4UmOzQl49c74zVyFPq29HE7g ++PwqL ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19599.pem b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19599.pem +new file mode 100644 +index 0000000..3fa0b9a +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA19599.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010841 (0x70b9f4eb2fa19599) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 6 20:34:09 2022 GMT ++ Not After : Sep 7 20:34:09 2022 GMT ++ Subject: CN=srv01.crt02-expired.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:ec:2c:88:01:b5:8b:3a:74:56:0d:57:b3:75:fd: ++ 05:58:05:ed:8a:ab:e8:29:0e:f1:52:34:2e:22:62: ++ 6e:41:74:ff:78:33:b4:ff:15:73:fa:ce:90:10:a4: ++ fe:d2:66:14:7b:0b:79:7b:d6:20:88:f9:41:31:14: ++ 9a:49:36:8c:38:74:4b:f3:e2:51:e7:e5:6f:bd:65: ++ 38:e6:9c:30:80:3f:24:56:f6:68:9e:09:76:81:5b: ++ 59:81:44:56:9f:1c:3f:48:f0:95:bf:60:40:29:df: ++ ac:42:3d:c3:6f:85:2d:c3:0e:08:b6:f7:12:2a:51: ++ 00:bf:cf:fe:6c:ae:d7:7d:de:c1:72:f8:32:03:5f: ++ c9:3f:4a:de:e5:fa:24:90:46:f0:4a:5f:09:d8:93: ++ 4c:bf:1c:61:4c:d2:dc:db:6c:f8:af:73:5b:b7:3b: ++ 7a:e8:6d:1c:bb:26:23:47:87:fd:50:06:0f:f1:b5: ++ 88:8a:a8:25:69:57:e3:46:3b:d2:6b:52:fb:5a:01: ++ f6:96:e9:2a:cf:13:e7:16:4c:fd:5a:f6:1f:0b:8d: ++ f7:25:a3:68:d7:15:fc:5c:48:49:05:e2:85:24:70: ++ 57:b1:d8:05:24:ae:26:3a:00:9b:72:a8:47:05:c5: ++ f3:7c:2d:f2:58:72:37:fb:c1:8b:4f:42:8f:dd:9a: ++ ac:5b:ae:6f:21:62:ad:29:81:b9:8b:4b:6c:ff:61: ++ 99:0f:7c:09:d3:6d:00:20:2d:b1:0c:00:6c:99:4c: ++ 92:dc:0e:11:2d:e7:ba:7b:c7:c8:b1:a3:1a:61:f8: ++ cc:2c:af:17:b6:db:cc:36:02:fe:fb:66:15:77:84: ++ 70:cd:42:25:b7:16:64:28:ae:9d:8c:81:85:a0:e0: ++ 50:82:aa:e8:e9:ac:51:fc:2b:63:44:b1:08:b8:90: ++ d7:8c:1c:23:b2:1b:08:59:85:d5:dd:39:44:f7:47: ++ 5e:48:08:34:eb:2c:df:75:47:08:b6:b6:e6:32:ed: ++ 76:74:77:ce:3d:4d:fe:02:b1:33 ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.crt02-expired.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 2a:52:c4:cb:a9:2f:f7:2b:ed:04:b5:03:d5:06:59:ed:5c:7c: ++ b7:00:9e:c4:33:90:fe:d0:b0:18:f3:f2:06:30:54:18:fe:34: ++ cb:ea:61:4f:9c:23:67:3c:ae:ed:20:df:82:52:ec:59:88:45: ++ ad:3c:6c:a7:34:24:1c:4d:66:ab:71:3d:59:8c:ef:cd:a0:e2: ++ 7b:59:2d:43:94:cd:f5:0a:3c:4e:81:24:e8:fd:c6:d0:fd:ad: ++ 6f:cc:29:5b:67:0b:b7:ee:43:38:a4:91:c2:d9:3b:f8:d6:97: ++ bc:92:dd:ec:a1:ab:85:35:44:f4:0a:df:ad:8d:8c:52:c3:49: ++ 7e:39:10:a1:13:43:78:71:e2:92:aa:31:3d:d9:94:15:7f:86: ++ c8:aa:b4:a1:6d:bf:eb:55:b1:d7:41:6f:c3:7d:88:5e:9c:b7: ++ b1:4b:0d:a7:17:4f:3e:4a:46:3f:6f:48:27:8c:d0:e5:51:fc: ++ 42:ba:c5:b9:4f:63:6f:2e:f2:fd:0c:c0:6e:23:b4:59:93:68: ++ a4:2d:16:ce:f4:7b:3a:45:1d:a0:6e:98:0b:f7:6a:e6:75:0c: ++ db:56:19:6b:88:f0:7f:6b:08:f8:fc:bb:d1:3f:25:25:1a:6c: ++ 8e:34:cb:91:18:54:d5:2d:ce:9c:d0:b7:c3:bc:b5:0a:e0:b9: ++ 73:6f:4d:ad:6b:3c:b6:49:ef:c0:10:13:c7:0a:78:4d:98:7d: ++ cb:84:a1:29:40:8c:dd:31:7d:ae:c4:f5:25:5d:b9:74:b2:f5: ++ e2:2b:e0:43:c8:50:61:a3:a8:26:1a:03:ab:1a:24:3b:13:56: ++ da:0d:ee:ff:2f:bd:d5:77:82:72:63:b8:aa:e1:18:f7:3b:c1: ++ a1:f8:51:b1:70:b9:25:39:df:a3:41:79:d7:2b:ec:32:f6:cb: ++ 30:28:d2:1e:f1:b4:e1:80:03:9f:c2:0f:36:85:82:5e:39:ba: ++ 9e:eb:67:76:42:93:bf:e0:df:64:b2:b5:5f:98:a1:45:3f:4a: ++ 1f:5c:c5:04:10:f6 ++-----BEGIN CERTIFICATE----- ++MIIEXTCCAsWgAwIBAgIIcLn06y+hlZkwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMB4XDTIyMDkwNjIwMzQwOVoXDTIyMDkwNzIw ++MzQwOVowKjEoMCYGA1UEAwwfc3J2MDEuY3J0MDItZXhwaXJlZC5leGFtcGxlLm5p ++bDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAOwsiAG1izp0Vg1Xs3X9 ++BVgF7Yqr6CkO8VI0LiJibkF0/3gztP8Vc/rOkBCk/tJmFHsLeXvWIIj5QTEUmkk2 ++jDh0S/PiUeflb71lOOacMIA/JFb2aJ4JdoFbWYFEVp8cP0jwlb9gQCnfrEI9w2+F ++LcMOCLb3EipRAL/P/myu133ewXL4MgNfyT9K3uX6JJBG8EpfCdiTTL8cYUzS3Nts +++K9zW7c7euhtHLsmI0eH/VAGD/G1iIqoJWlX40Y70mtS+1oB9pbpKs8T5xZM/Vr2 ++HwuN9yWjaNcV/FxISQXihSRwV7HYBSSuJjoAm3KoRwXF83wt8lhyN/vBi09Cj92a ++rFuubyFirSmBuYtLbP9hmQ98CdNtACAtsQwAbJlMktwOES3nunvHyLGjGmH4zCyv ++F7bbzDYC/vtmFXeEcM1CJbcWZCiunYyBhaDgUIKq6OmsUfwrY0SxCLiQ14wcI7Ib ++CFmF1d05RPdHXkgINOss33VHCLa25jLtdnR3zj1N/gKxMwIDAQABozQwMjAwBgNV ++HREEKTAngh9zcnYwMS5jcnQwMi1leHBpcmVkLmV4YW1wbGUubmlshwQKNQABMA0G ++CSqGSIb3DQEBCwUAA4IBgQAqUsTLqS/3K+0EtQPVBlntXHy3AJ7EM5D+0LAY8/IG ++MFQY/jTL6mFPnCNnPK7tIN+CUuxZiEWtPGynNCQcTWarcT1ZjO/NoOJ7WS1DlM31 ++CjxOgSTo/cbQ/a1vzClbZwu37kM4pJHC2Tv41pe8kt3soauFNUT0Ct+tjYxSw0l+ ++ORChE0N4ceKSqjE92ZQVf4bIqrShbb/rVbHXQW/DfYhenLexSw2nF08+SkY/b0gn ++jNDlUfxCusW5T2NvLvL9DMBuI7RZk2ikLRbO9Hs6RR2gbpgL92rmdQzbVhlriPB/ ++awj4/LvRPyUlGmyONMuRGFTVLc6c0LfDvLUK4Llzb02tazy2Se/AEBPHCnhNmH3L ++hKEpQIzdMX2uxPUlXbl0svXiK+BDyFBho6gmGgOrGiQ7E1baDe7/L73Vd4JyY7iq ++4Rj3O8Gh+FGxcLklOd+jQXnXK+wy9sswKNIe8bThgAOfwg82hYJeObqe62d2QpO/ ++4N9ksrVfmKFFP0ofXMUEEPY= ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959A.pem b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959A.pem +new file mode 100644 +index 0000000..f546d35 +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959A.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010842 (0x70b9f4eb2fa1959a) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 8 08:20:17 2022 GMT ++ Not After : Aug 31 08:20:17 2052 GMT ++ Subject: CN=srv01.client01.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:ab:60:2e:9c:61:e3:89:c6:52:2b:bc:e9:e1:05: ++ fd:18:65:42:20:f6:56:16:40:33:d2:cb:9f:f7:ef: ++ 22:54:a7:c9:55:70:ca:52:f0:e2:a2:58:38:7f:10: ++ ad:2b:05:e0:11:b6:69:21:7f:2d:38:56:dd:d5:e4: ++ f3:de:a7:32:35:f7:33:2a:52:80:ae:b7:d6:7c:35: ++ 74:c3:0c:8a:c3:3a:18:61:68:73:62:58:56:ff:78: ++ 25:57:1c:7b:be:98:88:21:dd:1c:8a:13:a5:9a:52: ++ 48:98:d9:3d:c4:28:a6:7e:9b:11:56:7e:ce:09:bb: ++ 51:89:8a:a8:1b:00:b5:73:2b:41:93:b1:62:40:30: ++ 29:ea:f6:a3:e7:bc:f0:e9:9e:07:2b:ae:a9:a0:1d: ++ 4d:d9:f8:18:4d:83:47:4e:68:ee:57:c8:55:15:86: ++ 3c:6d:1e:f5:31:f1:de:cf:c2:7e:6b:8e:22:5a:c5: ++ 76:af:d0:01:de:ab:7a:03:b2:96:33:cc:a0:26:ae: ++ de:c4:bd:76:85:96:c7:88:e4:46:bc:3f:c6:54:c9: ++ 95:83:87:9c:49:0d:31:dd:c4:17:52:99:e4:65:49: ++ 9b:9d:f3:ad:ce:66:08:57:f4:83:be:5e:87:da:42: ++ 5a:01:2a:6d:68:d1:8d:38:d9:18:ae:5e:2e:54:72: ++ 8b:01:45:96:af:f5:a3:d0:29:5d:22:8b:b4:d4:30: ++ af:02:36:c5:2d:e9:29:eb:2c:ea:6a:7e:27:b3:70: ++ fc:87:1f:2b:c4:b1:3a:a6:c2:e9:b7:c2:6f:46:63: ++ b7:96:2e:53:d8:b7:cd:c3:f4:b5:6d:b2:fc:57:49: ++ ac:9f:98:c9:fe:b4:f5:7c:93:48:2e:93:dc:e9:18: ++ 54:63:5f:18:a3:e7:12:aa:fe:38:f0:73:e5:17:1e: ++ fe:40:65:81:a8:8f:60:46:c2:16:f2:a8:9d:b1:1b: ++ bc:ce:05:de:37:b2:a8:86:47:bd:8d:92:de:e0:e5: ++ 42:89:b8:e3:f8:b1:24:08:7e:99 ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.client01.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 07:97:69:51:12:50:6a:e1:02:a0:b0:dc:93:75:16:c4:38:0f: ++ 5c:b3:47:da:bf:fa:9c:b6:de:c0:ef:38:f7:cc:d9:8d:71:ba: ++ 51:89:e5:48:36:dd:e1:f8:73:9d:92:80:1c:42:30:69:4f:8c: ++ 19:5d:f7:1d:03:e4:f2:76:e0:58:7b:c2:76:c4:0a:7e:20:69: ++ 26:6c:3e:cb:31:45:93:1d:07:5f:45:44:8e:5a:fb:87:17:7b: ++ 4d:5c:bf:37:bd:5e:ba:5c:22:84:bf:26:21:4a:c4:e9:f9:cb: ++ 73:de:fc:62:04:96:ad:aa:fd:89:09:5c:74:d6:bd:5f:07:17: ++ ef:9c:3d:ee:b7:dc:08:11:7f:12:66:ab:c4:ff:43:6d:7f:1e: ++ 01:b6:d1:19:73:53:18:e4:02:b0:7c:9e:99:63:d8:57:dd:07: ++ 79:fb:83:39:09:de:76:6e:68:b7:87:81:13:b8:26:e5:1c:c9: ++ a0:23:e5:97:39:ff:93:c7:8d:08:d8:ce:97:34:fc:ad:22:14: ++ 89:c0:ae:83:7d:0a:3f:cf:a0:9b:b4:6a:5c:b3:6d:5d:3b:88: ++ ca:1e:9b:99:54:64:57:58:3c:4c:bd:26:ee:11:c3:13:0b:1d: ++ f5:fd:d9:37:b0:31:72:6f:1d:e8:ba:43:37:46:f7:71:fe:6d: ++ 4a:30:33:29:c5:7b:37:8b:7e:06:22:89:a4:46:36:f0:fe:c6: ++ f5:f0:53:04:c0:35:52:78:6e:10:24:3a:d8:bf:7b:13:2f:98: ++ bc:69:31:41:68:02:5a:c4:f9:11:a2:6b:3f:c8:e0:d4:b3:80: ++ af:d2:be:fe:28:70:61:18:ed:8a:de:c4:cb:da:c9:60:94:91: ++ 76:63:69:8c:6e:96:f5:ba:e7:be:1e:1c:c3:84:b1:8d:e8:31: ++ f7:66:8c:0d:da:a8:78:57:19:fd:a0:8d:fa:9a:7e:51:1c:d1: ++ d0:84:07:a2:45:40:2d:c4:6b:e9:9f:86:4a:08:20:8f:9c:79: ++ 97:e3:7f:2a:14:73 ++-----BEGIN CERTIFICATE----- ++MIIEVTCCAr2gAwIBAgIIcLn06y+hlZowDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMCAXDTIyMDkwODA4MjAxN1oYDzIwNTIwODMx ++MDgyMDE3WjAlMSMwIQYDVQQDDBpzcnYwMS5jbGllbnQwMS5leGFtcGxlLm5pbDCC ++AaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKtgLpxh44nGUiu86eEF/Rhl ++QiD2VhZAM9LLn/fvIlSnyVVwylLw4qJYOH8QrSsF4BG2aSF/LThW3dXk896nMjX3 ++MypSgK631nw1dMMMisM6GGFoc2JYVv94JVcce76YiCHdHIoTpZpSSJjZPcQopn6b ++EVZ+zgm7UYmKqBsAtXMrQZOxYkAwKer2o+e88OmeByuuqaAdTdn4GE2DR05o7lfI ++VRWGPG0e9THx3s/CfmuOIlrFdq/QAd6regOyljPMoCau3sS9doWWx4jkRrw/xlTJ ++lYOHnEkNMd3EF1KZ5GVJm53zrc5mCFf0g75eh9pCWgEqbWjRjTjZGK5eLlRyiwFF ++lq/1o9ApXSKLtNQwrwI2xS3pKess6mp+J7Nw/IcfK8SxOqbC6bfCb0Zjt5YuU9i3 ++zcP0tW2y/FdJrJ+Yyf609XyTSC6T3OkYVGNfGKPnEqr+OPBz5Rce/kBlgaiPYEbC ++FvKonbEbvM4F3jeyqIZHvY2S3uDlQom44/ixJAh+mQIDAQABoy8wLTArBgNVHREE ++JDAighpzcnYwMS5jbGllbnQwMS5leGFtcGxlLm5pbIcECjUAATANBgkqhkiG9w0B ++AQsFAAOCAYEAB5dpURJQauECoLDck3UWxDgPXLNH2r/6nLbewO8498zZjXG6UYnl ++SDbd4fhznZKAHEIwaU+MGV33HQPk8nbgWHvCdsQKfiBpJmw+yzFFkx0HX0VEjlr7 ++hxd7TVy/N71eulwihL8mIUrE6fnLc978YgSWrar9iQlcdNa9XwcX75w97rfcCBF/ ++EmarxP9DbX8eAbbRGXNTGOQCsHyemWPYV90HefuDOQnedm5ot4eBE7gm5RzJoCPl ++lzn/k8eNCNjOlzT8rSIUicCug30KP8+gm7RqXLNtXTuIyh6bmVRkV1g8TL0m7hHD ++Ewsd9f3ZN7Axcm8d6LpDN0b3cf5tSjAzKcV7N4t+BiKJpEY28P7G9fBTBMA1Unhu ++ECQ62L97Ey+YvGkxQWgCWsT5EaJrP8jg1LOAr9K+/ihwYRjtit7Ey9rJYJSRdmNp ++jG6W9brnvh4cw4Sxjegx92aMDdqoeFcZ/aCN+pp+URzR0IQHokVALcRr6Z+GSggg ++j5x5l+N/KhRz ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959B.pem b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959B.pem +new file mode 100644 +index 0000000..365b493 +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/newcerts/70B9F4EB2FA1959B.pem +@@ -0,0 +1,93 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 8122792693893010843 (0x70b9f4eb2fa1959b) ++ Signature Algorithm: sha256WithRSAEncryption ++ Issuer: C=UA, ST=Kharkiv Oblast', L=Kharkiv, O=Internet Systems Consortium, CN=ca.test.example.com ++ Validity ++ Not Before: Sep 7 08:14:18 2022 GMT ++ Not After : Sep 8 08:14:18 2022 GMT ++ Subject: CN=srv01.client02-expired.example.nil ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public-Key: (3072 bit) ++ Modulus: ++ 00:c0:11:27:17:25:3a:ad:85:a0:3b:59:0b:22:64: ++ 63:7d:bb:05:32:35:4f:68:d5:19:2b:cd:46:bd:e2: ++ b6:42:8c:08:cf:09:0d:a8:cd:58:d9:1b:77:db:17: ++ 8a:fc:f0:55:f2:e1:50:f4:fd:90:aa:49:15:5d:ea: ++ 9b:5a:47:c4:2f:82:07:46:87:f6:05:ef:15:02:a4: ++ 3c:a1:da:fc:5b:75:36:12:f7:12:50:55:f8:be:0c: ++ 7d:21:91:e2:92:d8:41:3f:71:fe:b2:17:c0:68:1d: ++ 09:be:fc:c4:24:ec:ef:d2:5c:52:a9:4f:d6:5d:30: ++ b8:ab:68:2e:39:e9:8b:5b:c6:f0:64:42:f7:b8:bd: ++ b2:90:32:22:68:bc:38:70:2f:14:ae:c8:7c:63:04: ++ d5:11:b2:0a:f1:8e:13:10:b2:3b:69:f4:fe:3a:e2: ++ f1:58:56:28:93:c1:28:aa:a7:19:c9:91:12:43:f8: ++ f5:1d:34:58:3d:32:9f:11:67:d1:1f:53:d4:e0:d5: ++ 0c:78:2c:6f:38:3f:e1:89:69:b5:09:3c:12:f4:a9: ++ ee:e5:2f:c5:47:65:a6:82:fa:ea:78:48:31:89:11: ++ b6:23:8a:27:ed:7c:1d:6d:e8:ab:a0:29:de:40:f4: ++ f2:9b:61:22:da:9c:22:32:f7:3d:f8:4c:e1:38:a7: ++ e2:c3:af:a4:67:7f:94:a4:fd:52:25:89:4d:f4:9a: ++ d6:35:ba:98:20:f1:4b:c9:a5:cf:ac:72:58:2a:cd: ++ 3b:4a:3e:e9:04:31:e2:9a:74:32:d5:52:60:34:ad: ++ 0c:85:02:65:58:41:74:2a:57:91:34:55:36:a9:14: ++ 5b:45:cc:28:27:d7:6d:ba:55:a3:dd:9f:00:04:a4: ++ 43:c2:af:5c:af:86:53:a6:d5:a7:49:aa:31:d6:5e: ++ 92:7d:26:dd:8d:f4:87:8a:9b:48:e8:25:f4:c7:34: ++ ca:cf:e3:f7:84:19:3b:43:c7:6a:b8:da:6e:6f:85: ++ af:8d:0c:fb:7c:ea:c7:73:9c:9b ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Subject Alternative Name: ++ DNS:srv01.client02-expired.example.nil, IP Address:10.53.0.1 ++ Signature Algorithm: sha256WithRSAEncryption ++ 18:f1:7c:24:5b:d2:03:b0:60:0e:60:e6:32:f9:a7:47:d1:e4: ++ bd:3f:a3:21:53:90:84:9a:c6:2c:87:b2:16:28:95:07:a3:2a: ++ c3:33:8f:60:70:3f:26:58:be:ec:a2:6c:44:89:d3:4e:ef:bb: ++ ce:af:9b:5f:15:06:03:21:74:e3:6f:2a:dc:5c:19:4e:d3:cb: ++ ba:c3:5f:d8:76:89:59:50:82:69:5f:a1:ac:9f:be:79:e1:22: ++ 12:37:f9:d3:2e:00:35:03:03:9d:08:24:45:65:7a:e9:72:31: ++ e1:67:44:32:17:25:dd:b9:72:eb:c6:40:d7:5d:8d:5f:00:48: ++ 07:09:0d:3c:4c:a1:f1:05:4b:05:9b:2b:5a:21:09:46:f4:17: ++ 7a:cf:34:87:ad:bf:ef:bd:56:74:d7:1a:8f:07:ce:70:b1:aa: ++ 4d:82:4f:08:dc:56:27:f9:21:20:b8:06:c7:29:b4:8e:36:82: ++ b8:43:85:1c:2d:9f:be:2d:b9:9d:40:de:52:55:6a:2e:0b:28: ++ 33:fc:f8:1b:70:e9:c5:46:50:f3:05:be:8d:ed:99:ec:f1:8c: ++ 51:8a:1c:4b:95:f4:c4:dd:cd:42:74:bc:6f:66:64:54:b8:c1: ++ 6e:c8:3d:e9:fe:10:02:61:50:77:38:b9:b0:b8:13:37:8f:0e: ++ 5b:49:92:3a:9d:9a:60:51:68:99:8a:d5:7e:92:71:7e:fa:db: ++ 52:37:4d:f9:0d:6c:3b:79:a3:b9:16:b7:95:00:ea:eb:17:54: ++ e2:50:d7:a5:08:54:58:2c:79:66:01:4b:95:65:ed:b8:81:f7: ++ 4c:fa:f8:89:37:ad:d9:dc:c9:75:9d:02:3e:e5:92:b3:03:ab: ++ 70:69:83:f5:6c:a6:27:7e:2e:fc:9d:b2:59:0a:43:ad:3f:55: ++ 2f:5d:ec:ef:52:f0:3e:be:b5:d6:e2:c3:91:9d:dd:5d:e1:9e: ++ e6:18:90:0b:6a:85:f8:e3:83:2a:7c:91:c3:52:1c:6d:aa:2b: ++ 44:b8:6f:2b:af:6e ++-----BEGIN CERTIFICATE----- ++MIIEYzCCAsugAwIBAgIIcLn06y+hlZswDQYJKoZIhvcNAQELBQAwfTELMAkGA1UE ++BhMCVUExGDAWBgNVBAgMD0toYXJraXYgT2JsYXN0JzEQMA4GA1UEBwwHS2hhcmtp ++djEkMCIGA1UECgwbSW50ZXJuZXQgU3lzdGVtcyBDb25zb3J0aXVtMRwwGgYDVQQD ++DBNjYS50ZXN0LmV4YW1wbGUuY29tMB4XDTIyMDkwNzA4MTQxOFoXDTIyMDkwODA4 ++MTQxOFowLTErMCkGA1UEAwwic3J2MDEuY2xpZW50MDItZXhwaXJlZC5leGFtcGxl ++Lm5pbDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAMARJxclOq2FoDtZ ++CyJkY327BTI1T2jVGSvNRr3itkKMCM8JDajNWNkbd9sXivzwVfLhUPT9kKpJFV3q ++m1pHxC+CB0aH9gXvFQKkPKHa/Ft1NhL3ElBV+L4MfSGR4pLYQT9x/rIXwGgdCb78 ++xCTs79JcUqlP1l0wuKtoLjnpi1vG8GRC97i9spAyImi8OHAvFK7IfGME1RGyCvGO ++ExCyO2n0/jri8VhWKJPBKKqnGcmREkP49R00WD0ynxFn0R9T1ODVDHgsbzg/4Ylp ++tQk8EvSp7uUvxUdlpoL66nhIMYkRtiOKJ+18HW3oq6Ap3kD08pthItqcIjL3PfhM ++4Tin4sOvpGd/lKT9UiWJTfSa1jW6mCDxS8mlz6xyWCrNO0o+6QQx4pp0MtVSYDSt ++DIUCZVhBdCpXkTRVNqkUW0XMKCfXbbpVo92fAASkQ8KvXK+GU6bVp0mqMdZekn0m ++3Y30h4qbSOgl9Mc0ys/j94QZO0PHarjabm+Fr40M+3zqx3OcmwIDAQABozcwNTAz ++BgNVHREELDAqgiJzcnYwMS5jbGllbnQwMi1leHBpcmVkLmV4YW1wbGUubmlshwQK ++NQABMA0GCSqGSIb3DQEBCwUAA4IBgQAY8XwkW9IDsGAOYOYy+adH0eS9P6MhU5CE ++msYsh7IWKJUHoyrDM49gcD8mWL7somxEidNO77vOr5tfFQYDIXTjbyrcXBlO08u6 ++w1/YdolZUIJpX6Gsn7554SISN/nTLgA1AwOdCCRFZXrpcjHhZ0QyFyXduXLrxkDX ++XY1fAEgHCQ08TKHxBUsFmytaIQlG9Bd6zzSHrb/vvVZ01xqPB85wsapNgk8I3FYn +++SEguAbHKbSONoK4Q4UcLZ++LbmdQN5SVWouCygz/PgbcOnFRlDzBb6N7Zns8YxR ++ihxLlfTE3c1CdLxvZmRUuMFuyD3p/hACYVB3OLmwuBM3jw5bSZI6nZpgUWiZitV+ ++knF++ttSN035DWw7eaO5FreVAOrrF1TiUNelCFRYLHlmAUuVZe24gfdM+viJN63Z ++3Ml1nQI+5ZKzA6twaYP1bKYnfi78nbJZCkOtP1UvXezvUvA+vrXW4sORnd1d4Z7m ++GJALaoX444MqfJHDUhxtqitEuG8rr24= ++-----END CERTIFICATE----- +diff --git a/bin/tests/system/nsupdate/CA/private/CA-other.key b/bin/tests/system/nsupdate/CA/private/CA-other.key +new file mode 100644 +index 0000000..41818aa +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/private/CA-other.key +@@ -0,0 +1,39 @@ ++-----BEGIN RSA PRIVATE KEY----- ++MIIG5AIBAAKCAYEA10Xj8dH8/XCfUvhdL/S3E10TnrYY8IIDBmU0lkUR5IHwgP9I ++YVyR/0Mibg79FAs+rvuEDifUK+6wvkpj+BXNVZCspo9/u3cl7dqrLH+1SeUs50Oe ++QnbbTrBl0PuNwvzEkbk7xwLlVDOyRmmvY/EEu7WkitQZgXSAYgttrk62CuJUQUmw ++UTX5Jxndsjydk/zW/DiulTsX+zv8kG5NiwpXCfL6QxBoMZNI4fUmDL3bX1XfHaFA +++45GT2lHu07xc+cVeZIRCo0Nk+fIO53lDol8mmR8/5vna27gRnqEUSU7MZAMG6QB ++Xkotnq3rHnrI/ku6dCJW4tbWV/ANQ+TG17g2tygzC/smqTuLqavyP9V5cRrdU9aw ++Eqwvy8uVbGkTmUZdtjkGWCcmBSWJvkH3MRJmijS7rDcb8m/g9+xKe79V1c8durGW ++vcfMRZZhWaoHyhnHg9+JLUCC3EUCp/1206w5vTXEQNpqi9Z3AZfgboPzJyji4OeY ++fcQ5eaIZ3OuIpyQzAgMBAAECggGAD+vUWvsr2datgeZqhfR0YdM9czyGhasn7B4q ++EH8VPrA5iGDZCpJdHeLqNfeX0hau0SQ69Q0PDRy/J6O61wtNv2lOy5bLXKMIRBor ++FMRxNQDlHEmM999wgtZbAWTJbEVjiF+Jw0M8kMiuA7UnSp31uqhJfhcHt+JU6Gtt ++9jlOD2oDzzxS9P6n6bNpCRigkuRdRhQvHUxcjrE2EbyGsaTXIR4+Uh1xh1EcT9Hg ++uYqFIfzo3nkhpDk2jAL+UiUZiHfrpO6OfqpNQj27jju/35DT+2hgGuS2JApzpi91 ++gJSDXwsDQYdP2a2B0y3K0+HwC7/YovAzlXkfes06ebtsiG4Nzl15vnKaTbON0vZO ++7jMkedmstKaLGM5PlLW0afls5ahr0dtrhWFs+1QKcv1JahcfeEvggeH9/gtjpunM ++MT31VuYbwleWAsRxjGG3OWKLgst4cJXqGTdM21JzBDOP43/ZIaaedl43jJzIgIM5 ++b4ae9DrhsTNIboYO20XYdwtn9Q2pAoHBAPLO1xTWfqpCwZU6udtX73jMfpwhGlWW ++0jqg9gvxs9Neg4nfYMtiliBS5VT+6oID8YSKOSWXHWFGFkBN5hqfGbu5Nd94rY0J ++g6UYgGOAcNfoGOTpI2xljpEWJJfquTFgbajwFg+q3p6mL1zShkzvf6hzqENxbLxy ++OvEPkszN6cy16jgEUv5qK9qNf7ISB8Ki3yFSKAfuRlapny3TcRTYkJNZ0y398/sG ++E5vqrrYyjUWv5Uwz0mHmZpmZuZuaUJxtlwKBwQDi+BKnIiYYwdJPmCNCykRJB02Z ++QZlxtnrrajxZsXHysTopX5HkOQH80VSbH6fj287qX7vV0ux2maFLoszjM0wtfQhE ++8fsuKRPfzxR0cFtPFtncCHI5FVT2MOsdz5dZ8BsinCgsVlZ3SrUC9gxPKpVdRd21 ++OUC3r+tOPvM0gdfyT560GDLhaH12iOA5KtWnE3FIEpk6y95D1a4E7zu4ZaoI98UU ++F8ezSREzF9UzAcdVn8MA3v82nlGQS8iFI9mHicUCgcACWkS1O/rQNYNgqcgBOxHj ++7r9PTfbOW36/+K1JolbmtmS54kMy1Uq1F3iHYUzuY5Fkgl5ZYeRz+9TdXKPdICuE ++qR+/gZDU7AGtiNY9oJH3VZVgKm4gb7944mkKW8jdlJybZXAhSLuNd/i/gn6woiVv ++gWdg9+lgzg6KJWd7uocIZ77UOh5/vpGcNYDGPex7U06sKPqgUQu3bT9Ql1riI9MK ++ynUEXhCOHxnzicuVklnSEgk7usjQEAZweI/W1SDw0xMCgcEAm9BQBdsEqlRNDAVW ++l6CB9lyEIiUNsSnkAr9AxRZzMngGhKauYi3ctnICkifOOzgIOZAVRDpzyQu41lLi ++M0thDY1bYvF4TX03vprL4Q/NL2NxloNZ3uRNGmIE1sdPkRermTv4vE9dNrHbyDef ++xa1nMswm4yV1z2R+to2yqqZE2H1eZyaBr4rrLrfSroxAdl17lE3oUZvpb0o/F/Yg ++Wnu4mkV2T0/v8Z3Ep/3BiC29aYOu/Gcab6WKOvQ7qWMuD8U9AoHBAJslXJMsMZVc ++UIaxRbknRMEBRBJW6X6EPbV3zGa+R9e9XRSG7jYSOWB9Yb2AbwjsvF4Qq+8VQq+V ++Ksxs7XOuwR202oZFzQDMoVj1LL4Cn60rRWlI+p6Q5SB2DQVo2kulTv1NtvdVR+U0 ++ABa0xp5TKi7+jTY/e3CJGiT69sZc7v2VXptoiGytlUl9GVr0SImD1ZJdaJSJCPZX ++S+cEzfF6LVnnhlaq4puuv/vKjumNWDymv3zwZOy9D8nn/tMHqLKWSg== ++-----END RSA PRIVATE KEY----- +diff --git a/bin/tests/system/nsupdate/CA/private/CA.key b/bin/tests/system/nsupdate/CA/private/CA.key +new file mode 100644 +index 0000000..2d5419d +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/private/CA.key +@@ -0,0 +1,39 @@ ++-----BEGIN RSA PRIVATE KEY----- ++MIIG5AIBAAKCAYEAouoRHoAc6VCmxNTU6Ge7s+xDFGO0wXJJIsP+8nUyyjWvGCOC ++aQYLhb1kLA2NHRhSSKFcMh8jcd7Hlvy6CAec1j2dsWzryy3HgPrdjWaW3PfBO41D ++lUtdt8hA/p6pX2YwqvWbdK/3s8J0LY5xRZKNZnFOB/Sb4PGiIJ1NgMRO/M3IlPQm ++PO/faRRTU4SI26KCPKFW342826Zi88YwOd6w5mQU4fskk5TGtlNqE+Fj40ZbWVpy ++VXoEUS6RveRp020NX5CQG49SLtdF05AnnsATqmgNVCXptGuqW8uaHRONeGO3NBEy ++nJmibWBDUMjtCCcGVgyrVXuTkyAJJWpImnshUwgMNYebRwmC2iVv2LtsJS5eUTUH ++EWffnFl55XU2PkyNYgY35gA4y3SiWFJYV8+5FibU4ut0nb+lmHBF8WlqcU/kd3tp ++Gkf0exjqOIHZFqV9bIhpUbXhxx9v9+gkkGQ9nrXE1KRlvigxxUeIK5xHy9a7fVIL ++wo6WuCnLLJmbVkklAgMBAAECggGBAI5ZV3v/FUQIZK+4CBDKEwizeClotZgR9DWc ++bDgOj8KABe5hmKGL1qWVRuH3NUYm6j7sP1LMQnxM3LjhOuupOzE3xYIyWhW+eoQI ++r23OJiQNl5ohZNweblUXdTMGD5h8AipfUOY0m4tGbZ0gyXixBTxt5HCvG0UB3VgC ++GqZY4Wujo5ADhSXZsqxuRiDDvZGr/YBcuTu87Tg/ulam5ZyrKIcnC9gpSVxqsva9 ++DAMy/cSoxUjd7ukhJISK3G3AF3fV4GSslQcJTlyJ2D3+LnqPuHJKYTI4hc46lN3x ++E2g24GdSCPYf6SoEPwACXtbavV8TXwQPJrHN+f+0/ePCI4jkYe5NoA3gwVgMb/WB ++wFchxzVh3V4e8tPGiG+ofKl81DSAW8VZCJLUIbTEce9oxafPT78WJxdC0wWbh5S8 ++V/qN6sW/yWnK3oY9SilWhJGRwKOZ+8xtStaDeCzyCaOqEcWi8ZR0QfC33UozlhdC ++SrMKnOXmn/rUuXGrVR56IzIl0M7YAQKBwQDM3GJDdlFuHn6L0syKYdHDS8gXD9ke ++s+ochIP6jvkEPcayaEoZGl8s7RT3iztqXod7wLaZdotktxfDAZnJfeuOcVrCu+Bx ++HLytnBvV6czMfp3REGgQAJQeusSgtlBCTHHVOsDzIjdnkY3WBa7IiFYWO5wnYrGx ++r3ucnwnHaUVDMj1r4YI7mYIpCuYQl6eGyW7mhWewyhVwoQXKbifdrXxjvOigL0Cp ++tgsoU9pql3hpphOaYMX6hLOincTfaMxfnCECgcEAy5UXp3dA0OwK+4iDGKr+cUpk ++AtGTheiE+8zEVh2KYFLt921mW/QZiB1+xtnkknp3c7u07Ugk8jAEXzCkwMnN5ZCx ++LrJ72fC+cLIAbRm6/vMMP8iz83wyttao4qNMeoOBBfE9rEiP+lrugpv282V3ZHYa ++IUZWTeugJbckUHTbD3RZQExmQcRVG3m/TzonBfoZ8HoRj/n3d7V2T911cHUhi8Xn ++RQIi2m63VofOIep86LgartlKneMWnL0oOPq4RKyFAoHAZUzpDkD4nUJZAx025Yrf ++ZfoYNEcy7vq6XmWsuX5vZoiBs4DcezNOMvH9NzdTJxMdXbV61cIHxcK/7j7hZABv ++NZ2Z6sdqgaRbLGIQZaPaEJjfwxygyKDwnY1vY6UjZNVWSMFn3hJiYUVZZKakuiao ++ow/Q9KzZ/2ot7tG5zTCh/ktekfUOKBiNg2wPPc8wGPeMblMzZflXxrzpFyOHdRev ++dcZZJbSX/hO1yrhEPgculNd5xBHsdCegiF4JlwvEW9bhAoHAZQQiy5bx03j8bhkr ++q6bVQFPAUmG5iL16lxLg7TYVPnyH1bk0DDaQIKk6CeN+dmxML2IZgY/FvWK0GKOj ++bIH2J43nTRuFNvwtEvBQI9KbpfvlvRSSriOXaoATJvoObdAoylEM4BrVTk2mgapw ++HA/h8Thk+NPU6S8ctPouC7ogJIf/7Va7erC35j0//0kEqgOSsW9wnXdUItMo1LI3 ++nsiQD7Hwcp5/utErKcWTM+MNfdA0dUQesT9ILhfyCGvn2TOdAoHBAKldZkDyRcu9 ++r9uDF1bhUEnpV2k4hgvTuCvQ3rzyx3WrVT8ChEmePC8Ke5A54ffu/YdbpDLbdf2c ++j4n5CQhHbMIZs3P2hB3WqDCImApCfMbXaltfBbaT0j7uLJPMp+2+f/wWYpc3R+bn ++HVnaRI2PoXXmG9OjQSQdVZ5gNpkEuemAo3dJOSS6BMqQaSxUynGy7o/a/d4izBjd ++B58Fwq3sZI/Xv90Se9+b6ICST3YJ3p0vn8RKzmlCQjLg/xynpCByiw== ++-----END RSA PRIVATE KEY----- +diff --git a/bin/tests/system/nsupdate/CA/serial b/bin/tests/system/nsupdate/CA/serial +new file mode 100644 +index 0000000..0a263a5 +--- /dev/null ++++ b/bin/tests/system/nsupdate/CA/serial +@@ -0,0 +1 @@ ++70B9F4EB2FA1959C +diff --git a/bin/tests/system/nsupdate/dhparam3072.pem b/bin/tests/system/nsupdate/dhparam3072.pem +new file mode 100644 +index 0000000..9c2e0aa +--- /dev/null ++++ b/bin/tests/system/nsupdate/dhparam3072.pem +@@ -0,0 +1,11 @@ ++-----BEGIN DH PARAMETERS----- ++MIIBiAKCAYEA5D/Oioe+G+EMf/9RVxmcV4rZAtqZpVTFHcX0ZulvdiQGCQmopm6K ++3+0uoU2J6WVMjhna5nHD2NO9miRDI/jIxX9g9k6PedSB4o3fSTtkAnGtUbB8S+Ab ++EHtWfd7FTES8P1n16HN7BfPXVbP8zTcK+jO63KdQoxueYoETcrw0Myi9Lm8ri8os ++O4oQ+XAH7GzZ60bcYV9jge0XIRUGVnYZDjWMlnwMvZyjLivxKXTC9HPNA6FF1/0H ++0LPhsfjdoLNsVHFzfQz7QELMfHbTd0C8y0UMDQw9FqUp0esHZ5gsTlqnDHp2ZHoR ++JDfNl4yVO5Gv4HiFJ0NSdggefhESU3FRAOhMmUkctOCxk5hyPqGMsvofOajY2MBp ++eCffrKuAU6/dGUeq8inwrZlAMIZ20WyskHmbHnc4DXo2Uo6xSZo3xyEq1ofXXwTZ ++vPw4e12so3RJAT2a8UsHf7DG1tH+9ke7HCAJQWxUizRFRsMi1Nl/7ikS4f3zgIbX ++GKz9+uk5eS6jAgEC ++-----END DH PARAMETERS----- +diff --git a/bin/tests/system/nsupdate/ns1/named.conf.in b/bin/tests/system/nsupdate/ns1/named.conf.in +index 2c1899f..aaf1d9c 100644 +--- a/bin/tests/system/nsupdate/ns1/named.conf.in ++++ b/bin/tests/system/nsupdate/ns1/named.conf.in +@@ -11,14 +11,48 @@ + * information regarding copyright ownership. + */ + ++tls tls-forward-secrecy { ++ protocols { TLSv1.2; }; ++ ciphers "HIGH:!kRSA:!aNULL:!eNULL:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SHA1:!SHA256:!SHA384"; ++ prefer-server-ciphers yes; ++ key-file "../CA/certs/srv01.crt01.example.nil.key"; ++ cert-file "../CA/certs/srv01.crt01.example.nil.pem"; ++ dhparam-file "../dhparam3072.pem"; ++}; ++ ++tls tls-forward-secrecy-mutual-tls { ++ protocols { TLSv1.2; }; ++ ciphers "HIGH:!kRSA:!aNULL:!eNULL:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SHA1:!SHA256:!SHA384"; ++ prefer-server-ciphers yes; ++ key-file "../CA/certs/srv01.crt01.example.nil.key"; ++ cert-file "../CA/certs/srv01.crt01.example.nil.pem"; ++ dhparam-file "../dhparam3072.pem"; ++ ca-file "../CA/CA.pem"; ++}; ++ ++tls tls-expired { ++ protocols { TLSv1.2; }; ++ ciphers "HIGH:!kRSA:!aNULL:!eNULL:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SHA1:!SHA256:!SHA384"; ++ prefer-server-ciphers yes; ++ key-file "../CA/certs/srv01.crt02-expired.example.nil.key"; ++ cert-file "../CA/certs/srv01.crt02-expired.example.nil.pem"; ++ dhparam-file "../dhparam3072.pem"; ++}; ++ ++ + options { + query-source address 10.53.0.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port @PORT@; ++ tls-port @TLSPORT@; + pid-file "named.pid"; + session-keyfile "session.key"; + listen-on { 10.53.0.1; 127.0.0.1; }; ++ listen-on tls ephemeral { 10.53.0.1; }; ++ listen-on port @EXTRAPORT1@ tls tls-forward-secrecy { 10.53.0.1; }; ++ listen-on port @EXTRAPORT2@ tls tls-forward-secrecy-mutual-tls { 10.53.0.1; }; ++ listen-on port @EXTRAPORT3@ tls tls-expired { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; + notify yes; +diff --git a/bin/tests/system/nsupdate/ns10/named.conf.in b/bin/tests/system/nsupdate/ns10/named.conf.in +index 25ba141..51a0b4f 100644 +--- a/bin/tests/system/nsupdate/ns10/named.conf.in ++++ b/bin/tests/system/nsupdate/ns10/named.conf.in +@@ -16,9 +16,11 @@ options { + notify-source 10.53.0.10; + transfer-source 10.53.0.10; + port @PORT@; ++ tls-port @TLSPORT@; + pid-file "named.pid"; + session-keyfile "session.key"; + listen-on { 10.53.0.10; }; ++ listen-on tls ephemeral { 10.53.0.10; }; + listen-on-v6 { none; }; + recursion no; + notify yes; +diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh +index 916f45b..735b659 100755 +--- a/bin/tests/system/nsupdate/tests.sh ++++ b/bin/tests/system/nsupdate/tests.sh +@@ -1145,7 +1145,182 @@ fi + + n=$((n + 1)) + ret=0 ++echo_i "check DoT (opportunistic-tls) ($n)" ++$NSUPDATE -D -S -O -k ns1/ddns.key <nsupdate.out.test$n 2>&1 || ret=1 ++server 10.53.0.1 ${TLSPORT} ++update add dot-non-auth-client-o.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-non-auth-client-o.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 || ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (strict-tls) with an implicit hostname (by IP address) ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -k ns1/ddns.key <nsupdate.out.test$n 2>&1 || ret=1 ++server 10.53.0.1 ${EXTRAPORT1} ++update add dot-non-auth-client.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-non-auth-client.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 || ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (strict-tls) with an implicit hostname (by IP address) ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -k ns1/ddns.key <nsupdate.out.test$n 2>&1 || ret=1 ++server 10.53.0.1 ${EXTRAPORT1} ++update add dot-fs.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fs.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 || ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (strict-tls) with a correct hostname ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -H srv01.crt01.example.nil -k ns1/ddns.key <nsupdate.out.test$n 2>&1 || ret=1 ++server 10.53.0.1 ${EXTRAPORT1} ++update add dot-fs-h.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fs-h.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 || ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (strict-tls) with an incorrect hostname (failure expected) ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -H srv01.crt01.example.bad -k ns1/ddns.key <nsupdate.out.test$n 2>&1 && ret=1 ++server 10.53.0.1 ${EXTRAPORT1} ++update add dot-fs-h-bad.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fs-h-bad.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 && ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (strict-tls) with a wrong authority (failure expected) ($n)" ++$NSUPDATE -D -S -A CA/CA-other.pem -k ns1/ddns.key <nsupdate.out.test$n 2>&1 && ret=1 ++server 10.53.0.1 ${EXTRAPORT1} ++update add dot-fs-auth-bad.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fs-auth-bad.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 && ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (mutual-tls) with a valid client certificate ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -K CA/certs/srv01.client01.example.nil.key -E CA/certs/srv01.client01.example.nil.pem -k ns1/ddns.key <nsupdate.out.test$n 2>&1 || ret=1 ++server 10.53.0.1 ${EXTRAPORT2} ++update add dot-fsmt.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fsmt.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 || ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (mutual-tls) with a valid client certificate but with an incorrect hostname (failure expected) ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -K CA/certs/srv01.client01.example.nil.key -E CA/certs/srv01.client01.example.nil.pem -H srv01.crt01.example.bad -k ns1/ddns.key <nsupdate.out.test$n 2>&1 && ret=1 ++server 10.53.0.1 ${EXTRAPORT2} ++update add dot-fsmt-h-bad.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fsmt-h-bad.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 && ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi + ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (mutual-tls) with a valid client certificate but with a wrong authority (failure expected) ($n)" ++$NSUPDATE -D -S -A CA/CA-other.pem -K CA/certs/srv01.client01.example.nil.key -E CA/certs/client01.crt01.example.nil.pem -k ns1/ddns.key <nsupdate.out.test$n 2>&1 && ret=1 ++server 10.53.0.1 ${EXTRAPORT2} ++update add dot-fsmt-auth-bad.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fsmt-auth-bad.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 && ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (mutual-tls) with an expired client certificate (failure expected) ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -K CA/certs/srv01.client02-expired.example.nil.key -E CA/certs/srv01.client02-expired.example.nil.pem -k ns1/ddns.key <nsupdate.out.test$n 2>&1 && ret=1 ++server 10.53.0.1 ${EXTRAPORT2} ++update add dot-fsmt-exp-bad.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fsmt-exp-bad.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 && ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 ++echo_i "check DoT (mutual-tls) with a valid client certificate and an expired server certificate (failure expected) ($n)" ++$NSUPDATE -D -S -A CA/CA.pem -K CA/certs/srv01.client01.example.nil.key -E CA/certs/srv01.client01.example.nil.pem -k ns1/ddns.key <nsupdate.out.test$n 2>&1 && ret=1 ++server 10.53.0.1 ${EXTRAPORT3} ++update add dot-fsmt-exp-bad.example.nil. 600 A 10.10.10.3 ++send ++END ++sleep 2 ++$DIG $DIGOPTS +short @10.53.0.1 dot-fsmt-exp-bad.example.nil >dig.out.test$n 2>&1 || ret=1 ++grep -F "10.10.10.3" dig.out.test$n >/dev/null 2>&1 && ret=1 ++if [ $ret -ne 0 ]; then ++ echo_i "failed" ++ status=1 ++fi ++ ++n=$((n + 1)) ++ret=0 + echo_i "check TSIG key algorithms (nsupdate -k) ($n)" + if $FEATURETEST --md5; then + ALGS="md5 sha1 sha224 sha256 sha384 sha512" +@@ -1409,6 +1584,7 @@ send + END + t2=$($PERL -e 'print time()') + grep "; Communication with 10.53.0.4#${PORT} failed: timed out" nsupdate.out.test$n >/dev/null 2>&1 || ret=1 ++grep "not implemented" nsupdate.out.test$n > /dev/null 2>&1 && ret=1 + grep "not implemented" nsupdate.out.test$n >/dev/null 2>&1 && ret=1 + elapsed=$((t2 - t1)) + # Check that default timeout value is respected, there should be 4 tries with 3 seconds each. +@@ -2710,6 +2886,23 @@ EOF + status=1 + } + ++ n=$((n + 1)) ++ ret=0 ++ echo_i "check ms-selfsub match using DoT (opportunistic-tls) ($n)" ++ KRB5CCNAME="FILE:$(pwd)/ns10/machine.ccache" ++ export KRB5CCNAME ++ $NSUPDATE -d -S -O << EOF > nsupdate.out.test$n 2>&1 || ret=1 ++ gsstsig ++ realm EXAMPLE.COM ++ server 10.53.0.10 ${TLSPORT} ++ zone example.com ++ update add dot.machine.example.com 3600 IN A 10.53.0.10 ++ send ++EOF ++ $DIG $DIGOPTS +tcp @10.53.0.10 dot.machine.example.com A > dig.out.ns10.test$n ++ grep "status: NOERROR" dig.out.ns10.test$n > /dev/null || ret=1 ++ grep "dot.machine.example.com..*A.*10.53.0.10" dig.out.ns10.test$n > /dev/null || ret=1 ++ [ $ret = 0 ] || { echo_i "failed"; status=1; } + fi + + echo_i "exit status: $status" +-- +2.47.0 + diff --git a/bind-9.20-nsupdate-tls.patch b/bind-9.20-nsupdate-tls.patch new file mode 100644 index 0000000..ccf46e4 --- /dev/null +++ b/bind-9.20-nsupdate-tls.patch @@ -0,0 +1,1604 @@ +From b44dc4ed5c34445511f06d4b972407d539f8e9da Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= +Date: Mon, 11 Nov 2024 18:09:07 +0100 +Subject: [PATCH] Backport nsupdate TLS support into 9.18 + +Attempt to support TLS from nsupdate even in 9.18 release. + +Create few dispatch calls with 2 suffix with tls + +Keep original functions without changes and add new functions with +additional tlsctx and transport pointers passed. + +Convert xfrin.c:get_create_tlsctx() into a library function + +In order to make xfrin.c:get_create_tlsctx() reusable, move the function +into transport.c, and make changes into its prototype to not use the +'dns_xfrin_ctx_t' type, thus making it more universal. + +This change prepares ground for adding transport support into the +dispatch manager. + +Also, move the typedefs for 'dns_transport_t' and 'dns_transport_list_t' +from transport.h into types.h. + +(cherry picked from commit 881747218ba0ad411f6f1bf361c2c09c805d4aa8) + +Update calls inside libdns + +Add remaining transport additions to request and dispatch calls. Add +mctx into dispentry. + +Compilable nsupdate + +Implement DoT support for nsupdate + +Implement DNS-over-TLS support for nsupdate. Use DiG's DoT +implementation as a model for the newly added features. + +(cherry picked from commit 13000c28c2e0ab2754f0f37ab8d6edb8249a1370) + +[pemensik] Adapted to previous 9.18 changes. +Add usage and command line parsing + +Fixup tls initialization from nsupdate + +Detach transport also on dispatch_destroy properly. + +Adapted to 9.18.33. +--- + bin/nsupdate/nsupdate.c | 192 ++++++++++++++++++++---- + lib/dns/dispatch.c | 128 ++++++++++++++-- + lib/dns/include/dns/dispatch.h | 22 +++ + lib/dns/include/dns/request.h | 23 +++ + lib/dns/include/dns/transport.h | 45 +++++- + lib/dns/include/dns/types.h | 2 + + lib/dns/request.c | 63 ++++++-- + lib/dns/transport.c | 253 ++++++++++++++++++++++++++++++++ + lib/dns/xfrin.c | 232 +---------------------------- + 9 files changed, 668 insertions(+), 292 deletions(-) + +diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c +index 293ed28..819925e 100644 +--- a/bin/nsupdate/nsupdate.c ++++ b/bin/nsupdate/nsupdate.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -67,6 +68,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -118,6 +120,7 @@ static bool memdebugging = false; + static bool have_ipv4 = false; + static bool have_ipv6 = false; + static bool is_dst_up = false; ++static bool use_tls = false; + static bool usevc = false; + static bool usegsstsig = false; + static bool use_win2k_gsstsig = false; +@@ -145,6 +148,14 @@ static dns_tsigkey_t *tsigkey = NULL; + static dst_key_t *sig0key = NULL; + static isc_sockaddr_t *servers = NULL; + static isc_sockaddr_t *primary_servers = NULL; ++static dns_transport_list_t *transport_list = NULL; ++static dns_transport_t *transport = NULL; ++static isc_tlsctx_cache_t *tls_ctx_cache = NULL; ++static char *tls_hostname = NULL; ++static char *tls_client_key_file = NULL; ++static char *tls_client_cert_file = NULL; ++static char *tls_ca_file = NULL; ++static bool tls_always_verify_remote = true; + static bool default_servers = true; + static int ns_inuse = 0; + static int primary_inuse = 0; +@@ -790,6 +801,19 @@ set_source_ports(dns_dispatchmgr_t *manager) { + isc_portset_destroy(gmctx, &v6portset); + } + ++static isc_result_t ++create_name(const char *str, char *namedata, size_t len, dns_name_t *name) { ++ isc_buffer_t namesrc, namebuf; ++ ++ dns_name_init(name, NULL); ++ isc_buffer_constinit(&namesrc, str, strlen(str)); ++ isc_buffer_add(&namesrc, strlen(str)); ++ isc_buffer_init(&namebuf, namedata, len); ++ ++ return dns_name_fromtext(name, &namesrc, dns_rootname, ++ DNS_NAME_DOWNCASE, &namebuf); ++} ++ + static void + setup_system(void) { + isc_result_t result; +@@ -797,6 +821,8 @@ setup_system(void) { + isc_sockaddrlist_t *nslist; + isc_logconfig_t *logconfig = NULL; + irs_resconf_t *resconf = NULL; ++ dns_name_t tlsname; ++ char namedata[DNS_NAME_FORMATSIZE + 1]; + + ddebug("setup_system()"); + +@@ -942,6 +968,31 @@ setup_system(void) { + check_result(result, "dns_dispatch_createudp (v4)"); + } + ++ transport_list = dns_transport_list_new(gmctx); ++ isc_tlsctx_cache_create(gmctx, &tls_ctx_cache); ++ ++ if (tls_client_key_file == NULL) { ++ result = create_name("tls-non-auth-client", namedata, ++ sizeof(namedata), &tlsname); ++ check_result(result, "create_name (tls-non-auth-client)"); ++ transport = dns_transport_new(&tlsname, DNS_TRANSPORT_TLS, ++ transport_list); ++ dns_transport_set_tlsname(transport, "tls-non-auth-client"); ++ } else { ++ result = create_name("tls-auth-client", namedata, ++ sizeof(namedata), &tlsname); ++ check_result(result, "create_name (tls-auth-client)"); ++ transport = dns_transport_new(&tlsname, DNS_TRANSPORT_TLS, ++ transport_list); ++ dns_transport_set_tlsname(transport, "tls-auth-client"); ++ dns_transport_set_keyfile(transport, tls_client_key_file); ++ dns_transport_set_certfile(transport, tls_client_cert_file); ++ } ++ dns_transport_set_cafile(transport, tls_ca_file); ++ dns_transport_set_remote_hostname(transport, tls_hostname); ++ dns_transport_set_always_verify_remote(transport, ++ tls_always_verify_remote); ++ + result = dns_requestmgr_create(gmctx, taskmgr, dispatchmgr, dispatchv4, + dispatchv6, &requestmgr); + check_result(result, "dns_requestmgr_create"); +@@ -982,7 +1033,7 @@ version(void) { + fprintf(stderr, "nsupdate %s\n", PACKAGE_VERSION); + } + +-#define PARSE_ARGS_FMT "46C:dDghilL:Mok:p:Pr:R:t:Tu:vVy:" ++#define PARSE_ARGS_FMT "46A:C:dDE:ghH:iK:lL:MoOk:p:Pr:R:St:Tu:vVy:" + + static void + pre_parse_args(int argc, char **argv) { +@@ -1025,7 +1076,9 @@ pre_parse_args(int argc, char **argv) { + fprintf(stderr, "usage: nsupdate [-CdDi] [-L level] " + "[-l] [-g | -o | -y keyname:secret " + "| -k keyfile] [-p port] " +- "[-v] [-V] [-P] [-T] [-4 | -6] " ++ "[ -S [-K tlskeyfile] [-E tlscertfile] " ++ "[-A tlscafile] [-H tlshostname] " ++ "[-O] ] [-v] [-V] [-P] [-T] [-4 | -6] " + "[filename]\n"); + exit(EXIT_FAILURE); + +@@ -1097,6 +1150,10 @@ parse_args(int argc, char **argv) { + fatal("can't find IPv6 networking"); + } + break; ++ case 'A': ++ use_tls = true; ++ tls_ca_file = isc_commandline_argument; ++ break; + case 'C': + resolvconf = isc_commandline_argument; + break; +@@ -1107,12 +1164,27 @@ parse_args(int argc, char **argv) { + debugging = true; + ddebugging = true; + break; ++ case 'E': ++ use_tls = true; ++ usevc = true; ++ tls_client_cert_file = isc_commandline_argument; ++ break; ++ case 'H': ++ use_tls = true; ++ usevc = true; ++ tls_hostname = isc_commandline_argument; ++ break; + case 'M': + break; + case 'i': + force_interactive = true; + interactive = true; + break; ++ case 'K': ++ use_tls = true; ++ usevc = true; ++ tls_client_key_file = isc_commandline_argument; ++ break; + case 'l': + local_only = true; + break; +@@ -1145,6 +1217,11 @@ parse_args(int argc, char **argv) { + usegsstsig = true; + use_win2k_gsstsig = true; + break; ++ case 'O': ++ use_tls = true; ++ usevc = true; ++ tls_always_verify_remote = false; ++ break; + case 'p': + result = isc_parse_uint16(&dnsport, + isc_commandline_argument, 10); +@@ -1156,6 +1233,10 @@ parse_args(int argc, char **argv) { + exit(EXIT_FAILURE); + } + break; ++ case 'S': ++ use_tls = true; ++ usevc = true; ++ break; + case 't': + result = isc_parse_uint32(&timeout, + isc_commandline_argument, 10); +@@ -1218,6 +1299,26 @@ parse_args(int argc, char **argv) { + } + #endif /* HAVE_GSSAPI */ + ++ if (use_tls) { ++ usevc = true; ++ if ((tls_client_key_file == NULL) != ++ (tls_client_cert_file == NULL)) ++ { ++ fprintf(stderr, ++ "%s: cannot specify the -K option without" ++ "the -E option, and vice versa.\n", ++ argv[0]); ++ exit(EXIT_FAILURE); ++ } ++ if (tls_ca_file != NULL && tls_always_verify_remote == false) { ++ fprintf(stderr, ++ "%s: cannot specify the -A option in " ++ "conjuction with the -O option.\n", ++ argv[0]); ++ exit(EXIT_FAILURE); ++ } ++ } ++ + if (argv[isc_commandline_index] != NULL) { + if (strcmp(argv[isc_commandline_index], "-") == 0) { + input = stdin; +@@ -2468,8 +2569,10 @@ static void + send_update(dns_name_t *zone, isc_sockaddr_t *primary) { + isc_result_t result; + dns_request_t *request = NULL; +- unsigned int options = DNS_REQUESTOPT_CASE; + isc_sockaddr_t *srcaddr; ++ unsigned int options = DNS_REQUESTOPT_CASE; ++ dns_transport_t *req_transport = NULL; ++ isc_tlsctx_cache_t *req_tls_ctx_cache = NULL; + + ddebug("send_update()"); + +@@ -2477,7 +2580,12 @@ send_update(dns_name_t *zone, isc_sockaddr_t *primary) { + + if (usevc) { + options |= DNS_REQUESTOPT_TCP; ++ if (use_tls) { ++ req_transport = transport; ++ req_tls_ctx_cache = tls_ctx_cache; ++ } + } ++ + if (tsigkey == NULL && sig0key != NULL) { + result = dns_message_setsig0key(updatemsg, sig0key); + check_result(result, "dns_message_setsig0key"); +@@ -2500,11 +2608,11 @@ send_update(dns_name_t *zone, isc_sockaddr_t *primary) { + updatemsg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS; + } + +- result = dns_request_create(requestmgr, updatemsg, srcaddr, primary, +- options, tsigkey, timeout, udp_timeout, +- udp_retries, global_task, update_completed, +- NULL, &request); +- check_result(result, "dns_request_create"); ++ result = dns_request_create2( ++ requestmgr, updatemsg, srcaddr, primary, req_transport, ++ req_tls_ctx_cache, options, tsigkey, timeout, udp_timeout, ++ udp_retries, global_task, update_completed, NULL, &request); ++ check_result(result, "dns_request_create2"); + + if (debugging) { + show_message(stdout, updatemsg, "Outgoing update query:"); +@@ -2594,7 +2702,9 @@ recvsoa(isc_task_t *task, isc_event_t *event) { + result = dns_request_getresponse(request, rcvmsg, + DNS_MESSAGEPARSE_PRESERVEORDER); + if (result == DNS_R_TSIGERRORSET && servers != NULL) { +- unsigned int options = 0; ++ unsigned int options = DNS_REQUESTOPT_CASE; ++ dns_transport_t *req_transport = NULL; ++ isc_tlsctx_cache_t *req_tls_ctx_cache = NULL; + + dns_message_detach(&rcvmsg); + ddebug("Destroying request [%p]", request); +@@ -2605,8 +2715,12 @@ recvsoa(isc_task_t *task, isc_event_t *event) { + dns_message_renderreset(soaquery); + ddebug("retrying soa request without TSIG"); + +- if (!default_servers && usevc) { ++ if (usevc) { + options |= DNS_REQUESTOPT_TCP; ++ if (!default_servers && use_tls) { ++ req_transport = transport; ++ req_tls_ctx_cache = tls_ctx_cache; ++ } + } + + if (isc_sockaddr_pf(addr) == AF_INET6) { +@@ -2615,10 +2729,10 @@ recvsoa(isc_task_t *task, isc_event_t *event) { + srcaddr = localaddr4; + } + +- result = dns_request_create(requestmgr, soaquery, srcaddr, addr, +- options, NULL, timeout, udp_timeout, +- udp_retries, global_task, recvsoa, +- reqinfo, &request); ++ result = dns_request_create2( ++ requestmgr, soaquery, srcaddr, addr, req_transport, ++ req_tls_ctx_cache, options, NULL, timeout, udp_timeout, ++ udp_retries, global_task, recvsoa, reqinfo, &request); + check_result(result, "dns_request_create"); + requests++; + return; +@@ -2831,10 +2945,16 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, + isc_result_t result; + nsu_requestinfo_t *reqinfo; + isc_sockaddr_t *srcaddr; +- unsigned int options = 0; ++ unsigned int options = DNS_REQUESTOPT_CASE; ++ dns_transport_t *req_transport = NULL; ++ isc_tlsctx_cache_t *req_tls_ctx_cache = NULL; + +- if (!default_servers && usevc) { ++ if (usevc) { + options |= DNS_REQUESTOPT_TCP; ++ if (!default_servers && use_tls) { ++ req_transport = transport; ++ req_tls_ctx_cache = tls_ctx_cache; ++ } + } + + reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t)); +@@ -2847,11 +2967,12 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, + srcaddr = localaddr4; + } + +- result = dns_request_create(requestmgr, msg, srcaddr, destaddr, options, +- default_servers ? NULL : tsigkey, timeout, +- udp_timeout, udp_retries, global_task, +- recvsoa, reqinfo, request); +- check_result(result, "dns_request_create"); ++ result = dns_request_create2(requestmgr, msg, srcaddr, destaddr, ++ req_transport, req_tls_ctx_cache, options, ++ default_servers ? NULL : tsigkey, timeout, ++ udp_timeout, udp_retries, global_task, ++ recvsoa, reqinfo, request); ++ check_result(result, "dns_request_create2"); + requests++; + } + +@@ -2934,7 +3055,6 @@ start_gssrequest(dns_name_t *primary) { + char namestr[DNS_NAME_FORMATSIZE]; + char mykeystr[DNS_NAME_FORMATSIZE]; + char *err_message = NULL; +- + debug("start_gssrequest"); + usevc = true; + +@@ -3030,8 +3150,15 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, + dns_request_t **request, gss_ctx_id_t context) { + isc_result_t result; + nsu_gssinfo_t *reqinfo; +- unsigned int options = 0; + isc_sockaddr_t *srcaddr; ++ unsigned int options = DNS_REQUESTOPT_CASE | DNS_REQUESTOPT_TCP; ++ dns_transport_t *req_transport = NULL; ++ isc_tlsctx_cache_t *req_tls_ctx_cache = NULL; ++ ++ if (!default_servers && use_tls) { ++ req_transport = transport; ++ req_tls_ctx_cache = tls_ctx_cache; ++ } + + debug("send_gssrequest"); + REQUIRE(destaddr != NULL); +@@ -3041,18 +3168,17 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, + reqinfo->addr = destaddr; + reqinfo->context = context; + +- options |= DNS_REQUESTOPT_TCP; +- + if (isc_sockaddr_pf(destaddr) == AF_INET6) { + srcaddr = localaddr6; + } else { + srcaddr = localaddr4; + } + +- result = dns_request_create(requestmgr, msg, srcaddr, destaddr, options, +- tsigkey, timeout, udp_timeout, udp_retries, +- global_task, recvgss, reqinfo, request); +- check_result(result, "dns_request_create"); ++ result = dns_request_create2(requestmgr, msg, srcaddr, destaddr, ++ req_transport, req_tls_ctx_cache, options, ++ tsigkey, timeout, udp_timeout, udp_retries, ++ global_task, recvgss, reqinfo, request); ++ check_result(result, "dns_request_create2"); + if (debugging) { + show_message(stdout, msg, "Outgoing update query:"); + } +@@ -3321,6 +3447,14 @@ static void + cleanup(void) { + ddebug("cleanup()"); + ++ if (tls_ctx_cache != NULL) { ++ isc_tlsctx_cache_detach(&tls_ctx_cache); ++ } ++ ++ if (transport_list != NULL) { ++ dns_transport_list_detach(&transport_list); ++ } ++ + LOCK(&answer_lock); + if (answer != NULL) { + dns_message_detach(&answer); +diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c +index eb37198..8273c32 100644 +--- a/lib/dns/dispatch.c ++++ b/lib/dns/dispatch.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -83,6 +84,10 @@ struct dns_dispentry { + dns_dispatch_t *disp; + isc_nmhandle_t *handle; /*%< netmgr handle for UDP connection */ + dns_dispatchstate_t state; ++ /* TLS support for nsupdate. */ ++ isc_mem_t *mctx; ++ dns_transport_t *transport; ++ isc_tlsctx_cache_t *tlsctx_cache; + unsigned int bucket; + unsigned int retries; + unsigned int timeout; +@@ -107,11 +112,12 @@ struct dns_dispatch { + /* Unlocked. */ + unsigned int magic; /*%< magic */ + int tid; +- dns_dispatchmgr_t *mgr; /*%< dispatch manager */ +- isc_nmhandle_t *handle; /*%< netmgr handle for TCP connection */ +- isc_sockaddr_t local; /*%< local address */ +- in_port_t localport; /*%< local UDP port */ +- isc_sockaddr_t peer; /*%< peer address (TCP) */ ++ dns_dispatchmgr_t *mgr; /*%< dispatch manager */ ++ isc_nmhandle_t *handle; /*%< netmgr handle for TCP connection */ ++ isc_sockaddr_t local; /*%< local address */ ++ in_port_t localport; /*%< local UDP port */ ++ isc_sockaddr_t peer; /*%< peer address (TCP) */ ++ dns_transport_t *transport; /*%< TCP transport parameters */ + + /*% Locked by mgr->lock. */ + ISC_LINK(dns_dispatch_t) link; +@@ -119,6 +125,7 @@ struct dns_dispatch { + /* Locked by "lock". */ + isc_mutex_t lock; /*%< locks all below */ + isc_socktype_t socktype; ++ dns_dispatchopt_t options; + dns_dispatchstate_t state; + isc_refcount_t references; + +@@ -220,13 +227,27 @@ udp_dispatch_getnext(dns_dispentry_t *resp, int32_t timeout); + + static const char * + socktype2str(dns_dispentry_t *resp) { ++ dns_transport_type_t transport_type = DNS_TRANSPORT_UDP; + dns_dispatch_t *disp = resp->disp; + +- switch (disp->socktype) { +- case isc_socktype_udp: ++ if (disp->socktype == isc_socktype_tcp) { ++ if (resp->transport != NULL) { ++ transport_type = ++ dns_transport_get_type(resp->transport); ++ } else { ++ transport_type = DNS_TRANSPORT_TCP; ++ } ++ } ++ ++ switch (transport_type) { ++ case DNS_TRANSPORT_UDP: + return "UDP"; +- case isc_socktype_tcp: ++ case DNS_TRANSPORT_TCP: + return "TCP"; ++ case DNS_TRANSPORT_TLS: ++ return "TLS"; ++ case DNS_TRANSPORT_HTTP: ++ return "HTTP"; + default: + return ""; + } +@@ -457,6 +478,14 @@ dispentry_destroy(dns_dispentry_t *resp) { + isc_nmhandle_detach(&resp->handle); + } + ++ if (resp->tlsctx_cache != NULL) { ++ isc_tlsctx_cache_detach(&resp->tlsctx_cache); ++ } ++ ++ if (resp->transport != NULL) { ++ dns_transport_detach(&resp->transport); ++ } ++ + isc_mem_put(disp->mgr->mctx, resp, sizeof(*resp)); + + dns_dispatch_detach(&disp); /* DISPATCH001 */ +@@ -1161,6 +1190,15 @@ dispatch_allocate(dns_dispatchmgr_t *mgr, isc_socktype_t type, + isc_result_t + dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr, + const isc_sockaddr_t *destaddr, dns_dispatch_t **dispp) { ++ return dns_dispatch_createtcp2(mgr, localaddr, destaddr, NULL, 0, ++ dispp); ++} ++ ++isc_result_t ++dns_dispatch_createtcp2(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr, ++ const isc_sockaddr_t *destaddr, ++ dns_transport_t *transport, dns_dispatchopt_t options, ++ dns_dispatch_t **dispp) { + dns_dispatch_t *disp = NULL; + + REQUIRE(VALID_DISPATCHMGR(mgr)); +@@ -1170,7 +1208,11 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr, + + dispatch_allocate(mgr, isc_socktype_tcp, &disp); + ++ disp->options = options; + disp->peer = *destaddr; ++ if (transport != NULL) { ++ dns_transport_attach(transport, &disp->transport); ++ } + + if (localaddr != NULL) { + disp->local = *localaddr; +@@ -1185,6 +1227,7 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr, + * Append it to the dispatcher list. + */ + ++ /* TODO: DNS_DISPATCHOPT_UNSHARED is not backported */ + /* FIXME: There should be a lookup hashtable here */ + ISC_LIST_APPEND(mgr->list, disp, link); + UNLOCK(&mgr->lock); +@@ -1208,6 +1251,13 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr, + isc_result_t + dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, + const isc_sockaddr_t *localaddr, dns_dispatch_t **dispp) { ++ return dns_dispatch_gettcp2(mgr, destaddr, localaddr, NULL, dispp); ++} ++ ++isc_result_t ++dns_dispatch_gettcp2(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, ++ const isc_sockaddr_t *localaddr, ++ dns_transport_t *transport, dns_dispatch_t **dispp) { + dns_dispatch_t *disp_connected = NULL; + dns_dispatch_t *disp_fallback = NULL; + isc_result_t result = ISC_R_NOTFOUND; +@@ -1248,8 +1298,10 @@ dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, + if (disp->socktype != isc_socktype_tcp || + !isc_sockaddr_equal(destaddr, &peeraddr) || + (localaddr != NULL && +- !isc_sockaddr_eqaddr(localaddr, &sockname))) ++ !isc_sockaddr_eqaddr(localaddr, &sockname)) || ++ (transport != disp->transport)) + { ++ // dispatch_match alternative + UNLOCK(&disp->lock); + continue; + } +@@ -1403,6 +1455,9 @@ dispatch_destroy(dns_dispatch_t *disp) { + disp->handle, &disp->handle); + isc_nmhandle_detach(&disp->handle); + } ++ if (disp->transport != NULL) { ++ dns_transport_detach(&disp->transport); ++ } + + isc_mutex_destroy(&disp->lock); + +@@ -1426,7 +1481,18 @@ dns_dispatch_add(dns_dispatch_t *disp, unsigned int options, + unsigned int timeout, const isc_sockaddr_t *dest, + dispatch_cb_t connected, dispatch_cb_t sent, + dispatch_cb_t response, void *arg, dns_messageid_t *idp, +- dns_dispentry_t **respp) { ++ dns_dispentry_t **resp) { ++ return dns_dispatch_add2(disp, options, timeout, dest, NULL, NULL, ++ connected, sent, response, arg, idp, resp); ++} ++ ++isc_result_t ++dns_dispatch_add2(dns_dispatch_t *disp, unsigned int options, ++ unsigned int timeout, const isc_sockaddr_t *dest, ++ dns_transport_t *transport, isc_tlsctx_cache_t *tlsctx_cache, ++ dispatch_cb_t connected, dispatch_cb_t sent, ++ dispatch_cb_t response, void *arg, dns_messageid_t *idp, ++ dns_dispentry_t **respp) { + dns_dispentry_t *resp = NULL; + dns_qid_t *qid = NULL; + in_port_t localport; +@@ -1444,6 +1510,7 @@ dns_dispatch_add(dns_dispatch_t *disp, unsigned int options, + REQUIRE(connected != NULL); + REQUIRE(response != NULL); + REQUIRE(sent != NULL); ++ REQUIRE(disp->transport == transport); + + LOCK(&disp->lock); + +@@ -1471,6 +1538,7 @@ dns_dispatch_add(dns_dispatch_t *disp, unsigned int options, + .rlink = ISC_LINK_INITIALIZER, + .magic = RESPONSE_MAGIC, + }; ++ isc_mem_attach(disp->mgr->mctx, &resp->mctx); + + #if DNS_DISPATCH_TRACE + fprintf(stderr, "dns_dispentry__init:%s:%s:%d:%p->references = 1\n", +@@ -1530,6 +1598,14 @@ dns_dispatch_add(dns_dispatch_t *disp, unsigned int options, + return ISC_R_NOMORE; + } + ++ if (transport != NULL) { ++ dns_transport_attach(transport, &resp->transport); ++ } ++ ++ if (tlsctx_cache != NULL) { ++ isc_tlsctx_cache_attach(tlsctx_cache, &resp->tlsctx_cache); ++ } ++ + dns_dispatch_attach(disp, &resp->disp); /* DISPATCH001 */ + + disp->requests++; +@@ -1779,6 +1855,7 @@ dns_dispatch_done(dns_dispentry_t **respp) { + *respp = NULL; + + dispentry_cancel(resp, ISC_R_CANCELED); ++ isc_mem_detach(&resp->mctx); ///< FIXME: is this ok? + dns_dispentry_detach(&resp); /* DISPENTRY000 */ + } + +@@ -1970,6 +2047,27 @@ udp_dispatch_connect(dns_dispatch_t *disp, dns_dispentry_t *resp) { + + static isc_result_t + tcp_dispatch_connect(dns_dispatch_t *disp, dns_dispentry_t *resp) { ++ dns_transport_type_t transport_type = DNS_TRANSPORT_TCP; ++ isc_tlsctx_t *tlsctx = NULL; ++ isc_tlsctx_client_session_cache_t *sess_cache = NULL; ++ ++ if (resp->transport != NULL) { ++ transport_type = dns_transport_get_type(resp->transport); ++ } ++ ++ if (transport_type == DNS_TRANSPORT_TLS) { ++ isc_result_t result; ++ ++ result = dns_transport_get_tlsctx( ++ resp->transport, &resp->peer, resp->tlsctx_cache, ++ resp->mctx, &tlsctx, &sess_cache); ++ ++ if (result != ISC_R_SUCCESS) { ++ return result; ++ } ++ INSIST(tlsctx != NULL); ++ } ++ + /* Check whether the dispatch is already connecting or connected. */ + LOCK(&disp->lock); + switch (disp->state) { +@@ -1995,8 +2093,14 @@ tcp_dispatch_connect(dns_dispatch_t *disp, dns_dispentry_t *resp) { + "connecting from %s to %s, timeout %u", localbuf, + peerbuf, resp->timeout); + +- isc_nm_tcpdnsconnect(disp->mgr->nm, &disp->local, &disp->peer, +- tcp_connected, disp, resp->timeout, 0); ++ if (tlsctx != NULL) { ++ isc_nm_tlsdnsconnect(disp->mgr->nm, &disp->local, &disp->peer, ++ tcp_connected, disp, resp->timeout, 0, ++ tlsctx, sess_cache); ++ } else { ++ isc_nm_tcpdnsconnect(disp->mgr->nm, &disp->local, &disp->peer, ++ tcp_connected, disp, resp->timeout, 0); ++ } + break; + + case DNS_DISPATCHSTATE_CONNECTING: +diff --git a/lib/dns/include/dns/dispatch.h b/lib/dns/include/dns/dispatch.h +index ad377f0..cfdc374 100644 +--- a/lib/dns/include/dns/dispatch.h ++++ b/lib/dns/include/dns/dispatch.h +@@ -56,6 +56,7 @@ + #include + #include + ++#include + #include + + /* Add -DDNS_DISPATCH_TRACE=1 to CFLAGS for detailed reference tracing */ +@@ -74,6 +75,11 @@ struct dns_dispatchset { + isc_mutex_t lock; + }; + ++typedef enum dns_dispatchopt { ++ DNS_DISPATCHOPT_FIXEDID = 1 << 0, ++ DNS_DISPATCHOPT_UNSHARED = 1 << 1, /* Don't share this connection */ ++} dns_dispatchopt_t; ++ + /* + */ + #define DNS_DISPATCHOPT_FIXEDID 0x00000001U +@@ -199,6 +205,11 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr, + * + *\li Anything else -- failure. + */ ++isc_result_t ++dns_dispatch_createtcp2(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr, ++ const isc_sockaddr_t *destaddr, ++ dns_transport_t *transport, dns_dispatchopt_t options, ++ dns_dispatch_t **dispp); + + #if DNS_DISPATCH_TRACE + #define dns_dispatch_ref(ptr) \ +@@ -258,6 +269,10 @@ dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, + /* + * Attempt to connect to a existing TCP connection. + */ ++isc_result_t ++dns_dispatch_gettcp2(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, ++ const isc_sockaddr_t *localaddr, ++ dns_transport_t *transport, dns_dispatch_t **dispp); + + typedef void (*dispatch_cb_t)(isc_result_t eresult, isc_region_t *region, + void *cbarg); +@@ -268,6 +283,13 @@ dns_dispatch_add(dns_dispatch_t *disp, unsigned int options, + dispatch_cb_t connected, dispatch_cb_t sent, + dispatch_cb_t response, void *arg, dns_messageid_t *idp, + dns_dispentry_t **resp); ++isc_result_t ++dns_dispatch_add2(dns_dispatch_t *disp, unsigned int options, ++ unsigned int timeout, const isc_sockaddr_t *dest, ++ dns_transport_t *transport, isc_tlsctx_cache_t *tlsctx_cache, ++ dispatch_cb_t connected, dispatch_cb_t sent, ++ dispatch_cb_t response, void *arg, dns_messageid_t *idp, ++ dns_dispentry_t **respp); + /*%< + * Add a response entry for this dispatch. + * +diff --git a/lib/dns/include/dns/request.h b/lib/dns/include/dns/request.h +index d00574f..17bcbf6 100644 +--- a/lib/dns/include/dns/request.h ++++ b/lib/dns/include/dns/request.h +@@ -44,6 +44,7 @@ + #define DNS_REQUESTOPT_TCP 0x00000001U + #define DNS_REQUESTOPT_CASE 0x00000002U + #define DNS_REQUESTOPT_FIXEDID 0x00000004U ++#define DNS_REQUESTOPT_LARGE 0x00000008U + + typedef struct dns_requestevent { + ISC_EVENT_COMMON(struct dns_requestevent); +@@ -161,6 +162,17 @@ dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message, + unsigned int udptimeout, unsigned int udpretries, + isc_task_t *task, isc_taskaction_t action, void *arg, + dns_request_t **requestp); ++isc_result_t ++dns_request_create2(dns_requestmgr_t *requestmgr, dns_message_t *message, ++ const isc_sockaddr_t *srcaddr, ++ const isc_sockaddr_t *destaddr, ++ dns_transport_t *req_transport, ++ isc_tlsctx_cache_t *req_tls_ctx_cache, ++ unsigned int options, ++ dns_tsigkey_t *key, unsigned int timeout, ++ unsigned int udptimeout, unsigned int udpretries, ++ isc_task_t *task, isc_taskaction_t action, void *arg, ++ dns_request_t **requestp); + /*%< + * Create and send a request. + * +@@ -204,6 +216,17 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, + unsigned int udpretries, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_request_t **requestp); ++isc_result_t ++dns_request_createraw2(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, ++ const isc_sockaddr_t *srcaddr, ++ const isc_sockaddr_t *destaddr, ++ dns_transport_t *transport, ++ isc_tlsctx_cache_t *tlsctx_cache, ++ unsigned int options, ++ unsigned int timeout, unsigned int udptimeout, ++ unsigned int udpretries, isc_task_t *task, ++ isc_taskaction_t action, void *arg, ++ dns_request_t **requestp); + /*!< + * \brief Create and send a request. + * +diff --git a/lib/dns/include/dns/transport.h b/lib/dns/include/dns/transport.h +index e74ccd7..e6499a9 100644 +--- a/lib/dns/include/dns/transport.h ++++ b/lib/dns/include/dns/transport.h +@@ -13,7 +13,9 @@ + + #pragma once + +-#include ++#include ++ ++#include + + typedef enum { + DNS_TRANSPORT_NONE = 0, +@@ -29,9 +31,6 @@ typedef enum { + DNS_HTTP_POST = 1, + } dns_http_mode_t; + +-typedef struct dns_transport dns_transport_t; +-typedef struct dns_transport_list dns_transport_list_t; +- + dns_transport_t * + dns_transport_new(const dns_name_t *name, dns_transport_type_t type, + dns_transport_list_t *list); +@@ -63,15 +62,44 @@ dns_transport_get_tls_versions(const dns_transport_t *transport); + bool + dns_transport_get_prefer_server_ciphers(const dns_transport_t *transport, + bool *preferp); ++bool ++dns_transport_get_always_verify_remote(dns_transport_t *transport); + /*%< + * Getter functions: return the type, cert file, key file, CA file, +- * hostname, HTTP endpoint, or HTTP mode (GET or POST) for 'transport'. ++ * hostname, HTTP endpoint, HTTP mode (GET or POST), ciphers, TLS name, ++ * TLS version, server ciphers preference mode, and always enabling ++ * authentication mode for 'transport'. + * + * dns_transport_get_prefer_server_ciphers() returns 'true' is value + * was set, 'false' otherwise. The actual value is returned via + * 'preferp' pointer. + */ + ++isc_result_t ++dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer, ++ isc_tlsctx_cache_t *tlsctx_cache, isc_mem_t *mctx, ++ isc_tlsctx_t **pctx, ++ isc_tlsctx_client_session_cache_t **psess_cache); ++/*%< ++ * Get the transport's TLS Context and the TLS Client Session Cache associated ++ * with it. ++ * ++ * When neither the TLS hostname, nor the TLS certificates authorities (CA) ++ * file are set for the 'transport', then Opportunistic TLS (no authentication ++ * of the remote peer) will be used, unless the 'always_verify_remote' mode is ++ * enabled on the 'transport', in which case the remote peer will be ++ * authenticated by its IP address using the system's default certificates ++ * authorities store. ++ * ++ * Requires: ++ *\li 'transport' is a valid, 'DNS_TRANSPORT_TLS' type transport. ++ *\li 'peer' is not NULL. ++ *\li 'tlsctx_cache' is not NULL. ++ *\li 'mctx' is not NULL. ++ *\li 'pctx' is not NULL and '*pctx' is NULL. ++ *\li 'psess_cache' is not NULL and '*psess_cache' is NULL. ++ */ ++ + void + dns_transport_set_certfile(dns_transport_t *transport, const char *certfile); + void +@@ -96,9 +124,14 @@ dns_transport_set_tls_versions(dns_transport_t *transport, + void + dns_transport_set_prefer_server_ciphers(dns_transport_t *transport, + const bool prefer); ++void ++dns_transport_set_always_verify_remote(dns_transport_t *transport, ++ const bool always_verify_remote); + /*%< + * Setter functions: set the type, cert file, key file, CA file, +- * hostname, HTTP endpoint, or HTTP mode (GET or POST) for 'transport'. ++ * hostname, HTTP endpoint, HTTP mode (GET or POST), ciphers, TLS name, ++ * TLS version, server ciphers preference mode, and always enabling ++ * authentication mode for 'transport'. + * + * Requires: + *\li 'transport' is valid. +diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h +index 6465962..f0aaa24 100644 +--- a/lib/dns/include/dns/types.h ++++ b/lib/dns/include/dns/types.h +@@ -141,6 +141,8 @@ typedef struct dns_ssutable dns_ssutable_t; + typedef struct dns_stats dns_stats_t; + typedef uint32_t dns_rdatastatstype_t; + typedef struct dns_tkeyctx dns_tkeyctx_t; ++typedef struct dns_transport dns_transport_t; ++typedef struct dns_transport_list dns_transport_list_t; + typedef uint16_t dns_trust_t; + typedef struct dns_tsec dns_tsec_t; + typedef struct dns_tsig_keyring dns_tsig_keyring_t; +diff --git a/lib/dns/request.c b/lib/dns/request.c +index 8aaa29f..badedab 100644 +--- a/lib/dns/request.c ++++ b/lib/dns/request.c +@@ -399,12 +399,12 @@ isblackholed(dns_dispatchmgr_t *dispatchmgr, const isc_sockaddr_t *destaddr) { + static isc_result_t + tcp_dispatch(bool newtcp, dns_requestmgr_t *requestmgr, + const isc_sockaddr_t *srcaddr, const isc_sockaddr_t *destaddr, +- dns_dispatch_t **dispatchp) { ++ dns_transport_t *transport, dns_dispatch_t **dispatchp) { + isc_result_t result; + + if (!newtcp) { +- result = dns_dispatch_gettcp(requestmgr->dispatchmgr, destaddr, +- srcaddr, dispatchp); ++ result = dns_dispatch_gettcp2(requestmgr->dispatchmgr, destaddr, ++ srcaddr, transport, dispatchp); + if (result == ISC_R_SUCCESS) { + char peer[ISC_SOCKADDR_FORMATSIZE]; + +@@ -415,8 +415,8 @@ tcp_dispatch(bool newtcp, dns_requestmgr_t *requestmgr, + } + } + +- result = dns_dispatch_createtcp(requestmgr->dispatchmgr, srcaddr, +- destaddr, dispatchp); ++ result = dns_dispatch_createtcp2(requestmgr->dispatchmgr, srcaddr, ++ destaddr, transport, 0, dispatchp); + return result; + } + +@@ -452,12 +452,12 @@ udp_dispatch(dns_requestmgr_t *requestmgr, const isc_sockaddr_t *srcaddr, + static isc_result_t + get_dispatch(bool tcp, bool newtcp, dns_requestmgr_t *requestmgr, + const isc_sockaddr_t *srcaddr, const isc_sockaddr_t *destaddr, +- dns_dispatch_t **dispatchp) { ++ dns_transport_t *transport, dns_dispatch_t **dispatchp) { + isc_result_t result; + + if (tcp) { + result = tcp_dispatch(newtcp, requestmgr, srcaddr, destaddr, +- dispatchp); ++ transport, dispatchp); + } else { + result = udp_dispatch(requestmgr, srcaddr, destaddr, dispatchp); + } +@@ -472,6 +472,21 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, + unsigned int udpretries, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_request_t **requestp) { ++ return dns_request_createraw2(requestmgr, msgbuf, srcaddr, destaddr, ++ NULL, NULL, options, timeout, udptimeout, ++ udpretries, task, action, arg, requestp); ++} ++ ++isc_result_t ++dns_request_createraw2(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, ++ const isc_sockaddr_t *srcaddr, ++ const isc_sockaddr_t *destaddr, ++ dns_transport_t *transport, ++ isc_tlsctx_cache_t *tlsctx_cache, unsigned int options, ++ unsigned int timeout, unsigned int udptimeout, ++ unsigned int udpretries, isc_task_t *task, ++ isc_taskaction_t action, void *arg, ++ dns_request_t **requestp) { + dns_request_t *request = NULL; + isc_result_t result; + isc_mem_t *mctx = NULL; +@@ -553,7 +568,7 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, + again: + + result = get_dispatch(tcp, newtcp, requestmgr, srcaddr, destaddr, +- &request->dispatch); ++ transport, &request->dispatch); + if (result != ISC_R_SUCCESS) { + goto detach; + } +@@ -563,10 +578,10 @@ again: + dispopt |= DNS_DISPATCHOPT_FIXEDID; + } + +- result = dns_dispatch_add(request->dispatch, dispopt, request->timeout, +- destaddr, req_connected, req_senddone, +- req_response, request, &id, +- &request->dispentry); ++ result = dns_dispatch_add2(request->dispatch, dispopt, request->timeout, ++ destaddr, transport, tlsctx_cache, ++ req_connected, req_senddone, req_response, ++ request, &id, &request->dispentry); + if (result != ISC_R_SUCCESS) { + if ((options & DNS_REQUESTOPT_FIXEDID) != 0 && !newtcp) { + newtcp = true; +@@ -630,6 +645,21 @@ dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message, + unsigned int udptimeout, unsigned int udpretries, + isc_task_t *task, isc_taskaction_t action, void *arg, + dns_request_t **requestp) { ++ return dns_request_create2(requestmgr, message, srcaddr, destaddr, NULL, ++ NULL, options, key, timeout, udptimeout, ++ udpretries, task, action, arg, requestp); ++} ++ ++isc_result_t ++dns_request_create2(dns_requestmgr_t *requestmgr, dns_message_t *message, ++ const isc_sockaddr_t *srcaddr, ++ const isc_sockaddr_t *destaddr, ++ dns_transport_t *req_transport, ++ isc_tlsctx_cache_t *req_tls_ctx_cache, unsigned int options, ++ dns_tsigkey_t *key, unsigned int timeout, ++ unsigned int udptimeout, unsigned int udpretries, ++ isc_task_t *task, isc_taskaction_t action, void *arg, ++ dns_request_t **requestp) { + dns_request_t *request = NULL; + isc_result_t result; + isc_mem_t *mctx = NULL; +@@ -707,14 +737,15 @@ dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message, + + again: + result = get_dispatch(tcp, false, requestmgr, srcaddr, destaddr, +- &request->dispatch); ++ req_transport, &request->dispatch); + if (result != ISC_R_SUCCESS) { + goto detach; + } + +- result = dns_dispatch_add( +- request->dispatch, 0, request->timeout, destaddr, req_connected, +- req_senddone, req_response, request, &id, &request->dispentry); ++ result = dns_dispatch_add2(request->dispatch, 0, request->timeout, ++ destaddr, req_transport, req_tls_ctx_cache, ++ req_connected, req_senddone, req_response, ++ request, &id, &request->dispentry); + if (result != ISC_R_SUCCESS) { + goto detach; + } +diff --git a/lib/dns/transport.c b/lib/dns/transport.c +index 88a3df4..2a779ba 100644 +--- a/lib/dns/transport.c ++++ b/lib/dns/transport.c +@@ -15,9 +15,11 @@ + + #include + #include ++#include + #include + #include + #include ++#include + #include + + #include +@@ -54,6 +56,7 @@ struct dns_transport { + char *ciphers; + uint32_t protocol_versions; + ternary_t prefer_server_ciphers; ++ bool always_verify_remote; + } tls; + struct { + char *endpoint; +@@ -332,6 +335,256 @@ dns_transport_get_prefer_server_ciphers(const dns_transport_t *transport, + return false; + } + ++void ++dns_transport_set_always_verify_remote(dns_transport_t *transport, ++ const bool always_verify_remote) { ++ REQUIRE(VALID_TRANSPORT(transport)); ++ REQUIRE(transport->type == DNS_TRANSPORT_TLS || ++ transport->type == DNS_TRANSPORT_HTTP); ++ ++ transport->tls.always_verify_remote = always_verify_remote; ++} ++ ++bool ++dns_transport_get_always_verify_remote(dns_transport_t *transport) { ++ REQUIRE(VALID_TRANSPORT(transport)); ++ REQUIRE(transport->type == DNS_TRANSPORT_TLS || ++ transport->type == DNS_TRANSPORT_HTTP); ++ ++ return transport->tls.always_verify_remote; ++} ++ ++isc_result_t ++dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer, ++ isc_tlsctx_cache_t *tlsctx_cache, isc_mem_t *mctx, ++ isc_tlsctx_t **pctx, ++ isc_tlsctx_client_session_cache_t **psess_cache) { ++ isc_result_t result = ISC_R_FAILURE; ++ isc_tlsctx_t *tlsctx = NULL, *found = NULL; ++ isc_tls_cert_store_t *store = NULL, *found_store = NULL; ++ isc_tlsctx_client_session_cache_t *sess_cache = NULL; ++ isc_tlsctx_client_session_cache_t *found_sess_cache = NULL; ++ uint32_t tls_versions; ++ const char *ciphers = NULL; ++ bool prefer_server_ciphers; ++ uint16_t family; ++ const char *tlsname = NULL; ++ ++ REQUIRE(VALID_TRANSPORT(transport)); ++ REQUIRE(transport->type == DNS_TRANSPORT_TLS); ++ REQUIRE(peer != NULL); ++ REQUIRE(tlsctx_cache != NULL); ++ REQUIRE(mctx != NULL); ++ REQUIRE(pctx != NULL && *pctx == NULL); ++ REQUIRE(psess_cache != NULL && *psess_cache == NULL); ++ ++ family = (isc_sockaddr_pf(peer) == PF_INET6) ? AF_INET6 : AF_INET; ++ ++ tlsname = dns_transport_get_tlsname(transport); ++ INSIST(tlsname != NULL && *tlsname != '\0'); ++ ++ /* ++ * Let's try to re-use the already created context. This way ++ * we have a chance to resume the TLS session, bypassing the ++ * full TLS handshake procedure, making establishing ++ * subsequent TLS connections faster. ++ */ ++ result = isc_tlsctx_cache_find(tlsctx_cache, tlsname, ++ isc_tlsctx_cache_tls, family, &found, ++ &found_store, &found_sess_cache); ++ if (result != ISC_R_SUCCESS) { ++ const char *hostname = ++ dns_transport_get_remote_hostname(transport); ++ const char *ca_file = dns_transport_get_cafile(transport); ++ const char *cert_file = dns_transport_get_certfile(transport); ++ const char *key_file = dns_transport_get_keyfile(transport); ++ const bool always_verify_remote = ++ dns_transport_get_always_verify_remote(transport); ++ char peer_addr_str[INET6_ADDRSTRLEN] = { 0 }; ++ isc_netaddr_t peer_netaddr = { 0 }; ++ bool hostname_ignore_subject; ++ ++ /* ++ * So, no context exists. Let's create one using the ++ * parameters from the configuration file and try to ++ * store it for further reuse. ++ */ ++ result = isc_tlsctx_createclient(&tlsctx); ++ if (result != ISC_R_SUCCESS) { ++ goto failure; ++ } ++ tls_versions = dns_transport_get_tls_versions(transport); ++ if (tls_versions != 0) { ++ isc_tlsctx_set_protocols(tlsctx, tls_versions); ++ } ++ ciphers = dns_transport_get_ciphers(transport); ++ if (ciphers != NULL) { ++ isc_tlsctx_set_cipherlist(tlsctx, ciphers); ++ } ++ ++ if (dns_transport_get_prefer_server_ciphers( ++ transport, &prefer_server_ciphers)) ++ { ++ isc_tlsctx_prefer_server_ciphers(tlsctx, ++ prefer_server_ciphers); ++ } ++ ++ if (always_verify_remote || hostname != NULL || ca_file != NULL) ++ { ++ /* ++ * The situation when 'found_store != NULL' while ++ * 'found == NULL' may occur as there is a one-to-many ++ * relation between cert stores and per-transport TLS ++ * contexts. That is, there could be one store ++ * shared between multiple contexts. ++ */ ++ if (found_store == NULL) { ++ /* ++ * 'ca_file' can equal 'NULL' here, in ++ * which case the store with system-wide ++ * CA certificates will be created. ++ */ ++ result = isc_tls_cert_store_create(ca_file, ++ &store); ++ ++ if (result != ISC_R_SUCCESS) { ++ goto failure; ++ } ++ } else { ++ store = found_store; ++ } ++ ++ INSIST(store != NULL); ++ if (hostname == NULL) { ++ /* ++ * If hostname is not specified, then use the ++ * peer IP address for validation. ++ */ ++ isc_netaddr_fromsockaddr(&peer_netaddr, peer); ++ isc_netaddr_format(&peer_netaddr, peer_addr_str, ++ sizeof(peer_addr_str)); ++ hostname = peer_addr_str; ++ } ++ ++ /* ++ * According to RFC 8310, Subject field MUST NOT ++ * be inspected when verifying hostname for DoT. ++ * Only SubjectAltName must be checked. ++ */ ++ hostname_ignore_subject = true; ++ result = isc_tlsctx_enable_peer_verification( ++ tlsctx, false, store, hostname, ++ hostname_ignore_subject); ++ if (result != ISC_R_SUCCESS) { ++ goto failure; ++ } ++ ++ /* ++ * Let's load client certificate and enable ++ * Mutual TLS. We do that only in the case when ++ * Strict TLS is enabled, because Mutual TLS is ++ * an extension of it. ++ */ ++ if (cert_file != NULL) { ++ INSIST(key_file != NULL); ++ ++ result = isc_tlsctx_load_certificate( ++ tlsctx, key_file, cert_file); ++ if (result != ISC_R_SUCCESS) { ++ goto failure; ++ } ++ } ++ } ++ ++ isc_tlsctx_enable_dot_client_alpn(tlsctx); ++ ++ isc_tlsctx_client_session_cache_create( ++ mctx, tlsctx, ++ ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE, ++ &sess_cache); ++ ++ found_store = NULL; ++ result = isc_tlsctx_cache_add(tlsctx_cache, tlsname, ++ isc_tlsctx_cache_tls, family, ++ tlsctx, store, sess_cache, &found, ++ &found_store, &found_sess_cache); ++ if (result == ISC_R_EXISTS) { ++ /* ++ * It seems the entry has just been created from ++ * within another thread while we were initialising ++ * ours. Although this is unlikely, it could happen ++ * after startup/re-initialisation. In such a case, ++ * discard the new context and associated data and use ++ * the already established one from now on. ++ * ++ * Such situation will not occur after the ++ * initial 'warm-up', so it is not critical ++ * performance-wise. ++ */ ++ INSIST(found != NULL); ++ isc_tlsctx_free(&tlsctx); ++ /* ++ * The 'store' variable can be 'NULL' when remote server ++ * verification is not enabled (that is, when Strict or ++ * Mutual TLS are not used). ++ * ++ * The 'found_store' might be equal to 'store' as there ++ * is one-to-many relation between a store and ++ * per-transport TLS contexts. In that case, the call to ++ * 'isc_tlsctx_cache_find()' above could have returned a ++ * store via the 'found_store' variable, whose value we ++ * can assign to 'store' later. In that case, ++ * 'isc_tlsctx_cache_add()' will return the same value. ++ * When that happens, we should not free the store ++ * object, as it is managed by the TLS context cache. ++ */ ++ if (store != NULL && store != found_store) { ++ isc_tls_cert_store_free(&store); ++ } ++ isc_tlsctx_client_session_cache_detach(&sess_cache); ++ /* Let's return the data from the cache. */ ++ *psess_cache = found_sess_cache; ++ *pctx = found; ++ } else { ++ /* ++ * Adding the fresh values into the cache has been ++ * successful, let's return them ++ */ ++ INSIST(result == ISC_R_SUCCESS); ++ *psess_cache = sess_cache; ++ *pctx = tlsctx; ++ } ++ } else { ++ /* ++ * The cache lookup has been successful, let's return the ++ * results. ++ */ ++ INSIST(result == ISC_R_SUCCESS); ++ *psess_cache = found_sess_cache; ++ *pctx = found; ++ } ++ ++ return ISC_R_SUCCESS; ++ ++failure: ++ if (tlsctx != NULL) { ++ isc_tlsctx_free(&tlsctx); ++ } ++ ++ /* ++ * The 'found_store' is being managed by the TLS context ++ * cache. Thus, we should keep it as it is, as it will get ++ * destroyed alongside the cache. As there is one store per ++ * multiple TLS contexts, we need to handle store deletion in a ++ * special way. ++ */ ++ if (store != NULL && store != found_store) { ++ isc_tls_cert_store_free(&store); ++ } ++ ++ return result; ++} ++ + static void + transport_destroy(dns_transport_t *transport) { + isc_refcount_destroy(&transport->references); +diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c +index 3a4f761..3695815 100644 +--- a/lib/dns/xfrin.c ++++ b/lib/dns/xfrin.c +@@ -962,234 +962,6 @@ xfrin_create(isc_mem_t *mctx, dns_zone_t *zone, dns_db_t *db, isc_nm_t *netmgr, + *xfrp = xfr; + } + +-static isc_result_t +-get_create_tlsctx(const dns_xfrin_ctx_t *xfr, isc_tlsctx_t **pctx, +- isc_tlsctx_client_session_cache_t **psess_cache) { +- isc_result_t result = ISC_R_FAILURE; +- isc_tlsctx_t *tlsctx = NULL, *found = NULL; +- isc_tls_cert_store_t *store = NULL, *found_store = NULL; +- isc_tlsctx_client_session_cache_t *sess_cache = NULL, +- *found_sess_cache = NULL; +- uint32_t tls_versions; +- const char *ciphers = NULL; +- bool prefer_server_ciphers; +- const uint16_t family = isc_sockaddr_pf(&xfr->primaryaddr) == PF_INET6 +- ? AF_INET6 +- : AF_INET; +- const char *tlsname = NULL; +- +- REQUIRE(psess_cache != NULL && *psess_cache == NULL); +- REQUIRE(pctx != NULL && *pctx == NULL); +- +- INSIST(xfr->transport != NULL); +- tlsname = dns_transport_get_tlsname(xfr->transport); +- INSIST(tlsname != NULL && *tlsname != '\0'); +- +- /* +- * Let's try to re-use the already created context. This way +- * we have a chance to resume the TLS session, bypassing the +- * full TLS handshake procedure, making establishing +- * subsequent TLS connections for XoT faster. +- */ +- result = isc_tlsctx_cache_find(xfr->tlsctx_cache, tlsname, +- isc_tlsctx_cache_tls, family, &found, +- &found_store, &found_sess_cache); +- if (result != ISC_R_SUCCESS) { +- const char *hostname = +- dns_transport_get_remote_hostname(xfr->transport); +- const char *ca_file = dns_transport_get_cafile(xfr->transport); +- const char *cert_file = +- dns_transport_get_certfile(xfr->transport); +- const char *key_file = +- dns_transport_get_keyfile(xfr->transport); +- char primary_addr_str[INET6_ADDRSTRLEN] = { 0 }; +- isc_netaddr_t primary_netaddr = { 0 }; +- bool hostname_ignore_subject; +- /* +- * So, no context exists. Let's create one using the +- * parameters from the configuration file and try to +- * store it for further reuse. +- */ +- result = isc_tlsctx_createclient(&tlsctx); +- if (result != ISC_R_SUCCESS) { +- goto failure; +- } +- tls_versions = dns_transport_get_tls_versions(xfr->transport); +- if (tls_versions != 0) { +- isc_tlsctx_set_protocols(tlsctx, tls_versions); +- } +- ciphers = dns_transport_get_ciphers(xfr->transport); +- if (ciphers != NULL) { +- isc_tlsctx_set_cipherlist(tlsctx, ciphers); +- } +- +- if (dns_transport_get_prefer_server_ciphers( +- xfr->transport, &prefer_server_ciphers)) +- { +- isc_tlsctx_prefer_server_ciphers(tlsctx, +- prefer_server_ciphers); +- } +- +- if (hostname != NULL || ca_file != NULL) { +- /* +- * The situation when 'found_store != NULL' while 'found +- * == NULL' might appear as there is one to many +- * relation between per transport TLS contexts and cert +- * stores. That is, there could be one store shared +- * between multiple contexts. +- */ +- if (found_store == NULL) { +- /* +- * 'ca_file' can equal 'NULL' here, in +- * that case the store with system-wide +- * CA certificates will be created, just +- * as planned. +- */ +- result = isc_tls_cert_store_create(ca_file, +- &store); +- +- if (result != ISC_R_SUCCESS) { +- goto failure; +- } +- } else { +- store = found_store; +- } +- +- INSIST(store != NULL); +- if (hostname == NULL) { +- /* +- * If CA bundle file is specified, but +- * hostname is not, then use the primary +- * IP address for validation, just like +- * dig does. +- */ +- INSIST(ca_file != NULL); +- isc_netaddr_fromsockaddr(&primary_netaddr, +- &xfr->primaryaddr); +- isc_netaddr_format(&primary_netaddr, +- primary_addr_str, +- sizeof(primary_addr_str)); +- hostname = primary_addr_str; +- } +- /* +- * According to RFC 8310, Subject field MUST NOT +- * be inspected when verifying hostname for DoT. +- * Only SubjectAltName must be checked. +- */ +- hostname_ignore_subject = true; +- result = isc_tlsctx_enable_peer_verification( +- tlsctx, false, store, hostname, +- hostname_ignore_subject); +- if (result != ISC_R_SUCCESS) { +- goto failure; +- } +- +- /* +- * Let's load client certificate and enable +- * Mutual TLS. We do that only in the case when +- * Strict TLS is enabled, because Mutual TLS is +- * an extension of it. +- */ +- if (cert_file != NULL) { +- INSIST(key_file != NULL); +- +- result = isc_tlsctx_load_certificate( +- tlsctx, key_file, cert_file); +- if (result != ISC_R_SUCCESS) { +- goto failure; +- } +- } +- } +- +- isc_tlsctx_enable_dot_client_alpn(tlsctx); +- +- isc_tlsctx_client_session_cache_create( +- xfr->mctx, tlsctx, +- ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE, +- &sess_cache); +- +- found_store = NULL; +- result = isc_tlsctx_cache_add(xfr->tlsctx_cache, tlsname, +- isc_tlsctx_cache_tls, family, +- tlsctx, store, sess_cache, &found, +- &found_store, &found_sess_cache); +- if (result == ISC_R_EXISTS) { +- /* +- * It seems the entry has just been created from within +- * another thread while we were initialising +- * ours. Although this is unlikely, it could happen +- * after startup/re-initialisation. In such a case, +- * discard the new context and associated data and use +- * the already established one from now on. +- * +- * Such situation will not occur after the +- * initial 'warm-up', so it is not critical +- * performance-wise. +- */ +- INSIST(found != NULL); +- isc_tlsctx_free(&tlsctx); +- /* +- * The 'store' variable can be 'NULL' when remote server +- * verification is not enabled (that is, when Strict or +- * Mutual TLS are not used). +- * +- * The 'found_store' might be equal to 'store' as there +- * is one-to-many relation between a store and +- * per-transport TLS contexts. In that case, the call to +- * 'isc_tlsctx_cache_find()' above could have returned a +- * store via the 'found_store' variable, whose value we +- * can assign to 'store' later. In that case, +- * 'isc_tlsctx_cache_add()' will return the same value. +- * When that happens, we should not free the store +- * object, as it is managed by the TLS context cache. +- */ +- if (store != NULL && store != found_store) { +- isc_tls_cert_store_free(&store); +- } +- isc_tlsctx_client_session_cache_detach(&sess_cache); +- /* Let's return the data from the cache. */ +- *psess_cache = found_sess_cache; +- *pctx = found; +- } else { +- /* +- * Adding the fresh values into the cache has been +- * successful, let's return them +- */ +- INSIST(result == ISC_R_SUCCESS); +- *psess_cache = sess_cache; +- *pctx = tlsctx; +- } +- } else { +- /* +- * The cache lookup has been successful, let's return the +- * results. +- */ +- INSIST(result == ISC_R_SUCCESS); +- *psess_cache = found_sess_cache; +- *pctx = found; +- } +- +- return ISC_R_SUCCESS; +- +-failure: +- if (tlsctx != NULL) { +- isc_tlsctx_free(&tlsctx); +- } +- +- /* +- * The 'found_store' is being managed by the TLS context +- * cache. Thus, we should keep it as it is, as it will get +- * destroyed alongside the cache. As there is one store per +- * multiple TLS contexts, we need to handle store deletion in a +- * special way. +- */ +- if (store != NULL && store != found_store) { +- isc_tls_cert_store_free(&store); +- } +- +- return result; +-} +- + static isc_result_t + xfrin_start(dns_xfrin_ctx_t *xfr) { + isc_result_t result; +@@ -1232,7 +1004,9 @@ xfrin_start(dns_xfrin_ctx_t *xfr) { + connect_xfr, 30000, 0); + break; + case DNS_TRANSPORT_TLS: { +- result = get_create_tlsctx(xfr, &tlsctx, &sess_cache); ++ result = dns_transport_get_tlsctx( ++ xfr->transport, &xfr->primaryaddr, xfr->tlsctx_cache, ++ xfr->mctx, &tlsctx, &sess_cache); + if (result != ISC_R_SUCCESS) { + goto failure; + } +-- +2.48.1 + diff --git a/bind-9.5-PIE.patch b/bind-9.5-PIE.patch new file mode 100644 index 0000000..9744f69 --- /dev/null +++ b/bind-9.5-PIE.patch @@ -0,0 +1,28 @@ +From 13348a5fc64387bf53ef450688e181100d0ceddb Mon Sep 17 00:00:00 2001 +From: Petr Mensik +Date: Thu, 12 Dec 2024 15:56:13 +0100 +Subject: [PATCH] Harden named service build flags + +--- + bin/named/Makefile.am | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/bin/named/Makefile.am b/bin/named/Makefile.am +index 57a023b..b832e9c 100644 +--- a/bin/named/Makefile.am ++++ b/bin/named/Makefile.am +@@ -33,7 +33,10 @@ endif HAVE_LIBXML2 + + AM_CPPFLAGS += \ + -DNAMED_LOCALSTATEDIR=\"${localstatedir}\" \ +- -DNAMED_SYSCONFDIR=\"${sysconfdir}\" ++ -DNAMED_SYSCONFDIR=\"${sysconfdir}\" \ ++ -fpie ++ ++AM_LDFLAGS += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack + + sbin_PROGRAMS = named + +-- +2.47.1 + diff --git a/SPECS/bind.spec b/bind.spec similarity index 73% rename from SPECS/bind.spec rename to bind.spec index 847f170..a6daa14 100644 --- a/SPECS/bind.spec +++ b/bind.spec @@ -1,54 +1,42 @@ # -# Red Hat BIND package .spec file +# Red Hat BIND9 package .spec file # # vim:expandtab ts=2: -#%%global PATCHVER P1 -#%%global PREVER rc1 -%global BINDVERSION %{version}%{?PREVER}%{?PATCHVER:-%{PATCHVER}} - # bcond_without is built by default, unless --without X is passed # bcond_with is built only when --with X is passed to build %bcond_with SYSTEMTEST -%bcond_without SDB %bcond_without GSSTSIG -# it is not possible to build the package without PKCS11 sub-package -# due to extensive changes to Makefiles -%bcond_without PKCS11 %bcond_without JSON -%bcond_with LMDB -%bcond_without DNSTAP -%bcond_with DLZ -%bcond_without EXPORT_LIBS -%bcond_without BDB -# Legacy GeoIP support -%bcond_with GEOIP -%bcond_with DOC -%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 -%bcond_without UNITTEST -%else -%bcond_with UNITTEST -%endif -%bcond_with TSAN -%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 # New MaxMind GeoLite support %bcond_without GEOIP2 -%else -%bcond_with GEOIP2 +# Disabled temporarily until kyua is fixed on rawhide, bug #1926779 +%bcond_without UNITTEST +# Do not set CI environment, include more unit tests, even less stable +%bcond_with UNITTEST_ALL +%bcond_without DNSTAP +%bcond_without LMDB +%bcond_without DOC +# Because of issues with PDF rebuild, include only HTML pages +# Current error: unable top find isc-logo.pdf +%if 0%{?fedora} +# RHEL and ELN do not have all required packages +%bcond_without DOCPDF +%endif +%bcond_with TSAN +%if 0%{?fedora} >= 41 && ! 0%{?rhel} +# Make this enabled on recent Fedora, but not in ELN or RHEL + %bcond_without OPENSSL_ENGINE %endif -%{?!bind_uid: %global bind_uid 25} -%{?!bind_gid: %global bind_gid 25} %{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} %global bind_dir /var/named %global chroot_prefix %{bind_dir}/chroot -%if %{with SDB} -%global chroot_sdb_prefix %{bind_dir}/chroot_sdb -%endif %global chroot_create_directories /dev /run/named %{_localstatedir}/{log,named,tmp} \\\ %{_sysconfdir}/{crypto-policies/back-ends,pki/dnssec-keys,named} \\\ - %{_libdir}/bind %{_datadir}/GeoIP %{_datadir}/GeoIP /proc/sys/net/ipv4 + %{_libdir}/bind %{_libdir}/named %{_datadir}/GeoIP /proc/sys/net/ipv4 +%global selinuxbooleans named_write_master_zones=1 ## The order of libs is important. See lib/Makefile.in for details %define bind_export_libs isc dns isccfg irs %{!?_export_dir:%global _export_dir /bind9-export/} @@ -57,27 +45,50 @@ # Visit https://bugzilla.redhat.com/show_bug.cgi?id=1540300 %undefine _strict_symbol_defs_build # +# significant changes: +# no more isc-config.sh and bind9-config +# lib*.so.X versions of selected libraries no longer provided, +# lib*-%%{version}-RH.so is provided as an internal implementation detail -# lib*.so.X versions of selected libraries -%global sover_dns 1115 -%global sover_isc 1107 -%global sover_irs 161 -%global sover_isccfg 163 +# Upstream package name +%global upname bind +%define upname_compat() \ +%if "%{name}" != "%{upname}" \ +Provides: %1 = %{epoch}:%{version}-%{release} \ +Conflicts: %1 \ +%endif +# . Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server Name: bind -License: MPLv2.0 -Version: 9.11.36 -Release: 16%{?PATCHVER:.%{PATCHVER}}%{?PREVER:.%{PREVER}}%{?dist}.4 +License: MPL-2.0 AND ISC AND MIT AND BSD-3-Clause AND BSD-2-Clause +# Most of code is licensed under MPL-2.0. Some additions follow: +# ./contrib/dlz/* ISC and/or MPL-2.0 +# ./lib/isccc/*.c ISC and/or MPL-2.0 +# ./lib/isccc/include/isccc/*.h ISC and/or MPL-2.0 +# ./lib/isc/picohttpparser.c Expat, should be MIT +# ./lib/isc/picohttpparser.h Expat, should be MIT +# ./lib/isc/url.c Expat and/or MPL-2.0, should be MIT +# ./lib/isc/include/isc/url.h Expat and/or MPL-2.0 +# ./lib/dns/dnstap.c BSD-3-clause and/or MPL-2.0 +# ./lib/isc/commandline.c BSD-3-clause and/or MPL-2.0 +# ./lib/isc/file.c BSD-3-clause and/or MPL-2.0 +# ./lib/isc/string.c BSD-3-clause and/or MPL-2.0 +# ./lib/isc/tm.c BSD-2-clause and/or MPL-2.0 +# ./lib/isccfg/parser.c BSD-2-clause and/or MPL-2.0 +# +# Before rebasing bind, ensure bind-dyndb-ldap is ready to be rebuild and use side-tag with it. +# Updating just bind will cause freeipa-dns-server package to be uninstallable. +Version: 9.18.33 +Release: 3%{?dist} Epoch: 32 Url: https://www.isc.org/downloads/bind/ # -Source: https://downloads.isc.org/isc/bind9/%{BINDVERSION}/bind-%{BINDVERSION}.tar.gz +Source0: https://downloads.isc.org/isc/bind9/%{version}/%{upname}-%{version}.tar.xz Source1: named.sysconfig +Source2: https://downloads.isc.org/isc/bind9/%{version}/%{upname}-%{version}.tar.xz.asc Source3: named.logrotate -Source7: bind-9.3.1rc1-sdb_tools-Makefile.in -Source8: dnszone.schema -Source12: README.sdb_pgsql +Source4: https://www.isc.org/docs/isc-keyblock.asc Source16: named.conf # Refresh by command: dig @a.root-servers.net. +tcp +norec # or from URL @@ -88,173 +99,74 @@ Source20: named.empty Source23: named.rfc1912.zones Source25: named.conf.sample Source27: named.root.key -Source30: ldap2zone.c -Source31: ldap2zone.1 -Source32: named-sdb.8 -Source33: zonetodb.1 -Source34: zone2sqlite.1 Source35: bind.tmpfiles.d Source36: trusted-key.key Source37: named.service Source38: named-chroot.service -Source39: named-sdb.service -Source40: named-sdb-chroot.service Source41: setup-named-chroot.sh Source42: generate-rndc-key.sh Source43: named.rwtab Source44: named-chroot-setup.service -Source45: named-sdb-chroot-setup.service Source46: named-setup-rndc.service -Source47: named-pkcs11.service Source48: setup-named-softhsm.sh Source49: named-chroot.files -Source50: random.data +Source50: named.sysusers # Common patches +# FIXME: Is this still required? Patch10: bind-9.5-PIE.patch -Patch16: bind-9.3.2-redhat_doc.patch -Patch72: bind-9.5-dlz-64bit.patch -Patch101:bind-96-old-api.patch -Patch102:bind-95-rh452060.patch -Patch106:bind93-rh490837.patch -Patch109:bind97-rh478718.patch -Patch112:bind97-rh645544.patch -Patch130:bind-9.9.1-P2-dlz-libdb.patch -Patch131:bind-9.9.1-P2-multlib-conflict.patch -Patch133:bind99-rh640538.patch -Patch134:bind97-rh669163.patch -# Fedora specific patch to distribute native-pkcs#11 functionality -Patch136:bind-9.10-dist-native-pkcs11.patch +Patch16: bind-9.16-redhat_doc.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2122010 +Patch26: bind-9.18-unittest-netmgr-unstable.patch +# Downstream backport from 9.20 +# https://issues.redhat.com/browse/FREEIPA-11706 +# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/6751 +# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/6752 +Patch28: bind-9.20-nsupdate-tls.patch +# Man change for patch28 nsupdate +Patch29: bind-9.20-nsupdate-tls-doc.patch +# Test suport for patch28 nsupdate +Patch30: bind-9.20-nsupdate-tls-test.patch -# [ISC-Bugs #42525] non-portable use of strlcat in contrib/sdb/ldap/zone2ldap.c -# introduced by https://source.isc.org/cgi-bin/gitweb.cgi?p=bind9.git;a=commit;h=fc9f0ac5778f78003a7acc957a23711811fec122 -Patch137:bind-9.10-use-of-strlcat.patch -Patch140:bind-9.11-rh1410433.patch -Patch145:bind-9.11-rh1205168.patch -# [ISC-Bugs #46853] commit cb616c6d5c2ece1fac37fa6e0bca2b53d4043098 ISC 4851 -Patch149:bind-9.11-kyua-pkcs11.patch -# Avoid conflicts with OpenSSL PKCS11 engine -Patch150:bind-9.11-engine-pkcs11.patch -Patch153:bind-9.11-export-suffix.patch -Patch154:bind-9.11-oot-manual.patch -Patch155:bind-9.11-pk11.patch -Patch156:bind-9.11-fips-code.patch -Patch157:bind-9.11-fips-tests.patch -Patch159:bind-9.11-host-idn-disable.patch -Patch164:bind-9.11-fips-code-includes.patch -# [RT #31459] commit 06a8051d2476fb526fe6960832209392c763a9af -Patch165:bind-9.11-rt31459.patch -# [RT #46047] commit 24172bd2eeba91441ab1c65d2717b0692309244a ISC 4724 -Patch166:bind-9.11-rt46047.patch -Patch167:bind-9.11-rh1668682.patch -# random_test fails too often by random, disable it -Patch168:bind-9.11-unit-disable-random.patch -Patch174:bind-9.11-fips-disable.patch -# Make sure jsonccp-devel does not interfere -Patch175:bind-9.11-json-c.patch -Patch177:bind-9.11-serve-stale.patch -Patch178:bind-9.11-dhcp-time-monotonic.patch -# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/5253 -Patch183:bind-9.11-rh1980757.patch -# modified, https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/3067 -Patch184: bind-9.15-resolver-ntasks.patch -Patch185: bind-9.11-CVE-2021-25220.patch -Patch186: bind-9.11-CVE-2021-25220-test.patch -Patch188: bind-9.16-CVE-2022-38177.patch -Patch189: bind-9.16-CVE-2022-38178.patch -# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/6695 -Patch190: bind-9.11-rh2101712.patch -Patch191: bind-9.11-CVE-2022-2795.patch -# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7376 -Patch192: bind-9.11-rh2133889.patch -# https://gitlab.isc.org/isc-projects/bind9/commit/82185f4f80d2fa39a4569f6740cb360ffff8f5c4 -Patch193: bind-9.16-CVE-2022-3094-1.patch -Patch194: bind-9.16-CVE-2022-3094-2.patch -Patch195: bind-9.16-CVE-2022-3094-3.patch -Patch196: bind-9.16-CVE-2022-3094-test.patch -# https://gitlab.isc.org/isc-projects/bind9/commit/f1d9e9ee3859976f403914d20ad2a10855343702 -Patch197: bind-9.11-CVE-2023-2828.patch -Patch198: bind-9.16-CVE-2023-3341.patch -# https://issues.redhat.com/browse/RHEL-11785, downstream -Patch199: bind-9.11-stale-cache.patch -# https://gitlab.isc.org/isc-projects/bind9/commit/8924adca613ca9daea63786563cce6fdbd742c56 -Patch200: bind-9.16-update-b.root-servers.net.patch -# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/8768 -Patch201: bind-9.11-CVE-2023-4408.patch -# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/8769 -Patch202: bind-9.11-CVE-2023-50387.patch -# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/8778 -Patch203: bind-9.11-CVE-2023-2828-fixup.patch -# addition to patch 200 -Patch204: bind-9.11-CVE-2023-50387-fixup.patch -# https://gitlab.isc.org/isc-projects/bind9/commit/225f2861920b8f8d42a0ea6c34dd1faa93aa8726 -Patch205: bind-9.11-CVE-2024-1975.patch -# https://gitlab.isc.org/isc-projects/bind9/commit/3e0a67e4bdb253dae3a03a45c1aa117239a3313d -# https://gitlab.isc.org/isc-projects/bind9/commit/e4d7ce686bb38428eddc7e33b40057d68eca9a6e -# https://gitlab.isc.org/isc-projects/bind9/commit/b9b5485b22c364fb88c27aa04bad4c8f616da3fa -# https://gitlab.isc.org/isc-projects/bind9/commit/3f10d6eff035702796ba82cd28b9f7cf9836e743 -# https://gitlab.isc.org/isc-projects/bind9/commit/23a4652346fb2877d6246b1eebaa967969dbde16 -Patch206: bind-9.11-CVE-2024-1737.patch -# RH downstream, allow changing by environment -Patch208: bind-9.11-CVE-2024-1737-runtime-env.patch -# https://gitlab.isc.org/isc-projects/bind9/-/commit/c6e6a7af8ac6b575dd3657b0f5cf4248d734c2b0 -Patch209: bind-9.18-CVE-2024-11187-pre-test.patch -Patch210: bind-9.18-CVE-2024-11187.patch - -# SDB patches -Patch11: bind-9.3.2b2-sdbsrc.patch -Patch12: bind-9.10-sdb.patch - -# needs inpection -Patch17: bind-9.3.2b1-fix_sdb_ldap.patch -Patch18: bind-9.11-zone2ldap.patch - -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd +%{?systemd_ordering} +# https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers +%{?sysusers_requires_compat} Requires: coreutils -Requires(pre): shadow-utils Requires(post): shadow-utils Requires(post): glibc-common Requires(post): grep -Requires: bind-libs%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-libs-lite%{?_isa} = %{epoch}:%{version}-%{release} -Obsoletes: bind-config < 30:9.3.2-34.fc6 -Provides: bind-config = 30:9.3.2-34.fc6 -Obsoletes: caching-nameserver < 31:9.4.1-7.fc8 -Provides: caching-nameserver = 31:9.4.1-7.fc8 -Obsoletes: dnssec-conf < 1.27-2 -Provides: dnssec-conf = 1.27-2 -# Fixes of CVE-2023-50387 and CVE-2023-50868 caused ABI change -# Enforce updated rebuild is accepted only -Conflicts: bind-dyndb-ldap < 11.6-5 -Conflicts: dhcp-client < 12:4.3.6-50 -Conflicts: dhcp-server < 12:4.3.6-50 -Conflicts: dhcp-relay < 12:4.3.6-50 +Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} +Recommends: %{name}-utils %{name}-dnssec-utils +%upname_compat %{upname} +Obsoletes: %{name}-pkcs11 < 32:9.18.4-2 + BuildRequires: gcc, make BuildRequires: openssl-devel, libtool, autoconf, pkgconfig, libcap-devel +%if %{with OPENSSL_ENGINE} +# Not available in RHEL10+ +BuildRequires: openssl-devel-engine +%endif BuildRequires: libidn2-devel, libxml2-devel -BuildRequires: systemd -# needed for %%{__python3} macro -BuildRequires: python3-devel -BuildRequires: python3-ply +BuildRequires: systemd-rpm-macros +BuildRequires: selinux-policy BuildRequires: findutils sed -%if %{with SDB} -BuildRequires: openldap-devel, postgresql-devel, sqlite-devel, mariadb-connector-c-devel -%endif -%if %{with BDB} -BuildRequires: libdb-devel +BuildRequires: libnghttp2-devel +%if 0%{?fedora} +BuildRequires: jemalloc-devel +BuildRequires: gnupg2 %endif +BuildRequires: libuv-devel %if %{with UNITTEST} # make unit dependencies -BuildRequires: libcmocka-devel kyua +BuildRequires: libcmocka-devel %endif -%if %{with PKCS11} && (%{with UNITTEST} || %{with SYSTEMTEST}) +%if %{with UNITTEST} || %{with SYSTEMTEST} BuildRequires: softhsm %endif %if %{with SYSTEMTEST} # bin/tests/system dependencies BuildRequires: perl(Net::DNS) perl(Net::DNS::Nameserver) perl(Time::HiRes) perl(Getopt::Long) +BuildRequires: python3-dns # manual configuration requires this tool BuildRequires: iproute %endif @@ -267,9 +179,6 @@ BuildRequires: lmdb-devel %if %{with JSON} BuildRequires: json-c-devel %endif -%if %{with GEOIP} -BuildRequires: GeoIP-devel -%endif %if %{with GEOIP2} BuildRequires: libmaxminddb-devel %endif @@ -277,7 +186,14 @@ BuildRequires: libmaxminddb-devel BuildRequires: fstrm-devel protobuf-c-devel %endif # Needed to regenerate dig.1 manpage -BuildRequires: docbook-style-xsl, libxslt +%if %{with DOC} +BuildRequires: python3-sphinx python3-sphinx_rtd_theme +BuildRequires: doxygen +%endif +%if %{with DOCPDF} +# Because remaining issues with COPR, allow turning off PDF (re)generation +BuildRequires: python3-sphinx-latex latexmk texlive-xetex texlive-xindy +%endif %if %{with TSAN} BuildRequires: libtsan %endif @@ -289,86 +205,16 @@ which resolves host names to IP addresses; a resolver library (routines for applications to use when interfacing with DNS); and tools for verifying that the DNS server is operating properly. -%if %{with PKCS11} -%package pkcs11 -Summary: Bind with native PKCS#11 functionality for crypto -Requires: systemd -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-libs%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-libs-lite%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-pkcs11-libs%{?_isa} = %{epoch}:%{version}-%{release} - -%description pkcs11 -This is a version of BIND server built with native PKCS#11 functionality. -It is important to have SoftHSM v2+ installed and some token initialized. -For other supported HSM modules please check the BIND documentation. - -%package pkcs11-utils -Summary: Bind tools with native PKCS#11 for using DNSSEC -Requires: bind-pkcs11-libs%{?_isa} = %{epoch}:%{version}-%{release} -Obsoletes: bind-pkcs11 < 32:9.9.4-16.P2 - -%description pkcs11-utils -This is a set of PKCS#11 utilities that when used together create rsa -keys in a PKCS11 keystore. Also utilities for working with DNSSEC -compiled with native PKCS#11 functionality are included. - -%package pkcs11-libs -Summary: Bind libraries compiled with native PKCS#11 -Requires: bind-license = %{epoch}:%{version}-%{release} -Requires: bind-libs%{?_isa} = %{epoch}:%{version}-%{release} - -%description pkcs11-libs -This is a set of BIND libraries (dns, isc) compiled with native PKCS#11 -functionality. - -%package pkcs11-devel -Summary: Development files for Bind libraries compiled with native PKCS#11 -Requires: bind-pkcs11-libs%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-lite-devel%{?_isa} = %{epoch}:%{version}-%{release} - -%description pkcs11-devel -This a set of development files for BIND libraries (dns, isc) compiled -with native PKCS#11 functionality. -%endif - -%if %{with SDB} -%package sdb -Summary: BIND server with database backends and DLZ support -Requires: systemd -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-libs%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-libs-lite%{?_isa} = %{epoch}:%{version}-%{release} - -%description sdb -BIND (Berkeley Internet Name Domain) is an implementation of the DNS -(Domain Name System) protocols. BIND includes a DNS server (named-sdb) -which has compiled-in SDB (Simplified Database Backend) which includes -support for using alternative Zone Databases stored in an LDAP server -(ldapdb), a postgreSQL database (pgsqldb), an sqlite database (sqlitedb), -or in the filesystem (dirdb), in addition to the standard in-memory RBT -(Red Black Tree) zone database. It also includes support for DLZ -(Dynamic Loadable Zones) -%endif - -%package libs-lite -Summary: Libraries for working with the DNS protocol -Obsoletes:bind-libbind-devel < 31:9.3.3-4.fc7 -Provides: bind-libbind-devel = 31:9.3.3-4.fc7 -Requires: bind-license = %{epoch}:%{version}-%{release} - -%description libs-lite -Contains lite version of BIND suite libraries which are used by various -programs to work with DNS protocol. - %package libs Summary: Libraries used by the BIND DNS packages -Requires: bind-license = %{epoch}:%{version}-%{release} -Requires: bind-libs-lite%{?_isa} = %{epoch}:%{version}-%{release} +Requires: %{name}-license = %{epoch}:%{version}-%{release} +Provides: %{name}-libs-lite = %{epoch}:%{version}-%{release} +Obsoletes: %{name}-libs-lite < 32:9.16.13 +Obsoletes: %{name}-pkcs11-libs < 32:9.18.4-2 %description libs Contains heavyweight version of BIND suite libraries used by both named DNS -server and utilities in bind-utils package. +server and utilities in %{name}-utils package. %package license Summary: License of the BIND DNS suite @@ -379,9 +225,11 @@ Contains license of the BIND DNS suite. %package utils Summary: Utilities for querying DNS name servers -Requires: bind-libs%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-libs-lite%{?_isa} = %{epoch}:%{version}-%{release} -Requires: python3-bind = %{epoch}:%{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} +# For compatibility with Debian package +Provides: dnsutils = %{epoch}:%{version}-%{release} +Obsoletes: %{name}-pkcs11-utils < 32:9.18.4-2 +%upname_compat %{upname}-utils %description utils Bind-utils contains a collection of utilities for querying DNS (Domain @@ -390,25 +238,31 @@ hosts. These tools will provide you with the IP addresses for given host names, as well as other information about registered domains and network addresses. -You should install bind-utils if you need to get information from DNS name +You should install %{name}-utils if you need to get information from DNS name servers. +%package dnssec-utils +Summary: DNSSEC keys and zones management utilities +Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} +Recommends: %{name}-utils +Obsoletes: python3-%{name} < 32:9.18.0 +Obsoletes: %{name}-dnssec-doc < 32:9.18.4-2 +%upname_compat %{upname}-dnssec-utils + +%description dnssec-utils +%{name}-dnssec-utils contains a collection of utilities for editing +DNSSEC keys and BIND zone files. These tools provide generation, +revocation and verification of keys and DNSSEC signatures in zone files. + +You should install %{name}-dnssec-utils if you need to sign a DNS zone +or maintain keys for it. + %package devel -Summary: Header files and libraries needed for BIND DNS development -Obsoletes:bind-libbind-devel < 31:9.3.3-4.fc7 -Provides: bind-libbind-devel = 31:9.3.3-4.fc7 -Requires: bind-libs%{?_isa} = %{epoch}:%{version}-%{release} -Requires: bind-lite-devel%{?_isa} = %{epoch}:%{version}-%{release} - -%description devel -The bind-devel package contains full version of the header files and libraries -required for development with ISC BIND 9 - -%package lite-devel -Summary: Lite version of header files and libraries needed for BIND DNS development -Requires: bind-libs-lite%{?_isa} = %{epoch}:%{version}-%{release} +Summary: Header files and libraries needed for bind-dyndb-ldap +Provides: %{name}-lite-devel = %{epoch}:%{version}-%{release} +Obsoletes: %{name}-lite-devel < 32:9.16.6-3 +Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} Requires: openssl-devel%{?_isa} libxml2-devel%{?_isa} -# Not required by headers, but "isc-config.sh --libs isc" requires it Requires: libcap-devel%{?_isa} %if %{with GSSTSIG} Requires: krb5-devel%{?_isa} @@ -422,103 +276,32 @@ Requires: json-c-devel%{?_isa} %if %{with DNSTAP} Requires: fstrm-devel%{?_isa} protobuf-c-devel%{?_isa} %endif +%if %{with GEOIP2} +Requires: libmaxminddb-devel%{?_isa} +%endif -%description lite-devel -The bind-lite-devel package contains lite version of the header -files and libraries required for development with ISC BIND 9 +%description devel +The %{name}-devel package contains full version of the header files and libraries +required for building bind-dyndb-ldap. Upstream no longer supports nor recommends +bind libraries for third party applications. %package chroot Summary: A chroot runtime environment for the ISC BIND DNS server, named(8) Prefix: %{chroot_prefix} # grep is required due to setup-named-chroot.sh script Requires: grep -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} +Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} %description chroot This package contains a tree of files which can be used as a chroot(2) jail for the named(8) program from the BIND package. Based on the code from Jan "Yenya" Kasprzak -%if %{with SDB} -%package sdb-chroot -Summary: A chroot runtime environment for the ISC BIND DNS server, named-sdb(8) -Prefix: %{chroot_sdb_prefix} -# grep is required due to setup-named-chroot.sh script -Requires: grep -Requires: bind-sdb%{?_isa} = %{epoch}:%{version}-%{release} - -%description sdb-chroot -This package contains a tree of files which can be used as a -chroot(2) jail for the named-sdb(8) program from the BIND package. -Based on the code from Jan "Yenya" Kasprzak -%endif - - -%if %{with DLZ} -%if %{with BDB} -%package dlz-bdb -Summary: BIND server bdb DLZ module -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} - -%description dlz-bdb -Dynamic Loadable Zones module for BIND server. - -%end - -%endif - -%package dlz-filesystem -Summary: BIND server filesystem DLZ module -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} - -%description dlz-filesystem -Dynamic Loadable Zones module for BIND server. - -%package dlz-ldap -Summary: BIND server ldap DLZ module -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} - -%description dlz-ldap -Dynamic Loadable Zones module for BIND server. - -%package dlz-mysql -Summary: BIND server mysql DLZ module -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} - -%description dlz-mysql -Dynamic Loadable Zones module for BIND server. - -%package dlz-mysqldyn -Summary: BIND server mysqldyn DLZ module -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} - -%description dlz-mysqldyn -Dynamic Loadable Zones module for BIND server. - -%package dlz-sqlite3 -Summary: BIND server sqlite3 DLZ module -Requires: bind%{?_isa} = %{epoch}:%{version}-%{release} - -%description dlz-sqlite3 -Dynamic Loadable Zones module for BIND server. -%endif - - -%package -n python3-bind -Summary: A module allowing rndc commands to be sent from Python programs -Requires: bind-license = %{epoch}:%{version}-%{release} -Requires: %{?__python3} python3-ply %{?py3_dist:%py3_dist ply} -BuildArch: noarch -%{?python_provide:%python_provide python3-bind} -%{?python_provide:%python_provide python3-isc} - -%description -n python3-bind -This package provides a module which allows commands to be sent to rndc directly from Python programs. - %if %{with DOC} %package doc Summary: BIND 9 Administrator Reference Manual -Requires: bind-license = %{epoch}:%{version}-%{release} +Requires: %{name}-license = %{epoch}:%{version}-%{release} +Requires: python3-sphinx_rtd_theme BuildArch: noarch %description doc @@ -532,161 +315,34 @@ This package contains BIND 9 Administrator Reference Manual in HTML and PDF format. %end -%endif +%pretrans doc -p +paths = { + '%{_pkgdocdir}/html/_static/css', + '%{_pkgdocdir}/html/_static/js' +} +for _, path in ipairs(paths) do + st = posix.stat(path) + if st and st.type == "link" then + os.remove(path) + end +end -%if %{with EXPORT_LIBS} -%package export-libs -Summary: ISC libs for DHCP application -%if 0%{?fedora} >= 1 -Obsoletes: bind99-libs < 9.9.11-4 -Provides: bind99-libs = 9.9.11-4 -# This subpackage will not use shared license, but distribute its own -%endif - -%description export-libs -BIND (Berkeley Internet Name Domain) is an implementation of the DNS -(Domain Name System) protocols. This package set contains only export -version of BIND libraries, that are used for building ISC DHCP. - -%package export-devel -Summary: Header files and libraries needed for BIND export libraries -Requires: %{name}-export-libs%{?_isa} = %{epoch}:%{version}-%{release} -Requires: openssl-devel -Requires: libcap-devel - -%if 0%{?fedora} >= 1 -Obsoletes: bind99-devel < 9.9.11-4 -# To prevent linking against wrong set of libraries, -# do not coexist with bind99-devel -Conflicts: bind99-devel -%endif - -%description export-devel -This package contains export version of the header files and libraries -required for development with ISC BIND. These headers and libraries -are used for building ISC DHCP. %endif %prep -%setup -q -n %{name}-%{BINDVERSION} - -# Common patches -%patch -P 10 -p1 -b .PIE -%patch -P 16 -p1 -b .redhat_doc -%ifnarch alpha ia64 -%patch -P 72 -p1 -b .64bit +%if 0%{?fedora} +# RHEL does not yet support this verification +%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE2}' --data='%{SOURCE0}' %endif -%patch -P 102 -p1 -b .rh452060 -%patch -P 106 -p1 -b .rh490837 -%patch -P 109 -p1 -b .rh478718 -%patch -P 112 -p1 -b .rh645544 -%patch -P 130 -p1 -b .libdb -%patch -P 131 -p1 -b .multlib-conflict -%patch -P 140 -p1 -b .rh1410433 -%patch -P 145 -p1 -b .rh1205168 -%patch -P 153 -p1 -b .export_suffix -%patch -P 154 -p1 -b .oot-man -%patch -P 155 -p1 -b .pk11-internal -%patch -P 156 -p1 -b .fips-code -%patch -P 157 -p1 -b .fips-tests -%patch -P 159 -p1 -b .host-idn-disable -%patch -P 164 -p1 -b .fips-includes -%patch -P 165 -p1 -b .rt31459 -%patch -P 166 -p1 -b .rt46047 -%patch -P 167 -p1 -b .rh1668682 -%patch -P 168 -p1 -b .random_test-disable -%patch -P 174 -p1 -b .rh1737407 -%patch -P 175 -p1 -b .json-c -%patch -P 177 -p1 -b .serve-stale -%patch -P 178 -p1 -b .time-monotonic -%patch -P 183 -p1 -b .rh1980757 -%patch -P 184 -p1 -b .rh2030239 -%patch -P 185 -p1 -b .CVE-2021-25220 -%patch -P 186 -p1 -b .CVE-2021-25220-test -%patch -P 188 -p1 -b .CVE-2022-38177 -%patch -P 189 -p1 -b .CVE-2022-38178 -%patch -P 190 -p1 -b .rh2101712 -%patch -P 191 -p1 -b .CVE-2022-2795 -%patch -P 192 -p1 -b .rh2133889 -%patch -P 193 -p1 -b .CVE-2022-3094 -%patch -P 194 -p1 -b .CVE-2022-3094 -%patch -P 195 -p1 -b .CVE-2022-3094 -%patch -P 196 -p1 -b .CVE-2022-3094-test -%patch -P 197 -p1 -b .CVE-2023-2828 -%patch -P 198 -p1 -b .CVE-2023-3341 -%patch -P 199 -p1 -b .RHEL-11785 -%patch -P 200 -p1 -b .b.root-servers.net -%patch -P 201 -p1 -b .CVE-2023-4408 -%patch -P 202 -p1 -b .CVE-2023-50387+50868 -%patch -P 203 -p1 -b .CVE-2023-2828-fixup -%patch -P 204 -p1 -b .CVE-2023-50387-fixup -%patch -P 205 -p1 -b .CVE-2024-1975 -%patch -P 206 -p1 -b .CVE-2024-1737 -%patch -P 208 -p1 -b .CVE-2024-1737-env -%patch -P 209 -p1 -b .CVE-2024-11187-pre-test -%patch -P 210 -p1 -b .CVE-2024-11187 - -mkdir lib/dns/tests/testdata/dstrandom -cp -a %{SOURCE50} lib/dns/tests/testdata/dstrandom/random.data - -# Avoid having [FIXME: manual] on top of generated manual pages -# Alternative approach due missing docbook5 style sheets. -# Remove namespace, so docbook is threated as version 4. -# Spaces should be fine. -# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/4524 -find bin lib/lwres/man -name '*.docbook' -exec \ - sed -e 's|BIND9|BIND9|' \ - -e 's|xmlns="http://docbook.org/ns/docbook"\sversion="5.0"\s||' \ - -i '{}' ';' - -%if %{with PKCS11} -%patch -P 150 -p1 -b .engine-pkcs11 -cp -r bin/named{,-pkcs11} -cp -r bin/dnssec{,-pkcs11} -cp -r lib/isc{,-pkcs11} -cp -r lib/dns{,-pkcs11} -%patch -P 136 -p1 -b .dist_pkcs11 -%patch -P 149 -p1 -b .kyua-pkcs11 -%endif - -%if %{with SDB} -%patch -P 101 -p1 -b .old-api -mkdir bin/named-sdb -cp -r bin/named/* bin/named-sdb -%patch -P 11 -p1 -b .sdbsrc -# SDB ldap -cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named-sdb -# SDB postgreSQL -cp -fp contrib/sdb/pgsql/pgsqldb.[ch] bin/named-sdb -# SDB sqlite -cp -fp contrib/sdb/sqlite/sqlitedb.[ch] bin/named-sdb -# SDB Berkeley DB - needs to be ported to DB4! -#cp -fp contrib/sdb/bdb/bdb.[ch] bin/named_sdb -# SDB dir -cp -fp contrib/sdb/dir/dirdb.[ch] bin/named-sdb -# SDB tools -mkdir -p bin/sdb_tools -cp -fp %{SOURCE30} bin/sdb_tools/ldap2zone.c -cp -fp %{SOURCE7} bin/sdb_tools/Makefile.in -#cp -fp contrib/sdb/bdb/zone2bdb.c bin/sdb_tools -cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/sdb_tools -cp -fp contrib/sdb/pgsql/zonetodb.c bin/sdb_tools -cp -fp contrib/sdb/sqlite/zone2sqlite.c bin/sdb_tools -%patch -P 12 -p1 -b .sdb -%patch -P 17 -p1 -b .fix_sdb_ldap -%patch -P 18 -p1 -b .fix_zone2ldap -%patch -P 137 -p1 -b .strlcat_fix -%endif - -%patch -P 133 -p1 -b .rh640538 -%patch -P 134 -p1 -b .rh669163 +%autosetup -n %{upname}-%{version} -p1 # Sparc and s390 arches need to use -fPIE %ifarch sparcv9 sparc64 s390 s390x -for i in bin/named{,-sdb}/{,unix}/Makefile.in; do +for i in bin/named/Makefile.am; do sed -i 's|fpie|fPIE|g' $i done %endif + :; @@ -696,71 +352,48 @@ done # normal and pkcs11 unit tests %define unit_prepare_build() \ - cp -uv Kyuafile "%{1}/" \ find lib -name 'K*.key' -exec cp -uv '{}' "%{1}/{}" ';' \ - find lib -name 'Kyuafile' -exec cp -uv '{}' "%{1}/{}" ';' \ find lib -name 'testdata' -type d -exec cp -Tav '{}' "%{1}/{}" ';' \ find lib -name 'testkeys' -type d -exec cp -Tav '{}' "%{1}/{}" ';' \ %define systemtest_prepare_build() \ cp -Tuav bin/tests "%{1}/bin/tests/" \ - cp -uv version "%{1}" \ -CFLAGS="$CFLAGS $RPM_OPT_FLAGS" +%if %{with OPENSSL_ENGINE} +CPPFLAGS="$CPPFLAGS -DOPENSSL_API_COMPAT=10100" +%else +CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_ENGINE=1" +%endif %if %{with TSAN} CFLAGS+=" -O1 -fsanitize=thread -fPIE -pie" %endif -export CFLAGS -export CPPFLAGS="$CPPFLAGS -DDIG_SIGCHASE" +export CFLAGS CPPFLAGS export STD_CDEFINES="$CPPFLAGS" sed -i -e \ -'s/RELEASEVER=\(.*\)/RELEASEVER=\1-RedHat-%{version}-%{release}/' \ -version +'s/([bind_VERSION_EXTRA],\s*\([^)]*\))/([bind_VERSION_EXTRA], \1-RH)/' \ +configure.ac -libtoolize -c -f; aclocal -I libtool.m4 --force; autoconf -f +autoreconf --force --install mkdir build + pushd build LIBDIR_SUFFIX= export LIBDIR_SUFFIX %configure \ - --with-python=%{__python3} \ - --with-libtool \ - --localstatedir=/var \ - --enable-threads \ - --enable-ipv6 \ - --enable-filter-aaaa \ + --localstatedir=%{_var} \ --with-pic \ --disable-static \ --includedir=%{_includedir}/bind9 \ --with-tuning=large \ --with-libidn2 \ - --enable-openssl-hash \ -%if %{with GEOIP} - --with-geoip \ -%endif %if %{with GEOIP2} - --with-geoip2 \ -%endif -%if %{with PKCS11} - --enable-native-pkcs11 \ - --with-pkcs11=%{_libdir}/pkcs11/libsofthsm2.so \ -%endif -%if %{with SDB} - --with-dlopen=yes \ - --with-dlz-ldap=yes \ - --with-dlz-postgres=yes \ - --with-dlz-mysql=yes \ - --with-dlz-filesystem=yes \ -%endif -%if %{with BDB} - --with-dlz-bdb=yes \ + --with-maxminddb \ %endif %if %{with GSSTSIG} --with-gssapi=yes \ - --disable-isc-spnego \ %endif %if %{with LMDB} --with-lmdb=yes \ @@ -768,155 +401,48 @@ export LIBDIR_SUFFIX --with-lmdb=no \ %endif %if %{with JSON} - --with-libjson \ + --with-json-c \ %endif %if %{with DNSTAP} --enable-dnstap \ -%else - --disable-dnstap \ %endif %if %{with UNITTEST} --with-cmocka \ %endif --enable-fixed-rrset \ - --with-docbook-xsl=%{_datadir}/sgml/docbook/xsl-stylesheets \ --enable-full-report \ + CPPFLAGS="$CPPFLAGS" \ ; %if %{with DNSTAP} pushd lib SRCLIB="../../../lib" (cd dns && ln -s ${SRCLIB}/dns/dnstap.proto) -%if %{with PKCS11} - (cd dns-pkcs11 && ln -s ${SRCLIB}/dns-pkcs11/dnstap.proto) -%endif popd %endif -make %{?_smp_mflags} -### FIXME hack!!! -### xsltproc doesn't find properly configured files -### and use ones from source tree -### copy generated files to the original location -cp -rv doc/* ../doc/ +%if %{with DOCPDF} +# avoid using home for pdf latex files +export TEXMFVAR="`pwd`" +export TEXMFCONFIG="`pwd`" +fmtutil-user --listcfg || : +fmtutil-user --missing || : +%endif - -# Regenerate dig.1 manpage -pushd bin/dig -make man -popd -pushd bin/python -make man -popd +%make_build %if %{with DOC} - # Does not work. Use upstream generated documentation instead. - # make doc + make doc %endif -%if %{with DLZ} - pushd contrib/dlz - pushd modules - for DIR in filesystem ldap mysql mysqldyn sqlite3; do - make -C $DIR CFLAGS="-fPIC -I../include $CFLAGS $LDFLAGS" - done - popd - %if %{with BDB} - pushd bin/dlzbdb - make - popd - pushd modules - make -C bdbhpt CFLAGS="-fPIC -I../include $CFLAGS $LDFLAGS" - popd - %endif - popd -%endif popd # build %unit_prepare_build build %systemtest_prepare_build build -%if %{with EXPORT_LIBS} -cp isc-config.sh.1 isc-export-config.sh.1 - -## Create export libs ## -mkdir -p export-libs -pushd export-libs -LIBDIR_SUFFIX=%{_export_dir} -export LIBDIR_SUFFIX -## minimal subset of options to make clients aka dhcp working -%{configure} \ - --with-libtool \ - --disable-static \ - --disable-epoll \ - --disable-kqueue \ - --libdir=%{_libdir}%{_export_dir} \ - --includedir=%{_includedir}%{_export_dir}/ \ - --disable-threads \ - --enable-openssl-hash \ -%if %{with GSSTSIG} - --with-gssapi=yes \ - --disable-isc-spnego \ -%endif -%if %{with UNITTEST} - --with-cmocka \ -%endif - --enable-fixed-rrset \ - --disable-rpz-nsip \ - --disable-rpz-nsdname \ - --without-lmdb \ - --without-libxml2 \ - --without-libjson \ - --without-zlib \ - --without-dlopen \ - --enable-full-report - -## We don't want to build other libs than -export twice -## FIXME this should be in patch instead of SED'ing -## but do we really like/want to patch generated files? - -mv isc-config.sh isc-export-config.sh - -sed -i \ --e '/^SUBDIRS =/s/.*/SUBDIRS = make lib/i' \ --e 's/isc-config.sh/isc-export-config.sh/g' \ --e 's/bind9-config/bind9-export-config/g' \ -Makefile - -sed -i -e \ -"/^SUBDIRS =/s/.*/SUBDIRS = %{bind_export_libs}/i" \ -lib/Makefile - -for lib in %{bind_export_libs} -do - find . -name Makefile -exec sed "s/lib${lib}\./lib${lib}-export\./g" -i {} \; - sed -e "s/-l${lib}\([^[:alpha:]]\)/-l${lib}-export\1/g" \ - -e "s/lib${lib}\./lib${lib}-export\./g" \ - -i isc-export-config.sh -done; - -make %{?_smp_mflags} -popd - -# export library unit tests -%unit_prepare_build export-libs -# Test just compiled libraries -for lib in %{bind_export_libs} -do - sed -e "s,^\s*include(.*${lib}/.*,-- use &," \ - -i export-libs/lib/Kyuafile -done - -sed -e "/^\s*include(/ d" -e 's/^-- use //' \ - -i export-libs/lib/Kyuafile - -## End of export libs -%endif - %check -%if %{with PKCS11} && (%{with UNITTEST} || %{with SYSTEMTEST}) +%if %{with UNITTEST} || %{with SYSTEMTEST} # Tests require initialization of pkcs11 token - export SOFTHSM2_CONF="`pwd`/softhsm2.conf" - sh %{SOURCE48} "${SOFTHSM2_CONF}" "`pwd`/softhsm-tokens" + eval "$(bash %{SOURCE48} -A "`pwd`/softhsm-tokens")" %endif %if %{with TSAN} @@ -925,23 +451,27 @@ export TSAN_OPTIONS="log_exe_name=true log_path=ThreadSanitizer exitcode=0" %if %{with UNITTEST} pushd build - make unit - e=$? + CPUS=$(lscpu -p=cpu,core | grep -v '^#' | wc -l) + THREADS="$CPUS" +%if %{without UNITTEST_ALL} + export CI=true +%endif + if [ "$CPUS" -gt 16 ]; then + ORIGFILES=$(ulimit -n) + THREADS=16 + ulimit -n 8092 || : # Requires on some machines with many cores + fi + e=0 + make unit -j${THREADS} || e=$? + # Display details of failure + cat tests/*/test-suite.log if [ "$e" -ne 0 ]; then echo "ERROR: this build of BIND failed 'make unit'. Aborting." exit $e; fi; + [ "$CPUS" -gt 16 ] && ulimit -n $ORIGFILES || : popd - - pushd export-libs - make unit - e=$? - if [ "$e" -ne 0 ]; then - echo "ERROR: this build of BIND export-libs failed 'make unit'. Aborting." - exit $e; - fi; - popd - +## End of UNITTEST %endif %if %{with SYSTEMTEST} @@ -960,7 +490,7 @@ then set -e pushd build/bin/tests chown -R ${USER} . # Can be unknown user - make test %{?_smp_mflags} 2>&1 | tee test.log + %make_build test 2>&1 | tee test.log e=$? popd [ "$CONFIGURED" = build ] && sh bin/tests/system/ifconfig.sh down @@ -977,7 +507,7 @@ fi %install # Build directory hierarchy mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d -mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/bind +mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/{bind,named} mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/named/{slaves,data,dynamic} mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/{man1,man5,man8} mkdir -p ${RPM_BUILD_ROOT}/run/named @@ -998,38 +528,10 @@ popd touch ${RPM_BUILD_ROOT}/%{chroot_prefix}%{_sysconfdir}/named.conf #end chroot -#sdb-chroot -%if %{with SDB} -for D in %{chroot_create_directories} -do - mkdir -p ${RPM_BUILD_ROOT}/%{chroot_sdb_prefix}${D} -done - -# create symlink as it is on real filesystem -pushd ${RPM_BUILD_ROOT}/%{chroot_sdb_prefix}%{_localstatedir} -ln -s ../run run -popd - -# these are required to prevent them being erased during upgrade of previous -touch ${RPM_BUILD_ROOT}/%{chroot_sdb_prefix}%{_sysconfdir}/named.conf -%endif -#end sdb-chroot - pushd build -make DESTDIR=${RPM_BUILD_ROOT} install +%make_install popd -%if %{with EXPORT_LIBS} -pushd export-libs -make DESTDIR=${RPM_BUILD_ROOT} install -mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/ld.so.conf.d -echo "%{_libdir}/%{_export_dir}" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-export-%{_arch}.conf -cp -fp config.h ${RPM_BUILD_ROOT}/%{_includedir}%{_export_dir} -rm -rf ${RPM_BUILD_ROOT}/%{_includedir}%{_export_dir}/pkcs11/ -rm -f ${RPM_BUILD_ROOT}/%{_includedir}%{_export_dir}/pk11/{constants,internal,pk11,result}.h -popd -%endif - # Remove unwanted files rm -f ${RPM_BUILD_ROOT}/etc/bind.keys @@ -1040,92 +542,65 @@ install -m 644 %{SOURCE38} ${RPM_BUILD_ROOT}%{_unitdir} install -m 644 %{SOURCE44} ${RPM_BUILD_ROOT}%{_unitdir} install -m 644 %{SOURCE46} ${RPM_BUILD_ROOT}%{_unitdir} -%if %{with SDB} -install -m 644 %{SOURCE39} ${RPM_BUILD_ROOT}%{_unitdir} -install -m 644 %{SOURCE40} ${RPM_BUILD_ROOT}%{_unitdir} -install -m 644 %{SOURCE45} ${RPM_BUILD_ROOT}%{_unitdir} -%endif - -%if %{with PKCS11} -install -m 644 %{SOURCE47} ${RPM_BUILD_ROOT}%{_unitdir} -%endif +mkdir -p ${RPM_BUILD_ROOT}%{_sysusersdir} +install -m 644 %{SOURCE50} ${RPM_BUILD_ROOT}%{_sysusersdir}/named.conf mkdir -p ${RPM_BUILD_ROOT}%{_libexecdir} install -m 755 %{SOURCE41} ${RPM_BUILD_ROOT}%{_libexecdir}/setup-named-chroot.sh install -m 755 %{SOURCE42} ${RPM_BUILD_ROOT}%{_libexecdir}/generate-rndc-key.sh -%if %{with PKCS11} install -m 755 %{SOURCE48} ${RPM_BUILD_ROOT}%{_libexecdir}/setup-named-softhsm.sh -%endif install -m 644 %SOURCE3 ${RPM_BUILD_ROOT}/etc/logrotate.d/named mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig install -m 644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/named install -m 644 %{SOURCE49} ${RPM_BUILD_ROOT}%{_sysconfdir}/named-chroot.files -%if %{with SDB} -mkdir -p ${RPM_BUILD_ROOT}/etc/openldap/schema -install -m 644 %{SOURCE8} ${RPM_BUILD_ROOT}/etc/openldap/schema/dnszone.schema -install -m 644 %{SOURCE12} contrib/sdb/pgsql/ -%endif -%if %{with DLZ} - pushd contrib/dlz - pushd modules - for DIR in filesystem ldap mysql mysqldyn sqlite3; do - make -C $DIR DESTDIR=${RPM_BUILD_ROOT} libdir=%{_libdir}/bind install - done - mv mysqldyn/testing/README mysqldyn/testing/README.testing - %if %{with BDB} - make -C bdbhpt DESTDIR=${RPM_BUILD_ROOT} libdir=%{_libdir}/bind install - %endif - popd - %if %{with BDB} - pushd bin/dlzbdb - make DESTDIR=${RPM_BUILD_ROOT} install - popd - %endif - popd -%endif - -# Install isc/errno2result.h header -install -m 644 lib/isc/unix/errno2result.h ${RPM_BUILD_ROOT}%{_includedir}/bind9/isc - -pushd build -# Files required to run test-suite outside of build tree: -cp -fp config.h ${RPM_BUILD_ROOT}/%{_includedir}/bind9 +pushd ${RPM_BUILD_ROOT}%{_sbindir} +# Compatibility with previous major versions, only for selected binaries +for BIN in named-checkconf named-checkzone named-compilezone +do + ln -s ../bin/$BIN $BIN +done popd # Remove libtool .la files: find ${RPM_BUILD_ROOT}/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';'; - -# SDB manpages -%if %{with SDB} -install -m 644 %{SOURCE31} ${RPM_BUILD_ROOT}%{_mandir}/man1/ldap2zone.1 -install -m 644 %{SOURCE32} ${RPM_BUILD_ROOT}%{_mandir}/man8/named-sdb.8 -install -m 644 %{SOURCE33} ${RPM_BUILD_ROOT}%{_mandir}/man1/zonetodb.1 -install -m 644 %{SOURCE34} ${RPM_BUILD_ROOT}%{_mandir}/man1/zone2sqlite.1 +# 9.16.4 installs even manual pages for tools not generated +%if %{without DNSTAP} +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/dnstap-read.1* || true +%endif +%if %{without LMDB} +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man8/named-nzd2nzf.8* || true %endif -# PKCS11 versions manpages -%if %{with PKCS11} pushd ${RPM_BUILD_ROOT}%{_mandir}/man8 -ln -s named.8.gz named-pkcs11.8.gz -ln -s dnssec-checkds.8.gz dnssec-checkds-pkcs11.8.gz -ln -s dnssec-dsfromkey.8.gz dnssec-dsfromkey-pkcs11.8.gz -ln -s dnssec-importkey.8.gz dnssec-importkey-pkcs11.8.gz -ln -s dnssec-keyfromlabel.8.gz dnssec-keyfromlabel-pkcs11.8.gz -ln -s dnssec-keygen.8.gz dnssec-keygen-pkcs11.8.gz -ln -s dnssec-revoke.8.gz dnssec-revoke-pkcs11.8.gz -ln -s dnssec-settime.8.gz dnssec-settime-pkcs11.8.gz -ln -s dnssec-signzone.8.gz dnssec-signzone-pkcs11.8.gz -ln -s dnssec-verify.8.gz dnssec-verify-pkcs11.8.gz +ln -s ddns-confgen.8.gz tsig-keygen.8.gz +popd +pushd ${RPM_BUILD_ROOT}%{_mandir}/man1 +ln -s named-checkzone.1.gz named-compilezone.1.gz popd -%endif %if %{with DOC} mkdir -p ${RPM_BUILD_ROOT}%{_pkgdocdir} -cp -a doc/arm/*.html doc/arm/*.pdf ${RPM_BUILD_ROOT}%{_pkgdocdir} +cp -a build/doc/arm/_build/html ${RPM_BUILD_ROOT}%{_pkgdocdir} +rm -rf ${RPM_BUILD_ROOT}%{_pkgdocdir}/html/.{buildinfo,doctrees} +# Backward compatible link to 9.11 documentation +(cd ${RPM_BUILD_ROOT}%{_pkgdocdir} && ln -s html/index.html Bv9ARM.html) +# Share static data from original sphinx package +for DIR in %{python3_sitelib}/sphinx_rtd_theme/static/* +do + BASE=$(basename -- "$DIR") + BINDTHEMEDIR="${RPM_BUILD_ROOT}%{_pkgdocdir}/html/_static/$BASE" + if [ -d "$BINDTHEMEDIR" ]; then + rm -rf "$BINDTHEMEDIR" + ln -sr "${RPM_BUILD_ROOT}${DIR}" "$BINDTHEMEDIR" + fi +done +%endif +%if %{with DOCPDF} +cp -p build/doc/arm/_build/latex/Bv9ARM.pdf ${RPM_BUILD_ROOT}%{_pkgdocdir} %endif # Ghost config files: @@ -1168,8 +643,7 @@ install -m 644 %{SOURCE43} ${RPM_BUILD_ROOT}%{_sysconfdir}/rwtab.d/named %pre if [ "$1" -eq 1 ]; then - /usr/sbin/groupadd -g %{bind_gid} -f -r named >/dev/null 2>&1 || :; - /usr/sbin/useradd -u %{bind_uid} -r -N -M -g named -s /bin/false -d /var/named -c Named named >/dev/null 2>&1 || :; + %sysusers_create_compat %{SOURCE50} fi; :; @@ -1183,14 +657,18 @@ if [ "$1" -eq 1 ]; then [ -e /etc/rndc.key ] && chmod 0640 /etc/rndc.key else # Upgrade, use invalid shell - if getent passwd named | grep ':/sbin/nologin$' >/dev/null; then - usermod -s /bin/false named + if getent passwd named | grep ':/bin/false$' >/dev/null; then + /sbin/usermod -s /sbin/nologin named fi # Checkconf will parse out comments - if /usr/sbin/named-checkconf -p /etc/named.conf 2>/dev/null | grep -q named.iscdlv.key + if /usr/bin/named-checkconf -p /etc/named.conf 2>/dev/null | grep -q named.iscdlv.key then echo "Replacing obsolete named.iscdlv.key with named.root.key..." - sed -e 's|/etc/named\.iscdlv\.key|/etc/named.root.key|' -i.rpmbackup /etc/named.conf + if cp -Rf --preserve=all --remove-destination /etc/named.conf /etc/named.conf.rpmbackup; then + sed -e 's/named\.iscdlv\.key/named.root.key/' \ + /etc/named.conf.rpmbackup > /etc/named.conf || \ + mv /etc/named.conf.rpmbackup /etc/named.conf + fi fi fi %systemd_post named.service @@ -1205,72 +683,11 @@ fi # Package upgrade, not uninstall %systemd_postun_with_restart named.service -%if %{with SDB} -%post sdb -# Initial installation -%systemd_post named-sdb.service - -%preun sdb -# Package removal, not upgrade -%systemd_preun named-sdb.service - -%postun sdb -# Package upgrade, not uninstall -%systemd_postun_with_restart named-sdb.service -%endif - -%if %{with PKCS11} -%post pkcs11 -# Initial installation -%systemd_post named-pkcs11.service - -%preun pkcs11 -# Package removal, not upgrade -%systemd_preun named-pkcs11.service - -%postun pkcs11 -# Package upgrade, not uninstall -%systemd_postun_with_restart named-pkcs11.service -%endif - -%triggerin -- selinux-policy < 3.14.1-44 -# Failsafe for upgrades, set to new default -if [ -x "%{_sbindir}/selinuxenabled" -a -x "%{_sbindir}/setsebool" ] && %{_sbindir}/selinuxenabled; then - "%{_sbindir}/setsebool" -P named_write_master_zones=1 -fi -%end - -%triggerpostun -n bind -- bind <= 32:9.5.0-20.b1 -if [ "$1" -gt 0 ]; then - [ -e /etc/rndc.key ] && chown root:named /etc/rndc.key - [ -e /etc/rndc.key ] && chmod 0640 /etc/rndc.key -fi -:; - -%triggerun -- bind < 32:9.9.0-0.6.rc1 -/sbin/chkconfig --del named >/dev/null 2>&1 || : -/bin/systemctl try-restart named.service >/dev/null 2>&1 || : - -%ldconfig_scriptlets libs -%ldconfig_scriptlets libs-lite - -%if %{with PKCS11} -%ldconfig_scriptlets pkcs11-libs -%endif - -%if %{with EXPORT_LIBS} -%post export-libs -p /sbin/ldconfig -%end - -%postun export-libs -p /sbin/ldconfig -%end -%endif - # Fix permissions on existing device files on upgrade %define chroot_fix_devices() \ if [ $1 -gt 1 ]; then \ for DEV in "%{1}/dev"/{null,random,zero}; do \ - if [ -e "$DEV" ] && [ "$(/bin/stat --printf="%G %a" "$DEV")" = "root 644" ]; \ + if [ -e "$DEV" -a "$(/bin/stat --printf="%G %a" "$DEV")" = "root 644" ]; \ then \ /bin/chmod 0664 "$DEV" \ /bin/chgrp named "$DEV" \ @@ -1278,6 +695,23 @@ if [ $1 -gt 1 ]; then \ done \ fi +%triggerun -- bind < 32:9.9.0-0.6.rc1 +/sbin/chkconfig --del named >/dev/null 2>&1 || : +/bin/systemctl try-restart named.service >/dev/null 2>&1 || : + +%triggerpostun -- bind < 32:9.18.4-2, selinux-policy, policycoreutils +if [ -x %{_sbindir}/selinuxenabled ] && [ -x %{_sbindir}/getsebool ] && [ -x %{_sbindir}/setsebool ] \ + && %{_sbindir}/selinuxenabled && [ -x %{_sbindir}/named ]; then + # Return master zones after upgrade from selinux_booleans version + WRITEBOOL="$(LC_ALL=C %{_sbindir}/getsebool named_write_master_zones)" + if [ "echo ${WRITEBOOL#named_write_master_zones --> }" = "off" ]; then + echo "Restoring new sebool default of named_write_master_zones..." + %{_sbindir}/setsebool -P named_write_master_zones=1 || : + fi +fi + +%ldconfig_scriptlets libs + %post chroot %systemd_post named-chroot.service %chroot_fix_devices %{chroot_prefix} @@ -1299,64 +733,41 @@ fi; %systemd_postun_with_restart named-chroot.service -%if %{with SDB} - -%post sdb-chroot -%systemd_post named-sdb-chroot.service -%chroot_fix_devices %{chroot_sdb_prefix} -:; - -%posttrans sdb-chroot -if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then - [ -x /sbin/restorecon ] && /sbin/restorecon %{chroot_sdb_prefix}/dev/* > /dev/null 2>&1; -fi; -:; - -%preun sdb-chroot -%systemd_preun named-sdb-chroot.service -:; - -%postun sdb-chroot -# Package upgrade, not uninstall -%systemd_postun_with_restart named-sdb-chroot.service - -%endif - -%clean -rm -rf ${RPM_BUILD_ROOT} -:; - %files -%{_libdir}/bind +# TODO: Move from lib/bind to lib/named, as used by upstream +# FIXME: current build targets filters into %%_libdir/bind again? +%dir %{_libdir}/bind +%{_libdir}/bind/filter*.so +%dir %{_libdir}/named %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/sysconfig/named %config(noreplace) %attr(0644,root,named) %{_sysconfdir}/named.root.key +%config(noreplace) %{_sysconfdir}/logrotate.d/named %{_tmpfilesdir}/named.conf %{_sysconfdir}/rwtab.d/named %{_unitdir}/named.service %{_unitdir}/named-setup-rndc.service -%{_sbindir}/named-journalprint -%{_sbindir}/named-checkconf +%{_sysusersdir}/named.conf +%{_bindir}/named-journalprint +%{_bindir}/named-checkconf %{_bindir}/named-rrchecker %{_bindir}/mdig -%{_sbindir}/lwresd %{_sbindir}/named %{_sbindir}/rndc* +%{_sbindir}/named-checkconf %{_libexecdir}/generate-rndc-key.sh +%{_libexecdir}/setup-named-softhsm.sh %{_mandir}/man1/mdig.1* %{_mandir}/man1/named-rrchecker.1* %{_mandir}/man5/named.conf.5* %{_mandir}/man5/rndc.conf.5* %{_mandir}/man8/rndc.8* %{_mandir}/man8/named.8* -%{_mandir}/man8/lwresd.8* -%{_mandir}/man8/named-checkconf.8* +%{_mandir}/man1/named-checkconf.1* %{_mandir}/man8/rndc-confgen.8* -%{_mandir}/man8/named-journalprint.8* -%doc CHANGES README named.conf.default +%{_mandir}/man1/named-journalprint.1* +%{_mandir}/man8/filter-*.8.gz +%doc README.md named.conf.default %doc sample/ -%if %{without DOC} -%doc doc/arm/*.html doc/arm/*.pdf -%endif # Hide configuration %defattr(0640,root,named,0750) @@ -1380,38 +791,17 @@ rm -rf ${RPM_BUILD_ROOT} %ghost %config(noreplace) %{_sysconfdir}/rndc.conf # ^- The default rndc.conf which uses rndc.key is in named's default internal config - # so rndc.conf is not necessary. -%config(noreplace) %{_sysconfdir}/logrotate.d/named %defattr(-,named,named,-) %dir /run/named -%if %{with SDB} -%files sdb -%{_unitdir}/named-sdb.service -%{_mandir}/man1/zone2ldap.1* -%{_mandir}/man1/ldap2zone.1* -%{_mandir}/man1/zonetodb.1* -%{_mandir}/man1/zone2sqlite.1* -%{_mandir}/man8/named-sdb.8* -%doc contrib/sdb/ldap/README.ldap contrib/sdb/ldap/INSTALL.ldap contrib/sdb/pgsql/README.sdb_pgsql -%dir %{_sysconfdir}/openldap/schema -%config(noreplace) %{_sysconfdir}/openldap/schema/dnszone.schema -%{_sbindir}/named-sdb -%{_sbindir}/zone2ldap -%{_sbindir}/ldap2zone -%{_sbindir}/zonetodb -%{_sbindir}/zone2sqlite -%endif - %files libs -%{_libdir}/libbind9.so.161* -%{_libdir}/libisccc.so.161* -%{_libdir}/liblwres.so.161* - -%files libs-lite -%{_libdir}/libdns.so.%{sover_dns}* -%{_libdir}/libirs.so.%{sover_irs}* -%{_libdir}/libisc.so.%{sover_isc}* -%{_libdir}/libisccfg.so.%{sover_isccfg}* +%{_libdir}/libbind9-%{version}*.so +%{_libdir}/libisccc-%{version}*.so +%{_libdir}/libns-%{version}*.so +%{_libdir}/libdns-%{version}*.so +%{_libdir}/libirs-%{version}*.so +%{_libdir}/libisc-%{version}*.so +%{_libdir}/libisccfg-%{version}*.so %files license %{!?_licensedir:%global license %%doc} @@ -1426,13 +816,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_bindir}/arpaname %{_sbindir}/ddns-confgen %{_sbindir}/tsig-keygen -%{_sbindir}/genrandom -%{_sbindir}/nsec3hash -%{_sbindir}/dnssec* -%if %{with PKCS11} -%exclude %{_sbindir}/dnssec*pkcs11 -%endif -%{_sbindir}/isc-hmac-fixup +%{_bindir}/nsec3hash +%{_bindir}/named-checkzone +%{_bindir}/named-compilezone %{_sbindir}/named-checkzone %{_sbindir}/named-compilezone %if %{with DNSTAP} @@ -1440,11 +826,8 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man1/dnstap-read.1* %endif %if %{with LMDB} -%{_sbindir}/named-nzd2nzf -%endif -%if %{with DNSTAP} -%{_bindir}/dnstap-read -%{_mandir}/man1/dnstap-read.1* +%{_bindir}/named-nzd2nzf +%{_mandir}/man1/named-nzd2nzf.1* %endif %{_mandir}/man1/host.1* %{_mandir}/man1/nsupdate.1* @@ -1454,46 +837,31 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man1/arpaname.1* %{_mandir}/man8/ddns-confgen.8* %{_mandir}/man8/tsig-keygen.8* -%{_mandir}/man8/genrandom.8* -%{_mandir}/man8/nsec3hash.8* -%{_mandir}/man8/dnssec*.8* -%if %{with PKCS11} -%exclude %{_mandir}/man8/dnssec*-pkcs11.8* -%endif -%{_mandir}/man8/isc-hmac-fixup.8* -%{_mandir}/man8/named-checkzone.8* -%{_mandir}/man8/named-compilezone.8* -%if %{with LMDB} -%{_mandir}/man8/named-nzd2nzf.8* -%endif +%{_mandir}/man1/nsec3hash.1* +%{_mandir}/man1/named-checkzone.1* +%{_mandir}/man1/named-compilezone.1* %{_sysconfdir}/trusted-key.key +%files dnssec-utils +%{_bindir}/dnssec* +%{_mandir}/man1/dnssec*.1* + %files devel %{_libdir}/libbind9.so %{_libdir}/libisccc.so -%{_libdir}/liblwres.so -%{_includedir}/bind9/config.h -%{_includedir}/bind9/bind9 -%{_includedir}/bind9/isccc -%{_includedir}/bind9/lwres -%{_mandir}/man1/isc-config.sh.1* -%{_mandir}/man1/bind9-config.1* -%{_mandir}/man3/lwres* -%{_bindir}/isc-config.sh -%{_bindir}/bind9-config - -%files lite-devel +%{_libdir}/libns.so %{_libdir}/libdns.so %{_libdir}/libirs.so %{_libdir}/libisc.so %{_libdir}/libisccfg.so %dir %{_includedir}/bind9 +%{_includedir}/bind9/bind9 +%{_includedir}/bind9/isccc +%{_includedir}/bind9/ns %{_includedir}/bind9/dns %{_includedir}/bind9/dst %{_includedir}/bind9/irs %{_includedir}/bind9/isc -%dir %{_includedir}/bind9/pk11 -%{_includedir}/bind9/pk11/site.h %{_includedir}/bind9/isccfg %files chroot @@ -1533,404 +901,571 @@ rm -rf ${RPM_BUILD_ROOT} %dir %{chroot_prefix}/run/named %{chroot_prefix}%{_localstatedir}/run -%if %{with SDB} -%files sdb-chroot -%config(noreplace) %{_sysconfdir}/named-chroot.files -%{_unitdir}/named-sdb-chroot.service -%{_unitdir}/named-sdb-chroot-setup.service -%{_libexecdir}/setup-named-chroot.sh -%defattr(0664,root,named,-) -%ghost %dev(c,1,3) %verify(not mtime) %{chroot_sdb_prefix}/dev/null -%ghost %dev(c,1,8) %verify(not mtime) %{chroot_sdb_prefix}/dev/random -%ghost %dev(c,1,9) %verify(not mtime) %{chroot_sdb_prefix}/dev/urandom -%ghost %dev(c,1,5) %verify(not mtime) %{chroot_sdb_prefix}/dev/zero -%defattr(0640,root,named,0750) -%dir %{chroot_sdb_prefix} -%dir %{chroot_sdb_prefix}/dev -%dir %{chroot_sdb_prefix}%{_sysconfdir} -%dir %{chroot_sdb_prefix}%{_sysconfdir}/named -%dir %{chroot_sdb_prefix}%{_sysconfdir}/pki -%dir %{chroot_sdb_prefix}%{_sysconfdir}/pki/dnssec-keys -%dir %{chroot_sdb_prefix}%{_sysconfdir}/crypto-policies -%dir %{chroot_sdb_prefix}%{_sysconfdir}/crypto-policies/back-ends -%dir %{chroot_sdb_prefix}%{_localstatedir} -%dir %{chroot_sdb_prefix}/run -%ghost %config(noreplace) %{chroot_sdb_prefix}%{_sysconfdir}/named.conf -%defattr(0660,root,named,01770) -%dir %{chroot_sdb_prefix}%{_localstatedir}/named -%defattr(-,root,root,-) -%dir %{chroot_sdb_prefix}/usr -%dir %{chroot_sdb_prefix}/%{_libdir} -%dir %{chroot_sdb_prefix}/%{_libdir}/bind -%dir %{chroot_sdb_prefix}/%{_datadir}/GeoIP -%defattr(0660,named,named,0770) -%dir %{chroot_sdb_prefix}%{_localstatedir}/tmp -%dir %{chroot_sdb_prefix}%{_localstatedir}/log -%defattr(-,named,named,-) -%dir %{chroot_sdb_prefix}/run/named -%{chroot_sdb_prefix}%{_localstatedir}/run -%endif - -%if %{with PKCS11} -%files pkcs11 -%{_sbindir}/named-pkcs11 -%{_unitdir}/named-pkcs11.service -%{_mandir}/man8/named-pkcs11.8* -%{_libexecdir}/setup-named-softhsm.sh - -%files pkcs11-utils -%{_sbindir}/dnssec*pkcs11 -%{_sbindir}/pkcs11-destroy -%{_sbindir}/pkcs11-keygen -%{_sbindir}/pkcs11-list -%{_sbindir}/pkcs11-tokens -%{_mandir}/man8/pkcs11*.8* -%{_mandir}/man8/dnssec*-pkcs11.8* -%{_mandir}/man8/dnssec*.8* -%exclude %{_mandir}/man8/dnssec-coverage.8* -%exclude %{_mandir}/man8/dnssec-keymgr.8* - -%files pkcs11-libs -%{_libdir}/libdns-pkcs11.so.%{sover_dns}* -%{_libdir}/libisc-pkcs11.so.%{sover_isc}* - -%files pkcs11-devel -%{_includedir}/bind9/pk11/*.h -%exclude %{_includedir}/bind9/pk11/site.h -%{_includedir}/bind9/pkcs11 -%{_libdir}/libdns-pkcs11.so -%{_libdir}/libisc-pkcs11.so -%endif - -%if %{with EXPORT_LIBS} -%files export-libs -%dir %{_libdir}/%{_export_dir} -%{_libdir}/%{_export_dir}/libdns-export.so.%{sover_dns}* -%{_libdir}/%{_export_dir}/libirs-export.so.%{sover_irs}* -%{_libdir}/%{_export_dir}/libisc-export.so.%{sover_isc}* -%{_libdir}/%{_export_dir}/libisccfg-export.so.%{sover_isccfg}* -%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-export-%{_arch}.conf -# This subpackage has to distribute its own license. Do not conflict with -# other subpackages of different version -%license COPYRIGHT - -%files export-devel -%{_libdir}/%{_export_dir}/libdns-export.so -%{_libdir}/%{_export_dir}/libirs-export.so -%{_libdir}/%{_export_dir}/libisc-export.so -%{_libdir}/%{_export_dir}/libisccfg-export.so -%dir %{_includedir}/%{_export_dir} -%{_includedir}/%{_export_dir}/dns -%{_includedir}/%{_export_dir}/dst -%{_includedir}/%{_export_dir}/irs -%{_includedir}/%{_export_dir}/isc -%dir %{_includedir}/%{_export_dir}/pk11 -%{_includedir}/%{_export_dir}/pk11/site.h -%{_includedir}/%{_export_dir}/isccfg -%{_includedir}/%{_export_dir}/config.h -%{_mandir}/man1/isc-export-config.sh.1* -%{_mandir}/man1/bind9-export-config.1* -%attr(0755,root,root) %{_bindir}/isc-export-config.sh -%{_bindir}/bind9-export-config -%endif - -%if %{with DLZ} && %{with BDB} -%files dlz-bdb -%{_sbindir}/dlzbdb -%{_libdir}/bind/dlz_bdbhpt_dynamic.so -%doc contrib/dlz/modules/bdbhpt/testing/* - -%endif - -%if %{with DLZ} -%files dlz-filesystem -%{_libdir}/bind/dlz_filesystem_dynamic.so - -%files dlz-mysql -%{_libdir}/bind/dlz_mysql_dynamic.so -%doc contrib/dlz/modules/mysql/testing/* - -%files dlz-mysqldyn -%{_libdir}/bind/dlz_mysqldyn_mod.so -%doc contrib/dlz/modules/mysqldyn/testing/* -%doc contrib/dlz/modules/mysqldyn/README - -%files dlz-ldap -%{_libdir}/bind/dlz_ldap_dynamic.so -%doc contrib/dlz/modules/ldap/testing/* - -%files dlz-sqlite3 -%{_libdir}/bind/dlz_sqlite3_dynamic.so -%doc contrib/dlz/modules/sqlite3/testing/* - -%endif - -%files -n python3-bind -%{python3_sitelib}/*.egg-info -%{python3_sitelib}/isc/ - %if %{with DOC} %files doc %dir %{_pkgdocdir} -%doc %{_pkgdocdir}/*.html -%doc %{_pkgdocdir}/*.pdf +%doc %{_pkgdocdir}/html +%doc %{_pkgdocdir}/Bv9ARM.html +%endif +%if %{with DOCPDF} +%doc %{_pkgdocdir}/Bv9ARM.pdf %endif %changelog -* Thu Feb 06 2025 Petr Menšík - 32:9.11.36-16.4 -- Change patches applying to use -P parameter +* Thu Feb 13 2025 Thomas Woerner - 32:9.18.33-3 +- Fix upgrade of doc sub package to remove links replaced by directories + (RHEL-48798) -* Wed Feb 05 2025 Petr Menšík - 32:9.11.36-16.3 -- Limit additional section records CPU processing (CVE-2024-11187) -- Correct ANY queries to not have additional data appended +* Sun Feb 02 2025 Petr Menšík - 32:9.18.33-2 +- Add nsupdate TLS support (RHEL-77354) +- Include a test for nsupdate changes -* Tue Aug 06 2024 Petr Menšík - 32:9.11.36-16.2 -- Rebuild after CI change +* Sun Feb 02 2025 Petr Menšík - 32:9.18.33-1 +- Update to 9.16.33 (rhbz#2342784) +- Make relative documentation links +- Permanently remove DLZ parts build -* Thu Jul 18 2024 Petr Menšík - 32:9.11.36-16.1 -- Resolve CVE-2024-1975 -- Resolve CVE-2024-1737 -- Add ability to change runtime limits for max types and records per name +* Fri Jan 17 2025 Petr Menšík - 32:9.18.32-2 +- Add sysusers named user creation (rhbz#2105415) -* Mon Apr 15 2024 Petr Menšík - 32:9.11.36-16 -- Ensure incompatible dhcp is not accepted +* Thu Dec 12 2024 Petr Menšík - 32:9.18.32-1 +- Update to 9.18.32 (RHEL-48798) +- Remove CHANGES file from package -* Fri Apr 12 2024 Petr Menšík - 32:9.11.36-15 -- Ensure incompatible bind-dyndb-ldap is not accepted +* Tue Oct 29 2024 Petr Menšík - 32:9.18.29-1 +- Update to 9.18.29 (RHEL-48798) -* Mon Feb 26 2024 Petr Menšík - 32:9.11.36-14 -- Speed up parsing of DNS messages with many different names (CVE-2023-4408) -- Prevent increased CPU consumption in DNSSEC validator (CVE-2023-50387 CVE-2023-50868) -- Do not use header_prev in expire_lru_headers +* Tue Oct 29 2024 Petr Menšík - 32:9.18.28-1 +- Update to 9.18.28 (RHEL-48798) -* Thu Dec 07 2023 Petr Menšík - 32:9.11.36-13 -- Update addresses of b.root-servers.net (RHEL-18449) +* Tue Oct 29 2024 Petr Menšík - 32:9.18.27-6 +- Update to 9.18.27 (RHEL-48798) -* Mon Oct 09 2023 Petr Menšík - 32:9.11.36-12 -- Disable caching of stale records by default (RHEL-11785) +* Tue Oct 29 2024 Troy Dawson - 32:9.18.21-7 +- Bump release for October 2024 mass rebuild: + Resolves: RHEL-64018 -* Tue Sep 19 2023 Petr Menšík - 32:9.11.36-11 -- Prevent exahustion of memory from control channel (CVE-2023-3341) +* Tue Oct 08 2024 Petr Menšík - 32:9.18.21-6 +- Make OpenSSL engine support optional and disabled (RHEL-22408) -* Thu Jun 22 2023 Petr Menšík - 32:9.11.36-10 -- Prevent the cache going over the configured limit (CVE-2023-2828) +* Mon Jun 24 2024 Troy Dawson - 32:9.18.21-5 +- Bump release for June 2024 mass rebuild -* Wed Feb 08 2023 Petr Menšík - 32:9.11.36-9 -- Prevent flooding with UPDATE requests (CVE-2022-3094) -- include upstream test for that change +* Tue Jan 23 2024 Fedora Release Engineering - 32:9.18.21-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild -* Thu Oct 13 2022 Petr Menšík - 32:9.11.36-8 -- Correct regression preventing bind-dyndb-ldap build (#2133889) +* Fri Jan 19 2024 Fedora Release Engineering - 32:9.18.21-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild -* Thu Sep 29 2022 Petr Menšík - 32:9.11.36-7 -- Prevent excessive resource use while processing large delegations. - (CVE-2022-2795) +* Tue Jan 16 2024 Petr Menšík - 32:9.18.21-2 +- Update changed b.root-servers.net address in hints (#2253460) -* Thu Sep 22 2022 Petr Menšík - 32:9.11.36-6 -- Prevent freeing zone during statistics rendering (#2101712) +* Mon Jan 15 2024 Petr Menšík - 32:9.18.21-1 +- Update to 9.18.21 (#2255407) -* Thu Sep 22 2022 Petr Menšík - 32:9.11.36-5 -- Fix memory leak in ECDSA verify processing (CVE-2022-38177) -- Fix memory leak in EdDSA verify processing (CVE-2022-38178) +* Thu Nov 16 2023 Petr Menšík - 32:9.18.20-1 +- Update to 9.18.20 (#2249835) -* Wed Apr 13 2022 Petr Menšík - 32:9.11.36-4 -- Tighten cache protection against record from forwarders (CVE-2021-25220) -- Include test of forwarders +* Fri Sep 22 2023 Petr Menšík - 32:9.18.19-1 +- Update to 9.18.19 (#2232346) -* Thu Feb 10 2022 Petr Menšík - 32:9.11.36-2 -- Reduce memory used per-view on machine with few processors (#2030239) +* Fri Sep 22 2023 Petr Menšík - 32:9.18.18-2 +- Skip failing rbtdb_test unit test on i686 (#2240253) -* Tue Dec 21 2021 Petr Menšík - 32:9.11.36-2 -- Rebuilt on a new side-tag (#2013993) +* Wed Sep 06 2023 Petr Menšík - 32:9.18.18-1 +- Update to 9.18.18 (#2232346) -* Mon Nov 01 2021 Petr Menšík - 32:9.11.36-1 -- Update to 9.11.36 +* Wed Jul 19 2023 Petr Menšík - 32:9.18.17-1 +- Update to 9.18.17 (#2223913) -* Mon Nov 01 2021 Petr Menšík - 32:9.11.26-9 -- Correct tsig system test +* Wed Jul 19 2023 Fedora Release Engineering - 32:9.18.16-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild -* Wed Oct 13 2021 Petr Menšík - 32:9.11.26-8 -- Propagate ephemeral port ranges to chroot (#1950714) +* Wed Jun 21 2023 Petr Menšík - 32:9.18.16-1 +- Update to 9.18.16 (#2216462) -* Tue Aug 24 2021 Petr Menšík - 32:9.11.26-7 -- Do not request softhsm from bind-pkcs11, it is only in modular build - (#1934035) +* Wed May 17 2023 Petr Menšík - 32:9.18.15-1 +- Update to 9.18.15 (#2207908) -* Fri Jul 09 2021 Petr Menšík - 32:9.11.26-6 -- Use random entropy to generate unique TKEY identifiers (#1980916) +* Fri Apr 21 2023 Petr Menšík - 32:9.18.14-1 +- Update to 9.18.14 (#2187996) -* Fri May 07 2021 Petr Menšík - 32:9.11.26-5 -- Fix possible assertion failure isc_refcount_current == 0 in free_rbtdb - (#1953056) +* Wed Apr 05 2023 Petr Menšík - 32:9.18.13-2 +- Enumerate all SPDX licenses used -* Tue Apr 27 2021 Petr Menšík - 32:9.11.26-4 -- Possible assertion failure on DNAME processing (CVE-2021-25215) -- Insufficient IXFR checks could lead to assertion failure (CVE-2021-25214) +* Sat Mar 18 2023 Petr Menšík - 32:9.18.13-1 +- Update to 9.18.3 (#2178717) -* Mon Feb 15 2021 Petr Menšík - 32:9.11.26-3 -- Fix off-by-one bug in ISC SPNEGO implementation (CVE-2020-8625) +* Thu Feb 16 2023 Petr Menšík - 32:9.18.12-1 +- Update to 9.18.12 (#2170096) -* Tue Jan 05 2021 Petr Menšík - 32:9.11.26-2 -- Add DNSTAP support (#1854148), new dnstap-read tool -- Add JSON support in statistics-channel (#1899257) +* Fri Jan 27 2023 Petr Menšík - 32:9.18.11-1 +- Update to 9.18.11 (#2164395) + +* Wed Jan 18 2023 Fedora Release Engineering - 32:9.18.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Mon Jan 16 2023 Petr Menšík - 32:9.18.10-1 +- Update to 9.18.10 (#2143258) +- Include rwlock.h from dns/zt.h + +* Mon Nov 21 2022 Petr Menšík - 32:9.18.9-1 +- Update to 9.18.9 (#2143258) + +* Sat Oct 22 2022 Petr Menšík - 32:9.18.8-1 +- Update to 9.18.8 (#2136100) + +* Fri Sep 30 2022 Petr Menšík - 32:9.18.7-3 +- Update License to SPDX identifier +- Enable automatic restart on crashes + +* Sat Sep 24 2022 Petr Menšík - 32:9.18.7-2 +- Build ARM documentation also with older sphinx on RHEL9 + +* Wed Sep 21 2022 Petr Menšík - 32:9.18.7-1 +- Update to 9.18.7 (#2128609) + +* Wed Sep 14 2022 Petr Menšík - 32:9.18.6-4 +- Disable yet another test (##2122010) + +* Tue Sep 06 2022 Petr Menšík - 32:9.18.6-3 +- Return OpenSSL engine implementation for pkcs11 interface (#2122841) +- Skip problematic netmgr unit tests (#2122010) +- Properly obsolete bind-dnssec-doc + +* Thu Sep 01 2022 Petr Menšík - 32:9.18.6-2 +- Always show error details for failed unittests (#2122010) + +* Tue Aug 30 2022 Petr Menšík - 32:9.18.6-1 +- Update to 9.18.6 (#2119132) +- Report unit tests detailed results + +* Thu Aug 04 2022 Petr Menšík - 32:9.18.5-2 +- Use multiple threads on unit tests, but 16 at most + +* Wed Aug 03 2022 Petr Menšík - 32:9.18.5-1 +- Update to 9.18.5 (#2109170) +- Return doc symlink to main page + +* Wed Jul 20 2022 Petr Menšík - 32:9.18.4-2 +- Stop enabling selinux booleans on every upgrade +- Deprecate python3-bind for smooth upgrade +- Remove PKCS1111 native utilities, libs and daemon + +* Wed Jul 20 2022 Petr Menšík - 32:9.18.4-1 +- Update to 9.18.4 (#2057493) + +* Wed Jul 20 2022 Fedora Release Engineering - 32:9.16.30-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 20 2022 Petr Menšík - 32:9.16.30-1 +- Update to 9.16.30 (#2097312) + +* Mon Jun 13 2022 Python Maint - 32:9.16.29-2 +- Rebuilt for Python 3.11 + +* Thu May 26 2022 Petr Menšík - 32:9.16.29-1 +- Update to 9.16.29 (#2087920) +- Fix netmgr_test fails on s390x (#2088125) + +* Tue May 17 2022 Petr Menšík - 32:9.16.28-2 +- Parse again timeout and attempts from resolv.conf (#2087156) +- Reenable unit tests during build + +* Wed Apr 20 2022 Petr Menšík - 32:9.16.28-1 +- Update to 9.16.28 (#2076941) + +* Thu Mar 17 2022 Petr Menšík - 32:9.16.27-1 +- Upgrade to 9.16.27 (#2055120) + +* Tue Mar 01 2022 Petr Menšík - 32:9.16.26-2 +- Switch to locked queue (#2048235) + +* Thu Feb 17 2022 Petr Menšík - 32:9.16.26-1 +- Update to 9.16.26 (#2055120) + +* Fri Feb 11 2022 Petr Menšík - 32:9.16.25-3 +- Allow reservation of extra hp threads (#2048235) + +* Tue Jan 25 2022 Petr Menšík - 32:9.16.25-2 +- Replace master with primary in configuration + +* Fri Jan 21 2022 Petr Menšík - 32:9.16.25-1 +- Update to 9.16.25 (#2042504) + +* Wed Jan 19 2022 Fedora Release Engineering - 32:9.16.24-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Dec 22 2021 Petr Menšík - 32:9.16.24-2 +- Build with OpenLDAP 2.6 (#2032704) + +* Wed Dec 15 2021 Petr Menšík - 32:9.16.24-1 +- Update to 9.16.24 (#2032934) + +* Fri Nov 26 2021 Petr Menšík - 32:9.16.23-2 +- Correct with GEOIP2 condition (#2026823) + +* Fri Nov 19 2021 Petr Menšík - 32:9.16.23-1 +- Update to 9.16.23 (#2024210) + +* Sat Nov 06 2021 Adrian Reber - 32:9.16.22-2 +- Rebuilt for protobuf 3.19.0 + +* Wed Oct 27 2021 Petr Menšík - 32:9.16.22-1 +- Update to 9.16.22 + +* Sun Oct 24 2021 Adrian Reber - 32:9.16.21-3 +- Rebuilt for protobuf 3.18.1 + +* Wed Oct 13 2021 Petr Menšík - 32:9.16.21-2 +- Propagate ephemeral port ranges to chroot (#2013597) + +* Wed Sep 15 2021 Petr Menšík - 32:9.16.21-1 +- Update to 9.16.21 + +* Tue Sep 14 2021 Sahana Prasad - 32:9.16.20-4 +- Rebuilt with OpenSSL 3.0.0 + +* Wed Aug 25 2021 Petr Menšík - 32:9.16.20-3 +- Increase map format version, lower memory consuption a bit (#1997504) +- Remove unneeded test variants changes +- Include documentation of dig return codes + +* Thu Aug 19 2021 Petr Menšík - 32:9.16.20-2 +- Fix map file format regression + +* Tue Aug 17 2021 Petr Menšík - 32:9.16.20-1 +- Update to 9.16.20 + +* Thu Aug 05 2021 Petr Menšík - 32:9.16.19-4 +- Do not depend on systemd package + +* Tue Aug 03 2021 Petr Menšík - 32:9.16.19-3 +- Reenable PDF building again (#1984687) + +* Fri Jul 23 2021 Petr Menšík - 32:9.16.19-2 +- Include backward compatible html symlink in doc subpackage + +* Wed Jul 21 2021 Petr Menšík - 32:9.16.19-1 +- Update to 9.16.19 (#1984627) +- Disable PDF rebuild on Rawhide (#1984687) + +* Wed Jul 21 2021 Fedora Release Engineering - 32:9.16.18-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Sat Jul 10 2021 Petr Menšík - 32:9.16.18-4 +- Disable PDF building on ELN + +* Sat Jul 10 2021 Björn Esser - 32:9.16.18-3 +- Rebuild for versioned symbols in json-c + +* Tue Jun 22 2021 Petr Menšík - 32:9.16.18-2 +- Re-enable building of PDF ARM documentation + +* Fri Jun 18 2021 Petr Menšík - 32:9.16.18-1 +- Update to 9.16.18 + +* Fri Jun 18 2021 Petr Menšík - 32:9.16.17-2 +- Fix wildcard expansion not working with 'w' (#1973587) + +* Thu Jun 17 2021 Petr Menšík - 32:9.16.17-1 +- Update to 9.16.17 + +* Fri Jun 04 2021 Python Maint - 32:9.16.16-2 +- Rebuilt for Python 3.10 + +* Thu May 20 2021 Petr Menšík - 32:9.16.16-1 +- Update to 9.16.16 (#1954827) + +* Thu Apr 29 2021 Petr Menšík - 32:9.16.15-1 +- Update to 9.16.15 + +* Thu Mar 25 2021 Petr Menšík - 32:9.16.13-1 +- Update to 9.16.13 +- Changed displayed version just to include -RH suffix, not release +- Version is now part of library names, soname versions are no longer provided +- Removed bind-libs-lite subpackage + +* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 32:9.16.11-6 +- Rebuilt for updated systemd-rpm-macros + See https://pagure.io/fesco/issue/2583. + +* Fri Feb 26 2021 Petr Menšík - 32:9.16.11-5 +- Make logrotate.d world-readable (#1917061) + +* Mon Feb 22 2021 Petr Menšík - 32:9.16.11-4 +- Fix off-by-one bug in ISC SPNEGO implementation (#1929965) + +* Mon Feb 08 2021 Pavel Raiskup - 32:9.16.11-3 +- rebuild for libpq ABI fix rhbz#1908268 + +* Tue Jan 26 2021 Fedora Release Engineering - 32:9.16.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Thu Jan 21 2021 Petr Menšík - 32:9.16.11-1 +- Update to 9.16.11 (#1827602) +- Avoid unit test failures on machines with many cores + +* Thu Jan 14 2021 Petr Menšík - 32:9.16.10-2 +- Update to 9.16.10 +- Remove bind-sdb package +- https://fedoraproject.org/wiki/Changes/BIND9.16 + +* Wed Jan 13 08:55:11 CET 2021 Adrian Reber - 32:9.11.26-3 +- Rebuilt for protobuf 3.14 + +* Wed Jan 06 2021 Petr Menšík - 32:9.11.26-2 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro * Mon Jan 04 2021 Petr Menšík - 32:9.11.26-1 - Update to 9.11.26 +* Mon Nov 30 2020 Petr Menšík - 32:9.11.25-2 +- Regenerate all manual pages on build + * Thu Nov 26 2020 Petr Menšík - 32:9.11.25-1 - Update to 9.11.25 -- Require libcap from devel package + +* Wed Nov 04 2020 Petr Menšík - 32:9.11.24-2 - Fix crash on NTA recheck failure (#1893761) -* Fri Sep 25 2020 Tomas Korbar - 32:9.11.20-6 -- Do not ignore RPZ wildcard passthru (#1876492) +* Fri Oct 23 2020 Petr Menšík - 32:9.11.24-1 +- Update to 9.11.24 -* Tue Aug 18 2020 Petr Menšík - 32:9.11.20-5 -- Fix tsig-request verify (CVE-2020-8622) -- Prevent PKCS11 daemon crash on crafted packet (CVE-2020-8623) -- Correct update-policy type subdomain to match documentation (CVE-2020-8624) -- Include available test +* Wed Sep 23 2020 Adrian Reber - 32:9.11.23-2 +- Rebuilt for protobuf 3.13 -* Wed Jul 22 2020 Petr Menšík - 32:9.11.20-4 -- Prevent crash on dstlib initialization failure (#1859454) +* Thu Sep 17 2020 Petr Menšík - 32:9.11.23-1 +- Update to 9.11.23 +- Merge bind-lite-devel into devel package -* Fri Jun 19 2020 Petr Menšík - 32:9.11.20-3 -- Add remaining require to bind package (#1633169) +* Tue Sep 01 2020 Petr Menšík - 32:9.11.22-2 +- Require libcap from devel package -* Fri Jun 19 2020 Petr Menšík - 32:9.11.20-2 -- Add manual page for dnssec-importkey-pkcs11 (#1666785) -- Add versioned depends to all library subpackages +* Thu Aug 20 2020 Petr Menšík - 32:9.11.22-1 +- Update to 9.11.22 + +* Sat Aug 01 2020 Fedora Release Engineering - 32:9.11.21-3 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 32:9.11.21-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 15 2020 Petr Menšík - 32:9.11.21-1 +- Update to 9.11.21 + +* Tue Jun 23 2020 Petr Menšík - 32:9.11.20-3 +- Move documentation to separate bind-doc package + +* Sat Jun 20 2020 Adrian Reber - 32:9.11.20-2 +- Rebuilt for protobuf 3.12 * Wed Jun 17 2020 Petr Menšík - 32:9.11.20-1 - Update to 9.11.20 -* Mon Jun 08 2020 Petr Menšík - 32:9.11.19-2 -- Remove old KSK 19036 from remaining trusted-key.key +* Tue May 26 2020 Miro Hrončok - 32:9.11.19-2 +- Rebuilt for Python 3.9 * Fri May 15 2020 Petr Menšík - 32:9.11.19-1 - Update to 9.11.19 (CVE-2020-8616, CVE-2020-8617) +- Make initscripts just optional dependency + +* Tue Apr 21 2020 Björn Esser - 32:9.11.18-2 +- Rebuild (json-c) * Thu Apr 16 2020 Petr Menšík - 32:9.11.18-1 - Update to 9.11.18 -* Tue Apr 07 2020 Petr Menšík - 32:9.11.17-1 +* Tue Mar 31 2020 Petr Menšík - 32:9.11.17-1 - Update to 9.11.17 -* Tue Apr 07 2020 Petr Menšík - 32:9.11.14-1 -- Update to 9.11.14 +* Tue Jan 28 2020 Fedora Release Engineering - 32:9.11.14-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + + * Wed Jan 08 2020 Petr Menšík - 32:9.11.14-4 - Remove libmaxminddb-devel from devel package dependencies -* Thu Feb 27 2020 Miroslav Lichvar - 32:9.11.13-3 -- Fix rwlock to be thread-safe (#1740511) +* Fri Jan 03 2020 Petr Menšík - 32:9.11.14-3 +- Preserve symlinks to named.conf on iscdlv modification (#1786626) -* Tue Jan 14 2020 Petr Menšík - 32:9.11.13-2 -- Release GeoIP data on reload (#1790879) +* Thu Dec 19 2019 Petr Menšík - 32:9.11.14-2 +- Include more Thread Sanitizer detected changes (#1736762) + +* Thu Dec 19 2019 Petr Menšík - 32:9.11.14-1 +- Update to 9.11.14 + +* Tue Dec 03 2019 Petr Menšík - 32:9.11.13-4 +- Disable Berkeley DB support (#1779190) + +* Mon Dec 02 2019 Petr Menšík - 32:9.11.13-3 +- Backport few thread safety related fixed from upstream (#1736762) + +* Tue Nov 26 2019 Petr Menšík - 32:9.11.13-2 +- Complete explicit disabling of RSAMD5 in FIPS mode (#1709553) * Tue Nov 19 2019 Petr Menšík - 32:9.11.13-1 - Update to 9.11.13 -* Tue Nov 19 2019 Petr Menšík - 32:9.11.12-5 -- Report failures on systemctl reload (#1739428) +* Tue Nov 19 2019 Petr Menšík - 32:9.11.12-6 +- Report failures on systemctl reload -* Mon Nov 18 2019 Pavel Zhukov - 32:9.11.12-4 -- dhcp: Use monotonic time for detecting time jumps if available (#1729211) +* Tue Nov 12 2019 Petr Menšík - 32:9.11.12-5 +- Fix binary compatibility after serve-stale patch (#1770492) -* Fri Nov 15 2019 Petr Menšík - 32:9.11.12-3 -- Backported serve-stale feature (#1664863) +* Wed Nov 06 2019 Petr Menšík - 32:9.11.12-4 +- Backported serve-stale feature -* Thu Nov 07 2019 Petr Menšík - 32:9.11.12-2 -- Add GeoLite2 support (#1564443) -- Add GeoIP to bind-chroot (#1497646) +* Wed Nov 06 2019 Petr Menšík - 32:9.11.12-3 - Fix wrong default GeoIP directory (#1768258) +* Mon Nov 04 2019 Petr Menšík - 32:9.11.12-2 +- Move data files outside config archive +- Specify geoip data directory in config file (#1768258) + * Mon Oct 21 2019 Petr Menšík - 32:9.11.12-1 - Update to 9.11.12 (#1557762) * Wed Sep 25 2019 Petr Menšík - 32:9.11.11-1 - Update to 9.11.11 -* Tue Aug 27 2019 Petr Menšík - 32:9.11.10-1 -- Update to 9.11.10 +* Wed Sep 04 2019 Petr Menšík - 32:9.11.10-3 - Share pkcs11-utils and dnssec-utils manuals instead of recommend -* Thu Aug 08 2019 Petr Menšík - 32:9.11.7-1 +* Tue Sep 03 2019 Petr Menšík - 32:9.11.10-2 +- Move some administration utilities back to bind-utils (#1720380) +- Add GeoIP to bind-chroot (#1497646) +- Recommend bind-dnssec-utils from bind-pkcs11-utils + +* Tue Aug 27 2019 Petr Menšík - 32:9.11.10-1 +- Update to 9.11.10 + +* Mon Aug 19 2019 Miro Hrončok - 32:9.11.9-4 +- Rebuilt for Python 3.8 + +* Fri Aug 09 2019 Petr Menšík - 32:9.11.9-3 +- Display errors from rndc reload (#1739441) + +* Thu Aug 08 2019 Petr Menšík - 32:9.11.9-2 +- Permit explicit disabling of RSAMD5 in FIPS mode (#1709553) + +* Wed Jul 24 2019 Petr Menšík - 32:9.11.9-1 +- Update to 9.11.9 +- Add GeoLite2 support +- Disable export-libs + +* Wed Jul 24 2019 Petr Menšík - 32:9.11.8-2 +- Use monotonic time in export library (#1732883) + +* Wed Jul 24 2019 Fedora Release Engineering - 32:9.11.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Jul 02 2019 Petr Menšík - 32:9.11.8-1 +- Update to 9.11.8 + +* Mon Jun 17 2019 Petr Menšík - 32:9.11.7-2 +- Fix OpenSSL random generator initialization + +* Mon Jun 10 2019 Petr Menšík - 32:9.11.7-1 - Update to 9.11.7 -* Thu Aug 08 2019 Petr Menšík - 32:9.11.4-26.P2 -- Permit explicit disabling of RSAMD5 in FIPS mode (#1737407) +* Mon May 06 2019 Petr Menšík - 32:9.11.6-5.P1 +- Fix also postun script -* Wed Jul 17 2019 Petr Menšík - 32:9.11.4-25.P2 -- Fix CVE-2018-5745 -- Fix CVE-2019-6465 +* Mon May 06 2019 Petr Menšík - 32:9.11.6-4.P1 +- Fix error in scriptlet condition -* Wed Jul 17 2019 Petr Menšík - 32:9.11.4-24.P2 -- Do not override random numbers provider in DHCP (#1668682) - -* Wed Jul 17 2019 Petr Menšík - 32:9.11.4-23.P2 -- Report errors on invalid IDN 2008 names (#1679307) - -* Wed Jun 19 2019 Petr Menšík - 32:9.11.4-22.P2 -- Fix CVE-2019-6471 - -* Thu Jun 13 2019 Petr Menšík - 32:9.11.4-21.P2 -- Fix random generator initialization - -* Wed Apr 24 2019 Petr Menšík - 32:9.11.4-20.P2 -- Fix multilib conflict of devel packages (#1666785) - -* Wed Apr 24 2019 Petr Menšík - 32:9.11.4-19.P2 -- Add support for OpenSSL provided random data -- Disable often failing unit test random_test -- Add /dev/urandom to chroot - -* Wed Apr 24 2019 Petr Menšík - 32:9.11.4-18.P2 -- Fix zone2ldap tool memory management (#1602451) -- Add support for OpenSSL provided random data - -* Wed Apr 24 2019 Petr Menšík - 32:9.11.4-17.P2 +* Thu May 02 2019 Petr Menšík - 32:9.11.6-3.P1 - Fix inefective limit of TCP clients (CVE-2018-5743) -* Thu Feb 21 2019 Petr Menšík - 32:9.11.4-16.P2 -- Fix CVE-2018-5744 +* Thu Mar 14 2019 Petr Menšík - 32:9.11.6-2 +- Fix dnstap and timer issues in unit test +- Enable DLZ modules -* Thu Jan 10 2019 Petr Menšík - 32:9.11.4-15.P2 -- Fix error on bind-chroot upgrade before first start (#1634753) +* Tue Mar 05 2019 Petr Menšík - 32:9.11.6-1 +- Update to 9.11.6 -* Mon Oct 15 2018 Petr Menšík - 32:9.11.4-14.P2 -- Rely on named_write_master_zones being default on (#1588592) +* Fri Mar 01 2019 Petr Menšík - 32:9.11.5-15.P4 +- Support testing of named variants -* Sat Sep 29 2018 Petr Menšík - 32:9.11.4-13.P2 +* Thu Feb 28 2019 Petr Menšík - 32:9.11.5-14.P4 +- Modify feature-test detection of dlz-filesystem + +* Fri Feb 22 2019 Petr Menšík - 32:9.11.5-13.P4 +- Update to 9.11.5-P4 + +* Fri Feb 22 2019 Petr Menšík - 32:9.11.5-12.P1 +- Enable DNSTAP support (#1564776) +- Enable LMDB support for rndc addzone +- Enable json format in statistics-channel + +* Thu Feb 21 2019 Petr Menšík - 32:9.11.5-11.P1 +- Disable often failing unit test random_test + +* Thu Feb 21 2019 Petr Menšík - 32:9.11.5-10.P1 +- Disable autodetected eddsa algorithm ED448 + +* Thu Jan 31 2019 Petr Menšík - 32:9.11.5-9.P1 +- dig prints ASCII name instead of failure (#1647829) +- disable IDN output from scripts +- Update project URL +- Removed revoked KSK 19164 from trusted keys + +* Thu Jan 31 2019 Fedora Release Engineering - 32:9.11.5-8.P1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sun Jan 27 2019 Petr Menšík - 32:9.11.5-7.P1 +- Update to 9.11.5-P1 + +* Wed Jan 23 2019 Petr Menšík - 32:9.11.5-6 +- Reenable crypto rand for DHCP, disable just entropy check (#1663318) + +* Thu Jan 17 2019 Petr Menšík - 32:9.11.5-5 +- Move dnssec related tools from bind-utils to bind-dnssec-utils (#1649398) + +* Wed Jan 16 2019 Petr Menšík - 32:9.11.5-4 +- Reject invalid binary file (#1666814) + +* Mon Jan 14 2019 Petr Menšík - 32:9.11.5-3 +- Disable crypto rand for DHCP (#1663318) + +* Thu Oct 25 2018 Petr Menšík - 32:9.11.5-2 +- Add optional support for JSON statistics +- Add optional DNSTAP support (#1564776), new dnstap-read tool + +* Wed Oct 24 2018 Petr Menšík - 32:9.11.5-1 +- Update to 9.11.5 + +* Tue Oct 02 2018 Petr Menšík - 32:9.11.4-12.P2 +- Add Requires to devel packages referenced by bind-devel + +* Sat Sep 29 2018 Igor Gnatenko - 32:9.11.4-11.P2 - Fix export-libs macro & scriptlet -* Thu Sep 27 2018 Petr Menšík - 32:9.11.4-12.P2 -- Update to bind-9.11.4-P2 (#1631134, #1633665) +* Wed Sep 26 2018 Petr Menšík - 32:9.11.4-10.P2 +- Reenable IDN output but allow turning it off (#1580200) +* Thu Sep 20 2018 Petr Menšík - 32:9.11.4-9.P2 +- Update to bind-9.11.4-P2 +- Add /dev/urandom to chroot (#1631515) -* Thu Sep 27 2018 Petr Menšík - 32:9.11.4-11.P1 -- Reenable IDN output but allow turning it off (#1632891) +* Fri Aug 24 2018 Petr Menšík - 32:9.11.4-8.P1 +- Replace unoptimized code by OpenSSL counterparts +- Fix multilib conflicts of devel package +- Add versioned depends to all library subpackages -* Wed Sep 26 2018 Petr Menšík - 32:9.11.4-10.P1 -- Make spec valid when python3-rpm-macros is not installed (#1619153) +* Fri Aug 24 2018 Petr Menšík - 32:9.11.4-7.P1 +- Add support for OpenSSL provided random data -* Wed Sep 19 2018 Tomas Orsava - 32:9.11.4-9.P1 -- Require the Python interpreter directly instead of using the package name -- Related: rhbz#1619153 - -* Mon Sep 17 2018 Petr Menšík - 32:9.11.4-8.P1 -- Fix annocheck failures, replace unoptimized code by OpenSSL counterparts (#1624100) - -* Tue Aug 14 2018 Petr Menšík - 32:9.11.4-7.P1 -- Fix chroot devices upgrade warning (#1592872) +* Mon Aug 13 2018 Petr Menšík - 32:9.11.4-6.P1 +- Fix sdb-chroot devices upgrade (#1592873) - Automatically replace obsoleted ISC DLV key with root key (#1595782) -* Fri Aug 10 2018 Petr Menšík - 32:9.11.4-6.P1 -- Fix sdb-chroot devices upgrade (#1592872) - * Thu Aug 09 2018 Petr Menšík - 32:9.11.4-5.P1 - Update to 9.11.4-P1 - Adds root key sentinel support - Large IXFR zone transfers are rejected to prevent journal corruption -- Fixes CVE-2018-5740 * Thu Aug 02 2018 Petr Menšík - 32:9.11.4-4 - Support unavailable MD5 in FIPS mode @@ -1940,8 +1475,6 @@ rm -rf ${RPM_BUILD_ROOT} * Tue Jul 31 2018 Petr Menšík - 32:9.11.4-2 - Install generated manual pages -- Remove system-config-bind from manual -- Disable GeoIP support (#1609856) * Thu Jul 12 2018 Petr Menšík - 32:9.11.4-1 - Update to 9.11.4 diff --git a/SOURCES/bind.tmpfiles.d b/bind.tmpfiles.d similarity index 100% rename from SOURCES/bind.tmpfiles.d rename to bind.tmpfiles.d diff --git a/SOURCES/generate-rndc-key.sh b/generate-rndc-key.sh similarity index 56% rename from SOURCES/generate-rndc-key.sh rename to generate-rndc-key.sh index dde7f70..df0604a 100755 --- a/SOURCES/generate-rndc-key.sh +++ b/generate-rndc-key.sh @@ -1,12 +1,23 @@ #!/bin/bash -. /etc/rc.d/init.d/functions +if [ -r /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +else +success() { + echo $" OK " +} + +failure() { + echo -n " " + echo $"FAILED" +} +fi # This script generates /etc/rndc.key if doesn't exist AND if there is no rndc.conf -if [ ! -s /etc/rndc.key -a ! -s /etc/rndc.conf ]; then +if [ ! -s /etc/rndc.key ] && [ ! -s /etc/rndc.conf ]; then echo -n $"Generating /etc/rndc.key:" - if /usr/sbin/rndc-confgen -a -A hmac-sha256 -r /dev/urandom > /dev/null 2>&1 + if /usr/sbin/rndc-confgen -a -A hmac-sha256 > /dev/null 2>&1 then chmod 640 /etc/rndc.key chown root:named /etc/rndc.key @@ -14,7 +25,9 @@ if [ ! -s /etc/rndc.key -a ! -s /etc/rndc.conf ]; then success $"/etc/rndc.key generation" echo else + rc=$? failure $"/etc/rndc.key generation" echo + exit $rc fi fi diff --git a/isc-keyblock.asc b/isc-keyblock.asc new file mode 100644 index 0000000..876061d --- /dev/null +++ b/isc-keyblock.asc @@ -0,0 +1,175 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGNjen4BEADDHiUVNbkFtiKPaMWjKxbKmF1nmv7XKjDhwSww6WFiGPbQyxNM +r8EHlEJx5kMT67rx0IYMhTLiXm/9C4dGYyUfFWc35CGetuzstzCNkwJs7vZAhEyk ++06CX4GFiHPOmWIupGCxFkNz1Qopz3ZePMlZRslVCHzW4dbg5NKLI0ojXlNaTDU5 +mgUXpsPi/6l6QE6q3ouvmWPF4u71cZ1+W4UkIRAXOlbVsDzGaMaoHjJd8cOM8DrZ +gKHACNPjzqOvEujXDC2vyKw6XpxR+pHz0QcrRtlKnVhPNiKcDfw2mJJ5zxi9uSDc +dh5FomMn9sS4gy2Tub2urELnPf9xnURftRGG3VO6nZc81ufQB4s1BNT2ny0Uhx5V +mXUJwefMypMBfAvWCWBCeyWYtBeo7LT3NmtLq3oVGPfl7+a0ToFAYeghspK8/nOX +6/fqF1MEtzvWjXljz6K7FSDYSY9AoaESLHGwCo6dtff5S7f1+l6PCUNo6aM/B5Ke +SIAN9Lm6z2iVuy9Lukw+5IRoRKHHV4rJauPtDeYoWnNiSd7Q4vFtotUIjRpDARpm +xWS711Q2T+knHFLEiU8QzxjLhOnTzh4n9dDLHCkOY5WM5krldVeL5EuTyPKinuSn +oE01A7I4IGJp753CshibxjNYDiEOVeK93R38Y543edlIrYxnfyMVsiqPkwARAQAB +tDRNaWNoYcWCIEvEmXBpZcWEIChDb2RlLVNpZ25pbmcgS2V5KSA8bWljaGFsQGlz +Yy5vcmc+iQJOBBMBCgA4FiEEcGtsKGIOdvkdEfffUQpkKgbFLOwFAmNjen4CGwMF +CwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQUQpkKgbFLOwiLxAAjYuI4JQ8mPq7 +YrV9m4tu+jOKvoKfpjct2Rh02n/X3ChOgrdcXU898eH56tRk8Mv/E+cBTPN9zQn6 +rLprbYR2t2R+zgvuUZWA8In7aewoPIJw8OdlG0gTK9m3VHJIOhIX07qcFttSZw4m +4rEU5mdxi9FatBWBzqnVm4Pn577aqRXK908j+6TvgWbZ6Cq0tw3syVT4kGj+93+P +uIQQQkTYN8UDQPsAKzfzkbQC9I5YXBKUoB9CfhXig8V9N75R0gsWkJ8Vy/8wsPXT +9/EPIIzhnhSuUIjvvBPbLGrzDgbhrfUQ/QVuXDVN8xl3rAWM/tiNGOnmzoYORyM5 +ftrnCDIaO4aVKR6rtEzfdQa5Kid1StfhFien/U8jYErxkEn2HRt2gVEX5nYq31T+ +0jgVode2Dzkm4+HKHmfOYsQeC07Mu6wZw9raNYqFjTcfh0ajFpLIT3j2YqOJE2jy +KbcveJcy2NiOiUl13exIZuBkZm0wEVbvgVX1PlgL3GJqnbU/Q+maRTb8FBoQVsOd +GIm7U/phU91qR+00SkOcp2LgHCCNKrmHXgiBNYBbInNIp6ze3bFvfKTRFn8WdY9v +Z7vNfKar8rt90mpjYG9qMhmvh4E9icfp3wRUtOwyi7VVtVTTUq0iFTe2C0m0v6KW +XcDwwwaTbl79BOqOH3Gp1flS2ECBsyiZAg0EY2N8xQEQAMWcyZbpxEyefX4JTszG +ocpz8C8yqvZJQUfoDK5AecQWR7OegPkIqwJcHEH5cz+MduklXNQdra/snn6pxGig +At3xCwfzRTH/aYXdjcjnma1elzZSTgk6Maw4zR/W9wea2DcUtMCcsys0gviN/VUe +Aqt+5pmhy2PlEWfJG+Mzyrqgz3Q8hRyAJAKONAwNhs1A4ZqQX/6iuCkJbH1CBeoW ++c+5qJHYEXsx25qR1yiKOFo5b90QOcwaebUq+xKQRlnESn75FTgDjDfDm9BqrHcn +Tv79kOuIN5vhz4BCsuo5QbNu4RGrs/1VSTPvMf5AN7xs9pYNMAEde7pSF1Ps3B5p +CE6iUw9L53ytV4iJQKXpzG29LofUu65YQjIXPgK7NbBO7FUHA41YbSfoWiOAjfMh +iE025YM2+RPQh/Nrc3PqBj4h21ycT+d8eEXKfc/okbVFFE9dKS1hUwKgSrs7baOG +CBZdpiB+t3jWrr8UrteALab7v0rndco3QKOe9U3f+Gm3MdgLK1TGiRgpdyiIXEel +J7zhsdoYEvaKMgUOjhf+COdlf8b9ITg93mDKe8h0OcpirCXw4O2ma3sklabzZKZf +CPhhja6Ro5gmO5pxaLau+esQWNrjEikynNIs+GRphtcFsVVH+ww26mR0nI65Llgv +kb4+DrbDGSPP6R/C2q/LMLM1ABEBAAG0ME1pY2hhbCBOb3dhayAoQ29kZS1TaWdu +aW5nIEtleSkgPG1ub3dha0Bpc2Mub3JnPokCTgQTAQoAOBYhBNmczq+Hl0cBTwON +YxguI1eUYu+qBQJjY3zFAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEBgu +I1eUYu+q9IAP/j/GGneuvjwbXdATiQAmkiFlOxjs+SsO/hgA/mmWcm+Kpg4cAlbP +C2xEDa6biJyZ8TmLZEqPNrRm/umiisC8JnIJpIbInn42n4aDCRDW35lrYGdnP1Ft +fexnEOWAJBDRVvh9OnfRfvf+HLFfLFl40b/15YzkTYGIfrMR9y8zalkzXxsVNsyr +9Eq2pmYR7BT2z8d/9SAVuh8D3qgUylIgcFcCFJodsrI4zJSpIMfMntwVsZxDlis8 +JVFN8/pfhuBBe6vjqX/cGJnj6OL3T12jvvniv13W3rar2Ocm6XA9j1t5TZNhKqAy +azAKu52NtdJjh25B6C/H+haXAX1eduCCE74uSarqS3F1wf6JI3p8fnWzk4hZNzxp +nZjIk3vrHNjE4jXTZosXCf5DoVRfMpNbxj3YEnXV+kNZQRYPPatUPgFYbxz91hbN +tHyCiy0GmTyf0QId8LTc0y9mPtP9QureJJ6rL8lt7pvXyrYglqhxDgRhJIGKMKdw +0bQtTEF4tyNzC4/sg4/omAGH66clhXlqMmuUjHSUiQyA4LL1mJl63Q+bwqXX4B8t +898tSUmb4Jmg3jLZ3Z9Hl7H8Sp3yYPOLzb2YUF6w3xFsUrNNzVxHFo8tAtEhtEfX +D+ypkowZq8g41WqMlOBrrzQFuExUSXckH2Cn97lV6lkBoueqxP+Zv0bbmQINBGNj +qIkBEADDw/CKszyuFKpVp4Z26rKJ3ooOlp8p9a+fmfuknPtMjJMSX8xK8pOlK739 +K83yvDRUidT4+R9IAUKM7TqGA0hoPZmZQLiK0YLlAAXufKxO9IsDZI/7DuF2d8fu +usKQfS4oJC/IbzOAVwgwodnvKhttLWutT09GxiHrnfVPu6Uf4A+GWtrcTIWhXuxE +m7+16ToxBOTLtQ3hh79/RndUuM0ldKRRzJUzASGIPmdQJDLCKgSSeaGjZAdq6gkl +qT/K/R8eoLWSOaBRq8lBE1k7Tq4nSwthMHtCQq4+vxFWH3VF9hwy6ixccROPqt9s +fNfJK3KF4KGhfejMuVn/Lxp1v+Ne2DsdnVofFakAbBMpMyauzAyXPncYSfFhzLBD +kkn7THkfRznmHD8ux89kV534EyqYLjAy8AAD6zNc3tSYgfC0UUw7yz05Sl/eV9Xc +pbezu2ipONlXko8jpCQiiHck599cy+StrjjYPwcHF5m8uUlNnzHoUj8qsoK5SA8u +RnTW2I4DFbL0+x8eL7gmNQYFdMaA4azogtaTFWgPL2jPJ3B+/bUfHDZflvR0FB5+ +OD/QHsDv4SB6uX8TOhGbFsHpt7E0scb2U9B8gQeQQJZ3jmcIRp+K18mjYh/ErDFW +23ixBe7h3tn2MGUTOhv1ibOYDE3GYBuGLQiom6yhCs8zrneuAQARAQABtDFXbG9k +ZWsgV2VuY2VsIChDb2RlLVNpZ25pbmcgS2V5KSA8d2xvZGVrQGlzYy5vcmc+iQJO +BBMBCgA4FiEEAlmjO19aOkRmzzRcel4ITKylGIQFAmNjqIkCGwMFCwkIBwMFFQoJ +CAsFFgIDAQACHgECF4AACgkQel4ITKylGIRk9g//XrvOYy9zQkpo4Dkol8yLxr99 +Dq9Ur2v8F5Ba4za4QdUxeYrlq8J827mkUqMtnlyb/+3zSMy2I6HAI8QxlDZL5K0g +Gm7iLrwVTM8nAQiNU5vAe4D6PeO5ATBEvRdAUTQGz4xeaTrUXbmNUSC1dZEPvH1z +Fa/Z1WZoy9GLeuWDXix6OXTP8FlQWUTL4/ILLtfJDsWCCX7efkyfnvad8Ye2NfU9 +tBjRX5QQ0Dpvgpr8/7El44XcmaHxPWEiq8X2p/d6j3nU/7LspUXRu3ptu5Q2RqMM +iRDZme2c8zieHETpC7m5sshzGxRtT5jWEtZ6V37On5DNTObvXCiaGV95qgiHi5VG +s3MFD3QSo1jJI951k68UM8V+OnzbJGN7TezZ3fTn5Pwdd4C4035QMl0E5NXCcXc8 +9d+3DeFmewRRGCaOKPuO/jFPLWcwMlQqp5tkNx8LpqEZfD7/t6FrSvDUsUDU8Rn0 +TQILnUZioO68HmeuJbhKaUCMuZGjBIbBqviiufFRiJuEFOVKADQ1u/P5ct/0T/gE +JAho3aubzdYMH5DLsaw03W5KfOjeTLW10zSmSK65wnR6fdwlo5l/Sg6Z63QXD+/H +/OIFgzviJkyoh6MkH55z2K8BDWbhOmaUBjNAcQEXV1KyHeLDkQ+TJfLjctv4KIpv +D7i6kNIp1b6OSdDS9W+ZAg0EY2OzdwEQAMRWPO237ohaXNpKO+dw1qkfOYYisiTQ +yfkT7BG0Xvu8jxeOdRuvUzzplgOfwWhOQkyEEXd205/PpwReeeRwhiu0BDSrzYGM +KZdw9Bw4enoaOinf5WTqM76mc5WUYfvDJIiHies+ANxj4EqTzvSif9hxvvzrbKYV +lHdaGtLm40D6yZSzDEe3X49DmEABM4g/Bs7NfVJcJ3LtLo6qbLy2tKEgNPW+VN/s +harufucxnH5HM6BUUOGZx8L04UCNJu+jvZ0zjLc5DqubNO1526kZclAo94DfTkb+ +ir9nxKn7RkdcseibeYPdeIh3le6aU6M0KhTJs3RCxaQF9At08Vrrkh+wkK2Jr5QW +bs8cHpEJ+Q7BwDuAQetFi94eq7Sswh4mjhJ6ZnFCx8v9EbQnvL76afMbhZOezpaQ +aAwXVuIio2fsJpHfxWnXb93H1QKiOQdBZZLQGowcFQCqAWg7h2FwWWbKMV1smGHr +/28tLZtk/4aSCd9cZ9+nofFPPemPLbYwnBECIZN21QKZ2oBXKxb3hchy4EBTKWtC +G/fbTsjSfTCUpMNZ57HO3rGXchjSdIf+tTGJpAqWkTcXuhWXBMWPK6/2REk/DKis +XHugHg9R9hqGs2DaMpGh5NrOLly9+0dsjU15iTQucXbCS9895bRtmDjIN8dLSo9H +6DDw4yO7SHTlABEBAAG0NE1hcmNpbiBHb2R6aW5hIChDb2RlLVNpZ25pbmcgS2V5 +KSA8bWdvZHppbmFAaXNjLm9yZz6JAk4EEwEKADgWIQQJCioHkj+SW1dngDpC5d94 +yDJx2wUCY2OzdwIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRBC5d94yDJx +29U0D/41C8WaGEphQW1N5lT/1284qiPuz3w3iSciAAoAe8iHUGBcSNpAWQmWvWXI +buKb92Gtt8JtSOHwQj8qiHjqRsUu02t/tEgQMQUq6p2jqbxODJfHR8oMFMMB0i0I +RgKtEQeq5wRJpVtH+zIFSl9PorsJtHHfhVbqxvE/axcNKa+WaqZdHuKMqADupQEw +6rD7yYVX6YPiHxMhba2AAAoHT/3VpHC0JidZ5BWGwkfnGbV1/7O91GHfJx6KN/AK +DKb5hFl4TrieDLJzphBWg0y4FJ4K7WSIKvcT2cLel9f9pHV6ysqSZWkCbkjkaVIi +LyoA0o7l263WU0D5oG2ihW6Pa2YrWHDDjfTem+kOEFsMjN+Gw74I4KWUBtldfnHK +A8TyeviKkVok1lwDAoJ3LJi/bcyCLgBZLInOU31mQ7mIXq1ENCOIvQvaG0Lwdt59 +sBI8sknHkt+54t/VCaKbWSBOzgGur6EDf9WtPHWvHNCKEleDiHCELdhRYYtENO7T +vTv6Fq6Lh26dor26LnARLPvGLAKwONJ0vlTEG8IyoD5AHz9MwdXYgzh8wIvc/HtD +/0FlQGLd0WYVI6UjZfPxHOZAzARJKXLJMqiSn8hnO8v6JZaUcOF0yRKTKtzqsjzU +v9TubCGdQAaCSCaD2fmA0BEs/FpOnZ8P1fXMpcHGEtMV0qc0wZkCDQRjY7/GARAA +ubCCHkdiMblMA9ZlcOVN1Wep7TuYxQouATTb+73iHDQRNIU7DvluHoSq5zJe1Qst +zjTmtlkr2dyI5JnBexUEKrw2X7gPXfLaXY01gLLB/Jn8tU9VxPqBybxmjmEdP58B +I7BwmCyMYNqDuvPSfTMlogH/pF35Al+c8UbOfDEQqxSO2nKPNa4T5ZoVxvMxV4gn +hEJPv8Xte/wiE+CxxbmO2we6rwJjWe7O3T0mNmqvpO8iIsLlQnwTFD5L1huywPc0 +UDHK0nl8k2lkue2buaOiancLatXt/i+L1DIimCgZwOt3DlVLURH5lz5ALXE/fn+5 +wKkp+XVyNTAEFhSGifgBDYFw3nZeRTU7unMsRssL8SjuwPWoCcRI/3VE08xCuXc+ +h6NpGfeJjLRgUSSBF+958djY320TcXaRLrqRhjcJ34dBsDYsRSC15nnq2JU6Vj5t +rJL9qOdwVAFwKeAfROUULcy/LHZ3QgKLN5jOfdqYzE2KHk1+VANttRPTG34i6uq6 +yzCFFYadwST22+QWvxh2ohYj2INvvrzRf3lVxssWyb4USB0JPajgnGeNY/hSYfDa +KArqOr9S+3q7h0v4RgoPxDRFIC8v/10W4wPC7R3wj0m/1WHkSm951Wtzq3V84uCF +LLhx2ByNpnJFRFqklonAH3WHUIeYcdXAsTeunrGU/XsAEQEAAbQuR3JlZyBDaG91 +bGVzIChDb2RlLVNpZ25pbmcgS2V5KSA8Z3JlZ0Bpc2Mub3JnPokCTgQTAQoAOBYh +BJWA1r8syA8eO7ESUt6rkdVLE8m4BQJjY7/GAhsDBQsJCAcDBRUKCQgLBRYCAwEA +Ah4BAheAAAoJEN6rkdVLE8m42PwP/RFmUzgsoM23Z/NQ2AacCFTmHweEllkmf+25 +3hP80BuSHKsdzlmllFux+xbKZEpQK0nL3fqW8yyv69WmsoKZPpZJxmQ6bwUbtXC7 +rHkt5gfOXiTaxDBmgO2dcnDsKLb+bEQ7C5hay1P8rOvf13a4UZeTP37gRGmMr38+ +LvADIspIxBdSvFa7Hb4HKG4VVDai8jaPCF0q8daEWMJxyKSfOQBtSVVAzjLcGrYR +bCPDAI1DEASyQOru52WREe4vJCwSaq9dZyGhaWcnyTVQO8bsSLxu7cUVxA3SOheQ +izYKkYNbaBDmWlZxLYFsTUf5izEYdW5BwHaowmw22hSspFod+c37BoY/ePfkR5iQ +YuEff/unyqvdHMDqIXWZqpAi5o5hW3jdCd7ZL5T0WWjz4CQ8eko1ZYYnYzZlDrge +F0veW8+lzHBLx3Ad8HyVGwtRe+VV1V0AZ0lpWMtxo02ZDRtqNDqPqVfLT5P87ZPv +r5GhKtedgrjwY2clgmCT0xgAKNxi2SC+c/vI5PRkIoqwbTiryLIYq8tl6T1k6AMY +eN1ZNQR7eNEXpIvYRD/BZw7IWKkCRaKwfDVhUHCm0ikylwdLXIfEEEA5mu2LJeZh +vCddhks0S8+lRyWR/3okurF6rlloNtM1pslceh2AMDwfs3fORhYJxFsV7O7fyRnD +NS93fq56mQINBGNj8P4BEADXK//p0lWEUNUYirsm6BUyUXqPlPrpVTdPB1tJPj1o +zgeMKFOpYRPU1IZF1G6pbKD09gL6y19LehQYx1a57PF7kCx2ZvvcFN24EHto1H1p +Ti48dZ7KyyEO1rBeLY5Zjgz6YvQZcSH3cd6cTrAo7hPIAjtgSTWp04FjtYJqf+tT +gf+9ZWY+i4nQ6/Q5Z5NUd8jsOcOoFDsmY6Fds+lzn0aZSg2yfd8fnX5QFOIwDv66 +aM25q2kvkrX0wtvSQbulC8x5g6fIB3xEL6MWbXcEBYkBMW5Cnw/Kmyj7lJwVwvEO +FFhKaOH/d2LG3rM66gl048aJYLhEJyFSyooBynXs8S/NLDgca94Bvb54FPX8LC3p +lqJRLxhdkha5NLcUYiHOq/L7LWdThh5rRAy87Ggog8TVza118K3oiYujlyVEzLhB +NVMT8x5kl15YknVgOKJAv9j28bSZihHrS7aga1BtYFD8yA9MuuDaHARV6YmThkdg +OEz/PNECjsxCLcT5Bbthzg6Jg1qo3Unyeup0UbyX4zxSphCVmerDmMYddLjJ/ydc +1uxyn4IPINBSx2sAPuUIymhVC29MB6N+SnB37/poTvSsIH15Vg264OVdaervIpuC +W3eUANr7zrdO85nc1CTWGhugFwccXv9nyxAt8zUF/ci17p1/mLpy9K3LqlStVI9j +MwARAQABtDBDYXRoeSBBbG1vbmQgKENvZGUtU2lnbmluZyBLZXkpIDxjYXRoeWFA +aXNjLm9yZz6JAk4EEwEKADgWIQT8h0w+P+hncHCscb617/asfhrd+AUCY2Pw/gIb +AwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRC17/asfhrd+HM6D/9KD/n245Fq +jVzew92lJtufAxAFkTA5WO6fXweMlUeqMOub4vpVMLPLoFe5TzWbJMtF0m/P5+aU +YbcvZBWFHsrnwTgA55c1VrhggLOxpw4EU0TvBdwrO7PFOYc2WznaMG+mJdqw+uNM +yK+G44aIaC6rvi3ILSo5HPnbgQWHs39QIRLLcUjtqvavQQeyYAl0zrvNI9Xrs/Nf +eE6PS4hIXg90A9VJRhay18w9hA+STb+xmK+3oSwP1ayLqqQ43OnV/pExSHBsjBQk +4p1nIPlRFL30lGp/o2MoBsRvQM1tELpgBTk1LaTHzuKEpOskrWU37xu0QgEtj7YE +r0X+GGBxgJuUzqSyLsaDgH1sEDqE+AthFfv2dxDadcXM2cdch9y3OyuSMo89aWGc +mEVyesjYoV40tDCG73qLtfehhV/iARDMCfnZGyGYIZdDBL+tZTNeLKVDIUi/R3x9 +OmpEl8ZuCuYltyEsJnCF/rQBVMgcTOmsMu6CMx+qT3kC8iGtHqkUT2ufpKISahTn +e329FQjClEWwBHkr0T4K80Z0REjSo6UBtio73IOCxXe0RqO37L/qgo8xKZbLxy86 +857PRWJhgbw169FJ2kR5p+M5d/g/MUeYnigvWlORW5LyrFg6RnZ1ZbULZI80QhHN +aSFf/w020HBsLCkzWA/XM6MO2ifJTSn8NpkCDQRkSjCrARAApLUMHAbmxUMWLgDQ +apRZBwWXriEyIVqA/SIy1PyWPPFXqs3LZ5Kn5Gw1WO8PfzkPZNtccGmNLjujIoRB +qR41nV5zxcpS896SujBoYl80A4F4v9Op9i2pFeI9r9acFcUDjbGWBqNro4EfRcJN +Ctkd9+pl3TUvFX06QCTxmmHy3M81SW3b4NWI+jia1cKjCd+qBFBgKWdjSMBeVTBC +R9eKqsBQ1UJql2bRzc8pReS+TYCeEbhaOCvUCCKCwGtsSUOW726iNB/4zR4OOuQV +B9ORufwed+E/RXa8N08/l5O96uXG0krJtOVm0/qQcXOaKxiDo6djnAgCdjFK5zaj +7594wqbI7de58alWb/egqIhjBTgk+/cO+epZ05qx5SoJZL7ny2ottrfS2cBqP4g1 +SIt1sYl9ImHmJkNrNDy0s25nE9Nga6OfRqVbwnwot4ouTGwj0oZsCjw+gWjDdztH +1fUWSnlA8jaX9/RZG2wKt9dI+Tp/U4d5dyTb8lIIzzgtAzDmDfPxwwT0rxAAL13A +gDkJ0AzXA4WTOxb/JE2yfCz//kt7n8SYM//LixL4VAB7e/wnfZBhTq0OFpaPjFU0 +h/k0dc40AqcUuK3lSSjQr3KTzRHtjz8qtN4DFSuyZac83QSVtWE1rFKjS8bl3XHC +kFFRJ2dMt2WRSkLOYNiTGbYLvmEAEQEAAbQwQW5kcmVpIFBhdmVsIChDb2RlLVNp +Z25pbmcgS2V5KSA8YW5kcmVpQGlzYy5vcmc+iQJOBBMBCgA4FiEE2mo1COZypJ3T +gq/ZW49NkbiO2QkFAmRKMKsCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQ +W49NkbiO2QnQZw//XCpeqT0z/sqtu4FYWwYLz1OvWqhe+uA45f9BccnNSVkGFa7w +3hlLQC/FLUIx2cVy9AluJBP29iQge/bCcXnzo/QvCbhe/4lCTxhr7nsBe1bWpuNI +4Pl+cQxZQBwcz74zZ1jjaaQOqm3XtdZxeKNfCQmNvz389UZEk2m8K6qJD23fy20V +n5Y2C502UuP3MitbYKBxBSbs+Auwy1evz/prQ9VeD4Nv3Zr+jWbWFW+dSDC8jkrX +cGdwWrUQ51QD8VBB9lPWPGY6yTbRmacr4AlVSo2DAfyjHRrGHigRF/VAD5p1+u2g +3UFLJaEyujfzwU1kG4+zQCWZ2W2UBOekklq/yefxEY5vU1/Lad7vQhBmogQNF21T +FvLUE6ez7XNsdMZStDPiT8OoTyFZYLRM4yw5rWKw+1mICBv7NV82YD/8hoMoZPyX +2tNRTXv2MZ6qD++0dMCIZNEyFTB344srvQSyJ7K7vwxulc7iFWngRA8oe6JkAhH4 +B0yNq1FJm6jIL41S2FmnDL3DlfAdKWapBqzgqkv+X5DQBaTlG9a4BcSsdMJgU/Yx +dD03YsKhDtEWTqBmmEamR1K1CgCC3mOJfsHB5z+Qhdraz2hMr00EQrD5lnpLLpcF +rYWoilvVlRy7Y7U5wfhY4074L2ZfB+yElKsvtfGKJX/8g+eJdeRuII+hjEc= +=NX7P +-----END PGP PUBLIC KEY BLOCK----- diff --git a/SOURCES/named-chroot-setup.service b/named-chroot-setup.service similarity index 100% rename from SOURCES/named-chroot-setup.service rename to named-chroot-setup.service diff --git a/SOURCES/named-chroot.files b/named-chroot.files similarity index 100% rename from SOURCES/named-chroot.files rename to named-chroot.files diff --git a/SOURCES/named-chroot.service b/named-chroot.service similarity index 87% rename from SOURCES/named-chroot.service rename to named-chroot.service index a49df15..4c38601 100644 --- a/SOURCES/named-chroot.service +++ b/named-chroot.service @@ -17,7 +17,7 @@ EnvironmentFile=-/etc/sysconfig/named Environment=KRB5_KTNAME=/etc/named.keytab PIDFile=/var/named/chroot/run/named/named.pid -ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -t /var/named/chroot -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' +ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/bin/named-checkconf -t /var/named/chroot -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} -t /var/named/chroot $OPTIONS ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/rndc reload; else /bin/kill -HUP $MAINPID; fi' @@ -25,6 +25,7 @@ ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/r ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID' PrivateTmp=false +Restart=on-abnormal [Install] WantedBy=multi-user.target diff --git a/SOURCES/named-setup-rndc.service b/named-setup-rndc.service similarity index 100% rename from SOURCES/named-setup-rndc.service rename to named-setup-rndc.service diff --git a/SOURCES/named.conf b/named.conf similarity index 97% rename from SOURCES/named.conf rename to named.conf index 1dc9d15..c906875 100644 --- a/SOURCES/named.conf +++ b/named.conf @@ -30,10 +30,10 @@ options { */ recursion yes; - dnssec-enable yes; dnssec-validation yes; managed-keys-directory "/var/named/dynamic"; + geoip-directory "/usr/share/GeoIP"; pid-file "/run/named/named.pid"; session-keyfile "/run/named/session.key"; diff --git a/SOURCES/named.conf.sample b/named.conf.sample similarity index 77% rename from SOURCES/named.conf.sample rename to named.conf.sample index a6cdc5e..0f3ae98 100644 --- a/SOURCES/named.conf.sample +++ b/named.conf.sample @@ -63,10 +63,6 @@ options /* DNSSEC related options. See information about keys ("Trusted keys", bellow) */ - /* Enable serving of DNSSEC related data - enable on both authoritative - and recursive servers DNSSEC aware servers */ - dnssec-enable yes; - /* Enable DNSSEC validation on recursive servers */ dnssec-validation yes; @@ -163,17 +159,17 @@ view "internal" */ zone "my.internal.zone" { - type master; + type primary; file "my.internal.zone.db"; }; zone "my.slave.internal.zone" { - type slave; + type secondary; file "slaves/my.slave.internal.zone.db"; masters { /* put master nameserver IPs here */ 127.0.0.1; } ; // put slave zones in the slaves/ directory so named can update them }; zone "my.ddns.internal.zone" { - type master; + type primary; allow-update { key ddns_key; }; file "dynamic/my.ddns.internal.zone.db"; // put dynamically updateable zones in the slaves/ directory so named can update them @@ -182,8 +178,8 @@ view "internal" key ddns_key { - algorithm hmac-md5; - secret "use /usr/sbin/dnssec-keygen to generate TSIG keys"; + algorithm hmac-sha256; + secret "use /usr/sbin/ddns-confgen to generate TSIG keys"; }; view "external" @@ -206,7 +202,7 @@ view "external" // contain entries for just your web and mail servers: zone "my.external.zone" { - type master; + type primary; file "my.external.zone.db"; }; }; @@ -214,39 +210,34 @@ view "external" /* Trusted keys This statement contains DNSSEC keys. If you want DNSSEC aware resolver you - have to configure at least one trusted key. + should configure at least one trusted key. Note that no key written below is valid. Especially root key because root zone is not signed yet. */ /* -trusted-keys { +trust-anchors { // Root Key -"." 257 3 3 "BNY4wrWM1nCfJ+CXd0rVXyYmobt7sEEfK3clRbGaTwSJxrGkxJWoZu6I7PzJu/ - E9gx4UC1zGAHlXKdE4zYIpRhaBKnvcC2U9mZhkdUpd1Vso/HAdjNe8LmMlnzY3 - zy2Xy4klWOADTPzSv9eamj8V18PHGjBLaVtYvk/ln5ZApjYghf+6fElrmLkdaz - MQ2OCnACR817DF4BBa7UR/beDHyp5iWTXWSi6XmoJLbG9Scqc7l70KDqlvXR3M - /lUUVRbkeg1IPJSidmK3ZyCllh4XSKbje/45SKucHgnwU5jefMtq66gKodQj+M - iA21AfUVe7u99WzTLzY3qlxDhxYQQ20FQ97S+LKUTpQcq27R7AT3/V5hRQxScI - Nqwcz4jYqZD2fQdgxbcDTClU0CRBdiieyLMNzXG3"; +. initial-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3 + +/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv + ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF + 0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e + oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd + RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN + R1AkUTV74bU="; // Key for forward zone -example.com. 257 3 5 "AwEAAaxPMcR2x0HbQV4WeZB6oEDX+r0QM65KbhTjrW1ZaARmPhEZZe - 3Y9ifgEuq7vZ/zGZUdEGNWy+JZzus0lUptwgjGwhUS1558Hb4JKUbb - OTcM8pwXlj0EiX3oDFVmjHO444gLkBO UKUf/mC7HvfwYH/Be22GnC - lrinKJp1Og4ywzO9WglMk7jbfW33gUKvirTHr25GL7STQUzBb5Usxt - 8lgnyTUHs1t3JwCY5hKZ6CqFxmAVZP20igTixin/1LcrgX/KMEGd/b - iuvF4qJCyduieHukuY3H4XMAcR+xia2 nIUPvm/oyWR8BW/hWdzOvn - SCThlHf3xiYleDbt/o1OTQ09A0="; +example.com. static-key 257 3 8 "AwEAAZ0aqu1rJ6orJynrRfNpPmayJZoAx9Ic2/Rl9VQW + LMHyjxxem3VUSoNUIFXERQbj0A9Ogp0zDM9YIccKLRd6 + LmWiDCt7UJQxVdD+heb5Ec4qlqGmyX9MDabkvX2NvMws + UecbYBq8oXeTT9LRmCUt9KUt/WOi6DKECxoG/bWTykrX + yBR8elD+SQY43OAVjlWrVltHxgp4/rhBCvRbmdflunaP + Igu27eE2U4myDSLT8a4A0rB5uHG4PkOa9dIRs9y00M2m + Wf4lyPee7vi5few2dbayHXmieGcaAHrx76NGAABeY393 + xjlmDNcUkF1gpNWUla4fWZbbaYQzA93mLdrng+M="; + // Key for reverse zone. -2.0.192.IN-ADDRPA.NET. 257 3 5 "AQOnS4xn/IgOUpBPJ3bogzwcxOdNax071L18QqZnQQQA - VVr+iLhGTnNGp3HoWQLUIzKrJVZ3zggy3WwNT6kZo6c0 - tszYqbtvchmgQC8CzKojM/W16i6MG/ea fGU3siaOdS0 - yOI6BgPsw+YZdzlYMaIJGf4M4dyoKIhzdZyQ2bYQrjyQ - 4LB0lC7aOnsMyYKHHYeRv PxjIQXmdqgOJGq+vsevG06 - zW+1xgYJh9rCIfnm1GX/KMgxLPG2vXTD/RnLX+D3T3UL - 7HJYHJhAZD5L59VvjSPsZJHeDCUyWYrvPZesZDIRvhDD - 52SKvbheeTJUm6EhkzytNN2SN96QRk8j/iI8ib"; +2.0.192.IN-ADDRPA.NET. initial-ds 31406 8 2 "F78CF3344F72137235098ECBBD08947C2C9001C7F6A085A17F518B5D8F6B916D"; }; */ diff --git a/SOURCES/named.empty b/named.empty similarity index 100% rename from SOURCES/named.empty rename to named.empty diff --git a/SOURCES/named.localhost b/named.localhost similarity index 100% rename from SOURCES/named.localhost rename to named.localhost diff --git a/SOURCES/named.logrotate b/named.logrotate similarity index 100% rename from SOURCES/named.logrotate rename to named.logrotate diff --git a/SOURCES/named.loopback b/named.loopback similarity index 100% rename from SOURCES/named.loopback rename to named.loopback diff --git a/SOURCES/named.rfc1912.zones b/named.rfc1912.zones similarity index 92% rename from SOURCES/named.rfc1912.zones rename to named.rfc1912.zones index fa8caf5..2c3c2a8 100644 --- a/SOURCES/named.rfc1912.zones +++ b/named.rfc1912.zones @@ -15,31 +15,31 @@ // zone "localhost.localdomain" IN { - type master; + type primary; file "named.localhost"; allow-update { none; }; }; zone "localhost" IN { - type master; + type primary; file "named.localhost"; allow-update { none; }; }; zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN { - type master; + type primary; file "named.loopback"; allow-update { none; }; }; zone "1.0.0.127.in-addr.arpa" IN { - type master; + type primary; file "named.loopback"; allow-update { none; }; }; zone "0.in-addr.arpa" IN { - type master; + type primary; file "named.empty"; allow-update { none; }; }; diff --git a/named.root b/named.root new file mode 100644 index 0000000..8b8a3b1 --- /dev/null +++ b/named.root @@ -0,0 +1,92 @@ +; This file holds the information on root name servers needed to +; initialize cache of Internet domain name servers +; (e.g. reference this file in the "cache . " +; configuration file of BIND domain name servers). +; +; This file is made available by InterNIC +; under anonymous FTP as +; file /domain/named.cache +; on server FTP.INTERNIC.NET +; -OR- RS.INTERNIC.NET +; +; last update: December 20, 2023 +; related version of root zone: 2023122001 +; +; FORMERLY NS.INTERNIC.NET +; +. 3600000 NS A.ROOT-SERVERS.NET. +A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 +A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:ba3e::2:30 +; +; FORMERLY NS1.ISI.EDU +; +. 3600000 NS B.ROOT-SERVERS.NET. +B.ROOT-SERVERS.NET. 3600000 A 170.247.170.2 +B.ROOT-SERVERS.NET. 3600000 AAAA 2801:1b8:10::b +; +; FORMERLY C.PSI.NET +; +. 3600000 NS C.ROOT-SERVERS.NET. +C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 +C.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2::c +; +; FORMERLY TERP.UMD.EDU +; +. 3600000 NS D.ROOT-SERVERS.NET. +D.ROOT-SERVERS.NET. 3600000 A 199.7.91.13 +D.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2d::d +; +; FORMERLY NS.NASA.GOV +; +. 3600000 NS E.ROOT-SERVERS.NET. +E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 +E.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:a8::e +; +; FORMERLY NS.ISC.ORG +; +. 3600000 NS F.ROOT-SERVERS.NET. +F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 +F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f +; +; FORMERLY NS.NIC.DDN.MIL +; +. 3600000 NS G.ROOT-SERVERS.NET. +G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 +G.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:12::d0d +; +; FORMERLY AOS.ARL.ARMY.MIL +; +. 3600000 NS H.ROOT-SERVERS.NET. +H.ROOT-SERVERS.NET. 3600000 A 198.97.190.53 +H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::53 +; +; FORMERLY NIC.NORDU.NET +; +. 3600000 NS I.ROOT-SERVERS.NET. +I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 +I.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fe::53 +; +; OPERATED BY VERISIGN, INC. +; +. 3600000 NS J.ROOT-SERVERS.NET. +J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30 +J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:c27::2:30 +; +; OPERATED BY RIPE NCC +; +. 3600000 NS K.ROOT-SERVERS.NET. +K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 +K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1 +; +; OPERATED BY ICANN +; +. 3600000 NS L.ROOT-SERVERS.NET. +L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42 +L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:9f::42 +; +; OPERATED BY WIDE +; +. 3600000 NS M.ROOT-SERVERS.NET. +M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 +M.ROOT-SERVERS.NET. 3600000 AAAA 2001:dc3::35 +; End of file \ No newline at end of file diff --git a/SOURCES/named.root.key b/named.root.key similarity index 53% rename from SOURCES/named.root.key rename to named.root.key index 48449a8..fbcb5d3 100644 --- a/SOURCES/named.root.key +++ b/named.root.key @@ -1,4 +1,4 @@ -managed-keys { +trust-anchors { # ROOT KEYS: See https://data.iana.org/root-anchors/root-anchors.xml # for current trust anchor information. # @@ -9,11 +9,5 @@ managed-keys { # file as initializing keys; thereafter, the keys in the # managed key database will be trusted and maintained # automatically. - . initial-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3 - +/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv - ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF - 0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e - oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd - RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN - R1AkUTV74bU="; + . initial-ds 20326 8 2 "E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D"; }; diff --git a/SOURCES/named.rwtab b/named.rwtab similarity index 100% rename from SOURCES/named.rwtab rename to named.rwtab diff --git a/SOURCES/named.service b/named.service similarity index 85% rename from SOURCES/named.service rename to named.service index 7cd6d34..5c32fc5 100644 --- a/SOURCES/named.service +++ b/named.service @@ -13,13 +13,14 @@ EnvironmentFile=-/etc/sysconfig/named Environment=KRB5_KTNAME=/etc/named.keytab PIDFile=/run/named/named.pid -ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' +ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/bin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/rndc reload; else /bin/kill -HUP $MAINPID; fi' ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID' PrivateTmp=true +Restart=on-abnormal [Install] WantedBy=multi-user.target diff --git a/SOURCES/named.sysconfig b/named.sysconfig similarity index 100% rename from SOURCES/named.sysconfig rename to named.sysconfig diff --git a/named.sysusers b/named.sysusers new file mode 100644 index 0000000..f173c78 --- /dev/null +++ b/named.sysusers @@ -0,0 +1,3 @@ +#Type Name ID GECOS Home directory Shell +u named 25 "Named" /var/named /sbin/nologin +g named 25 diff --git a/SOURCES/setup-named-chroot.sh b/setup-named-chroot.sh similarity index 100% rename from SOURCES/setup-named-chroot.sh rename to setup-named-chroot.sh diff --git a/setup-named-softhsm.sh b/setup-named-softhsm.sh new file mode 100755 index 0000000..c0f8445 --- /dev/null +++ b/setup-named-softhsm.sh @@ -0,0 +1,124 @@ +#!/bin/sh +# +# This script will initialise token storage of softhsm PKCS11 provider +# in custom location. Is useful to store tokens in non-standard location. +# +# Output can be evaluated from bash, it will prepare it for usage of temporary tokens. +# Quotes around eval are mandatory! +# Recommended use: +# eval "$(bash setup-named-softhsm.sh -A)" +# + +SOFTHSM2_CONF="$1" +TOKENPATH="$2" +GROUPNAME="$3" +# Do not use this script for real keys worth protection +# This is intended for crypto accelerators using PKCS11 interface. +# Uninitialized token would fail any crypto operation. +PIN=1234 +SO_PIN=1234 +LABEL=rpm + +set -e + +echo_i() +{ + echo "#" $@ +} + +random() +{ + if [ -x "$(which openssl 2>/dev/null)" ]; then + openssl rand -base64 $1 + else + dd if=/dev/urandom bs=1c count=$1 | base64 + fi +} + +usage() +{ + echo "Usage: $0 -A [token directory] [group]" + echo " or: $0 [group]" +} + +if [ "$SOFTHSM2_CONF" = "-A" -a -z "$TOKENPATH" ]; then + TOKENPATH=$(mktemp -d /var/tmp/softhsm-XXXXXX) +fi + +if [ -z "$SOFTHSM2_CONF" -o -z "$TOKENPATH" ]; then + usage >&2 + exit 1 +fi + +if [ "$SOFTHSM2_CONF" = "-A" ]; then + # Automagic mode instead + MODE=secure + SOFTHSM2_CONF="$TOKENPATH/softhsm2.conf" + PIN_SOURCE="$TOKENPATH/pin" + SOPIN_SOURCE="$TOKENPATH/so-pin" + TOKENPATH="$TOKENPATH/tokens" +else + MODE=legacy +fi + +[ -d "$TOKENPATH" ] || mkdir -p "$TOKENPATH" + +umask 0022 + +if ! [ -f "$SOFTHSM2_CONF" ]; then +cat << SED > "$SOFTHSM2_CONF" +# SoftHSM v2 configuration file + +directories.tokendir = ${TOKENPATH} +objectstore.backend = file + +# ERROR, WARNING, INFO, DEBUG +log.level = ERROR + +# If CKF_REMOVABLE_DEVICE flag should be set +slots.removable = false +SED +else + echo_i "Config file $SOFTHSM2_CONF already exists" >&2 +fi + +if [ -n "$PIN_SOURCE" ]; then + touch "$PIN_SOURCE" "$SOPIN_SOURCE" + chmod 0600 "$PIN_SOURCE" "$SOPIN_SOURCE" + if [ -n "$GROUPNAME" ]; then + chgrp "$GROUPNAME" "$PIN_SOURCE" "$SOPIN_SOURCE" + chmod g+r "$PIN_SOURCE" "$SOPIN_SOURCE" + fi +fi + +export SOFTHSM2_CONF + +if softhsm2-util --show-slots | grep 'Initialized:[[:space:]]*yes' > /dev/null +then + echo_i "Token in ${TOKENPATH} is already initialized" >&2 + + [ -f "$PIN_SOURCE" ] && PIN=$(cat "$PIN_SOURCE") + [ -f "$SOPIN_SOURCE" ] && SO_PIN=$(cat "$SOPIN_SOURCE") +else + PIN=$(random 6) + SO_PIN=$(random 18) + if [ -n "$PIN_SOURCE" ]; then + echo -n "$PIN" > "$PIN_SOURCE" + echo -n "$SO_PIN" > "$SOPIN_SOURCE" + fi + + echo_i "Initializing tokens to ${TOKENPATH}..." + softhsm2-util --init-token --free --label "$LABEL" --pin "$PIN" --so-pin "$SO_PIN" | sed -e 's/^/# /' + + if [ -n "$GROUPNAME" ]; then + chgrp -R -- "$GROUPNAME" "$TOKENPATH" + chmod -R -- g=rX,o= "$TOKENPATH" + fi +fi + +echo "export SOFTHSM2_CONF=\"$SOFTHSM2_CONF\"" +echo "export PIN_SOURCE=\"$PIN_SOURCE\"" +echo "export SOPIN_SOURCE=\"$SOPIN_SOURCE\"" +# These are intentionaly not exported +echo "PIN=\"$PIN\"" +echo "SO_PIN=\"$SO_PIN\"" diff --git a/sources b/sources new file mode 100644 index 0000000..6a2c757 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (bind-9.18.33.tar.xz) = 874465ccc7af92561dccf2bd596e13513048c4f1da730a6f38103eeb1d5b67178c1e2e2a56612946eba6edb9dad34851b9826055bcb7c0dad7ec64f7df9c10b9 diff --git a/SOURCES/trusted-key.key b/trusted-key.key similarity index 100% rename from SOURCES/trusted-key.key rename to trusted-key.key