changeset 13:059b5f3d7808 draft

added rDNS to tinydns datafile generation
author Nick <nick@somerandomnick.ano>
date Mon, 19 Apr 2010 07:37:46 +0000
parents 41b330b11a33
children 523b9c533d6c
files db/ip/01/03/03/cidr db/ip/01/03/03/ns/ns1.ucis.ano db/ip/01/03/03/owner scripts/check_db_safety scripts/hex2dec scripts/nameserver_autogen/tinydns_tld_datafile
diffstat 6 files changed, 63 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/01/03/03/cidr	Mon Apr 19 07:37:46 2010 +0000
@@ -0,0 +1,1 @@
+1.3.3.0/24
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/01/03/03/ns/ns1.ucis.ano	Mon Apr 19 07:37:46 2010 +0000
@@ -0,0 +1,1 @@
+1.3.3.1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/01/03/03/owner	Mon Apr 19 07:37:46 2010 +0000
@@ -0,0 +1,1 @@
+UFO
--- a/scripts/check_db_safety	Mon Apr 19 06:10:07 2010 +0000
+++ b/scripts/check_db_safety	Mon Apr 19 07:37:46 2010 +0000
@@ -27,3 +27,37 @@
   done
  done
 done
+if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
+ echo "There's a bad first octet.  You probably don't want to run any shell scripts." >&2
+ exit 1
+ for first in db/ip/* ; do
+  if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
+   echo "There's a bad second octet under $first." >&2
+   echo "You probably don't want to run any shell scripts." >&2
+   exit 1
+   for second in $first/* ; do
+    if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
+     echo "There's a bad third octet under $second." >&2
+     echo "You probably don't want to run any shell scripts." >&2
+     exit 1
+    fi
+    for third in $second/* ; do
+     if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then
+      ip="$(basename $first).$(basename $second).$(basename $third).0/24"
+      echo "There's a bad nameserver under $ip." >&2
+      echo "You probably don't want to run any shell scripts." >&2
+     fi
+     for ns in $third/ns/* ; do
+      if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then
+       ip="$(basename $first).$(basename $second).$(basename $third).0/24"
+       nsname="$(basename $ns)"
+       echo "There's a bad nameserver IP under $ip, for" >&2
+       echo " $nsname" >&2
+       echo "You probably don't want to run any shell scripts." >&2
+      fi
+     done
+    done
+   done
+  fi
+ done
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/hex2dec	Mon Apr 19 07:37:46 2010 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+(
+ echo -n "ibase=16; "
+ if [ x"$1" = x ]; then
+  cat
+ else
+  echo "$1"
+ fi
+) | bc -q
--- a/scripts/nameserver_autogen/tinydns_tld_datafile	Mon Apr 19 06:10:07 2010 +0000
+++ b/scripts/nameserver_autogen/tinydns_tld_datafile	Mon Apr 19 07:37:46 2010 +0000
@@ -4,6 +4,23 @@
 fi
 tldsrvrname="$(./scripts/conf_var tinydns__tldsrvrname uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano)"
 tldsrvrip="$(./scripts/conf_var tinydns__tldsrvrip 1.0.27.37)"
+for tld in db/ip/* ; do
+ first="$(basename $tld | ./scripts/hex2dec)"
+ tldname="$first.in-addr.arpa"
+ echo "+$tldsrvrname:$tldsrvrip:3600"
+ echo ".$tldname::$tldsrvrname"
+ for ip in $tld/*/* ; do
+  third="$(basename $ip | ./scripts/hex2dec)"
+  second="$(basename $(dirname $ip) | ./scripts/hex2dec)"
+  first="$(basename $(dirname $(dirname $ip)) | ./scripts/hex2dec)"
+  domain="$third.$second.$first.in-addr.arpa"
+  for ns in $ip/ns/* ; do
+   nsip="$(cat $ns)"
+   nsname="$(basename $ns)"
+   echo "&$domain:$nsip:$nsname"
+  done
+ done
+done
 for tld in db/dom/* ; do
  tldname="$(basename $tld)"
  echo "+$tldsrvrname:$tldsrvrip:3600"