Changeset 313 for trunk/system


Ignore:
Timestamp:
Apr 11, 2011, 4:21:38 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Při generování DNS záznamů poslední dvojčíslí serial upraveno na poměrovou část dnes (setinu).
Location:
trunk/system/generators
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/system/generators/dns.php

    r288 r313  
    55
    66$BaseDomain = 'zdechov.net';
    7 $Serial = date('Ymds', time());
     7$Now = getdate();
     8$I = floor(($Now['hours'] * 60 * 60 + $Now['minutes'] * 60 + $Now['seconds']) / (24 * 60 * 60) * 100);
     9$Serial = date('Ymd', time()).$I;
    810$MinimumTime = 7200;
    911$RetryTime = 7200;
     
    9496    $File = fopen($DNS['BaseDir'].$Parts[2].'.'.$Parts[1].'.'.$Parts[0].'.in-addr.arpa.zone', 'w+');
    9597    fputs($File, $Output);
     98    //echo($Output);
    9699    fclose($File);
    97100  }
     
    157160$ExternalDNS = array(
    158161  'Domain' => $BaseDomain,
     162  'Serial' => $Serial,
     163  'Refresh' => $RefreshTime,
     164  'Expire' => $ExpireTime,
     165  'Retry' => $RetryTime,
     166  'Minimum' => $MinimumTime,
     167  'TTL' => $TTL,
     168  'Description' => 'ZdechovNET community network',
     169  'BaseDir' => '/var/named/external/',
     170  'MailServer' => array('centrala.'.$BaseDomain),
     171  'NameServer' => array('gw-hajda.inext.cz', 'ns0.xname.org', 'ns1.twisted4life.com'),
     172  'ReverseNameServer' => array('gw-hajda.inext.cz', 'inext.inext.cz'),
     173  'Host' => array(),
     174  'Alias' => array(),
     175  'Network' => array('81.2.194', '193.86.238', '212.111.4', '77.92.221'),
     176);
     177
     178$DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP != ""');
     179while($Interface = $DbResult->fetch_assoc())
     180{
     181  $Name = $Interface['DeviceName'];
     182  if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
     183  $ExternalDNS['Host'][] = array('Name' => $Name, 'Address' => $Interface['ExternalIP']);
     184}
     185
     186// Domain alias
     187$DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
     188// JOIN `NetworkDevice` ON NetworkDomainAlias.Target LIKE NetworkDevice.Name AND NetworkInterface.ExternalIP != ""');
     189while($Alias = $DbResult->fetch_assoc())
     190{
     191  $ExternalDNS['Alias'][] = array('Name' => $Alias['Name'], 'Target' => $Alias['Target']);
     192}
     193
     194/*
     195// === CZFree network DNS server ===
     196$BaseDomain = 'zdechov.zlin.czf';
     197$CZFreeDNS = array(
     198  'Domain' => $BaseDomain,
    159199  'Serial' => date('Ymds', time()),
    160200  'Refresh' => 28800,
     
    164204  'TTL' => 86400,
    165205  'Description' => 'ZdechovNET community network',
    166   'BaseDir' => '/var/named/external/',
    167   'MailServer' => array('centrala.'.$BaseDomain),
    168   'NameServer' => array('gw-hajda.inext.cz', 'ns0.xname.org', 'ns1.twisted4life.com'),
    169   'ReverseNameServer' => array('gw-hajda.inext.cz', 'inext.inext.cz'),
    170   'Host' => array(),
    171   'Alias' => array(),
    172   'Network' => array('81.2.194', '193.86.238', '212.111.4', '77.92.221'),
    173 );
    174 
    175 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP != ""');
    176 while($Interface = $DbResult->fetch_assoc())
    177 {
    178   $Name = $Interface['DeviceName'];
    179   if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    180   $ExternalDNS['Host'][] = array('Name' => $Name, 'Address' => $Interface['ExternalIP']);
     206  'BaseDir' => '/var/named/czfree/',
     207  'MailServer' => array('centrala.'.$BaseDomain),
     208  'NameServer' => array('centrala.'.$BaseDomain, 'tv.'.$BaseDomain),
     209  'ReverseNameServer' => array('centrala.'.$BaseDomain, 'tv.'.$BaseDomain),
     210  'Host' => array(),
     211  'Alias' => array(),
     212  'Network' => array('10.144.200'),
     213);
     214
     215// Hosts
     216$DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.CZFreeIP != ""');
     217while($Interface = $DbResult->fetch_assoc())
     218{
     219  $Name = $Interface['DeviceName'];
     220  if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
     221  $CZFreeDNS['Host'][] = array('Name' => $Name, 'Address' => $Interface['CZFreeIP']);
    181222}
    182223
    183224// Domain alias
    184 $DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
    185 // JOIN `NetworkDevice` ON NetworkDomainAlias.Target LIKE NetworkDevice.Name AND NetworkInterface.ExternalIP != ""');
    186 while($Alias = $DbResult->fetch_assoc())
    187 {
    188   $ExternalDNS['Alias'][] = array('Name' => $Alias['Name'], 'Target' => $Alias['Target']);
    189 }
    190 
    191 /*
    192 // === CZFree network DNS server ===
    193 $BaseDomain = 'zdechov.zlin.czf';
    194 $CZFreeDNS = array(
     225$DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
     226// JOIN `hosts` ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""');
     227while($Alias = $DbResult->fetch_assoc())
     228{
     229  $CZFreeDNS['Alias'][] = array('Name' => $Alias['Name'], 'Target' => $Alias['Target']);
     230}
     231
     232// === CZFree network local address ===
     233$BaseDomain = 'zdechovnet.czf';
     234$CZFreeLocalDNS = array(
    195235  'Domain' => $BaseDomain,
    196236  'Serial' => date('Ymds', time()),
     
    201241  'TTL' => 86400,
    202242  'Description' => 'ZdechovNET community network',
    203   'BaseDir' => '/var/named/czfree/',
     243  'BaseDir' => '/var/named/internal/',
    204244  'MailServer' => array('centrala.'.$BaseDomain),
    205245  'NameServer' => array('centrala.'.$BaseDomain, 'tv.'.$BaseDomain),
     
    216256  $Name = $Interface['DeviceName'];
    217257  if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    218   $CZFreeDNS['Host'][] = array('Name' => $Name, 'Address' => $Interface['CZFreeIP']);
     258  $CZFreeLocalDNS['Host'][] = array('Name' => $Name.'-czfree', 'Address' => $Interface['CZFreeIP']);
     259  $CZFreeLocalDNS['Host'][] = array('Name' => $Name, 'Address' => $Interface['LocalIP']);
    219260}
    220261
     
    224265while($Alias = $DbResult->fetch_assoc())
    225266{
    226   $CZFreeDNS['Alias'][] = array('Name' => $Alias['Name'], 'Target' => $Alias['Target']);
    227 }
    228 
    229 // === CZFree network local address ===
    230 $BaseDomain = 'zdechovnet.czf';
    231 $CZFreeLocalDNS = array(
    232   'Domain' => $BaseDomain,
    233   'Serial' => date('Ymds', time()),
    234   'Refresh' => 28800,
    235   'Expire' => 2419200,
    236   'Retry' => 7200,
    237   'Minimum' => 10800,
    238   'TTL' => 86400,
    239   'Description' => 'ZdechovNET community network',
    240   'BaseDir' => '/var/named/internal/',
    241   'MailServer' => array('centrala.'.$BaseDomain),
    242   'NameServer' => array('centrala.'.$BaseDomain, 'tv.'.$BaseDomain),
    243   'ReverseNameServer' => array('centrala.'.$BaseDomain, 'tv.'.$BaseDomain),
    244   'Host' => array(),
    245   'Alias' => array(),
    246   'Network' => array('10.144.200'),
    247 );
    248 
    249 // Hosts
    250 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.CZFreeIP != ""');
    251 while($Interface = $DbResult->fetch_assoc())
    252 {
    253   $Name = $Interface['DeviceName'];
    254   if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    255   $CZFreeLocalDNS['Host'][] = array('Name' => $Name.'-czfree', 'Address' => $Interface['CZFreeIP']);
    256   $CZFreeLocalDNS['Host'][] = array('Name' => $Name, 'Address' => $Interface['LocalIP']);
    257 }
    258 
    259 // Domain alias
    260 $DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
    261 // JOIN `hosts` ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""');
    262 while($Alias = $DbResult->fetch_assoc())
    263 {
    264267  $CZFreeLocalDNS['Alias'][] = array('Name' => $Alias['Name'], 'Target' => $Alias['Target']);
    265268}
  • trunk/system/generators/netwatch_import.php

    r276 r313  
    77$Path = array('tool', 'netwatch');
    88
    9 $DbResult3 = $Database->query('SELECT * FROM `NetworkSubnet` WHERE `Member` = 0');
     9$DbResult3 = $Database->query('SELECT * FROM `NetworkSubnet`  WHERE `Member` = 0');
    1010while($Subnet = $DbResult3->fetch_assoc())
    1111{
Note: See TracChangeset for help on using the changeset viewer.