Mercurial > hg > anonet-resdb
annotate 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 |
rev | line source |
---|---|
1120
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
1 #!/bin/bash |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
2 #made for bash. not sure if all /bin/sh work. |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
3 #be sure to edit these variables first. |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
4 |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
5 ANO_ZONEFILE=/etc/namedb/ano |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
6 RESDB_PATH=/services/resdb/resdb |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
7 |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
8 echo "; this zonefile genreated on: `date`" > $ANO_ZONEFILE |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
9 echo '$TTL 3600' >> $ANO_ZONEFILE |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
10 echo '@ IN SOA localns root ('`date +" %Y%m%d00"`' 60 300 3600000 3600 )' >> $ANO_ZONEFILE |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
11 echo '@ IN NS localns' >> $ANO_ZONEFILE |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
12 echo 'localns IN A 127.0.0.1' >> $ANO_ZONEFILE |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
13 |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
14 cd ${RESDB_PATH}/db/dom/ano |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
15 |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
16 echo -n generating zonefile... |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
17 for name in *;do |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
18 if [ -e "${name}/ns/" ];then |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
19 for server in "$name"/ns/*;do |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
20 if grep '\.ano$' <<< $name > /dev/null;then |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
21 true |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
22 fi |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
23 if grep '\.ano$' <<< $server > /dev/null;then |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
24 true |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
25 fi |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
26 fqserver=`cut -d/ -f3- <<< $server` |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
27 echo -e "${name}\tIN NS\t${fqserver}." |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
28 for ip in `cat ${server}`;do |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
29 echo -e "${fqserver}.\tIN A\t$ip" |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
30 done |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
31 done |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
32 fi |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
33 done >> $ANO_ZONEFILE |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
34 echo done. |
8e01b8361e9e
changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents:
diff
changeset
|
35 echo might want to send a sighup to your named now. |