view scripts/nameserver_autogen/bind_tld_zonefile @ 341:4a4f9682f43e draft

Updated the bind generator script so that it checks that FQDNs are actually ending in . properly now so that stupid things don't happen whenever we transfer zones or, well, do anything with DNS
author lex <lex@lynx.ano>
date Mon, 10 Jan 2011 17:45:04 -0600
parents 1299c56b6d5c
children c9b4cd6ac74e
line wrap: on
line source

#!/usr/bin/php
<?php
print('$ttl 600'."\n");
chdir('../db/dom/ano');
$names = scandir('./');
foreach ($names as $name) {
 if (!file_exists($name.'/ns/')) continue;
 $servers = scandir($name.'/ns/');
 foreach ($servers as $server) {
  if ($server[0] == '.') continue;
  if (substr($name, -4) == ".ano") $name .= ".";
  $fqserver = $server;
  if (substr($server, -4) == ".ano") $fqserver .= ".";
  print($name.' IN NS '.$fqserver."\n");
  $ips = file($name.'/ns/'.$server, FILE_IGNORE_NEW_LINES |
   FILE_SKIP_EMPTY_LINES);
  foreach ($ips as $ip) {
   print($fqserver.' IN A '.$ip."\n");
  }
 }
}
?>