comparison scripts/nameserver_autogen/bind_tld_zonefile.sh @ 1220:c6fa1e38f44f draft

updated bind_tld_zonefile.sh to generate IPv6 rDNS zone too. added ns record for volatile.ano so I could test.
author epochqwert <epoch@hacking.allowed.org>
date Thu, 06 Sep 2018 05:19:36 +0000
parents 0e5d4b7fc3d8
children 4e07b815084b
comparison
equal deleted inserted replaced
1219:8da015667af4 1220:c6fa1e38f44f
4 #RESDB_PATH=/var/db/resdb 4 #RESDB_PATH=/var/db/resdb
5 #ZONEFILE_DIR=/etc/namedb 5 #ZONEFILE_DIR=/etc/namedb
6 # optional: 6 # optional:
7 : ${TLDS:=ano} 7 : ${TLDS:=ano}
8 : ${RDNS_PREFIX:=21} 8 : ${RDNS_PREFIX:=21}
9 : ${RDNS6_PREFIX:=fd63:1e39:6f73} 9 : ${RDNS6_PREFIX:=fd63:1e39:6f73} #not actually used atm.
10 10
11 if [ ! "$ZONEFILE_DIR" ];then 11 if [ ! "$ZONEFILE_DIR" ];then
12 echo "You forgot to set some variables. read the source plzkthx." >&2 12 echo "You forgot to set some variables. read the source plzkthx." >&2
13 exit 1 13 exit 1
14 fi 14 fi
15
16 DOM="3.7.f.6.9.3.e.1.3.6.d.f.ip6.arpa"
17 RDNS_ZONEFILE="$ZONEFILE_DIR/$DOM"
18
19 echo -n 'generating IPv6 reverse lookup zonefile for...' >&2
20 echo "; this zonefile generated on: `date -u`" > "$RDNS_ZONEFILE".tmp
21 echo '$TTL 3600' >> "$RDNS_ZONEFILE".tmp
22 echo '$ORIGIN' $DOM. >> "$RDNS_ZONEFILE".tmp
23 echo '@ IN SOA @ root ('`date -u +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$RDNS_ZONEFILE".tmp
24 echo '@ IN NS @' >> "$RDNS_ZONEFILE".tmp
25 echo '@ IN A 127.0.0.1' >> "$RDNS_ZONEFILE".tmp
26 cd $RESDB_PATH/db/ip6/F/D/6/3/1/E/3/9/6/F/7/3/
27 for i in */*/*/*/ns/*;do
28 a=$(printf "%s\n" "$i" | cut -d/ -f1-4 | tr '/' '.' | rev)
29 b=$(printf "%s\n" "$i" | cut -d/ -f6)
30 printf '%s IN NS %s.\n' "$a" "$b"
31 done >> "$RDNS_ZONEFILE".tmp
32 mv -f "$RDNS_ZONEFILE".tmp "$RDNS_ZONEFILE"
33 echo " done." >&2
34
15 35
16 # convert to hex 36 # convert to hex
17 if [ "*" != "$RDNS_PREFIX" ];then 37 if [ "*" != "$RDNS_PREFIX" ];then
18 X="" 38 X=""
19 for PFX in $RDNS_PREFIX;do 39 for PFX in $RDNS_PREFIX;do