From 2b54b27ccad47a74b78eeadfabcb20a9d1a2cc33 Mon Sep 17 00:00:00 2001 From: tbrehm Date: Mon, 25 Oct 2010 14:29:11 +0000 Subject: [PATCH] Updated some Helper scripts. --- helper_scripts/dns_export_to_bind.php | 120 +++++++++++------- .../dns_export_to_bind_retrans_daily.php | 14 ++ 2 files changed, 90 insertions(+), 44 deletions(-) create mode 100644 helper_scripts/dns_export_to_bind_retrans_daily.php diff --git a/helper_scripts/dns_export_to_bind.php b/helper_scripts/dns_export_to_bind.php index 56628d77c..ea5adf94c 100644 --- a/helper_scripts/dns_export_to_bind.php +++ b/helper_scripts/dns_export_to_bind.php @@ -1,72 +1,104 @@ 0) - { - $arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n"; - } - else - { - $arr3[$xx1]=$arr2[$xx1].$row2['3']."\n"; - } - $xx1=$xx1+1; - } - $f = fopen("/var/cache/bind/$varx11", "a+"); - foreach($arr3 as $values) fputs($f, $values); - fclose($f); - $arr2=array(); - $arr3=array(); -### ENDE Primärer Nameserver ########################################################################################################### + if ($row2['2']>0) + { + $arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n"; + } + else + { + $arr3[$xx1]=$arr2[$xx1].$row2['3']."\n"; + } + $xx1=$xx1+1; + } + $f = fopen("/var/cache/bind/$varx11", "a+"); + foreach($arr3 as $values) fputs($f, $values); + fclose($f); + $arr2=array(); + $arr3=array(); +### ENDE Primärer Nameserver TEIL 2 ##################################################################################################### ### Hier ALLES Aktivieren bei Secondary Nameserver ###################################################################################### # $tmp1 = substr($row["ns"],0,-1); # $tmp2 = substr($row["origin"],0,-1); -# $nsip = hostname2ipfunktion($tmp1); -# if ($nsip == $tmp1) # { + +# if (!isset($dnscache[$tmp1])) $nsip = hostname2ipfunktion($tmp1) ; +# else $nsip=$dnscache[$tmp1] ; + +# if ($nsip == $tmp1) +# { # echo "$tmp2 $tmp1 Not a valid Nameserver"; # echo "\n"; # } -# else # { +# else +# { +# $dnscache[$tmp1]=$nsip; # $arr1[$x11]="zone \"".$tmp2."\" in { type slave; file \"".$tmp2."\"; masters {".$nsip."; }; };\n"; # $x11=$x11+1; # } ### ENDE Secondary Nameserver ########################################################################################################### - } + } unlink ("/etc/bind/named.conf.local"); $fx = fopen("/etc/bind/named.conf.local", "a+"); foreach($arr1 as $values) fputs($fx, $values); fclose($fx); -exec("/etc/init.d/bind9 reload"); +system("rndc reconfig >/dev/null 2>&1"); + +### ANFANG Primärer Namerserver TEIL 2 ################################################################################################## +$serialsearch=date("Ymd"); +$resultx13 = mysql_query("SELECT origin,serial FROM dns_soa WHERE serial LIKE '$serialsearch%' ORDER BY origin ASC;"); +while ($rowx13=mysql_fetch_array($resultx13)) { + $serial_ist=($rowx13["serial"]); + $zone=substr($rowx13["origin"],0,-1); +# echo "zone: ".$zone." ist: ".$serial_ist." vergleich: ".$serialvergleich[$zone]."\n"; + if ($serialvergleich[$zone] != $serial_ist) { + $reload=system("rndc reload $zone >/dev/null 2>&1"); + } +} +### ENDE Primärer NamerserverTEIL 2 ###################################################################################################### ?> \ No newline at end of file diff --git a/helper_scripts/dns_export_to_bind_retrans_daily.php b/helper_scripts/dns_export_to_bind_retrans_daily.php new file mode 100644 index 000000000..39faf14fe --- /dev/null +++ b/helper_scripts/dns_export_to_bind_retrans_daily.php @@ -0,0 +1,14 @@ + \ No newline at end of file -- GitLab