- Timestamp:
- Dec 3, 2008, 11:35:37 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
system/generators/dns.php
r116 r117 3 3 4 4 $Serial = date('Ymds', time()); 5 $ExternalServerName = 'gw-hajda.inext.cz';6 5 $MinimumTime = 7200; 7 6 $RetryTime = 7200; 8 7 $ExpireTime = 2419200; 9 8 $RefreshTime = 28800; 9 $MinimumTime = 10800; 10 10 $BaseDir = '/var/named/chroot/var/named/'; 11 11 // === Local network DNS server === … … 15 15 fputs($File,'$ORIGIN zdechov.net.'."\n". 16 16 '$TTL 86400'."\n". 17 "zdechov.net.\tIN\tSOA\t centrala.zdechov.net.\troot.centrala.zdechov.net. (\n".18 "\t\t\t".$Serial."\t; serial\n". 19 "\t\t\t".$RefreshTime."\t; refresh\n". 20 "\t\t\t".$RetryTime."\t; retry\n". 21 "\t\t\t".$ExpireTime."\t; expire\n". 22 "\t\t\t 86400\t; ttl\n".17 "zdechov.net.\tIN\tSOA\tns1.zdechov.net.\troot.zdechov.net. (\n". 18 "\t\t\t".$Serial."\t; serial\n". 19 "\t\t\t".$RefreshTime."\t; refresh\n". 20 "\t\t\t".$RetryTime."\t; retry\n". 21 "\t\t\t".$ExpireTime."\t; expire\n". 22 "\t\t\t".$MinimumTime."\t; minimum\n". 23 23 "\t\t\t)\n". 24 24 "\t\t\tTXT\t".'"community network ZdechovNET"'."\n". 25 "\t\t\tNS\tcentrala.zdechov.net.\n". 25 "\t\t\tNS\tns1.zdechov.net.\n". 26 "\t\t\tNS\tns2.zdechov.net.\n". 26 27 // "\t\tIN\tA\t192.168.0.1\n". 27 28 "\t\t\tMX\t10 mail.zdechov.net.\n"); … … 31 32 { 32 33 $Data = strtolower($Row['name']); 33 if(strlen($Data) <8) $Data .= "\t";34 if(strlen($Data) < 8) $Data .= "\t"; 34 35 fputs($File, $Data."\tIN\tA\t".$Row['IP']."\n"); 35 36 } … … 40 41 { 41 42 $Data = strtolower($Row['name']).'-ext'; 42 if(strlen($Data) <8) $Data .= "\t";43 if(strlen($Data) < 8) $Data .= "\t"; 43 44 fputs($File,$Data."\tIN\tA\t".$Row['external_ip']."\n"); 44 45 } … … 48 49 { 49 50 $Data = strtolower($Alias['name']); 50 if(strlen($Data) <8) $Data .= "\t";51 if(strlen($Data) < 8) $Data .= "\t"; 51 52 fputs($File, $Data."\tIN\tCNAME\t".$Alias['target']."\n"); 52 53 } … … 62 63 fputs($File, 63 64 '$TTL 86400'."\n". 64 "@\tIN\tSOA\tcentrala.zdechov.net.\troot.centrala.zdechov.net. (\n". 65 "\t\t\t\t".$Serial."\t; serial\n". 66 "\t\t\t\t".$RefreshTime."\t; refresh\n". 67 "\t\t\t\t".$RetryTime."\t; retry\n". 68 "\t\t\t\t".$ExpireTime."\t; expire\n". 69 "\t\t\t\t86400 ; ttl\n". 70 "\t\t\t\t)\n". 71 "@\tIN\tNS\tcentrala.zdechov.net.\n\n"); 65 "@\tIN\tSOA\tns1.zdechov.net.\troot.zdechov.net. (\n". 66 "\t\t\t\t".$Serial."\t; serial\n". 67 "\t\t\t\t".$RefreshTime."\t; refresh\n". 68 "\t\t\t\t".$RetryTime."\t; retry\n". 69 "\t\t\t\t".$ExpireTime."\t; expire\n". 70 "\t\t\t\t".$MinimumTime."\t; minimum\n". 71 "\t\t\t\t)\n". 72 "@\tIN\tNS\tns1.zdechov.net.\n". 73 "\tIN\tNS\tns2.zdechov.net.\n\n"); 72 74 $DbResult = $Database->select('hosts','*','IP LIKE "'.$Network.'%"'); 73 75 while($Row = $DbResult->fetch_array()) … … 87 89 fputs($File, 88 90 '$TTL 86400'."\n". 89 "@\tIN\tSOA\tcentrala.zdechov.net.\troot.centrala.zdechov.net. (\n". 90 "\t\t\t\t".$Serial."\t; serial\n". 91 "\t\t\t\t".$RefreshTime."\t; refresh\n". 92 "\t\t\t\t".$RetryTime."\t; retry\n". 93 "\t\t\t\t".$ExpireTime."\t; expire\n". 94 "\t\t\t\t86400 ; ttl\n". 95 "\t\t\t\t)\n". 96 "@\tIN\tNS\tcentrala.zdechov.net.\n\n"); 91 "@\tIN\tSOA\tns1.zdechov.net.\troot.zdechov.net. (\n". 92 "\t\t\t\t".$Serial."\t; serial\n". 93 "\t\t\t\t".$RefreshTime."\t; refresh\n". 94 "\t\t\t\t".$RetryTime."\t; retry\n". 95 "\t\t\t\t".$ExpireTime."\t; expire\n". 96 "\t\t\t\t".$MinimumTime."\t; minimum\n". 97 "\t\t\t\t)\n". 98 "@\tIN\tNS\tns1.zdechov.net.\n". 99 "\tIN\tNS\tns2.zdechov.net.\n\n"); 97 100 $DbResult = $Database->select('hosts','*','external_ip LIKE "'.$Network.'.%"'); 98 101 while($Row = $DbResult->fetch_array()) … … 110 113 $Header = '$ORIGIN zdechov.net.'."\n". 111 114 '$TTL 86400'."\n". 112 "zdechov.net.\tIN\tSOA\t ".$ExternalServerName.".\troot.centrala.zdechov.net. (\t\n".113 "\t\t\t".$Serial."\t; serial\n". 114 "\t\t\t".$RefreshTime."\t; refresh\n". 115 "\t\t\t".$RetryTime."\t; retry\n". 116 "\t\t\t".$ExpireTime."\t; expire\n". 117 "\t\t\t 86400\t; ttl\n".115 "zdechov.net.\tIN\tSOA\tns1.zdechov.net.\troot.zdechov.net. (\t\n". 116 "\t\t\t".$Serial."\t; serial\n". 117 "\t\t\t".$RefreshTime."\t; refresh\n". 118 "\t\t\t".$RetryTime."\t; retry\n". 119 "\t\t\t".$ExpireTime."\t; expire\n". 120 "\t\t\t".$MinimumTime."\t; minimum\n". 118 121 "\t\t\t)\n". 119 122 "\t\t\tTXT\t".'"community network ZdechovNET"'."\n". 120 "\t\t\tNS\t ".$ExternalServerName.".\n".123 "\t\t\tNS\tns1.zdechov.net.\n". 121 124 "\t\t\tNS\tplandsfeld.avonet.cz.\n". 122 125 "\t\tIN\tA\t81.2.194.142\n". 126 "\t\t\tNS\tns2.zdechov.net.\n". 123 127 "\t\t\tMX\t10 mail.zdechov.net.\n"; 124 128 … … 151 155 fputs($File, 152 156 '$TTL 86400'."\n". 153 "@\tIN\tSOA\t".$ExternalServerName.".\troot.centrala.zdechov.net. (\n". 154 "\t\t\t\t".$Serial."\t; serial\n". 155 "\t\t\t\t".$RefreshTime."\t; refresh\n". 156 "\t\t\t\t".$RetryTime."\t; retry\n". 157 "\t\t\t\t".$ExpireTime."\t; expire\n". 158 "\t\t\t\t86400 ; ttl\n". 159 "\t\t\t\t)\n". 160 "@\tIN\tNS\t".$ExternalServerName.".\n\n". 161 "\t\t\tNS\tplandsfeld.avonet.cz.\n"); 157 "@\tIN\tSOA\tns1.zdechov.net.\troot.zdechov.net. (\n". 158 "\t\t\t\t".$Serial."\t; serial\n". 159 "\t\t\t\t".$RefreshTime."\t; refresh\n". 160 "\t\t\t\t".$RetryTime."\t; retry\n". 161 "\t\t\t\t".$ExpireTime."\t; expire\n". 162 "\t\t\t\t".$MinimumTime."\t; minimum\n". 163 "\t\t\t\t)\n". 164 "@\tIN\tNS\tns1.zdechov.net.\n\n". 165 "\t\t\tNS\tplandsfeld.avonet.cz.\n". 166 "\t\t\tNS\tns2.zdechov.net.\n"); 162 167 163 168 $DbResult = $Database->select('hosts','*','external_ip LIKE "'.$Network.'.%"'); … … 172 177 // === CZFree network DNS server === 173 178 $Domain = 'zdechov.zlin.czf'; 174 $Nameserver = 'centrala';175 179 176 180 // Generate DNS records … … 180 184 $Header = '$ORIGIN zdechov.zlin.czf.'."\n". 181 185 '$TTL 86400'."\n". 182 $Domain.".\tIN\tSOA\t ".$Nameserver.".".$Domain.".\troot.".$Nameserver.".".$Domain." (\n".183 "\t\t\t".$Serial."\t; serial\n". 184 "\t\t\t".$RefreshTime."\t; refresh\n". 185 "\t\t\t".$RetryTime."\t; retry\n". 186 "\t\t\t".$ExpireTime."\t; expire\n". 187 "\t\t\t 86400\t; ttl\n".186 $Domain.".\tIN\tSOA\tns1.".$Domain.".\troot.".$Domain." (\n". 187 "\t\t\t".$Serial."\t; serial\n". 188 "\t\t\t".$RefreshTime."\t; refresh\n". 189 "\t\t\t".$RetryTime."\t; retry\n". 190 "\t\t\t".$ExpireTime."\t; expire\n". 191 "\t\t\t".$MinimumTime."\t; minimum\n". 188 192 "\t\t\t)\n". 189 193 "\t\t\tTXT\t".'"Community network ZdechovNET"'."\n". 190 "\t\t\tNS\t".$Nameserver.".".$Domain.".\n". 194 "\t\t\tNS\tns1.".$Domain.".\n". 195 "\t\t\tNS\tns2.".$Domain.".\n". 191 196 "\t\t\tNS\tserver.zlin.czf.\n"; 192 197 "\t\t\tMX\t10 mail.".$Domain.".\n"; … … 196 201 $Header = '$ORIGIN zdechov.zlin.czf.'."\n". 197 202 '$TTL 86400'."\n". 198 $Domain.".\tIN\tSOA\t ".$Nameserver.".".$Domain.".\troot.".$Nameserver.".".$Domain." (\n".199 "\t\t\t".$Serial."\t; serial\n". 200 "\t\t\t".$RefreshTime."\t; refresh\n". 201 "\t\t\t".$RetryTime."\t; retry\n". 202 "\t\t\t".$ExpireTime."\t; expire\n". 203 "\t\t\t 86400\t; ttl\n".203 $Domain.".\tIN\tSOA\tns1.".$Domain.".\troot.".$Domain." (\n". 204 "\t\t\t".$Serial."\t; serial\n". 205 "\t\t\t".$RefreshTime."\t; refresh\n". 206 "\t\t\t".$RetryTime."\t; retry\n". 207 "\t\t\t".$ExpireTime."\t; expire\n". 208 "\t\t\t".$MinimumTime."\t; minimum\n". 204 209 "\t\t\t)\n". 205 210 "\t\t\tTXT\t".'"Community network ZdechovNET"'."\n". 206 "\t\t\tNS\t".$Nameserver.".".$Domain.".\n". 211 "\t\t\tNS\tns1.".$Domain.".\n". 212 "\t\t\tNS\tns2.".$Domain.".\n". 207 213 "\t\t\tNS\tserver.zlin.czf.\n"; 208 214 "\t\t\tMX\t10 mail.".$Domain.".\n"; … … 225 231 { 226 232 $Data = $Alias['name']; 227 if(strlen($Data) <8) $Data .= "\t";233 if(strlen($Data) < 8) $Data .= "\t"; 228 234 fputs($File, $Data."\tIN\tCNAME\t".$Alias['target']."\n"); 229 235 fputs($File2, $Data."\tIN\tCNAME\t".$Alias['target']."\n"); … … 233 239 234 240 // Generate reverse DNS records 235 $Nameserver = 'centrala';236 241 $Networks = array('10.144.200'); 237 242 foreach($Networks as $Network) … … 242 247 $Nameserver = 'centrala'; 243 248 $Header = '$TTL 86400'."\n". 244 "@\tIN\tSOA\t".$Nameserver.".".$Domain.".\troot.".$Nameserver.".".$Domain.". (\n". 245 "\t\t\t\t".$Serial."\t; serial\n". 246 "\t\t\t\t".$RefreshTime."\t; refresh\n". 247 "\t\t\t\t".$RetryTime."\t; retry\n". 248 "\t\t\t\t".$ExpireTime."\t; expire\n". 249 "\t\t\t\t86400 ; ttl\n". 250 "\t\t\t\t)\n". 251 "@\tIN\tNS\t".$Nameserver.".".$Domain.".\n". 249 "@\tIN\tSOA\tns1.".$Domain.".\troot.".$Domain.". (\n". 250 "\t\t\t\t".$Serial."\t; serial\n". 251 "\t\t\t\t".$RefreshTime."\t; refresh\n". 252 "\t\t\t\t".$RetryTime."\t; retry\n". 253 "\t\t\t\t".$ExpireTime."\t; expire\n". 254 "\t\t\t\t".$MinimumTime."\t; minimum\n". 255 "\t\t\t\t)\n". 256 "@\tIN\tNS\tns1.".$Domain.".\n". 257 "@\tIN\tNS\tns2.".$Domain.".\n". 252 258 "\tIN\tNS\tserver.zlin.czf.\n\n"; 253 259 fputs($File, $Header); … … 255 261 $Nameserver = 'centrala-ext'; 256 262 $Header = '$TTL 86400'."\n". 257 "@\tIN\tSOA\t".$Nameserver.".".$Domain.".\troot.".$Nameserver.".".$Domain.". (\n". 258 "\t\t\t\t".$Serial."\t; serial\n". 259 "\t\t\t\t".$RefreshTime."\t; refresh\n". 260 "\t\t\t\t".$RetryTime."\t; retry\n". 261 "\t\t\t\t".$ExpireTime."\t; expire\n". 262 "\t\t\t\t86400 ; ttl\n". 263 "\t\t\t\t)\n". 264 "@\tIN\tNS\t".$Nameserver.".".$Domain.".\n"; 263 "@\tIN\tSOA\tns1.".$Domain.".\troot.".$Domain.". (\n". 264 "\t\t\t\t".$Serial."\t; serial\n". 265 "\t\t\t\t".$RefreshTime."\t; refresh\n". 266 "\t\t\t\t".$RetryTime."\t; retry\n". 267 "\t\t\t\t".$ExpireTime."\t; expire\n". 268 "\t\t\t\t".$MinimumTime."\t; minimum\n". 269 "\t\t\t\t)\n". 270 "@\tIN\tNS\tns1.".$Domain.".\n"; 271 "@\tIN\tNS\tns2.".$Domain.".\n"; 265 272 "\tIN\tNS\tserver.zlin.czf.\n\n"; 266 273
Note:
See TracChangeset
for help on using the changeset viewer.