diff options
Diffstat (limited to 'config/bind/bind.inc')
-rw-r--r-- | config/bind/bind.inc | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/config/bind/bind.inc b/config/bind/bind.inc index 0eddda73..30828927 100644 --- a/config/bind/bind.inc +++ b/config/bind/bind.inc @@ -47,6 +47,29 @@ else define('CHROOT_LOCALBASE','/conf/named'); +function bind_zone_validate($post, $input_errors){ + if ($_POST['type']=='reverso'){ + if( $_POST['nameserver'] == "") + $input_errors[] = 'The field \'Name Server\' is required'; + } + if (key_exists("mail",$_POST)) + $_POST['mail']=preg_replace("/@/",".",$post['mail']); + for ($i=0;$i < count($_POST);$i++){ + if (key_exists("hostname$i",$_POST)){ + if (preg_match("/(MX|NS)/",$_POST["hosttype$i"])) + $_POST["hostname$i"]=""; + if (!preg_match("/(MX|NS)/",$_POST["hosttype$i"]) && $_POST["hostname$i"]=="") + $input_errors[] = 'Record cannot be empty for '.$_POST["hosttype$i"].' type '; + if ($_POST["hosttype$i"]=="MX" && $_POST["hostvalue$i"]=="") + $_POST["hostvalue$i"]="10"; + if ($_POST["hosttype$i"]!="MX" && $_POST["hostvalue$i"]!="") + $_POST["hostvalue$i"]=""; + if ($_POST["hostdst$i"]=="") + $input_errors[] = 'Alias or IP address cannot be empty.'; + } + } +} + function bind_sync(){ global $config; @@ -68,8 +91,9 @@ $bind_conf .= <<<EOD directory "/etc/namedb"; pid-file "/var/run/named/pid"; statistics-file "/var/log/named.stats"; + max-cache-size {$ram_limit}; + query-source address * port 53; - max-cache-size $ram_limit;\n EOD; // check response rate limit option //https://kb.isc.org/article/AA-01000/0/A-Quick-Introduction-to-Response-Rate-Limiting.html @@ -273,6 +297,7 @@ EOD; $zoneallowtransfer = str_replace(',','; ',$zone['allowtransfer']); $zone_conf = "\$TTL $zonetll\n;\n"; $zone_conf .= ";\tDatabase file {$zonename}.DB for {$zonename} zone.\n"; + $zone_conf .= ";\tDo not edit this file!!!\n"; $zone_conf .= ";\tZone version {$zoneserial}\n;\n"; if($zonereverso == "on") $zone_conf .= "@\t IN SOA $zonenameserver. \t $zonemail. (\n"; @@ -283,14 +308,15 @@ EOD; $zone_conf .= "\t\t$zonerefresh ; refresh\n"; $zone_conf .= "\t\t$zoneretry ; retry\n"; $zone_conf .= "\t\t$zoneexpire ; expire\n"; - $zone_conf .= "\t\t$zoneminimum)\n\n"; + $zone_conf .= "\t\t$zoneminimum ; default_ttl\n\t\t)\n\n"; $zone_conf .= ";\n; Zone Records\n;\n"; if($zonereverso == "on") $zone_conf .= "\t IN NS \t\t$zonenameserver.\n"; else{ - $zone_conf .= "@ \t IN NS \t\t$zonenameserver.\n"; - $zone_conf .= "@ \t IN A \t\t$zoneipns\n"; + $zone_conf .= "@ \t IN NS \t\t$zonenameserver.\n"; + if ($zoneipns !="") + $zone_conf .= "@ \t IN A \t\t$zoneipns\n"; } for ($y=0; $y<sizeof($zone['row']); $y++) { |