Mercurial > hg > anonet-resdb
comparison scripts/nameserver_autogen/bind_tld_zonefile.sh @ 1148:5c239f21ff7e draft
fixed a bug where I used a literal instead of one of the user defined variables (thx mkz)
author | epoch <epoch@hacking.allowed.org> |
---|---|
date | Mon, 04 Nov 2013 11:56:20 +0000 |
parents | c95369b825a2 |
children | 135e7c234e24 |
comparison
equal
deleted
inserted
replaced
1146:da853b90f62b | 1148:5c239f21ff7e |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 #made for bash. not sure if all /bin/sh work. | 2 #made for bash. not sure if all /bin/sh work. |
3 #be sure to edit these variables first. | 3 #be sure to edit these variables first. |
4 | 4 |
5 ANO_ZONEFILE=/etc/namedb/ano | 5 #ANO_ZONEFILE=/etc/namedb/ano |
6 RDNS_ZONEFILE=/etc/namedb/1.in-addr.arpa | 6 #RDNS_ZONEFILE=/etc/namedb/1.in-addr.arpa |
7 RESDB_PATH=/services/resdb/resdb | 7 #RESDB_PATH=/services/resdb/resdb |
8 | 8 |
9 if [ ! "$ANO_ZONEFILE" ];then | |
10 echo "You forgot to set some variables. read the source plzkthx." | |
11 exit 0; | |
12 fi | |
9 | 13 |
10 cd ${RESDB_PATH}/db/dom/ano | |
11 | 14 |
12 echo -n "generating ipv4 reverse lookup zonefile for 1/8..." | 15 echo -n "generating ipv4 reverse lookup zonefile for 1/8..." |
13 | 16 |
14 echo "; this zonefile genreated on: `date`" > "$RDNS_ZONEFILE" | 17 echo "; this zonefile genreated on: `date`" > "$RDNS_ZONEFILE" |
15 echo '$TTL 3600' >> "$RDNS_ZONEFILE" | 18 echo '$TTL 3600' >> "$RDNS_ZONEFILE" |
16 echo '@ IN SOA localhost. root.localhost. ('`date +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$RDNS_ZONEFILE" | 19 echo '@ IN SOA localhost. root.localhost. ('`date +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$RDNS_ZONEFILE" |
17 echo '@ IN NS localhost.' >> "$RDNS_ZONEFILE" | 20 echo '@ IN NS localhost.' >> "$RDNS_ZONEFILE" |
18 echo 'localhost. IN A 127.0.0.1' >> "$RDNS_ZONEFILE" | 21 echo 'localhost. IN A 127.0.0.1' >> "$RDNS_ZONEFILE" |
19 | 22 |
20 for i in `ls /services/resdb/resdb/db/ip/01/*/*/ns/*`;do | 23 for i in `ls ${RESDB_PATH}/db/ip/01/*/*/ns/*`;do |
21 f=$(basename $i) | 24 f=$(basename $i) |
22 a=$(basename $(dirname $i)) | 25 a=$(basename $(dirname $i)) |
23 b=$(basename $(dirname $(dirname $i))) | 26 b=$(basename $(dirname $(dirname $i))) |
24 c=$(basename $(dirname $(dirname $(dirname $i)))) | 27 c=$(basename $(dirname $(dirname $(dirname $i)))) |
25 printf "%d.%d IN NS %s\n" $[0x${b}] $[0x${c}] ${f}. | 28 printf "%d.%d IN NS %s\n" $[0x${b}] $[0x${c}] ${f}. |
26 done >> "$RDNS_ZONEFILE" | 29 done >> "$RDNS_ZONEFILE" |
27 echo done. | 30 echo done. |
28 | 31 |
32 cd ${RESDB_PATH}/db/dom/ano | |
33 | |
29 echo -n generating .ano TLD zonefile... | 34 echo -n generating .ano TLD zonefile... |
30 | 35 |
31 echo "; this zonefile genreated on: `date`" > "$ANO_ZONEFILE" | 36 echo "; this zonefile genreated on: `date`" > "$ANO_ZONEFILE" |
32 echo '$TTL 3600' >> "$ANO_ZONEFILE" | 37 echo '$TTL 3600' >> "$ANO_ZONEFILE" |
33 echo '@ IN SOA localhost. root.localhost. ('`date +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$ANO_ZONEFILE" | 38 echo '@ IN SOA localhost. root.localhost. ('`date +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$ANO_ZONEFILE" |
34 echo '@ IN NS localhost.' >> "$ANO_ZONEFILE" | 39 echo '@ IN NS localhost.' >> "$ANO_ZONEFILE" |
35 echo 'localhost. IN A 127.0.0.1' >> "$ANO_ZONEFILE" | 40 echo 'localhost. IN A 127.0.0.1' >> "$ANO_ZONEFILE" |
41 | |
36 | 42 |
37 for name in *;do | 43 for name in *;do |
38 if [ -e "${name}/ns/" ];then | 44 if [ -e "${name}/ns/" ];then |
39 for server in "$name"/ns/*;do | 45 for server in "$name"/ns/*;do |
40 if grep '\.ano$' <<< "$name" > /dev/null;then | 46 if grep '\.ano$' <<< "$name" > /dev/null;then |