Changeset 313 for trunk/system/generators/dns.php
- Timestamp:
- Apr 11, 2011, 4:21:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/generators/dns.php
r288 r313 5 5 6 6 $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; 8 10 $MinimumTime = 7200; 9 11 $RetryTime = 7200; … … 94 96 $File = fopen($DNS['BaseDir'].$Parts[2].'.'.$Parts[1].'.'.$Parts[0].'.in-addr.arpa.zone', 'w+'); 95 97 fputs($File, $Output); 98 //echo($Output); 96 99 fclose($File); 97 100 } … … 157 160 $ExternalDNS = array( 158 161 '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 != ""'); 179 while($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 != ""'); 189 while($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, 159 199 'Serial' => date('Ymds', time()), 160 200 'Refresh' => 28800, … … 164 204 'TTL' => 86400, 165 205 '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 != ""'); 217 while($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']); 181 222 } 182 223 183 224 // 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 != ""'); 227 while($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( 195 235 'Domain' => $BaseDomain, 196 236 'Serial' => date('Ymds', time()), … … 201 241 'TTL' => 86400, 202 242 'Description' => 'ZdechovNET community network', 203 'BaseDir' => '/var/named/ czfree/',243 'BaseDir' => '/var/named/internal/', 204 244 'MailServer' => array('centrala.'.$BaseDomain), 205 245 'NameServer' => array('centrala.'.$BaseDomain, 'tv.'.$BaseDomain), … … 216 256 $Name = $Interface['DeviceName']; 217 257 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']); 219 260 } 220 261 … … 224 265 while($Alias = $DbResult->fetch_assoc()) 225 266 { 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 // Hosts250 $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 alias260 $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 {264 267 $CZFreeLocalDNS['Alias'][] = array('Name' => $Alias['Name'], 'Target' => $Alias['Target']); 265 268 }
Note:
See TracChangeset
for help on using the changeset viewer.