diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check_db_safety | 29 | ||||
-rwxr-xr-x | scripts/conf_var | 7 | ||||
-rwxr-xr-x | scripts/nameserver_autogen/tinydns_tld_datafile | 19 |
3 files changed, 55 insertions, 0 deletions
diff --git a/scripts/check_db_safety b/scripts/check_db_safety new file mode 100755 index 0000000..f3f3236 --- /dev/null +++ b/scripts/check_db_safety @@ -0,0 +1,29 @@ +#!/bin/sh +if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then + echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2 + exit 1 +fi +for tld in db/dom/* ; do + if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then + tld="$(basename $tld)" + echo "There's a bad domain under $tld." >&2 + echo "You probably don't want to run any shell scripts." >&2 + exit 1 + fi + for dom in $tld/* ; do + if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then + domain="$(basename $dom).$(basename $tld)" + echo "There's a bad nameserver under $domain." >&2 + echo "You probably don't want to run any shell scripts." >&2 + fi + for ns in $dom/ns/* ; do + if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then + domain="$(basename $dom).$(basename $tld)" + nsname="$(basename $ns)" + echo "There's a bad nameserver IP under $domain, for" >&2 + echo " $nsname" >&2 + echo "You probably don't want to run any shell scripts." >&2 + fi + done + done +done diff --git a/scripts/conf_var b/scripts/conf_var new file mode 100755 index 0000000..b2bffaf --- /dev/null +++ b/scripts/conf_var @@ -0,0 +1,7 @@ +#!/bin/sh +if [ -r "conf/$1" ]; then + exec cat "conf/$1" +else + echo "$2" + exec false +fi diff --git a/scripts/nameserver_autogen/tinydns_tld_datafile b/scripts/nameserver_autogen/tinydns_tld_datafile new file mode 100755 index 0000000..ff84576 --- /dev/null +++ b/scripts/nameserver_autogen/tinydns_tld_datafile @@ -0,0 +1,19 @@ +#!/bin/sh +if ! ./scripts/check_db_safety; then + exit 1 +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/dom/* ; do + tldname="$(basename $tld)" + echo "+$tldsrvrname:$tldsrvrip:3600" + echo ".$tldname::$tldsrvrname" + for zone in $tld/* ; do + for ns in $zone/ns/* ; do + domain="$(basename $zone).$(basename $tld)" + nsip="$(cat $ns)" + nsname="$(basename $ns)" + echo "&$domain:$nsip:$nsname" + done + done +done |