You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- refresh, retry, expire and minimum were missing in the SOA record which was/is OK
because pdns has defaults for this, but this gives the user
the full options which are configurable from the UI
+ drop/replaced pdns service reloads
- the initscripts reload function was called which internally does 'pdns_control cycle',
which is a quick service restart. This is no needed in pdns to
load the new zone data. All updates are available without service reloads.
- to be sure the zone data is really loaded 'pdns_control rediscover' is called
- for pdns versions starting from 3 (DNSSEC) all zones must be rectified, implemented this using pdnssec.
+ send notify to slaves
- implemented using pdns_control,
this enables zone transfers to slaves (maybe this never worked before, because auf the service reloads)
hint: use supermasters table on slave server for zone autodeployment, but you need an extra cleanup script
for deleted zones for now
+ fetch Slave zone from master
- call 'pdns_control retrieve <zone>' for new slave zones
+ added fix from FS#3121
+ code cleanup
//* tell pdns to use 'pdnssec rectify' on the new zone
155
+
$this->rectifyZone($data);
156
+
//* tell pdns to send notify to slave
157
+
$this->notifySlave($data);
155
158
}
156
159
157
160
functionsoa_update($event_name, $data) {
@@ -161,13 +164,10 @@ function soa_update($event_name, $data) {
161
164
if($data["old"]["active"] != 'Y') return;
162
165
$this->soa_delete($event_name, $data);
163
166
} else {
164
-
if($data["old"]["active"] == 'Y'){
167
+
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["id"]);
168
+
if($data["old"]["active"] == 'Y' && $exists){
165
169
$origin = substr($data["new"]["origin"], 0, -1);
166
170
$ispconfig_id = $data["new"]["id"];
167
-
$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
168
-
$serial_id = $serial["serial"];
169
-
//$app->db->query("UPDATE powerdns.domains SET name = '$origin', notified_serial = $serial_id WHERE ispconfig_id = $ispconfig_idi AND type = 'MASTER'");
170
-
//$app->db->query("UPDATE powerdns.domains SET name = '$origin' WHERE ispconfig_id = $ispconfig_id AND type = 'MASTER'");
171
171
172
172
if(substr($data["new"]["ns"], -1) == '.'){
173
173
$ns = substr($data["new"]["ns"], 0, -1);
@@ -177,15 +177,14 @@ function soa_update($event_name, $data) {
$app->db->query("UPDATE powerdns.records SET name = '$origin', content = '$content', ttl = $ttl, change_date = ".time()." WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
@@ -249,15 +244,14 @@ function slave_update($event_name, $data) {
249
244
$master_ns = $data["new"]["ns"];
250
245
251
246
$app->db->query("UPDATE powerdns.domains SET name = '$origin', type = 'SLAVE', master = '$master_ns' WHERE ispconfig_id=$ispconfig_id AND type = 'SLAVE'");
252
-
//$app->db->query("INSERT INTO powerdns.domains (name, type, ispconfig_id) VALUES ('$origin', 'NATIVE', $ispconfig_id)");
253
247
$zone_id = $app->db->insertID();
254
248
255
249
$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$ispconfig_id." AND type = 'SLAVE'");
256
250
$zone_id = $zone["id"];
257
251
$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id AND ispconfig_id = 0");
//* tell pdns to use 'pdnssec rectify' on the new zone
331
+
$this->rectifyZone($data);
340
332
}
341
333
342
334
functionrr_update($event_name, $data) {
@@ -346,7 +338,8 @@ function rr_update($event_name, $data) {
346
338
if($data["old"]["active"] != 'Y') return;
347
339
$this->rr_delete($event_name, $data);
348
340
} else {
349
-
if($data["old"]["active"] == 'Y'){
341
+
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.records WHERE ispconfig_id = ".$data["new"]["id"]);
342
+
if($data["old"]["active"] == 'Y' && $exists){
350
343
$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
351
344
$origin = substr($zone["origin"], 0, -1);
352
345
$powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'");
@@ -397,24 +390,95 @@ function rr_update($event_name, $data) {
397
390
$prio = $data["new"]["aux"];
398
391
$change_date = time();
399
392
$ispconfig_id = $data["new"]["id"];
400
-
//echo "UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE id = $record_id";
401
393
$app->db->query("UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
402
394
395
+
//* tell pdns to use 'pdnssec rectify' on the new zone
396
+
$this->rectifyZone($data);
403
397
} else {
404
398
$this->rr_insert($event_name, $data);
405
399
}
406
400
}
407
-
408
401
}
409
402
410
403
functionrr_delete($event_name, $data) {
411
404
global$app, $conf;
412
405
413
406
$ispconfig_id = $data["old"]["id"];
414
407
$app->db->query("DELETE FROM powerdns.records WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
$zn = $app->db->queryOneRecord("SELECT d.name AS name FROM powerdns.domains d, powerdns.records r WHERE r.ispconfig_id=".$data["new"]["id"]." AND r.domain_id = d.id");
0 commit comments