Mercurial > hg > anonet-resdb
diff scripts/check_db_safety @ 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 | 6c1d4e261fdf |
line wrap: on
line diff
--- 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