3 # A Simple WWW interface for Sleuth domain checker
4 # (c) 1999--2001 Martin Mares <mj@ucw.cz>
7 # Load configuration file and all modules we need
9 BEGIN { require "check.conf"; }
17 $domain = $query->param('domain');
18 $server = $query->param('server');
19 $serverip = $query->param('serverip');
20 $verbose = $query->param('verbose');
21 $secondary = $query->param('secondary');
22 $submitter = $query->param('submitter');
27 background-color: #4c3bff; color: #fffa45; margin: 0 15%; padding: 1ex;
35 top: 0; bottom: auto; left: 0; right: auto;
41 top: 0; bottom: auto; left: auto; right: 0;
45 background-color: #ffffb0;
61 .singline { display: block }
62 .collapse { margin: 0 0 }
63 .msgW { color: #9e6500; font-style: normal; }
64 .msgE, .msgF { color: #d73a05; font-style: normal; }
68 print $query->start_html( -title=>"DNS Sleuth",
69 -author=>"$admin_email",
70 -dtd=>'-//W3C//DTD HTML 4.01//EN',
71 -style=>{-code=>$stylesheet}
75 <div id=headbar align=center>
76 <h2 class=collapse>The DNS Sleuth</h2>
77 <p class=collapse style="margin-top: 1ex">An online tool for checking of DNS zones
79 <div id=headbox1 align=center>
80 <p><A HREF="ftp://atrey.karlin.mff.cuni.cz/pub/local/mj/net/sleuth-$version.tar.gz">Sleuth</A> version $version ($rev_date)
82 <div id=headbox2 align=center>
84 <span class=singline>Written by</span>
85 <span class=singline>$author_ref</span>
86 <span class=singline><a href="mailto:$author_email"><$author_email></a></span>
91 if ($secondary_ns eq "") {
97 <P>This is an online version of Sleuth -- a detector
98 of common errors in DNS zones.
100 <P>To check a zone, just enter its name in the form below. You can explictly
101 specify a name server to be asked for zone data and if its name isn't available
102 from the public DNS, then also its IP address. If you select the verbose mode,
103 you will also get a full dump of the zone at no extra cost.
106 if ($secondary_ns ne "") {
108 <P>If you want to submit a request for secondary DNS service, fill in all
109 form fields and check the "request secondary" box. The secondary server will
110 run on <CODE>$secondary_ns</CODE>, so don't forget to list it as an
111 authoritative server in your zone file.
116 <P>If you want to run Sleuth on your own machine, just <a href="ftp://atrey.karlin.mff.cuni.cz/pub/local/mj/net/">download</a>
117 the latest version from our FTP server. Sleuth is free software, you can freely use and distribute it according
118 to the <a href="http://www.gnu.org/copyleft/">GNU General Public License</a>.
119 <P>If this page looks a bit fruitless, but otherwise displayed correctly,
120 it's probably because your browser doesn't support the <a href="http://www.w3.org/Style/CSS/">Cascading
121 Style Sheets</a> which are The Right Way to define presentation of HTML documents.
122 In case this page looks a bit weird, your browser probably tries
123 to support the style sheets, but does it wrongly (hello, Netscape 4).
126 } elsif ($secondary ne "" && $serverip eq "") {
127 $msg = "Missing server name";
128 } elsif ($secondary ne "" && $submitter eq "" && $need_submitter) {
129 $msg = "Please fill in who is submitting the zone";
130 } elsif ($server !~ /^[0-9A-Za-z.-]*$/ ||
131 $serverip !~ /^(\d+\.\d+\.\d+\.\d+)?$/ ||
132 $domain !~ /^[0-9A-Za-z.-]*$/ ||
133 $submitter !~ /^[0-9A-Za-z.\240-\376 -]*$/) {
134 $msg = "Incorrect parameter syntax";
135 } elsif ($secondary ne "" && defined $sec_ns_addr_space &&
136 unpack("H8",pack("c4",split(/\./,$serverip))) !~ $sec_ns_addr_space) {
137 $msg = "Name server address out of permitted range";
139 print "<H2>Check results for $domain</H2>\n";
141 if ($verbose ne "") { push @c, "-v"; }
142 push @c, "-h", $domain, $server;
143 if ($serverip ne "") { push @c, $serverip; }
144 if ($secondary ne "") { push @c, $secondary_ns, $secondary_ns_ip; }
147 if ($secondary ne "") {
149 print "<P>Request for secondary DNS service rejected because of errors in the zone.\n";
150 print "<P>If you have any questions, please ask $admin_ref.\n";
152 print "<P>Forwarding your secondary DNS service request to $admin_ref\n";
153 print "who will notify you by e-mail sent to the hostmaster address given in the\n";
154 print "SOA record when the secondary server will be configured.\n";
156 while ($c[0] =~ /^-[vh]$/) { shift @c; }
157 $ru = $query->remote_user;
158 ($rh = $query->remote_host) =~ s/[^A-Za-z0-9. \240-\376-]/?/g;
159 # This might look insecure, but we know all the names have been correctly
160 # validated by the first sleuth run.
161 `( echo "Domain: $domain" ;
162 echo "Server: $server [$serverip]" ;
164 echo "From: $submitter ($rh)" ;
167 ) | mail -s \"New zone\" $secondaries_to`;
168 $? && print "<P><EM>Forwarding failed (rc=$?)</EM>\n";
174 print $query->startform(-method=>'GET');
176 <p><table align=center border=0 id=querybox>\n\
177 <tr><td colspan=4 align=center id=qbhead>$msg</td></tr>\n";
178 print "<tr><td><em>Domain:</em></td><td>", $query->textfield('domain'), "</td>\n";
179 print "<td><em>Verbose output:</em></td><td>", $query->checkbox(-name=>'verbose',value=>'ON',-label=>''), "</td></tr>\n";
180 print "<tr><td><em>Server name:</em></td><td>", $query->textfield('server'), "</td>\n";
181 print "<td><em>Server IP:</em></td><td>", $query->textfield('serverip'), "</td></tr>\n";
182 if ($secondary_ns ne "") {
183 print "<tr><td><em>Request secondary:</em></td><td>", $query->checkbox(-name=>'secondary',value=>'ON',-label=>''), "</td>\n";
184 print "<td><em>Your name:</em></td><td>", $query->textfield('submitter'), "</td></tr>\n";
186 print "<tr><td colspan=4 align=center>", $query->submit('action', 'Submit'), "</td></tr>\n";
188 print $query->endform;
190 print "<div align=center><p>Please <a href=\"mailto:$author_email\">send</a> your bug reports and suggestions to $author_ref.</div>\n";
191 print $query->end_html;