zone.tpl.php 1.47 KB
Newer Older
anarcat's avatar
anarcat committed
1 2
; Bind zonefile
; File managed by Aegir
anarcat's avatar
typo  
anarcat committed
3
; Changes here may be lost by user configurations, tread carefully
4
$TTL <?php print $server->dns_ttl; ?>
anarcat's avatar
anarcat committed
5

6
<?php
7 8
print("@     IN     SOA  $server->remote_host $dns_email (
			      " . $records['@']['SOA']['serial'] . " ; serial
9 10 11 12
			      $server->dns_refresh; refresh
			      $server->dns_retry ; retry
			      $server->dns_expire ; expire
			      $server->dns_negativettl ; minimum
13
          )\n");
14

15 16 17 18 19 20 21
if (!empty($server->dns_default_mx)) {
  if ($server->dns_default_mx[strlen($server->dns_default_mx)-1] != '.') {
    $server->dns_default_mx .= '.';
  }
  print "@\tIN\tMX\t10\t" . $server->dns_default_mx . "\n";
}

22
print "@\tIN\tNS\t" . $server->remote_host . " ; primary DNS\n";
23 24 25 26 27 28 29
if (is_array($server->slave_servers_names)) {
  foreach ($server->slave_servers_names as $slave) {
    if ($slave[strlen($slave)-1] != '.') {
      $slave .= '.';
    }
    print "@\tIN\tNS\t" . $slave . " ; slave DNS\n";
  }
30
}
31

32 33 34 35 36 37
foreach ($records['@'] as $type => $destinations) {
  if ($type != 'SOA' && $type != 'NS') {
    foreach ($destinations as $destination) {
        print "@\tIN\t$type\t$destination\n";
    }
  }
38 39
}

40 41 42 43 44 45 46 47 48
foreach ($records as $name => $record) {
  if ($name != '@') {
    foreach ($record as $type => $destinations) {
      foreach ($destinations as $destination) {
        print "$name\tIN\t$type\t$destination\n";
      }
    }
  }
}
49 50 51 52 53
foreach ($hosts as $host => $info) {
  foreach ($info['A'] as $ip) {
    print "{$info['sub']}   IN  A     {$ip}\n";
  }
}