API call to set DNSSEC algorithm and activate it.
Here a patch to add a function to activate DNSSec and adjust the algorithm.
--- interface/lib/classes/remote.d/dns.inc.php.orig 2023-03-09 14:03:11.406869756 +0100
+++ interface/lib/classes/remote.d/dns.inc.php 2023-03-10 12:41:29.308279150 +0100
@@ -845,6 +845,37 @@
}
}
+ /**
+ * Set DNSSec Algo and activate it if needed.
+ *
+ * @param int session id
+ * @param int client id
+ * @param string algorithm 'NSEC3RSASHA1', 'ECDSAP256SHA256' or 'NSEC3RSASHA1,ECDSAP256SHA256' string
+ * @param boolean update serial
+ *
+ * @author Tom Albers <kovoks@kovoks.nl> KovoKs B.V. 2023
+ */
+ public function dns_zone_set_dnssec($session_id, $client_id, $primary_id, $algo, $update_serial=false) {
+ global $app;
+ if(!$this->checkPerm($session_id, 'dns_zone_set_status')) {
+ throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+
+ if(!in_array($algo, ['NSEC3RSASHA1', 'ECDSAP256SHA256', 'NSEC3RSASHA1,ECDSAP256SHA256'])) {
+ throw new SoapFault('permission_denied', 'You are not using a valid algorithm for this function.');
+ return false;
+ }
+
+ $params["dnssec_wanted"] = "Y";
+ $params["dnssec_algo"] = $algo;
+ $affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php', $client_id, $primary_id, $params);
+ if($update_serial) {
+ $this->increase_serial($session_id, $client_id, ["zone" => $primary_id]);
+ }
+ return $affected_rows;
+ }
+
private function increase_serial($session_id, $client_id, $params) {
global $app;
if(!isset($params['zone']) && isset($params['dns_rr_id'])) {
Edited by Tom