Mercurial > hg > anonet-resdb
comparison scripts/nameserver_autogen/bind_tld_zonefile.sh @ 1120:8e01b8361e9e draft
changed add_dom to not even bother with anything head -c -1 related. should still work.
added a comment at the top of dec2hex to suggest a shorter version that should work.
added a script for generating zonefiles for bind
author | epoch <epoch@hacking.allowed.org> |
---|---|
date | Mon, 27 May 2013 05:16:01 +0000 |
parents | |
children | c95369b825a2 |
comparison
equal
deleted
inserted
replaced
1119:5645d1ed79c5 | 1120:8e01b8361e9e |
---|---|
1 #!/bin/bash | |
2 #made for bash. not sure if all /bin/sh work. | |
3 #be sure to edit these variables first. | |
4 | |
5 ANO_ZONEFILE=/etc/namedb/ano | |
6 RESDB_PATH=/services/resdb/resdb | |
7 | |
8 echo "; this zonefile genreated on: `date`" > $ANO_ZONEFILE | |
9 echo '$TTL 3600' >> $ANO_ZONEFILE | |
10 echo '@ IN SOA localns root ('`date +" %Y%m%d00"`' 60 300 3600000 3600 )' >> $ANO_ZONEFILE | |
11 echo '@ IN NS localns' >> $ANO_ZONEFILE | |
12 echo 'localns IN A 127.0.0.1' >> $ANO_ZONEFILE | |
13 | |
14 cd ${RESDB_PATH}/db/dom/ano | |
15 | |
16 echo -n generating zonefile... | |
17 for name in *;do | |
18 if [ -e "${name}/ns/" ];then | |
19 for server in "$name"/ns/*;do | |
20 if grep '\.ano$' <<< $name > /dev/null;then | |
21 true | |
22 fi | |
23 if grep '\.ano$' <<< $server > /dev/null;then | |
24 true | |
25 fi | |
26 fqserver=`cut -d/ -f3- <<< $server` | |
27 echo -e "${name}\tIN NS\t${fqserver}." | |
28 for ip in `cat ${server}`;do | |
29 echo -e "${fqserver}.\tIN A\t$ip" | |
30 done | |
31 done | |
32 fi | |
33 done >> $ANO_ZONEFILE | |
34 echo done. | |
35 echo might want to send a sighup to your named now. |