<file name="named.conf">
##
##  @l_prefix@/etc/bind/named.conf -- BIND configuration
##

controls {
    inet 127.0.0.1 port 953
         allow { 127.0.0.1;  }
         keys  { "rndc-key"; };
};

include "@l_prefix@/etc/bind/rndc.key";

logging {
    channel logfile {
        file "@l_prefix@/var/bind/log/named.log";
        severity info;
        print-category yes;
        print-severity no;
        print-time yes;
    };
    category "default"         { "logfile"; };
    category "client"          { "logfile"; };
    category "config"          { "logfile"; };
    category "database"        { "logfile"; };
    category "delegation-only" { "logfile"; };
    category "dispatch"        { "logfile"; };
    category "dnssec"          { "logfile"; };
    category "general"         { "logfile"; };
    category "lame-servers"    { "logfile"; };
    category "network"         { "logfile"; };
    category "notify"          { "logfile"; };
    category "queries"         { "logfile"; };
    category "resolver"        { "logfile"; };
    category "security"        { "logfile"; };
    category "update"          { "logfile"; };
    category "xfer-in"         { "logfile"; };
    category "xfer-out"        { "logfile"; };
    category "unmatched"       { "null";    };
};

options {
    pid-file             "@l_prefix@/var/bind/run/named.pid";
    statistics-file      "@l_prefix@/var/bind/run/named.stats";
    directory            "@l_prefix@/etc/bind/named.db";
    allow-query          { any; };
    allow-transfer       { any; };
    allow-recursion      { localnets; };
    recursion            yes;
    transfers-in         10;
    transfers-per-ns     2;
    max-transfer-time-in 120;
    transfer-format      one-answer;
    interface-interval   60;
    listen-on            port 53 { 127.0.0.1; };
    #query-source        address 127.0.0.1 port *;
    #transfer-source     127.0.0.1;
    #notify-source       127.0.0.1;
    #forwarders          { 1.1.1.1; 9.9.9.9; 8.8.8.8; };
};

zone "." IN {
    type hint;
    file "db.root";
};

zone "localhost" IN {
    type           master;
    file           "db.localhost";
    notify         no;
    allow-update   { none; };
    allow-transfer { any;  };
};

zone "0.0.127.in-addr.arpa" IN {
    type           master;
    file           "db.localhost.ipv4";
    notify         no;
    allow-update   { none; };
    allow-transfer { any;  };
};

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;
    file           "db.localhost.ipv6";
    notify         no;
    allow-update   { none; };
    allow-transfer { any;  };
};

</file>
<file name="rndc.conf">
##
##  @l_prefix@/etc/bind/rndc.conf -- BIND rndc configuration
##

options {
    default-server localhost-inet;
};

server localhost-inet {
    addresses { 127.0.0.1; };
    port 953;
    key "rndc-key";
};

include "@l_prefix@/etc/bind/rndc.key";

</file>
<file name="named.db/db.root">
;;
;;  db.root -- Internet Root Nameservers
;;  DO NOT EDIT, IT WAS AUTOMATICALLY CREATED ON 2022-05-27 BY db.root.sh!
;;

.                    99999999  IN  NS   A.ROOT-SERVERS.NET.
.                    99999999  IN  NS   B.ROOT-SERVERS.NET.
.                    99999999  IN  NS   C.ROOT-SERVERS.NET.
.                    99999999  IN  NS   D.ROOT-SERVERS.NET.
.                    99999999  IN  NS   E.ROOT-SERVERS.NET.
.                    99999999  IN  NS   F.ROOT-SERVERS.NET.
.                    99999999  IN  NS   G.ROOT-SERVERS.NET.
.                    99999999  IN  NS   H.ROOT-SERVERS.NET.
.                    99999999  IN  NS   I.ROOT-SERVERS.NET.
.                    99999999  IN  NS   J.ROOT-SERVERS.NET.
.                    99999999  IN  NS   K.ROOT-SERVERS.NET.
.                    99999999  IN  NS   L.ROOT-SERVERS.NET.
.                    99999999  IN  NS   M.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET.  99999999  IN  A    198.41.0.4
A.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:503:ba3e::2:30
B.ROOT-SERVERS.NET.  99999999  IN  A    199.9.14.201
B.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:200::b
C.ROOT-SERVERS.NET.  99999999  IN  A    192.33.4.12
C.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:2::c
D.ROOT-SERVERS.NET.  99999999  IN  A    199.7.91.13
D.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:2d::d
E.ROOT-SERVERS.NET.  99999999  IN  A    192.203.230.10
E.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:a8::e
F.ROOT-SERVERS.NET.  99999999  IN  A    192.5.5.241
F.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:2f::f
G.ROOT-SERVERS.NET.  99999999  IN  A    192.112.36.4
G.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:12::d0d
H.ROOT-SERVERS.NET.  99999999  IN  A    198.97.190.53
H.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:1::53
I.ROOT-SERVERS.NET.  99999999  IN  A    192.36.148.17
I.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:7fe::53
J.ROOT-SERVERS.NET.  99999999  IN  A    192.58.128.30
J.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:503:c27::2:30
K.ROOT-SERVERS.NET.  99999999  IN  A    193.0.14.129
K.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:7fd::1
L.ROOT-SERVERS.NET.  99999999  IN  A    199.7.83.42
L.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:500:9f::42
M.ROOT-SERVERS.NET.  99999999  IN  A    202.12.27.33
M.ROOT-SERVERS.NET.  99999999  IN  AAAA 2001:dc3::35

</file>
<file name="named.db/db.root.sh">
#!/bin/sh

ROOTFILE=./db.root

echo '@l_prefix@' | egrep '^@l_' | egrep 'prefix@$' >/dev/null
if [ $? -eq 0 ]; then
    CURL='curl'
    DIG='dig'
else
    CURL='@l_prefix@/bin/openpkg curl'
    DIG='@l_prefix@/bin/dig'
fi

date=`date '+%Y-%m-%d'`
cat >$ROOTFILE <<EOT
;;
;;  db.root -- Internet Root Nameservers
;;  DO NOT EDIT, IT WAS AUTOMATICALLY CREATED ON $date BY db.root.sh!
;;

EOT

$CURL -s -L ftp://ftp.internic.net/domain/named.root >$ROOTFILE.raw
for i in A B C D E F G H I J K L M; do
    ${DIG} @$i.ROOT-SERVERS.NET . NS >>$ROOTFILE.raw
done
[ -f $ROOTFILE.raw ] || exit 1
awk <$ROOTFILE.raw '
  /[ 	]NS[ 	]/ { printf("%-20s 99999999  IN  NS   %s\n", $1, toupper($NF)); }
  /[ 	]AAAA[ 	]/ { printf("%-20s 99999999  IN  AAAA %s\n", toupper($1), tolower($NF)); }
  /[ 	]A[ 	]/ { printf("%-20s 99999999  IN  A    %s\n", toupper($1), tolower($NF)); }
' |\
egrep -v '^;' |\
sort -u >>$ROOTFILE
echo "" >>$ROOTFILE
rm $ROOTFILE.raw

</file>
<file name="named.db/db.localhost">
;;
;;  db.localhost -- zonefile for the forward mapping of the loopback network
;;

$TTL    86400

@       IN  SOA     localhost. root.localhost. (
                        2001010101 ; SERIAL
                        6H         ; REFRESH: Secondaries refresh
                        60M        ; RETRY:   Secondaries retry
                        1W         ; EXPIRE:  Maximum TTL of data (expiry)
                        1D         ; MINTTL:  Minimum TTL of data (expiry)
                    )

        IN  NS      @
        IN  A       127.0.0.1

</file>
<file name="named.db/db.localhost.ipv4">
;;
;;  db.localhost.ipv4 -- zonefile for the IPv4 reverse mapping of the loopback network
;;

$TTL    86400

@       IN  SOA     localhost. root.localhost. (
                        2001010101 ; SERIAL
                        6H         ; REFRESH: Secondaries refresh
                        60M        ; RETRY:   Secondaries retry
                        1W         ; EXPIRE:  Maximum TTL of data (expiry)
                        1D         ; MINTTL:  Minimum TTL of data (expiry)
                    )

        IN  NS      @
        IN  A       127.0.0.1
1       IN  PTR     localhost.

</file>
<file name="named.db/db.localhost.ipv6">
;;
;;  db.localhost.ipv6 -- zonefile for the IPv6 reverse mapping of the loopback network
;;

$TTL    86400

@       IN  SOA     localhost. root.localhost. (
                        2001010101 ; SERIAL
                        6H         ; REFRESH: Secondaries refresh
                        60M        ; RETRY:   Secondaries retry
                        1W         ; EXPIRE:  Maximum TTL of data (expiry)
                        1D         ; MINTTL:  Minimum TTL of data (expiry)
                    )

        IN  NS      @
        IN  AAAA    ::1
        IN  PTR     localhost.

</file>
