Score:-1

bind9 with mysql dlz start failed with Required token $zone$ not found

fi flag

bind 9.16.33 with mysql dlz start failed with Required token $zone$ not found. detailed informations:

$ sudo named -d 0 -g
07-Dec-2022 14:54:31.043 starting BIND 9.16.33 (Extended Support Version) <id:35e9c6e>
07-Dec-2022 14:54:31.043 running on Linux x86_64 6.0.9-kagamine #2 SMP PREEMPT_DYNAMIC Sat Nov 26 18:02:37 HKT 2022
07-Dec-2022 14:54:31.043 built with '--build=x86_64-pc-linux-gnu' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--datarootdir=/usr/share' '--disable-static' '--docdir=/usr/share/doc/bind-9.16.33' '--htmldir=/usr/share/doc/bind-9.16.33/html' '--with-sysroot=/' '--libdir=/usr/lib64' 'AR=/usr/bin/x86_64-pc-linux-gnu-ar' '--prefix=/usr' '--sysconfdir=/etc/bind' '--localstatedir=/var' '--with-libtool' '--enable-full-report' '--without-readline' '--with-openssl=/usr' '--without-cmocka' '--disable-backtrace' '--enable-linux-caps' '--disable-dnsrps' '--disable-dnstap' '--disable-fixed-rrset' '--without-dlz-bdb' '--with-dlopen' '--with-dlz-filesystem' '--with-dlz-stub' '--without-gssapi' '--without-json-c' '--without-dlz-ldap' '--with-dlz-mysql' '--without-dlz-odbc' '--without-dlz-postgres' '--without-lmdb' '--with-libxml2' '--with-zlib' '--without-python' '--without-maxminddb' '--disable-geoip' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu' 'CFLAGS=-O3 -pipe -mavx2 -mfma -maes -Wno-unused-variable -finline-functions -fomit-frame-pointer' 'LDFLAGS=-O3 -pipe -mavx2 -mfma -maes -Wno-unused-variable -finline-functions -fomit-frame-pointer -Wl,-O3 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,-x -Wl,-X'
07-Dec-2022 14:54:31.043 running as: named -d 0 -g
07-Dec-2022 14:54:31.043 compiled by GCC 11.3.0
07-Dec-2022 14:54:31.043 compiled with OpenSSL version: OpenSSL 1.1.1q  5 Jul 2022
07-Dec-2022 14:54:31.043 linked to OpenSSL version: OpenSSL 1.1.1q  5 Jul 2022
07-Dec-2022 14:54:31.043 compiled with libxml2 version: 2.10.3
07-Dec-2022 14:54:31.043 linked to libxml2 version: 21003
07-Dec-2022 14:54:31.043 compiled with zlib version: 1.2.12
07-Dec-2022 14:54:31.043 linked to zlib version: 1.2.13
07-Dec-2022 14:54:31.043 ---------------------------------------------
07-Dec-2022 14:54:31.043 BIND 9 is maintained by Internet Systems Consortium,
07-Dec-2022 14:54:31.043 Inc. (ISC), a non-profit 501(c)(3) public-benefit
07-Dec-2022 14:54:31.043 corporation.  Support and training for BIND 9 are
07-Dec-2022 14:54:31.043 available at https://www.isc.org/support
07-Dec-2022 14:54:31.043 ---------------------------------------------
07-Dec-2022 14:54:31.043 adjusted limit on open files from 4096 to 1048576
07-Dec-2022 14:54:31.043 found 28 CPUs, using 28 worker threads
07-Dec-2022 14:54:31.043 using 28 UDP listeners per interface
07-Dec-2022 14:54:31.075 using up to 21000 sockets
07-Dec-2022 14:54:31.078 loading configuration from '/etc/bind/named.conf'
07-Dec-2022 14:54:31.078 reading built-in trust anchors from file '/etc/bind/bind.keys'
07-Dec-2022 14:54:31.078 using default UDP/IPv4 port range: [32768, 60999]
07-Dec-2022 14:54:31.078 using default UDP/IPv6 port range: [32768, 60999]
07-Dec-2022 14:54:31.079 listening on IPv4 interface lo, 127.0.0.1#5353
07-Dec-2022 14:54:31.089 listening on IPv4 interface wg0, 10.123.112.20#5353
07-Dec-2022 14:54:31.092 listening on IPv6 interface lo, ::1#5353
07-Dec-2022 14:54:31.094 generating session key for dynamic DNS
07-Dec-2022 14:54:31.095 sizing zone task pool based on 1 zones
07-Dec-2022 14:54:31.095 Loading 'example_com_dlz' using driver mysql
07-Dec-2022 14:54:31.095 Required token $zone$ not found.
07-Dec-2022 14:54:31.095 Could not build find zone query list
07-Dec-2022 14:54:31.095 mysql driver could not create database instance object.
07-Dec-2022 14:54:31.095 SDLZ driver failed to load.
07-Dec-2022 14:54:31.095 DLZ driver failed to load.
07-Dec-2022 14:54:31.095 loading configuration: failure
07-Dec-2022 14:54:31.095 exiting (due to fatal error)

in named.conf :

zone "example.com" {
        type master;
        dlz example_com_dlz;
};

dlz "example_com_dlz" {
        database "mysql
                {socket=/run/mysqld/mysqld.sock user=root dbname=zonecc}
                {select id from example_com where zone = '%zone%' }
                {select ttl, record, case when type='TXT' then concat('\"', data, '\"') else data end from example_com where host = '%record%' and zone = '%zone%' }
                ";
};

in mariadb :

select * from example_com;
+-----+------------+--------+------+---------------------------------------------+-----------+
| id  | host       | record | ttl  | data                                                                    | zone      |
+-----+------------+--------+------+---------------------------------------------+-----------+
|   1 | @          | SOA    |  300 | ns0.example.com. dns.mail.example.com. 1670134076 7200 1800 604800 1800 | example.com |
|   2 | @          | NS     |  900 | ns0.example.com                                                         | example.com |
|   3 | @          | NS     | 1200 | ns1.example.com                                                         | example.com |
|  10 | ns0        | A      |  600 | xx.xx.xx.xx                                                             | example.com |
|  11 | ns0        | AAAA   |  600 | xxxx::xxxx                                                              | example.com |
|  12 | ns1        | AAAA   |  600 | xx.xx.xx.xx                                                             | example.com |
|  13 | ns1        | AAAA   |  600 | xxxx::xxxx                                                              | example.com |
|  28 | hydrogen   | A      |  600 | xx.xx.xx.xx                                                             | example.com |
|  29 | hydrogen   | AAAA   |  600 | xxxx:xxxx                                                               | example.com |
...
Score:1
jp flag

It seems you need to use $zone$ instead of %zone%. I also suspect that you need to replace delimiters for other variables like %record% too.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.