annotate scripts/check_db_safety @ 229:57a9c660edd5 draft

Added AS1112 for UCIS Anortr2
author Ivo Smits <Ivo@UCIS.nl>
date Wed, 27 Oct 2010 18:21:36 +0200
parents f37d8fca5548
children c9a7817b5f1d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
1 #!/bin/sh
77
6c1d4e261fdf OpenBSD fix (bug found by Quintum)
Nick <nick@somerandomnick.ano>
parents: 13
diff changeset
2 if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then
12
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
3 echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
4 exit 1
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
5 fi
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
6 for tld in db/dom/* ; do
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
7 if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then
12
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
8 tld="$(basename $tld)"
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
9 echo "There's a bad domain under $tld." >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
10 echo "You probably don't want to run any shell scripts." >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
11 exit 1
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
12 fi
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
13 for dom in $tld/* ; do
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
14 if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 0 ]; then
12
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
15 domain="$(basename $dom).$(basename $tld)"
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
16 echo "There's a bad nameserver under $domain." >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
17 echo "You probably don't want to run any shell scripts." >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
18 fi
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
19 for ns in $dom/ns/* ; do
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
20 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then
12
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
21 domain="$(basename $dom).$(basename $tld)"
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
22 nsname="$(basename $ns)"
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
23 echo "There's a bad nameserver IP under $domain, for" >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
24 echo " $nsname" >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
25 echo "You probably don't want to run any shell scripts." >&2
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
26 fi
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
27 done
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
28 done
41b330b11a33 coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff changeset
29 done
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
30 if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
13
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
31 echo "There's a bad first octet. You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
32 exit 1
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
33 for first in db/ip/* ; do
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
34 if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
13
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
35 echo "There's a bad second octet under $first." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
36 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
37 exit 1
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
38 for second in $first/* ; do
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
39 if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
13
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
40 echo "There's a bad third octet under $second." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
41 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
42 exit 1
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
43 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
44 for third in $second/* ; do
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
45 if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 0 ]; then
13
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
46 ip="$(basename $first).$(basename $second).$(basename $third).0/24"
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
47 echo "There's a bad nameserver under $ip." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
48 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
49 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
50 for ns in $third/ns/* ; do
78
f37d8fca5548 more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents: 77
diff changeset
51 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then
13
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
52 ip="$(basename $first).$(basename $second).$(basename $third).0/24"
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
53 nsname="$(basename $ns)"
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
54 echo "There's a bad nameserver IP under $ip, for" >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
55 echo " $nsname" >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
56 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
57 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
58 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
59 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
60 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
61 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
62 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
63 fi