ipv6 ispconfig ver2

ArnoldSchiller

New Member
Hallo,

dns AAAA records funktioniren jetzt mit der Änderung der Form dns A Record dort die Regularexpression auf

/^([0-9A-Fa-f]{1,4}:)[0-9A-Fa-f]{1,4}|(\d{1,3}\.)\d{1,3}$/

setzen. Damit aber war es das nicht, wenn man dann tatsächlich eine IPv6-Adresse einträgt stimmt das template nicht, weil es dann AAAA lauten muss.

Dazu untenstehende Diffs damit das Template mit ipv6-Adressen funktioniert:

in /root/ispconfig/scripts/lib/classes
diff -urNp ispconfig_bind.lib.php.org ispconfig_bind.lib.php
--- ispconfig_bind.lib.php.org 2009-01-16 06:30:37.000000000 +0100
+++ ispconfig_bind.lib.php 2009-01-16 06:58:58.000000000 +0100
@@ -147,6 +147,7 @@ function make_zonefile($doc_id) {
$mod->tpl->no_strict();
$mod->tpl->define( array(table => "pri.domain.master"));
$mod->tpl->define_dynamic( "arecords", "table" );
+ $mod->tpl->define_dynamic( "aipv6records", "table");
$mod->tpl->define_dynamic( "cnamerecords", "table" );
$mod->tpl->define_dynamic( "mxrecords", "table" );
$mod->tpl->define_dynamic( "spfrecords", "table" );
@@ -177,22 +178,34 @@ function make_zonefile($doc_id) {
'DNS_TTL' => $dns["dns_ttl"],
'DNS_NS1' => $dns["dns_ns1"],
'DNS_NS2' => $dns["dns_ns2"],
+ 'DNS_NS3' => $dns["dns_ns3"],
'DNS_SOA_IP' => $dns["dns_soa_ip"]));

$arecords = $mod->db->queryAllRecords("select dns_a.host, dns_a.ip_adresse from dns_dep, dns_a, dns_nodes WHERE dns_dep.parent_doc_id = '$doc_id' AND dns_dep.parent_doctype_id = '".$isp_web->dns_doctype_id."' AND dns_dep.child_doctype_id = '".$isp_web->a_record_doctype_id."' AND dns_a.doc_id = dns_dep.child_doc_id and dns_nodes.type = 'a' and dns_nodes.doctype_id = '".$isp_web->a_record_doctype_id."' and dns_nodes.status = '1' and dns_nodes.doc_id = dns_a.doc_id");
-
+
+ $ipv4regex = "/^((1?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(1?\d{1,2}|2[0-4]\d|25[0-5]){1}$/";
foreach($arecords as $arecord){

if(trim($arecord["host"]) == '') $arecord["host"] = $dns["dns_soa"].'.';
// Variablen zuweisen
+ if(preg_match($ipv4regex,$arecord["ip_adresse"])){
$mod->tpl->assign( array( 'A_HOST' => $arecord["host"],
'A_IP' => $arecord["ip_adresse"]));
$mod->tpl->parse('ARECORDS',".arecords");
$has_arecords = 1;
+ }
+ if(!preg_match($ipv4regex,$arecord["ip_adresse"])){
+ $mod->tpl->assign( array( 'A_IPV6HOST' => $arecord["host"],
+ 'A_IPV6' => $arecord["ip_adresse"]));
+ $mod->tpl->parse('AIPV6RECORDS',".aipv6records");
+ $has_aipv6records = 1;
+ }
}

if($has_arecords != 1) $mod->tpl->clear_dynamic('arecords');

+ if($has_aipv6records != 1) $mod->tpl->clear_dynamic('aipv6records');
+
$cnamerecords = $mod->db->queryAllRecords("select dns_cname.host, dns_cname.ziel from dns_dep, dns_cname, dns_nodes WHERE dns_dep.parent_doc_id = '$doc_id' AND dns_dep.parent_doctype_id = '".$isp_web->dns_doctype_id."' AND dns_dep.child_doctype_id = '".$isp_web->cname_record_doctype_id."' AND dns_cname.doc_id = dns_dep.child_doc_id and dns_nodes.type = 'a' and dns_nodes.doctype_id = '".$isp_web->cname_record_doctype_id."' and dns_nodes.status = '1' and dns_nodes.doc_id = dns_cname.doc_id");

foreach($cnamerecords as $cnamerecord){
@@ -424,4 +437,4 @@ function named_restart(){
}

}
-?>
+?>

========= end diff ===================

und das pri.domain.master template wie folgt anpassen:

diff -urNp ../../../../install_ispconfig/isp/conf/pri.domain.master ../../../isp/conf/pri.domain.master
--- ../../../../savisp/install_ispconfig/isp/conf/pri.domain.master 2005-08-15 22:30:08.000000000 +0200
+++ ../../../isp/conf/pri.domain.master 2009-01-16 06:43:13.000000000 +0100
@@ -9,7 +9,7 @@ $TTL {DNS_TTL}
NS {DNS_NS1}. ; Inet Address of name server 1
NS {DNS_NS2}. ; Inet Address of name server 2
;
-
+ NS {DNS_NS3}. ; Inst Address of name server 3
<!-- BEGIN DYNAMIC BLOCK: mxrecords -->
{MX_HOST} MX {MX_PRIORITAET} {MX_MAILSERVER}.
<!-- END DYNAMIC BLOCK: mxrecords -->
@@ -17,10 +17,13 @@ $TTL {DNS_TTL}
<!-- BEGIN DYNAMIC BLOCK: arecords -->
{A_HOST} A {A_IP}
<!-- END DYNAMIC BLOCK: arecords -->
+<!-- BEGIN DYNAMIC BLOCK: aipv6records -->
+{A_IPV6HOST} AAAA {A_IPV6}
+<!-- END DYNAMIC BLOCK: aipv6records -->
<!-- BEGIN DYNAMIC BLOCK: cnamerecords -->
{CNAME_HOST} CNAME {CNAME_ZIEL}.
<!-- END DYNAMIC BLOCK: cnamerecords -->
<!-- BEGIN DYNAMIC BLOCK: spfrecords -->
{SPF_HOST}. TXT "v=spf1 {SPF}"
<!-- END DYNAMIC BLOCK: spfrecords -->
-;;;; MAKE MANUAL ENTRIES BELOW THIS LINE! ;;;;
\ Kein Zeilenumbruch am Dateiende.
+;;;; MAKE MANUAL ENTRIES BELOW THIS LINE! ;;;;


HTH,
Arnold
 

Werbung

Top