summaryrefslogtreecommitdiff
path: root/scripts/nameserver_autogen/bind_tld_zonefile.sh
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2013-05-27 05:16:01 +0000
committerepoch <epoch@hacking.allowed.org>2013-05-27 05:16:01 +0000
commitec3162296ede3546936e0e6bb7c449ef10edcc75 (patch)
treedcbd552f272e92e0872897d35a37c4d2aaed3b51 /scripts/nameserver_autogen/bind_tld_zonefile.sh
parent59c1751062b903e3e009afd6ec0effb3bf29f1c0 (diff)
downloadresdb-ec3162296ede3546936e0e6bb7c449ef10edcc75.tar.gz
resdb-ec3162296ede3546936e0e6bb7c449ef10edcc75.zip
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
Diffstat (limited to 'scripts/nameserver_autogen/bind_tld_zonefile.sh')
-rwxr-xr-xscripts/nameserver_autogen/bind_tld_zonefile.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/nameserver_autogen/bind_tld_zonefile.sh b/scripts/nameserver_autogen/bind_tld_zonefile.sh
new file mode 100755
index 0000000..72c1128
--- /dev/null
+++ b/scripts/nameserver_autogen/bind_tld_zonefile.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+#made for bash. not sure if all /bin/sh work.
+#be sure to edit these variables first.
+
+ANO_ZONEFILE=/etc/namedb/ano
+RESDB_PATH=/services/resdb/resdb
+
+echo "; this zonefile genreated on: `date`" > $ANO_ZONEFILE
+echo '$TTL 3600' >> $ANO_ZONEFILE
+echo '@ IN SOA localns root ('`date +" %Y%m%d00"`' 60 300 3600000 3600 )' >> $ANO_ZONEFILE
+echo '@ IN NS localns' >> $ANO_ZONEFILE
+echo 'localns IN A 127.0.0.1' >> $ANO_ZONEFILE
+
+cd ${RESDB_PATH}/db/dom/ano
+
+echo -n generating zonefile...
+for name in *;do
+ if [ -e "${name}/ns/" ];then
+ for server in "$name"/ns/*;do
+ if grep '\.ano$' <<< $name > /dev/null;then
+ true
+ fi
+ if grep '\.ano$' <<< $server > /dev/null;then
+ true
+ fi
+ fqserver=`cut -d/ -f3- <<< $server`
+ echo -e "${name}\tIN NS\t${fqserver}."
+ for ip in `cat ${server}`;do
+ echo -e "${fqserver}.\tIN A\t$ip"
+ done
+ done
+ fi
+done >> $ANO_ZONEFILE
+echo done.
+echo might want to send a sighup to your named now.